Skip to content

Commit

Permalink
refactor(fork): revise and document test for withdrawing inflation
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviera9 committed Feb 23, 2024
1 parent 9cfbefe commit 0613d89
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions test/fork/dao.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down Expand Up @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 0613d89

Please sign in to comment.