diff --git a/contracts/v1/Blacklistable.sol b/contracts/v1/Blacklistable.sol index c1827e836..8bf481532 100644 --- a/contracts/v1/Blacklistable.sol +++ b/contracts/v1/Blacklistable.sol @@ -32,7 +32,7 @@ import { Ownable } from "./Ownable.sol"; */ contract Blacklistable is Ownable { address public blacklister; - mapping(address => bool) internal blacklisted; + mapping(address => bool) internal _deprecatedBlacklisted; event Blacklisted(address indexed _account); event UnBlacklisted(address indexed _account); @@ -55,7 +55,7 @@ contract Blacklistable is Ownable { */ modifier notBlacklisted(address _account) { require( - !blacklisted[_account], + !_deprecatedBlacklisted[_account], "Blacklistable: account is blacklisted" ); _; @@ -66,7 +66,7 @@ contract Blacklistable is Ownable { * @param _account The address to check */ function isBlacklisted(address _account) external view returns (bool) { - return blacklisted[_account]; + return _deprecatedBlacklisted[_account]; } /** @@ -74,7 +74,7 @@ contract Blacklistable is Ownable { * @param _account The address to blacklist */ function blacklist(address _account) external onlyBlacklister { - blacklisted[_account] = true; + _deprecatedBlacklisted[_account] = true; emit Blacklisted(_account); } @@ -83,7 +83,7 @@ contract Blacklistable is Ownable { * @param _account The address to remove from the blacklist */ function unBlacklist(address _account) external onlyBlacklister { - blacklisted[_account] = false; + _deprecatedBlacklisted[_account] = false; emit UnBlacklisted(_account); } diff --git a/contracts/v1/FiatTokenV1.sol b/contracts/v1/FiatTokenV1.sol index 1820842d1..2c911982f 100644 --- a/contracts/v1/FiatTokenV1.sol +++ b/contracts/v1/FiatTokenV1.sol @@ -44,7 +44,7 @@ contract FiatTokenV1 is AbstractFiatTokenV1, Ownable, Pausable, Blacklistable { address public masterMinter; bool internal initialized; - mapping(address => uint256) internal balances; + mapping(address => uint256) internal balanceAndBlacklistStates; mapping(address => mapping(address => uint256)) internal allowed; uint256 internal totalSupply_ = 0; mapping(address => bool) internal minters; @@ -128,7 +128,9 @@ contract FiatTokenV1 is AbstractFiatTokenV1, Ownable, Pausable, Blacklistable { ); totalSupply_ = totalSupply_.add(_amount); - balances[_to] = balances[_to].add(_amount); + balanceAndBlacklistStates[_to] = balanceAndBlacklistStates[_to].add( + _amount + ); minterAllowed[msg.sender] = mintingAllowedAmount.sub(_amount); emit Mint(msg.sender, _to, _amount); emit Transfer(address(0), _to, _amount); @@ -195,7 +197,7 @@ contract FiatTokenV1 is AbstractFiatTokenV1, Ownable, Pausable, Blacklistable { view returns (uint256) { - return balances[account]; + return balanceAndBlacklistStates[account]; } /** @@ -295,12 +297,16 @@ contract FiatTokenV1 is AbstractFiatTokenV1, Ownable, Pausable, Blacklistable { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); require( - value <= balances[from], + value <= balanceAndBlacklistStates[from], "ERC20: transfer amount exceeds balance" ); - balances[from] = balances[from].sub(value); - balances[to] = balances[to].add(value); + balanceAndBlacklistStates[from] = balanceAndBlacklistStates[from].sub( + value + ); + balanceAndBlacklistStates[to] = balanceAndBlacklistStates[to].add( + value + ); emit Transfer(from, to, value); } @@ -350,12 +356,12 @@ contract FiatTokenV1 is AbstractFiatTokenV1, Ownable, Pausable, Blacklistable { onlyMinters notBlacklisted(msg.sender) { - uint256 balance = balances[msg.sender]; + uint256 balance = balanceAndBlacklistStates[msg.sender]; require(_amount > 0, "FiatToken: burn amount not greater than 0"); require(balance >= _amount, "FiatToken: burn amount exceeds balance"); totalSupply_ = totalSupply_.sub(_amount); - balances[msg.sender] = balance.sub(_amount); + balanceAndBlacklistStates[msg.sender] = balance.sub(_amount); emit Burn(msg.sender, _amount); emit Transfer(msg.sender, address(0), _amount); } diff --git a/contracts/v2/FiatTokenV2_1.sol b/contracts/v2/FiatTokenV2_1.sol index 0ee0b3bb1..0d182f440 100644 --- a/contracts/v2/FiatTokenV2_1.sol +++ b/contracts/v2/FiatTokenV2_1.sol @@ -41,11 +41,11 @@ contract FiatTokenV2_1 is FiatTokenV2 { // solhint-disable-next-line reason-string require(_initializedVersion == 1); - uint256 lockedAmount = balances[address(this)]; + uint256 lockedAmount = balanceAndBlacklistStates[address(this)]; if (lockedAmount > 0) { _transfer(address(this), lostAndFound, lockedAmount); } - blacklisted[address(this)] = true; + _deprecatedBlacklisted[address(this)] = true; _initializedVersion = 2; } diff --git a/test/helpers/storageSlots.behavior.ts b/test/helpers/storageSlots.behavior.ts index 411cacf5a..db6542ec9 100644 --- a/test/helpers/storageSlots.behavior.ts +++ b/test/helpers/storageSlots.behavior.ts @@ -104,7 +104,7 @@ export function usesOriginalStorageSlotPositions< // slot 2 - blacklister expect(parseAddress(slots[2])).to.equal(blacklister); // blacklister - // slot 3 - blacklisted (mapping, slot is unused) + // slot 3 - _deprecatedBlacklisted (mapping, slot is unused) expect(slots[3]).to.equal("0"); // slot 4 - name @@ -123,7 +123,7 @@ export function usesOriginalStorageSlotPositions< expect(slots[8].slice(0, 2)).to.equal("01"); // initialized expect(parseAddress(slots[8].slice(2))).to.equal(masterMinter); // masterMinter - // slot 9 - balances (mapping, slot is unused) + // slot 9 - balanceAndBlacklistStates (mapping, slot is unused) expect(slots[9]).to.equal("0"); // slot 10 - allowed (mapping, slot is unused) @@ -154,15 +154,15 @@ export function usesOriginalStorageSlotPositions< }); } - it("retains original storage slots for blacklisted mapping", async () => { - // blacklisted[alice] + it("retains original storage slots for _deprecatedBlacklisted mapping", async () => { + // _deprecatedBlacklisted[alice] let v = parseInt( await readSlot(proxy.address, addressMappingSlot(alice, 3)), 16 ); expect(v).to.equal(0); - // blacklisted[charlie] + // _deprecatedBlacklisted[charlie] v = parseInt( await readSlot(proxy.address, addressMappingSlot(charlie, 3)), 16 @@ -170,15 +170,15 @@ export function usesOriginalStorageSlotPositions< expect(v).to.equal(1); }); - it("retains original storage slots for balances mapping", async () => { - // balance[alice] + it("retains original storage slots for balanceAndBlacklistStates mapping", async () => { + // balanceAndBlacklistStates[alice] let v = parseInt( await readSlot(proxy.address, addressMappingSlot(alice, 9)), 16 ); expect(v).to.equal(minted - transferred); - // balances[bob] + // balanceAndBlacklistStates[bob] v = parseInt( await readSlot(proxy.address, addressMappingSlot(bob, 9)), 16 diff --git a/test/minting/MintControllerTests.js b/test/minting/MintControllerTests.js index c3a04db17..8e87bbbe6 100644 --- a/test/minting/MintControllerTests.js +++ b/test/minting/MintControllerTests.js @@ -56,7 +56,7 @@ async function run_tests(newToken) { expectedTokenState.push( { variable: "isAccountMinter.minterAccount", expectedValue: true }, { - variable: "balances.arbitraryAccount", + variable: "balanceAndBlacklistStates.arbitraryAccount", expectedValue: newBigNumber(amount), }, { variable: "totalSupply", expectedValue: newBigNumber(amount) } diff --git a/test/minting/MintP0_EndToEndTests.js b/test/minting/MintP0_EndToEndTests.js index 9de45a70a..35105797e 100644 --- a/test/minting/MintP0_EndToEndTests.js +++ b/test/minting/MintP0_EndToEndTests.js @@ -557,7 +557,10 @@ async function run_MINT_tests(newToken, MintControllerArtifact) { variable: "minterAllowance.minterAccount", expectedValue: newBigNumber(5), }, - { variable: "balances.arbitraryAccount", expectedValue: newBigNumber(5) }, + { + variable: "balanceAndBlacklistStates.arbitraryAccount", + expectedValue: newBigNumber(5), + }, { variable: "totalSupply", expectedValue: newBigNumber(5) } ); await checkMINTp0( @@ -643,7 +646,10 @@ async function run_MINT_tests(newToken, MintControllerArtifact) { expectedMintControllerState.controllers.arbitraryAccount = Accounts.minterAccount; expectedTokenState.push( - { variable: "balances.minterAccount", expectedValue: newBigNumber(5) }, + { + variable: "balanceAndBlacklistStates.minterAccount", + expectedValue: newBigNumber(5), + }, { variable: "totalSupply", expectedValue: newBigNumber(5) } ); await checkMINTp0( diff --git a/test/v1/TokenTestUtils.js b/test/v1/TokenTestUtils.js index c5ab49002..9489de805 100644 --- a/test/v1/TokenTestUtils.js +++ b/test/v1/TokenTestUtils.js @@ -137,7 +137,7 @@ function buildExpectedState(token, customVars) { proxiedTokenAddress: token.proxiedTokenAddress, initializedV1: trueInStorageFormat, upgrader: proxyOwnerAccount, - balances: { + balanceAndBlacklistStates: { arbitraryAccount: bigZero, masterMinterAccount: bigZero, minterAccount: bigZero, @@ -537,7 +537,7 @@ async function getActualState(token) { proxiedTokenAddress: hexToAddress(proxiedTokenAddress), upgrader: hexToAddress(upgrader), initializedV1, - balances: { + balanceAndBlacklistStates: { arbitraryAccount: balancesA, masterMinterAccount: balancesMM, minterAccount: balancesM, diff --git a/test/v1/helpers/tokenTest.js b/test/v1/helpers/tokenTest.js index a223104b1..d92ab618f 100644 --- a/test/v1/helpers/tokenTest.js +++ b/test/v1/helpers/tokenTest.js @@ -227,7 +227,7 @@ function buildExpectedState(token, customVars) { proxiedTokenAddress: token.proxiedTokenAddress, initializedV1: trueInStorageFormat, upgrader: proxyOwnerAccount, - balances: { + balanceAndBlacklistStates: { arbitraryAccount: bigZero, masterMinterAccount: bigZero, minterAccount: bigZero, @@ -626,7 +626,7 @@ async function getActualState(token) { proxiedTokenAddress: hexToAddress(proxiedTokenAddress), upgrader: hexToAddress(upgrader), initializedV1, - balances: { + balanceAndBlacklistStates: { arbitraryAccount: balancesA, masterMinterAccount: balancesMM, minterAccount: balancesM, diff --git a/test/v1/misc.test.js b/test/v1/misc.test.js index db9f82ab1..9108a9a2e 100644 --- a/test/v1/misc.test.js +++ b/test/v1/misc.test.js @@ -65,7 +65,7 @@ function runTests(newToken, _accounts) { }, { variable: "isAccountMinter.minterAccount", expectedValue: true }, { - variable: "balances.arbitraryAccount", + variable: "balanceAndBlacklistStates.arbitraryAccount", expectedValue: new BN(mintAmount), }, { variable: "totalSupply", expectedValue: new BN(mintAmount) }, @@ -92,7 +92,7 @@ function runTests(newToken, _accounts) { expectedValue: new BN(amount - mintAmount), }, { - variable: "balances.arbitraryAccount", + variable: "balanceAndBlacklistStates.arbitraryAccount", expectedValue: new BN(mintAmount), }, { variable: "totalSupply", expectedValue: new BN(mintAmount) }, @@ -121,7 +121,7 @@ function runTests(newToken, _accounts) { expectedValue: new BN(amount - mintAmount), }, { - variable: "balances.arbitraryAccount", + variable: "balanceAndBlacklistStates.arbitraryAccount", expectedValue: new BN(mintAmount), }, { variable: "totalSupply", expectedValue: new BN(mintAmount) }, @@ -152,7 +152,7 @@ function runTests(newToken, _accounts) { expectedValue: new BN(amount - mintAmount), }, { - variable: "balances.minterAccount", + variable: "balanceAndBlacklistStates.minterAccount", expectedValue: new BN(mintAmount), }, { variable: "totalSupply", expectedValue: new BN(mintAmount) }, @@ -184,7 +184,7 @@ function runTests(newToken, _accounts) { expectedValue: new BN(amount - mintAmount), }, { - variable: "balances.arbitraryAccount", + variable: "balanceAndBlacklistStates.arbitraryAccount", expectedValue: new BN(mintAmount), }, { variable: "totalSupply", expectedValue: new BN(mintAmount) }, @@ -258,7 +258,7 @@ function runTests(newToken, _accounts) { expectedValue: new BN(amount - mintAmount2), }, { - variable: "balances.pauserAccount", + variable: "balanceAndBlacklistStates.pauserAccount", expectedValue: new BN(mintAmount1 + mintAmount2), }, { @@ -289,7 +289,7 @@ function runTests(newToken, _accounts) { expectedValue: new BN(amount - mintAmount1), }, { - variable: "balances.pauserAccount", + variable: "balanceAndBlacklistStates.pauserAccount", expectedValue: new BN(mintAmount1 + mintAmount2), }, { @@ -362,7 +362,7 @@ function runTests(newToken, _accounts) { expectedValue: new BN(amount - mintAmount), }, { - variable: "balances.pauserAccount", + variable: "balanceAndBlacklistStates.pauserAccount", expectedValue: new BN(mintAmount), }, { variable: "totalSupply", expectedValue: new BN(mintAmount) }, @@ -431,7 +431,7 @@ function runTests(newToken, _accounts) { { variable: "isAccountBlacklisted.minterAccount", expectedValue: true }, { variable: "totalSupply", expectedValue: new BN(mintAmount) }, { - variable: "balances.pauserAccount", + variable: "balanceAndBlacklistStates.pauserAccount", expectedValue: new BN(mintAmount), }, ]; @@ -459,7 +459,7 @@ function runTests(newToken, _accounts) { expectedValue: new BN(mintAmount + mintAmount), }, { - variable: "balances.pauserAccount", + variable: "balanceAndBlacklistStates.pauserAccount", expectedValue: new BN(mintAmount + mintAmount), }, ]; @@ -491,11 +491,11 @@ function runTests(newToken, _accounts) { expectedValue: new BN(amount - mintAmount2), }, { - variable: "balances.minterAccount", + variable: "balanceAndBlacklistStates.minterAccount", expectedValue: new BN(mintAmount1), }, { - variable: "balances.arbitraryAccount", + variable: "balanceAndBlacklistStates.arbitraryAccount", expectedValue: new BN(mintAmount2), }, { @@ -519,11 +519,11 @@ function runTests(newToken, _accounts) { expectedValue: new BN(amount - mintAmount2), }, { - variable: "balances.minterAccount", + variable: "balanceAndBlacklistStates.minterAccount", expectedValue: new BN(mintAmount1 - burnAmount), }, { - variable: "balances.arbitraryAccount", + variable: "balanceAndBlacklistStates.arbitraryAccount", expectedValue: new BN(mintAmount2 - burnAmount), }, { @@ -635,7 +635,7 @@ function runTests(newToken, _accounts) { expectedValue: new BN(amount - mintAmount), }, { - variable: "balances.arbitraryAccount", + variable: "balanceAndBlacklistStates.arbitraryAccount", expectedValue: new BN(mintAmount), }, { variable: "totalSupply", expectedValue: new BN(mintAmount) }, @@ -678,7 +678,7 @@ function runTests(newToken, _accounts) { expectedValue: new BN(amount - mintAmount), }, { - variable: "balances.arbitraryAccount", + variable: "balanceAndBlacklistStates.arbitraryAccount", expectedValue: new BN(mintAmount), }, { variable: "totalSupply", expectedValue: new BN(mintAmount) }, @@ -757,7 +757,7 @@ function runTests(newToken, _accounts) { expectedValue: new BN(0), }, { - variable: "balances.arbitraryAccount", + variable: "balanceAndBlacklistStates.arbitraryAccount", expectedValue: maxAmountBN, }, { variable: "totalSupply", expectedValue: maxAmountBN }, @@ -773,7 +773,7 @@ function runTests(newToken, _accounts) { let customVars = [ { variable: "isAccountMinter.minterAccount", expectedValue: true }, { - variable: "balances.minterAccount", + variable: "balanceAndBlacklistStates.minterAccount", expectedValue: maxAmountBN, }, { variable: "totalSupply", expectedValue: maxAmountBN }, @@ -795,7 +795,7 @@ function runTests(newToken, _accounts) { let customVars = [ { variable: "isAccountMinter.minterAccount", expectedValue: true }, { - variable: "balances.arbitraryAccount", + variable: "balanceAndBlacklistStates.arbitraryAccount", expectedValue: maxAmountBN, }, { variable: "totalSupply", expectedValue: maxAmountBN }, @@ -806,7 +806,7 @@ function runTests(newToken, _accounts) { customVars = [ { variable: "isAccountMinter.minterAccount", expectedValue: true }, { - variable: "balances.arbitraryAccount", + variable: "balanceAndBlacklistStates.arbitraryAccount", expectedValue: maxAmountBN, }, { variable: "totalSupply", expectedValue: maxAmountBN }, @@ -826,7 +826,7 @@ function runTests(newToken, _accounts) { let customVars = [ { variable: "isAccountMinter.minterAccount", expectedValue: true }, { - variable: "balances.arbitraryAccount", + variable: "balanceAndBlacklistStates.arbitraryAccount", expectedValue: maxAmountBN, }, { variable: "totalSupply", expectedValue: maxAmountBN }, @@ -837,7 +837,7 @@ function runTests(newToken, _accounts) { customVars = [ { variable: "isAccountMinter.minterAccount", expectedValue: true }, { - variable: "balances.pauserAccount", + variable: "balanceAndBlacklistStates.pauserAccount", expectedValue: maxAmountBN, }, { variable: "totalSupply", expectedValue: maxAmountBN }, @@ -854,7 +854,7 @@ function runTests(newToken, _accounts) { let customVars = [ { variable: "isAccountMinter.minterAccount", expectedValue: true }, { - variable: "balances.arbitraryAccount", + variable: "balanceAndBlacklistStates.arbitraryAccount", expectedValue: maxAmountBN, }, { variable: "totalSupply", expectedValue: maxAmountBN }, @@ -871,7 +871,7 @@ function runTests(newToken, _accounts) { customVars = [ { variable: "isAccountMinter.minterAccount", expectedValue: true }, { - variable: "balances.pauserAccount", + variable: "balanceAndBlacklistStates.pauserAccount", expectedValue: maxAmountBN, }, { variable: "totalSupply", expectedValue: maxAmountBN }, diff --git a/test/v1/negative.test.js b/test/v1/negative.test.js index d443791a2..43a2464b6 100644 --- a/test/v1/negative.test.js +++ b/test/v1/negative.test.js @@ -193,7 +193,7 @@ function runTests(newToken, _accounts) { expectedValue: new BN(amount - 50), }, { - variable: "balances.arbitraryAccount", + variable: "balanceAndBlacklistStates.arbitraryAccount", expectedValue: new BN(50), }, { variable: "totalSupply", expectedValue: new BN(50) }, @@ -232,7 +232,7 @@ function runTests(newToken, _accounts) { expectedValue: new BN(amount - 50), }, { - variable: "balances.arbitraryAccount", + variable: "balanceAndBlacklistStates.arbitraryAccount", expectedValue: new BN(50), }, { variable: "totalSupply", expectedValue: new BN(50) }, @@ -272,7 +272,7 @@ function runTests(newToken, _accounts) { expectedValue: new BN(amount - 50), }, { - variable: "balances.blacklisterAccount", + variable: "balanceAndBlacklistStates.blacklisterAccount", expectedValue: new BN(50), }, { variable: "totalSupply", expectedValue: new BN(50) }, @@ -316,7 +316,7 @@ function runTests(newToken, _accounts) { expectedValue: new BN(amount - 50), }, { - variable: "balances.tokenOwnerAccount", + variable: "balanceAndBlacklistStates.tokenOwnerAccount", expectedValue: new BN(50), }, { variable: "totalSupply", expectedValue: new BN(50) }, @@ -360,7 +360,7 @@ function runTests(newToken, _accounts) { expectedValue: new BN(amount - 50), }, { - variable: "balances.arbitraryAccount", + variable: "balanceAndBlacklistStates.arbitraryAccount", expectedValue: new BN(50), }, { variable: "totalSupply", expectedValue: new BN(50) }, @@ -403,7 +403,7 @@ function runTests(newToken, _accounts) { expectedValue: new BN(amount - 50), }, { - variable: "balances.arbitraryAccount", + variable: "balanceAndBlacklistStates.arbitraryAccount", expectedValue: new BN(50), }, { variable: "totalSupply", expectedValue: new BN(50) }, @@ -443,7 +443,7 @@ function runTests(newToken, _accounts) { expectedValue: new BN(amount - 50), }, { - variable: "balances.arbitraryAccount", + variable: "balanceAndBlacklistStates.arbitraryAccount", expectedValue: new BN(50), }, { variable: "totalSupply", expectedValue: new BN(50) }, @@ -484,7 +484,7 @@ function runTests(newToken, _accounts) { expectedValue: new BN(amount - 50), }, { - variable: "balances.arbitraryAccount", + variable: "balanceAndBlacklistStates.arbitraryAccount", expectedValue: new BN(50), }, { variable: "totalSupply", expectedValue: new BN(50) }, @@ -516,7 +516,7 @@ function runTests(newToken, _accounts) { expectedValue: new BN(amount - 50), }, { - variable: "balances.arbitraryAccount", + variable: "balanceAndBlacklistStates.arbitraryAccount", expectedValue: new BN(50), }, { variable: "totalSupply", expectedValue: new BN(50) }, @@ -549,7 +549,7 @@ function runTests(newToken, _accounts) { expectedValue: new BN(amount - 50), }, { - variable: "balances.tokenOwnerAccount", + variable: "balanceAndBlacklistStates.tokenOwnerAccount", expectedValue: new BN(50), }, { variable: "totalSupply", expectedValue: new BN(50) }, @@ -586,7 +586,7 @@ function runTests(newToken, _accounts) { expectedValue: new BN(amount - 50), }, { - variable: "balances.arbitraryAccount", + variable: "balanceAndBlacklistStates.arbitraryAccount", expectedValue: new BN(50), }, { variable: "totalSupply", expectedValue: new BN(50) }, @@ -623,7 +623,7 @@ function runTests(newToken, _accounts) { expectedValue: new BN(amount - 50), }, { - variable: "balances.arbitraryAccount", + variable: "balanceAndBlacklistStates.arbitraryAccount", expectedValue: new BN(50), }, { variable: "totalSupply", expectedValue: new BN(50) }, @@ -704,7 +704,7 @@ function runTests(newToken, _accounts) { expectedValue: new BN(0), }, { - variable: "balances.minterAccount", + variable: "balanceAndBlacklistStates.minterAccount", expectedValue: new BN(amount), }, { variable: "totalSupply", expectedValue: new BN(amount) }, @@ -734,7 +734,10 @@ function runTests(newToken, _accounts) { variable: "minterAllowance.minterAccount", expectedValue: new BN(amount - 50), }, - { variable: "balances.minterAccount", expectedValue: new BN(50) }, + { + variable: "balanceAndBlacklistStates.minterAccount", + expectedValue: new BN(50), + }, { variable: "totalSupply", expectedValue: new BN(50) }, { variable: "isAccountBlacklisted.minterAccount", expectedValue: true }, ]; @@ -763,7 +766,10 @@ function runTests(newToken, _accounts) { variable: "minterAllowance.minterAccount", expectedValue: new BN(amount - 50), }, - { variable: "balances.minterAccount", expectedValue: new BN(50) }, + { + variable: "balanceAndBlacklistStates.minterAccount", + expectedValue: new BN(50), + }, { variable: "totalSupply", expectedValue: new BN(50) }, { variable: "paused", expectedValue: true }, ]; @@ -791,7 +797,10 @@ function runTests(newToken, _accounts) { variable: "minterAllowance.minterAccount", expectedValue: new BN(amount - 50), }, - { variable: "balances.minterAccount", expectedValue: new BN(50) }, + { + variable: "balanceAndBlacklistStates.minterAccount", + expectedValue: new BN(50), + }, { variable: "totalSupply", expectedValue: new BN(50) }, ]; await expectRevert(token.burn(50, { from: arbitraryAccount })); @@ -818,7 +827,10 @@ function runTests(newToken, _accounts) { variable: "minterAllowance.minterAccount", expectedValue: new BN(amount - 50), }, - { variable: "balances.minterAccount", expectedValue: new BN(50) }, + { + variable: "balanceAndBlacklistStates.minterAccount", + expectedValue: new BN(50), + }, { variable: "totalSupply", expectedValue: new BN(50) }, ]; await checkVariables([token], [customVars]); @@ -830,7 +842,10 @@ function runTests(newToken, _accounts) { variable: "minterAllowance.minterAccount", expectedValue: new BN(0), }, - { variable: "balances.minterAccount", expectedValue: new BN(50) }, + { + variable: "balanceAndBlacklistStates.minterAccount", + expectedValue: new BN(50), + }, { variable: "totalSupply", expectedValue: new BN(50) }, ]; await expectRevert(token.burn(50, { from: minterAccount })); @@ -942,7 +957,7 @@ function runTests(newToken, _accounts) { const customVars = [ { variable: "isAccountMinter.minterAccount", expectedValue: true }, { - variable: "balances.minterAccount", + variable: "balanceAndBlacklistStates.minterAccount", expectedValue: new BN(amount), }, { variable: "totalSupply", expectedValue: new BN(amount) }, diff --git a/test/v1/positive.test.js b/test/v1/positive.test.js index 6e239b6ca..c6409bc5d 100644 --- a/test/v1/positive.test.js +++ b/test/v1/positive.test.js @@ -125,7 +125,7 @@ function runTests(newToken, _accounts) { expectedValue: new BN(amount - mintAmount), }, { - variable: "balances.arbitraryAccount", + variable: "balanceAndBlacklistStates.arbitraryAccount", expectedValue: new BN(mintAmount), }, { variable: "totalSupply", expectedValue: new BN(mintAmount) }, @@ -148,7 +148,7 @@ function runTests(newToken, _accounts) { expectedValue: new BN(0), }, { - variable: "balances.minterAccount", + variable: "balanceAndBlacklistStates.minterAccount", expectedValue: new BN(mintAmount), }, { variable: "totalSupply", expectedValue: new BN(mintAmount) }, @@ -163,7 +163,7 @@ function runTests(newToken, _accounts) { expectedValue: new BN(0), }, { - variable: "balances.minterAccount", + variable: "balanceAndBlacklistStates.minterAccount", expectedValue: new BN(mintAmount - burnAmount), }, { @@ -190,7 +190,7 @@ function runTests(newToken, _accounts) { expectedValue: new BN(amount - mintAmount), }, { - variable: "balances.arbitraryAccount", + variable: "balanceAndBlacklistStates.arbitraryAccount", expectedValue: new BN(mintAmount), }, { variable: "totalSupply", expectedValue: new BN(mintAmount) }, @@ -200,7 +200,7 @@ function runTests(newToken, _accounts) { await token.removeMinter(minterAccount, { from: masterMinterAccount }); customVars = [ { - variable: "balances.arbitraryAccount", + variable: "balanceAndBlacklistStates.arbitraryAccount", expectedValue: new BN(mintAmount), }, { variable: "totalSupply", expectedValue: new BN(mintAmount) }, @@ -233,7 +233,7 @@ function runTests(newToken, _accounts) { expectedValue: new BN(amount - mintAmount), }, { - variable: "balances.arbitraryAccount", + variable: "balanceAndBlacklistStates.arbitraryAccount", expectedValue: new BN(mintAmount), }, { variable: "totalSupply", expectedValue: new BN(mintAmount) }, @@ -247,9 +247,12 @@ function runTests(newToken, _accounts) { expectedValue: new BN(amount - mintAmount), }, { variable: "isAccountMinter.minterAccount", expectedValue: true }, - { variable: "balances.arbitraryAccount", expectedValue: bigZero }, { - variable: "balances.pauserAccount", + variable: "balanceAndBlacklistStates.arbitraryAccount", + expectedValue: bigZero, + }, + { + variable: "balanceAndBlacklistStates.pauserAccount", expectedValue: new BN(mintAmount), }, { variable: "totalSupply", expectedValue: new BN(mintAmount) }, @@ -280,7 +283,7 @@ function runTests(newToken, _accounts) { expectedValue: new BN(amount - mintAmount), }, { - variable: "balances.arbitraryAccount", + variable: "balanceAndBlacklistStates.arbitraryAccount", expectedValue: new BN(mintAmount), }, { variable: "totalSupply", expectedValue: new BN(mintAmount) }, @@ -299,9 +302,12 @@ function runTests(newToken, _accounts) { variable: "minterAllowance.minterAccount", expectedValue: new BN(amount - mintAmount), }, - { variable: "balances.arbitraryAccount", expectedValue: bigZero }, { - variable: "balances.pauserAccount", + variable: "balanceAndBlacklistStates.arbitraryAccount", + expectedValue: bigZero, + }, + { + variable: "balanceAndBlacklistStates.pauserAccount", expectedValue: new BN(mintAmount), }, { variable: "totalSupply", expectedValue: new BN(mintAmount) }, diff --git a/test/v1/proxyNegative.test.js b/test/v1/proxyNegative.test.js index 65363b76b..8cd5f15ef 100644 --- a/test/v1/proxyNegative.test.js +++ b/test/v1/proxyNegative.test.js @@ -206,9 +206,12 @@ function runTests(newToken, _accounts) { expectedValue: new BN(amount - mintAmount), }, { variable: "isAccountMinter.minterAccount", expectedValue: true }, - { variable: "balances.arbitraryAccount", expectedValue: bigZero }, { - variable: "balances.pauserAccount", + variable: "balanceAndBlacklistStates.arbitraryAccount", + expectedValue: bigZero, + }, + { + variable: "balanceAndBlacklistStates.pauserAccount", expectedValue: new BN(mintAmount), }, { variable: "totalSupply", expectedValue: new BN(mintAmount) }, diff --git a/test/v1/proxyPositive.test.js b/test/v1/proxyPositive.test.js index 9b128bb73..dc8acfc8a 100644 --- a/test/v1/proxyPositive.test.js +++ b/test/v1/proxyPositive.test.js @@ -63,8 +63,14 @@ function runTests(newToken, _accounts) { expectedValue: new BN(amount - mintAmount), }, { variable: "isAccountMinter.minterAccount", expectedValue: true }, - { variable: "balances.arbitraryAccount", expectedValue: bigZero }, - { variable: "balances.pauserAccount", expectedValue: new BN(mintAmount) }, + { + variable: "balanceAndBlacklistStates.arbitraryAccount", + expectedValue: bigZero, + }, + { + variable: "balanceAndBlacklistStates.pauserAccount", + expectedValue: new BN(mintAmount), + }, { variable: "totalSupply", expectedValue: new BN(mintAmount) }, { variable: "proxiedTokenAddress", expectedValue: upgradedToken.address }, ]; @@ -103,8 +109,14 @@ function runTests(newToken, _accounts) { expectedValue: new BN(amount - mintAmount), }, { variable: "isAccountMinter.minterAccount", expectedValue: true }, - { variable: "balances.arbitraryAccount", expectedValue: bigZero }, - { variable: "balances.pauserAccount", expectedValue: new BN(mintAmount) }, + { + variable: "balanceAndBlacklistStates.arbitraryAccount", + expectedValue: bigZero, + }, + { + variable: "balanceAndBlacklistStates.pauserAccount", + expectedValue: new BN(mintAmount), + }, { variable: "totalSupply", expectedValue: new BN(mintAmount) }, { variable: "proxiedTokenAddress", expectedValue: upgradedToken.address }, ]; @@ -148,9 +160,12 @@ function runTests(newToken, _accounts) { expectedValue: new BN(amount - mintAmount), }, { variable: "isAccountMinter.minterAccount", expectedValue: true }, - { variable: "balances.arbitraryAccount", expectedValue: bigZero }, { - variable: "balances.pauserAccount", + variable: "balanceAndBlacklistStates.arbitraryAccount", + expectedValue: bigZero, + }, + { + variable: "balanceAndBlacklistStates.pauserAccount", expectedValue: new BN(mintAmount), }, { variable: "totalSupply", expectedValue: new BN(mintAmount) }, @@ -308,9 +323,12 @@ function runTests(newToken, _accounts) { expectedValue: new BN(amount - mintAmount - 1), }, { variable: "isAccountMinter.minterAccount", expectedValue: true }, - { variable: "balances.arbitraryAccount", expectedValue: bigZero }, { - variable: "balances.pauserAccount", + variable: "balanceAndBlacklistStates.arbitraryAccount", + expectedValue: bigZero, + }, + { + variable: "balanceAndBlacklistStates.pauserAccount", expectedValue: new BN(mintAmount + 1), }, { variable: "totalSupply", expectedValue: new BN(mintAmount + 1) }, @@ -362,9 +380,12 @@ function runTests(newToken, _accounts) { expectedValue: new BN(amount - mintAmount), }, { variable: "isAccountMinter.minterAccount", expectedValue: true }, - { variable: "balances.arbitraryAccount", expectedValue: bigZero }, { - variable: "balances.pauserAccount", + variable: "balanceAndBlacklistStates.arbitraryAccount", + expectedValue: bigZero, + }, + { + variable: "balanceAndBlacklistStates.pauserAccount", expectedValue: new BN(mintAmount), }, { variable: "totalSupply", expectedValue: new BN(mintAmount) },