diff --git a/test/fork/dao.test.js b/test/fork/dao.test.js index bdbe771..dc620c3 100644 --- a/test/fork/dao.test.js +++ b/test/fork/dao.test.js @@ -24,6 +24,7 @@ const { LENDING_MANAGER, FEES_MANAGER, REWARDS_MANAGER, + FORWARDER: FORWARDER_ON_GNOSIS, ACL, DANDELION_VOTING, FINANCE_VAULT, @@ -45,7 +46,7 @@ const { CROSS_EXECUTOR, SAFE: SAFE_ON_ETH }, - POLYGON: { PNT: PNT_ON_POLYGON, PNT_MINTER: PNT_MINTER_ON_POLYGON } + POLYGON: { PNT: PNT_ON_POLYGON, PNT_MINTER: PNT_MINTER_ON_POLYGON, FORWARDER: FORWARDER_ON_POLYGON } }, MISC: { ONE_DAY }, PNETWORK_NETWORK_IDS @@ -73,7 +74,7 @@ const FORWARDER_STAKE_USER_DATA_2 = '0x0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000ddb5f4535123daa5ae343c24006f4075abaf5f7b0000000000000000000000000000000000000000000000000000000000000220000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000020000000000000000000000008805aa0c1a8e59b03fa95740f691e28942cf44f6000000000000000000000000dee8ebe2b7152eccd935fd67134bf1bad55302bc0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000044095ea7b3000000000000000000000000dee8ebe2b7152eccd935fd67134bf1bad55302bc0000000000000000000000000000000000000000000000000b0bfa54806c1db90000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000642b54f551000000000000000000000000ddb5f4535123daa5ae343c24006f4075abaf5f7b0000000000000000000000000000000000000000000000000b0bfa54806c1db90000000000000000000000000000000000000000000000000000000000093a8000000000000000000000000000000000000000000000000000000000' const WITHDRAW_INFLATION_FROM_GNOSIS_USER_DATA = // secretlint-disable-next-line - '0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000cf759bccfef5f322af58adae2d28885658b5e0200000000000000000000000000000000000000000000000000000000000003a0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000003000000000000000000000000f4ea6b892853413bd9d9f1a5d3a620a0ba39c5b2000000000000000000000000f4ea6b892853413bd9d9f1a5d3a620a0ba39c5b2000000000000000000000000e396757ec7e6ac7c8e5abe7285dde47b98f22db80000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000443352d49b000000000000000000000000e0bfe5ae5cebbf666c381f267187379117d0da73000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044095ea7b3000000000000000000000000e396757ec7e6ac7c8e5abe7285dde47b98f22db8000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000124c322525d000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000f4ea6b892853413bd9d9f1a5d3a620a0ba39c5b200000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000010000f1918e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002a30783632333939363865363233313136343638374342343066383338396439333364443766376530413500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' + '0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000cf759bccfef5f322af58adae2d28885658b5e0200000000000000000000000000000000000000000000000000000000000003a0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000003000000000000000000000000f4ea6b892853413bd9d9f1a5d3a620a0ba39c5b2000000000000000000000000f4ea6b892853413bd9d9f1a5d3a620a0ba39c5b2000000000000000000000000e396757ec7e6ac7c8e5abe7285dde47b98f22db80000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000443352d49b0000000000000000000000006a4bd6de0de7b80f24a307f31b40856da975b5a7000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044095ea7b3000000000000000000000000e396757ec7e6ac7c8e5abe7285dde47b98f22db8000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000124c322525d000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000f4ea6b892853413bd9d9f1a5d3a620a0ba39c5b200000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000010000f1918e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002a30783632333939363865363233313136343638374342343066383338396439333364443766376530413500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' const WITHDRAW_INFLATION_FROM_GNOSIS_USER_DATA_2 = // secretlint-disable-next-line '0x000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000003000000000000000000000000f4ea6b892853413bd9d9f1a5d3a620a0ba39c5b2000000000000000000000000f4ea6b892853413bd9d9f1a5d3a620a0ba39c5b2000000000000000000000000e396757ec7e6ac7c8e5abe7285dde47b98f22db80000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000443352d49b00000000000000000000000001234567890123456789012345678901234567890000000000000000000000000000000000000000000000056bc75e2d63100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044095ea7b3000000000000000000000000e396757ec7e6ac7c8e5abe7285dde47b98f22db80000000000000000000000000000000000000000000000056bc75e2d63100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000124c322525d0000000000000000000000000000000000000000000000056bc75e2d63100000000000000000000000000000f4ea6b892853413bd9d9f1a5d3a620a0ba39c5b200000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000010000f1918e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002a30786631663635363861373635353964383563463638453635393766413538373534343138346444343600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' @@ -180,11 +181,6 @@ describe('Integration tests on Gnosis deployment', () => { ] const missingSteps = async () => { - const Forwader = await ethers.getContractFactory('Forwarder') - forwarder = await Forwader.deploy(PNT_ON_GNOSIS, ethers.ZeroAddress) - await forwarder.whitelistOriginAddress(PNETWORK_NETWORK_IDS.POLYGON, ADDRESS_PLACEHOLDER.toLowerCase()) - await forwarder.addUnprivilegedCall('0x095ea7b3') - await daoVoting.connect(daoOwner).changeForwarder(forwarder.target) await mintPntOnGnosis(forwarder.target, ethers.parseUnits('1')) await mintPntOnGnosis(daoVoting.target, ethers.parseUnits('1')) } @@ -281,6 +277,7 @@ describe('Integration tests on Gnosis deployment', () => { registrationManager = RegistrationManager.attach(REGISTRATION_MANAGER) feesManager = EpochsManager.attach(FEES_MANAGER) rewardsManager = RewardsManager.attach(REWARDS_MANAGER) + forwarder = await ethers.getContractAt('Forwarder', FORWARDER_ON_GNOSIS) await missingSteps() @@ -772,7 +769,7 @@ describe('Integration tests on Gnosis deployment', () => { .withArgs(user.address, ethers.parseUnits('10')) }) - it('[dapp] should stake from forwarder call', async () => { + it('[dapp] should stake from forwarder call (1)', async () => { expect(await daoPNT.balanceOf(USER_ADDRESS)).to.be.eq(ethers.parseUnits('0')) const smBalance = await pntOnGnosis.balanceOf(STAKING_MANAGER) const metadata = encodeMetadata(ethers, { @@ -780,7 +777,7 @@ describe('Integration tests on Gnosis deployment', () => { // secretlint-disable-next-line FORWARDER_STAKE_USER_DATA.replaceAll(ADDRESS_PLACEHOLDER.slice(2), pntOnGnosis.target.slice(2)), sourceNetworkId: PNETWORK_NETWORK_IDS.POLYGON, - senderAddress: ADDRESS_PLACEHOLDER, + senderAddress: FORWARDER_ON_POLYGON, destinationNetworkId: PNETWORK_NETWORK_IDS.GNOSIS, receiverAddress: forwarder.target }) @@ -800,7 +797,7 @@ describe('Integration tests on Gnosis deployment', () => { // secretlint-disable-next-line FORWARDER_STAKE_USER_DATA_2, sourceNetworkId: PNETWORK_NETWORK_IDS.POLYGON, - senderAddress: ADDRESS_PLACEHOLDER, + senderAddress: FORWARDER_ON_POLYGON, destinationNetworkId: PNETWORK_NETWORK_IDS.GNOSIS, receiverAddress: forwarder.target }) @@ -843,7 +840,7 @@ describe('Integration tests on Gnosis deployment', () => { ethers.zeroPadValue(ethers.toBeHex(voteId), 32).slice(2) ), sourceNetworkId: PNETWORK_NETWORK_IDS.POLYGON, - senderAddress: ADDRESS_PLACEHOLDER, + senderAddress: FORWARDER_ON_POLYGON, destinationNetworkId: PNETWORK_NETWORK_IDS.GNOSIS, receiverAddress: forwarder.target }) @@ -974,9 +971,6 @@ describe('Integration tests on Ethereum deployment', () => { pegoutToken(vault, pnetwork, _recipient, PNT_ON_ETH, _value, _metadata) const missingSteps = async () => { - const CrossExecutor = await ethers.getContractFactory('CrossExecutor') - crossExecutor = await CrossExecutor.deploy(PNT_ON_ETH, ERC20_VAULT, DANDELION_VOTING) - await crossExecutor.whitelistOriginAddress(PNETWORK_NETWORK_IDS.GNOSIS, ADDRESS_PLACEHOLDER.toLocaleLowerCase()) daoVotingV1 = await ethers.getContractAt(DandelionVotingAbi, DANDELION_VOTING_V1) // open vote to change inflationOwner const executionScript = encodeCallScript( @@ -1013,6 +1007,7 @@ describe('Integration tests on Ethereum deployment', () => { ethPnt = await ethers.getContractAt(EthPntAbi, ETHPNT) vault = await ethers.getContractAt('IERC20Vault', ERC20_VAULT) safe = await ethers.getImpersonatedSigner(SAFE_ON_ETH) + crossExecutor = await ethers.getContractAt('CrossExecutor', CROSS_EXECUTOR) await sendEth(ethers, faucet, pnetwork.address, '10') await sendEth(ethers, faucet, association.address, '10') await sendEth(ethers, faucet, safe.address, '10') @@ -1028,7 +1023,7 @@ describe('Integration tests on Ethereum deployment', () => { crossExecutor.target.slice(2) ), sourceNetworkId: PNETWORK_NETWORK_IDS.GNOSIS, - senderAddress: ADDRESS_PLACEHOLDER, + senderAddress: FORWARDER_ON_GNOSIS, destinationNetworkId: PNETWORK_NETWORK_IDS.MAINNET, receiverAddress: crossExecutor.target }) @@ -1056,7 +1051,7 @@ describe('Integration tests on Ethereum deployment', () => { crossExecutor.target.slice(2) ), sourceNetworkId: PNETWORK_NETWORK_IDS.GNOSIS, - senderAddress: ADDRESS_PLACEHOLDER, + senderAddress: FORWARDER_ON_GNOSIS, destinationNetworkId: PNETWORK_NETWORK_IDS.MAINNET, receiverAddress: crossExecutor.target }) @@ -1174,19 +1169,7 @@ describe('Integration tests on Ethereum deployment', () => { ) }) - it.skip('[dapp] should open a vote for migrating ethPNT treasury funds (3)', async () => { - await crossExecutor - .connect(safe) - .call( - ethPnt.target, - ethPnt.interface.encodeFunctionData('withdrawInflation', [crossExecutor.target, ethers.parseUnits('100')]) - ) - await crossExecutor - .connect(safe) - .call( - ethPnt.target, - ethPnt.interface.encodeFunctionData('transfer', [FINANCE_VAULT_V1, ethers.parseUnits('100')]) - ) + it('[dapp] should open a vote for migrating ethPNT treasury funds (3)', async () => { await daoVotingV1.connect(association).newVote( // secretlint-disable-next-line '0x00000001dd92eb1478d3189707ab7f4a5ace3a615cdd047600000064beabacc8000000000000000000000000f4ea6b892853413bd9d9f1a5d3a620a0ba39c5b20000000000000000000000002211bfd97b1c02ae8ac305d206e9780ba7d8bff40000000000000000000000000000000000000000000000056bc75e2d63100000f4ea6b892853413bd9d9f1a5d3a620a0ba39c5b200000044095ea7b3000000000000000000000000e396757ec7e6ac7c8e5abe7285dde47b98f22db80000000000000000000000000000000000000000000000056bc75e2d63100000e396757ec7e6ac7c8e5abe7285dde47b98f22db800000124c322525d0000000000000000000000000000000000000000000000056bc75e2d63100000000000000000000000000000f4ea6b892853413bd9d9f1a5d3a620a0ba39c5b200000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000010000f1918e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002a307866316636353638613736353539643835634636384536353937664135383735343431383464443436000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', @@ -1215,7 +1198,7 @@ describe('Integration tests on Ethereum deployment', () => { }) // pBTC is not native! so the execution script should not peg-in - it.skip('[dapp] should open a vote for migrating pBTC treasury funds (4', async () => { + it.skip('[dapp] should open a vote for migrating pBTC treasury funds (4)', async () => { const amount = ethers.parseEther('100') const pbtc = await ethers.getContractAt(pBTConEthereumAbi, PBTC_ON_ETHEREUM) const minter = await ethers.getImpersonatedSigner(PBTC_MINTER) @@ -1248,32 +1231,12 @@ describe('Integration tests on Ethereum deployment', () => { PNETWORK_NETWORK_IDS.GNOSIS ) }) - - it.skip('should be able to change inflationOwner from CrossExecutor', async () => { - await expect( - crossExecutor - .connect(safe) - .call(ETHPNT, ethPnt.interface.encodeFunctionData('setInflationOwner', [association.address])) - ).to.emit(ethPnt, 'NewInflationOwner') - expect(await ethPnt.inflationOwner()).to.be.eq(association.address) - }) - - it.skip('should not be able to change inflationOwner from CrossExecutor without ownership', async () => { - await expect( - crossExecutor - .connect(association) - .call(ETHPNT, ethPnt.interface.encodeFunctionData('setInflationOwner', [association.address])) - ).to.be.revertedWith('Ownable: caller is not the owner') - expect(await ethPnt.inflationOwner()).to.be.eq(crossExecutor.target) - }) }) describe('Integration tests on Polygon deployment', () => { let pntOnPolygon, faucet, minter, user, forwarder const missingSteps = async () => { - const Forwader = await ethers.getContractFactory('Forwarder') - forwarder = await Forwader.deploy(PNT_ON_POLYGON, ethers.ZeroAddress) - await mintPToken(pntOnPolygon, minter, user.address, ethers.parseEther('1')) + await mintPToken(pntOnPolygon, minter, user.address, ethers.parseUnits('2')) await pntOnPolygon.connect(user).transfer(forwarder.target, ethers.parseUnits('1')) } @@ -1284,6 +1247,7 @@ describe('Integration tests on Polygon deployment', () => { minter = await ethers.getImpersonatedSigner(PNT_MINTER_ON_POLYGON) ;[faucet] = await ethers.getSigners() user = await ethers.getImpersonatedSigner(USER_ADDRESS) + forwarder = await ethers.getContractAt('Forwarder', FORWARDER_ON_POLYGON) await sendEth(ethers, faucet, user.address, '100') await missingSteps() }) @@ -1293,7 +1257,7 @@ describe('Integration tests on Polygon deployment', () => { await expect( forwarder.connect(user).call( '100000000000000000', - ADDRESS_PLACEHOLDER, + FORWARDER_ON_GNOSIS, // secretlint-disable-next-line '0x000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000123456789012345678901234567890123456789000000000000000000000000dee8ebe2b7152eccd935fd67134bf1bad55302bc0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000044095ea7b3000000000000000000000000dee8ebe2b7152eccd935fd67134bf1bad55302bc0000000000000000000000000000000000000000000000000162ea854d0fc0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000642b54f551000000000000000000000000ddb5f4535123daa5ae343c24006f4075abaf5f7b0000000000000000000000000000000000000000000000000162ea854d0fc0000000000000000000000000000000000000000000000000000000000000093a8000000000000000000000000000000000000000000000000000000000', PNETWORK_NETWORK_IDS.GNOSIS @@ -1303,7 +1267,7 @@ describe('Integration tests on Polygon deployment', () => { .withArgs( forwarder.target, 100000000000000000n, - ADDRESS_PLACEHOLDER.toLowerCase().slice(2), + FORWARDER_ON_GNOSIS.toLowerCase().slice(2), // secretlint-disable-next-line FORWARDER_STAKE_USER_DATA, PNETWORK_NETWORK_IDS.POLYGON, @@ -1317,15 +1281,14 @@ describe('Integration tests on Polygon deployment', () => { user.sendTransaction({ to: forwarder.target, // secretlint-disable-next-line - data: '0x996adf550000000000000000000000000000000000000000000000000b1310c5a2bfcbac00000000000000000000000099405b4e46256dd28e424a0edf296a28e2ae32a0000000000000000000000000000000000000000000000000000000000000008000f1918e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000220000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000020000000000000000000000008805aa0c1a8e59b03fa95740f691e28942cf44f6000000000000000000000000dee8ebe2b7152eccd935fd67134bf1bad55302bc0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000044095ea7b3000000000000000000000000dee8ebe2b7152eccd935fd67134bf1bad55302bc0000000000000000000000000000000000000000000000000b0bfa54806c1db90000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000642b54f551000000000000000000000000ddb5f4535123daa5ae343c24006f4075abaf5f7b0000000000000000000000000000000000000000000000000b0bfa54806c1db90000000000000000000000000000000000000000000000000000000000093a8000000000000000000000000000000000000000000000000000000000' + data: '0x996adf550000000000000000000000000000000000000000000000000b1310c5a2bfcbac0000000000000000000000002422eb5b6a20c7b8e3567c12ed6f5ed9d1cf1f79000000000000000000000000000000000000000000000000000000000000008000f1918e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000220000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000020000000000000000000000008805aa0c1a8e59b03fa95740f691e28942cf44f6000000000000000000000000dee8ebe2b7152eccd935fd67134bf1bad55302bc0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000044095ea7b3000000000000000000000000dee8ebe2b7152eccd935fd67134bf1bad55302bc0000000000000000000000000000000000000000000000000b0bfa54806c1db90000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000642b54f551000000000000000000000000ddb5f4535123daa5ae343c24006f4075abaf5f7b0000000000000000000000000000000000000000000000000b0bfa54806c1db90000000000000000000000000000000000000000000000000000000000093a8000000000000000000000000000000000000000000000000000000000' }) ) .to.emit(pntOnPolygon, 'Redeem') .withArgs( forwarder.target, ethers.parseUnits('0.797999999999789996'), - ADDRESS_PLACEHOLDER.toLowerCase().slice(2), - // secretlint-disable-next-line + FORWARDER_ON_GNOSIS.toLowerCase().slice(2), FORWARDER_STAKE_USER_DATA_2, PNETWORK_NETWORK_IDS.POLYGON, PNETWORK_NETWORK_IDS.GNOSIS @@ -1336,7 +1299,7 @@ describe('Integration tests on Polygon deployment', () => { await expect( forwarder.connect(user).call( '0', - ADDRESS_PLACEHOLDER, + FORWARDER_ON_GNOSIS, // secretlint-disable-next-line '0x0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000cf759bccfef5f322af58adae2d28885658b5e02000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000064571eed31000000000000000000000000ddb5f4535123daa5ae343c24006f4075abaf5f7b0000000000000000000000000000000000000000000000000000000000000025000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000', PNETWORK_NETWORK_IDS.GNOSIS @@ -1346,8 +1309,7 @@ describe('Integration tests on Polygon deployment', () => { .withArgs( forwarder.target, 1n, - ADDRESS_PLACEHOLDER.toLowerCase().slice(2), - // secretlint-disable-next-line + FORWARDER_ON_GNOSIS.slice(2).toLowerCase(), FORWARDER_DELEGATE_VOTE_USER_DATA, PNETWORK_NETWORK_IDS.POLYGON, PNETWORK_NETWORK_IDS.GNOSIS