diff --git a/.gitignore b/.gitignore index 12942d27..9febdea3 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ test-blockchain/data *.log .DS_Store +.vscode *.env coverage/ diff --git a/contracts/root/depositManager/DepositManager.sol b/contracts/root/depositManager/DepositManager.sol index 7067691f..4abb411f 100644 --- a/contracts/root/depositManager/DepositManager.sol +++ b/contracts/root/depositManager/DepositManager.sol @@ -171,7 +171,7 @@ contract DepositManager is DepositManagerStorage, IDepositManager, ERC721Holder } // new: bridge POL as MATIC, child chain behaviour does not change else if (_token == registry.contractMap(keccak256("pol"))) { - _token == registry.contractMap(keccak256("matic")); + _token = registry.contractMap(keccak256("matic")); } deposits[_depositId] = DepositBlock(keccak256(abi.encodePacked(_user, _token, _amountOrToken)), now); diff --git a/test/helpers/utils.js b/test/helpers/utils.js index 78129bea..2d2d28e6 100644 --- a/test/helpers/utils.js +++ b/test/helpers/utils.js @@ -252,7 +252,7 @@ export async function depositOnRoot( const NewDepositBlockEvent = logs.find( log => log.event === 'NewDepositBlock' ) - return NewDepositBlockEvent.args.depositBlockId + return NewDepositBlockEvent } export async function deposit( @@ -265,13 +265,14 @@ export async function deposit( ) { let depositBlockId if (options.rootDeposit) { - depositBlockId = await depositOnRoot( + const newDepositBlockEvent = await depositOnRoot( depositManager, rootContract, user, amountOrToken, options ) + depositBlockId = newDepositBlockEvent.args.depositBlockId } else { depositBlockId = '0x' + crypto.randomBytes(32).toString('hex') } diff --git a/test/integration/root/DepositManagerUpdate.test.js b/test/integration/root/DepositManagerUpdate.test.js index d69583d1..4b2c30ee 100644 --- a/test/integration/root/DepositManagerUpdate.test.js +++ b/test/integration/root/DepositManagerUpdate.test.js @@ -102,14 +102,18 @@ contract('DepositManager Update @skip-on-coverage', async function(accounts) { const bob = '0x' + crypto.randomBytes(20).toString('hex') // using the utils function more granularly here so we can call fireDepositFromMainToMatic with the correct token address - const depositBlockId = await utils.depositOnRoot( + const newDepositBlockEvent = await utils.depositOnRoot( depositManager, pol, bob, amount, { rootDeposit: true, erc20: true } ) - await utils.fireDepositFromMainToMatic(childContracts.childChain, '0xa', bob, e20.rootERC20.address, amount, depositBlockId) + + // token has been changed to MATIC + assert.strictEqual(newDepositBlockEvent.args.token, e20.rootERC20.address) + + await utils.fireDepositFromMainToMatic(childContracts.childChain, '0xa', bob, e20.rootERC20.address, amount, newDepositBlockEvent.args.depositBlockId) // deposit on child chain is technically still in MATIC utils.assertBigNumberEquality(await e20.childToken.balanceOf(bob), amount)