This template contains an opinionated smart contract template for creating proposals to list assets on the aave polygon v3 market.
For a proposal to be executed on polygon it needs to pass mainnet governance proposal that sends an encoded payload via sendMessageToChild(address,bytes)
on FX_ROOT(mainnet) to FX_CHILD(polygon). Once the state is synced to FX_CHILD
on polygon network it will queue the payload on POLYGON_BRIDGE_EXECUTOR.
To simplify the process of creating a cross chain proposal this repository contains an opinionated CrosschainForwarderPolygon which expects a payload address deployed on the polygon network as the only parameter. The mainnet proposal payload will then be a simple execute()
signature with DELEGATECALL
enabled.
cp .env.example .env
forge build
forge test
# Deploy proposal
make deploy-<mai|frax>-<ledger|pk>
# Verify proposal
make verify-<mai|frax>
Make sure the referenced IPFS_HASH is properly encoded (check if the ipfs file is in json format and renders nicely on https://app.aave.com/governance/ipfs-preview/?ipfsHash=).
make deploy-l1-<mai|frax>-proposal-<ledger|pk>
To create a proposal you have to do two things:
- deploy the Polygon Payload (see MiMatic)
- create the mainnet proposal (see DeployL1Proposal)
While the order of actions is important as the mainnet proposal needs the l2 payload address, both actions can be performed by different parties / addresses. The address creating the mainnet proposal requires 80k AAVE of proposition power.
- the deploy script currently requires the --legacy flag due to issues with polygon gas estimation ethers-io/ethers.js#2828 (comment)
- some of the tests are currently commented out due to a bug on foundry causing public library methods to revert foundry-rs/foundry#2549