From 0613d89440aadf07f61b844ef4da4938f5f5aaa0 Mon Sep 17 00:00:00 2001 From: Alain Olivier Date: Fri, 23 Feb 2024 15:35:03 +0100 Subject: [PATCH] refactor(fork): revise and document test for withdrawing inflation --- test/fork/dao.test.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/test/fork/dao.test.js b/test/fork/dao.test.js index c1b7011..b9ed1b9 100644 --- a/test/fork/dao.test.js +++ b/test/fork/dao.test.js @@ -36,6 +36,7 @@ const { sendEth } = require('../utils/send-eth') const PNT_ON_GNOSIS_MINTER = '0x53d51f8801f40657ca566a1ae25b27eada97413c' const USER_ADDRESS = '0xdDb5f4535123DAa5aE343c24006F4075aBAF5F7B' +const ADDRESS_PLACEHOLDER = '0x0123456789012345678901234567890123456789' const getBytes = (_hexString) => Buffer.from(_hexString.slice(2), 'hex') @@ -367,9 +368,9 @@ describe('Integration tests on Gnosis deployment', () => { .withArgs(1, USER_ADDRESS, 'test https://ipfs.io/ipfs/QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D') }) + // this test is coupled with Integration tests on Ethereum deployment -> should process pegOut, withdrawInflation, and pegIn to treasury it('should call withdrawInflation from Gnosis', async () => { - const FORWARDER_ETH = '0x0123456789012345678901234567890123456789' - const RECEIVER = FORWARDER_ETH + const FORWARDER_ETH = ADDRESS_PLACEHOLDER const ETH_PTN_ADDRESS = ETHPNT_ADDRESS const amount = 10 @@ -380,7 +381,7 @@ describe('Integration tests on Gnosis deployment', () => { [ [ETH_PTN_ADDRESS, ETH_PTN_ADDRESS, ERC20_VAULT], [ - new hre.ethers.Interface(EthPntAbi).encodeFunctionData('withdrawInflation', [RECEIVER, amount]), + new hre.ethers.Interface(EthPntAbi).encodeFunctionData('withdrawInflation', [FORWARDER_ETH, amount]), new hre.ethers.Interface(EthPntAbi).encodeFunctionData('approve', [ERC20_VAULT, amount]), new hre.ethers.Interface(ERC20VaultAbi).encodeFunctionData('pegIn(uint256,address,string,bytes,bytes4)', [ amount, @@ -491,12 +492,13 @@ describe('Integration tests on Ethereum deployment', () => { await missingSteps() }) - it('should process pegout and withdrawInflation', async () => { + // this test is coupled with Integration tests on Gnosis deployment -> should call withdrawInflation from Gnosis + it('should process pegOut, withdrawInflation, and pegIn to treasury', async () => { const metadata = encodeMetadata(hre.ethers, { userData: // secretlint-disable-next-line '0x000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000003000000000000000000000000f4ea6b892853413bd9d9f1a5d3a620a0ba39c5b2000000000000000000000000f4ea6b892853413bd9d9f1a5d3a620a0ba39c5b2000000000000000000000000e396757ec7e6ac7c8e5abe7285dde47b98f22db80000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000443352d49b0000000000000000000000000123456789012345678901234567890123456789000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044095ea7b3000000000000000000000000e396757ec7e6ac7c8e5abe7285dde47b98f22db8000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000124c322525d000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000f4ea6b892853413bd9d9f1a5d3a620a0ba39c5b200000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000010000f1918e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002a30783632333939363865363233313136343638374342343066383338396439333364443766376530413500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'.replaceAll( - '0123456789012345678901234567890123456789', + ADDRESS_PLACEHOLDER, (await crossExecutor.getAddress()).slice(2) ), sourceNetworkId: PNETWORK_NETWORK_IDS.gnosisMainnet, @@ -525,7 +527,7 @@ describe('Integration tests on Ethereum deployment', () => { userData: // secretlint-disable-next-line '0x000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000003000000000000000000000000f4ea6b892853413bd9d9f1a5d3a620a0ba39c5b2000000000000000000000000f4ea6b892853413bd9d9f1a5d3a620a0ba39c5b2000000000000000000000000e396757ec7e6ac7c8e5abe7285dde47b98f22db80000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000443352d49b0000000000000000000000000123456789012345678901234567890123456789000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044095ea7b3000000000000000000000000e396757ec7e6ac7c8e5abe7285dde47b98f22db8000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000124c322525d000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000f4ea6b892853413bd9d9f1a5d3a620a0ba39c5b200000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000010000f1918e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002a30783632333939363865363233313136343638374342343066383338396439333364443766376530413500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'.replaceAll( - '0123456789012345678901234567890123456789', + ADDRESS_PLACEHOLDER, (await crossExecutor.getAddress()).slice(2) ), sourceNetworkId: PNETWORK_NETWORK_IDS.gnosisMainnet,