diff --git a/test/integration/behaviors/redeem.dynamic.behavior.js b/test/integration/behaviors/redeem.dynamic.behavior.js index 5c80fc4dd9..2ce7f88ac3 100644 --- a/test/integration/behaviors/redeem.dynamic.behavior.js +++ b/test/integration/behaviors/redeem.dynamic.behavior.js @@ -47,7 +47,7 @@ function itCanRedeem({ ctx }) { ctx, symbol: synth1, user: someUser, - balance: parseEther('100'), + balance: parseEther('1'), }); }); @@ -56,7 +56,7 @@ function itCanRedeem({ ctx }) { ctx, symbol: synth2, user: someUser, - balance: parseEther('500'), + balance: parseEther('100'), }); }); diff --git a/test/integration/utils/balances.js b/test/integration/utils/balances.js index ede636213d..30e8b1b3dc 100644 --- a/test/integration/utils/balances.js +++ b/test/integration/utils/balances.js @@ -107,7 +107,11 @@ async function _getSNX({ ctx, user, amount }) { async function _getSNXForOwner({ ctx, amount }) { if (!ctx.useOvm) { - throw new Error('There is no more SNX!'); + if (ctx.fork) { + await _getSNXForOwnerOnL1ByHackTransfer({ ctx, amount }); + } else { + throw new Error('There is no more SNX!'); + } } else { if (ctx.l1) { await _getSNXForOwnerOnL2ByDepositing({ ctx: ctx.l1, amount }); @@ -121,6 +125,35 @@ async function _getSNXForOwnerOnL2ByDepositing({ ctx, amount }) { await deposit({ ctx, from: ctx.users.owner, to: ctx.users.owner, amount }); } +async function _getSNXForOwnerOnL1ByHackTransfer({ ctx, amount }) { + const owner = ctx.users.owner; + + let { Synthetix, AddressResolver } = ctx.contracts; + + const bridgeName = toBytes32('SynthetixBridgeToOptimism'); + const bridgeAddress = await AddressResolver.getAddress(bridgeName); + + const bridgeEscrowName = toBytes32('SynthetixBridgeEscrow'); + const bridgeEscrowAddress = await AddressResolver.getAddress(bridgeEscrowName); + + let tx; + + AddressResolver = AddressResolver.connect(owner); + tx = await AddressResolver.importAddresses([bridgeName], [owner.address]); + await tx.wait(); + tx = await AddressResolver.rebuildCaches([Synthetix.address]); + await tx.wait(); + + Synthetix = Synthetix.connect(owner); + tx = await Synthetix.transferFrom(bridgeEscrowAddress, owner.address, amount); + await tx.wait(); + + tx = await AddressResolver.importAddresses([bridgeName], [bridgeAddress]); + await tx.wait(); + tx = await AddressResolver.rebuildCaches([Synthetix.address]); + await tx.wait(); +} + async function _getSNXForOwnerOnL2ByHackMinting({ ctx, amount }) { const owner = ctx.users.owner;