-
Notifications
You must be signed in to change notification settings - Fork 376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CENT-361] Modify TokenTestUtils function buildExpectedState/getActualState #228
Merged
mirathewhite
merged 9 commits into
circlefin:multi-issuer
from
mirathewhite:updateUtils
Oct 24, 2018
Merged
Changes from 5 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
60fdf96
use compact state representation and getters for FiatToken
mirathewhite b8064c0
export fiatTokenEmptyState
mirathewhite e47b95b
Fixed bug: removed Accounts.upgraderAccount since it was causing dupl…
mirathewhite 5e88595
Speeded up unit tests by removing some Accounts
mirathewhite 8d85497
fixed balance check bug in unit tests by changing pauserAccount to ar…
mirathewhite f172e7f
Use all accounts and explicit token empty state
mirathewhite 4aae8b2
merging
mirathewhite 347227a
typos and minor fixes
mirathewhite eb1b994
removed bad file
mirathewhite File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,8 +71,8 @@ async function run_tests(newToken, accounts) { | |
await token.configureMinter(Accounts.minterAccount, amount, { from: Accounts.masterMinterAccount }); | ||
await token.mint(Accounts.arbitraryAccount, mintAmount, { from: Accounts.minterAccount }); | ||
|
||
await token.approve(Accounts.pauserAccount, mintAmount, { from: Accounts.arbitraryAccount }); | ||
await token.transferFrom(Accounts.arbitraryAccount, Accounts.arbitraryAccount, mintAmount, { from: Accounts.pauserAccount }); | ||
await token.approve(Accounts.arbitraryAccount2, mintAmount, { from: Accounts.arbitraryAccount }); | ||
await token.transferFrom(Accounts.arbitraryAccount, Accounts.arbitraryAccount, mintAmount, { from: Accounts.arbitraryAccount2 }); | ||
customVars = [ | ||
{ 'variable': 'isAccountMinter.minterAccount', 'expectedValue': true }, | ||
{ 'variable': 'minterAllowance.minterAccount', 'expectedValue': new BigNumber(amount - mintAmount) }, | ||
|
@@ -170,14 +170,14 @@ async function run_tests(newToken, accounts) { | |
|
||
await token.configureMinter(Accounts.minterAccount, amount, { from: Accounts.masterMinterAccount }); | ||
await token.configureMinter(Accounts.arbitraryAccount, amount, { from: Accounts.masterMinterAccount }); | ||
await token.mint(Accounts.pauserAccount, mintAmount1, { from: Accounts.minterAccount }); | ||
await token.mint(Accounts.pauserAccount, mintAmount2, { from: Accounts.arbitraryAccount }); | ||
await token.mint(Accounts.arbitraryAccount2, mintAmount1, { from: Accounts.minterAccount }); | ||
await token.mint(Accounts.arbitraryAccount2, mintAmount2, { from: Accounts.arbitraryAccount }); | ||
var customVars = [ | ||
{ 'variable': 'isAccountMinter.minterAccount', 'expectedValue': true }, | ||
{ 'variable': 'isAccountMinter.arbitraryAccount', 'expectedValue': true }, | ||
{ 'variable': 'minterAllowance.minterAccount', 'expectedValue': new BigNumber(amount - mintAmount1) }, | ||
{ 'variable': 'minterAllowance.arbitraryAccount', 'expectedValue': new BigNumber(amount - mintAmount2) }, | ||
{ 'variable': 'balances.pauserAccount', 'expectedValue': new BigNumber(mintAmount1 + mintAmount2) }, | ||
{ 'variable': 'balances.arbitraryAccount2', 'expectedValue': new BigNumber(mintAmount1 + mintAmount2) }, | ||
{ 'variable': 'totalSupply', 'expectedValue': new BigNumber(mintAmount1 + mintAmount2) }, | ||
]; | ||
await checkVariables([token], [customVars]); | ||
|
@@ -189,13 +189,13 @@ async function run_tests(newToken, accounts) { | |
|
||
await token.configureMinter(Accounts.minterAccount, amount, { from: Accounts.masterMinterAccount }); | ||
await token.configureMinter(Accounts.arbitraryAccount, amount, { from: Accounts.masterMinterAccount }); | ||
await token.mint(Accounts.pauserAccount, mintAmount1, { from: Accounts.minterAccount }); | ||
await token.mint(Accounts.pauserAccount, mintAmount2, { from: Accounts.arbitraryAccount }); | ||
await token.mint(Accounts.arbitraryAccount2, mintAmount1, { from: Accounts.minterAccount }); | ||
await token.mint(Accounts.arbitraryAccount2, mintAmount2, { from: Accounts.arbitraryAccount }); | ||
await token.removeMinter(Accounts.arbitraryAccount, { from: Accounts.masterMinterAccount }); | ||
var customVars = [ | ||
{ 'variable': 'isAccountMinter.minterAccount', 'expectedValue': true }, | ||
{ 'variable': 'minterAllowance.minterAccount', 'expectedValue': new BigNumber(amount - mintAmount1) }, | ||
{ 'variable': 'balances.pauserAccount', 'expectedValue': new BigNumber(mintAmount1 + mintAmount2) }, | ||
{ 'variable': 'balances.arbitraryAccount2', 'expectedValue': new BigNumber(mintAmount1 + mintAmount2) }, | ||
{ 'variable': 'totalSupply', 'expectedValue': new BigNumber(mintAmount1 + mintAmount2) }, | ||
]; | ||
await checkVariables([token], [customVars]); | ||
|
@@ -230,16 +230,16 @@ async function run_tests(newToken, accounts) { | |
|
||
await token.configureMinter(Accounts.minterAccount, amount, { from: Accounts.masterMinterAccount }); | ||
await token.configureMinter(Accounts.arbitraryAccount, 0, { from: Accounts.masterMinterAccount }); | ||
await token.mint(Accounts.pauserAccount, mintAmount, { from: Accounts.minterAccount }); | ||
await token.mint(Accounts.arbitraryAccount2, mintAmount, { from: Accounts.minterAccount }); | ||
var customVars = [ | ||
{ 'variable': 'isAccountMinter.minterAccount', 'expectedValue': true }, | ||
{ 'variable': 'isAccountMinter.arbitraryAccount', 'expectedValue': true }, | ||
{ 'variable': 'minterAllowance.minterAccount', 'expectedValue': new BigNumber(amount - mintAmount) }, | ||
{ 'variable': 'balances.pauserAccount', 'expectedValue': new BigNumber(mintAmount) }, | ||
{ 'variable': 'balances.arbitraryAccount2', 'expectedValue': new BigNumber(mintAmount) }, | ||
{ 'variable': 'totalSupply', 'expectedValue': new BigNumber(mintAmount) }, | ||
]; | ||
await expectRevert(token.mint(Accounts.pauserAccount, mintAmount, { from: Accounts.arbitraryAccount })); | ||
//await expectRevert(token.mint(Accounts.pauserAccount, 0, { from: Accounts.arbitraryAccount })); | ||
await expectRevert(token.mint(Accounts.arbitraryAccount2, mintAmount, { from: Accounts.arbitraryAccount })); | ||
//await expectRevert(token.mint(Accounts.arbitraryAccount2, 0, { from: Accounts.arbitraryAccount })); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. comment can be deleted There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed |
||
await checkVariables([token], [customVars]); | ||
}); | ||
|
||
|
@@ -267,28 +267,28 @@ async function run_tests(newToken, accounts) { | |
await token.configureMinter(Accounts.minterAccount, amount, { from: Accounts.masterMinterAccount }); | ||
await token.configureMinter(Accounts.arbitraryAccount, amount, { from: Accounts.masterMinterAccount }); | ||
await token.blacklist(Accounts.minterAccount, { from: Accounts.blacklisterAccount }); | ||
await token.mint(Accounts.pauserAccount, mintAmount, { from: Accounts.arbitraryAccount }); | ||
await token.mint(Accounts.arbitraryAccount2, mintAmount, { from: Accounts.arbitraryAccount }); | ||
var customVars = [ | ||
{ 'variable': 'isAccountMinter.minterAccount', 'expectedValue': true }, | ||
{ 'variable': 'isAccountMinter.arbitraryAccount', 'expectedValue': true }, | ||
{ 'variable': 'minterAllowance.minterAccount', 'expectedValue': new BigNumber(amount) }, | ||
{ 'variable': 'minterAllowance.arbitraryAccount', 'expectedValue': new BigNumber(amount - mintAmount) }, | ||
{ 'variable': 'isAccountBlacklisted.minterAccount', 'expectedValue': true }, | ||
{ 'variable': 'totalSupply', 'expectedValue': new BigNumber(mintAmount) }, | ||
{ 'variable': 'balances.pauserAccount', 'expectedValue': new BigNumber(mintAmount) }, | ||
{ 'variable': 'balances.arbitraryAccount2', 'expectedValue': new BigNumber(mintAmount) }, | ||
]; | ||
await expectRevert(token.mint(Accounts.pauserAccount, mintAmount, { from: Accounts.minterAccount })); | ||
await expectRevert(token.mint(Accounts.arbitraryAccount2, mintAmount, { from: Accounts.minterAccount })); | ||
await checkVariables([token], [customVars]); | ||
|
||
await token.unBlacklist(Accounts.minterAccount, { from: Accounts.blacklisterAccount }); | ||
await token.mint(Accounts.pauserAccount, mintAmount, { from: Accounts.minterAccount }); | ||
await token.mint(Accounts.arbitraryAccount2, mintAmount, { from: Accounts.minterAccount }); | ||
var customVars = [ | ||
{ 'variable': 'isAccountMinter.minterAccount', 'expectedValue': true }, | ||
{ 'variable': 'isAccountMinter.arbitraryAccount', 'expectedValue': true }, | ||
{ 'variable': 'minterAllowance.minterAccount', 'expectedValue': new BigNumber(amount - mintAmount) }, | ||
{ 'variable': 'minterAllowance.arbitraryAccount', 'expectedValue': new BigNumber(amount - mintAmount) }, | ||
{ 'variable': 'totalSupply', 'expectedValue': new BigNumber(mintAmount + mintAmount) }, | ||
{ 'variable': 'balances.pauserAccount', 'expectedValue': new BigNumber(mintAmount + mintAmount) }, | ||
{ 'variable': 'balances.arbitraryAccount2', 'expectedValue': new BigNumber(mintAmount + mintAmount) }, | ||
]; | ||
await checkVariables([token], [customVars]); | ||
}); | ||
|
@@ -502,12 +502,12 @@ async function run_tests(newToken, accounts) { | |
]; | ||
await checkVariables([token], [customVars]); | ||
|
||
await token.approve(Accounts.pauserAccount, maxAmount, {from: Accounts.arbitraryAccount}); | ||
await token.approve(Accounts.arbitraryAccount2, maxAmount, {from: Accounts.arbitraryAccount}); | ||
customVars = [ | ||
{ 'variable': 'isAccountMinter.minterAccount', 'expectedValue': true }, | ||
{ 'variable': 'balances.arbitraryAccount', 'expectedValue': new BigNumber(maxAmount) }, | ||
{ 'variable': 'totalSupply', 'expectedValue': new BigNumber(maxAmount) }, | ||
{ 'variable': 'allowance.arbitraryAccount.pauserAccount', 'expectedValue': new BigNumber(maxAmount) } | ||
{ 'variable': 'allowance.arbitraryAccount.arbitraryAccount2', 'expectedValue': new BigNumber(maxAmount) } | ||
]; | ||
await checkVariables([token], [customVars]); | ||
}); | ||
|
@@ -522,10 +522,10 @@ async function run_tests(newToken, accounts) { | |
]; | ||
await checkVariables([token], [customVars]); | ||
|
||
await token.transfer(Accounts.pauserAccount, maxAmount, {from: Accounts.arbitraryAccount}); | ||
await token.transfer(Accounts.arbitraryAccount2, maxAmount, {from: Accounts.arbitraryAccount}); | ||
customVars = [ | ||
{ 'variable': 'isAccountMinter.minterAccount', 'expectedValue': true }, | ||
{ 'variable': 'balances.pauserAccount', 'expectedValue': new BigNumber(maxAmount) }, | ||
{ 'variable': 'balances.arbitraryAccount2', 'expectedValue': new BigNumber(maxAmount) }, | ||
{ 'variable': 'totalSupply', 'expectedValue': new BigNumber(maxAmount) }, | ||
]; | ||
await checkVariables([token], [customVars]); | ||
|
@@ -534,19 +534,19 @@ async function run_tests(newToken, accounts) { | |
it('ms052 transferFrom works on amount=2^256-1', async function() { | ||
await token.configureMinter(Accounts.minterAccount, maxAmount, { from: Accounts.masterMinterAccount }); | ||
await token.mint(Accounts.arbitraryAccount, maxAmount, { from: Accounts.minterAccount }); | ||
await token.approve(Accounts.pauserAccount, maxAmount, {from: Accounts.arbitraryAccount}); | ||
await token.approve(Accounts.arbitraryAccount2, maxAmount, {from: Accounts.arbitraryAccount}); | ||
customVars = [ | ||
{ 'variable': 'isAccountMinter.minterAccount', 'expectedValue': true }, | ||
{ 'variable': 'balances.arbitraryAccount', 'expectedValue': new BigNumber(maxAmount) }, | ||
{ 'variable': 'totalSupply', 'expectedValue': new BigNumber(maxAmount) }, | ||
{ 'variable': 'allowance.arbitraryAccount.pauserAccount', 'expectedValue': new BigNumber(maxAmount) } | ||
{ 'variable': 'allowance.arbitraryAccount.arbitraryAccount2', 'expectedValue': new BigNumber(maxAmount) } | ||
]; | ||
await checkVariables([token], [customVars]); | ||
|
||
await token.transferFrom(Accounts.arbitraryAccount, Accounts.pauserAccount, maxAmount, {from: Accounts.pauserAccount}); | ||
await token.transferFrom(Accounts.arbitraryAccount, Accounts.arbitraryAccount2, maxAmount, {from: Accounts.arbitraryAccount2}); | ||
customVars = [ | ||
{ 'variable': 'isAccountMinter.minterAccount', 'expectedValue': true }, | ||
{ 'variable': 'balances.pauserAccount', 'expectedValue': new BigNumber(maxAmount) }, | ||
{ 'variable': 'balances.arbitraryAccount2', 'expectedValue': new BigNumber(maxAmount) }, | ||
{ 'variable': 'totalSupply', 'expectedValue': new BigNumber(maxAmount) }, | ||
]; | ||
await checkVariables([token], [customVars]); | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: mappingQuery -> accountQuery
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed