Skip to content

Commit

Permalink
feat: zkevm setup and deployment (#218)
Browse files Browse the repository at this point in the history
* first batch of test done

* update final hash of vaultManager implementation

* feat: add a script for the balance on a chain at a given time on any token

* feat: zkEVM deployment for agEUR and first Merkl contracts

---------

Co-authored-by: gs8nrv <[email protected]>
  • Loading branch information
sogipec and GuillaumeNervoXS authored Jul 10, 2023
1 parent 2d98820 commit bb4fafb
Show file tree
Hide file tree
Showing 25 changed files with 8,221 additions and 20 deletions.
13 changes: 7 additions & 6 deletions deploy/0_proxyAdmin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,20 @@ const func: DeployFunction = async ({ deployments, ethers, network }) => {
} else {
// Otherwise, we're using the proxy admin address from the desired network
guardian = CONTRACTS_ADDRESSES[network.config.chainId as ChainId]?.Guardian!;
guardian = '0xf0A31faec2B4fC6396c65B1aF1F6A71E653f11F0';
governor = '0x0F70EeD1Bb51d5eDB1a2E46142638df959bAFD69';
guardian = '0x10DeF8a92c51C8082087356186a1485301078DCd';
governor = '0x2a42Aeec7519883713272ec10FE44461a2Dfe354';
}
/*
console.log(`Now deploying ProxyAdmin on the chain ${network.config.chainId}`);
governor = guardian;
console.log('Governor address is ', governor);
await deploy('ProxyAdmin', {

await deploy('ProxyAdminGuardian', {
contract: 'ProxyAdmin',
from: deployer.address,
log: !argv.ci,
});
*/
const proxyAdminAddress = (await ethers.getContract('ProxyAdmin')).address;

const proxyAdminAddress = (await ethers.getContract('ProxyAdminGuardian')).address;

proxyAdmin = new ethers.Contract(proxyAdminAddress, ProxyAdmin__factory.createInterface(), deployer) as ProxyAdmin;

Expand Down
5 changes: 4 additions & 1 deletion deploy/1_coreBorrow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const func: DeployFunction = async ({ deployments, ethers, network }) => {
const json = await import('./networks/' + network.name + '.json');
const governor = json.governor;
const guardian = json.guardian;
const angleLabs = json.angleLabs;
let proxyAdmin: string;

if (!network.live) {
Expand Down Expand Up @@ -40,6 +41,8 @@ const func: DeployFunction = async ({ deployments, ethers, network }) => {

const coreBorrowInterface = CoreBorrow__factory.createInterface();

// governor = angleLabs;

const dataCoreBorrow = new ethers.Contract(
coreBorrowImplementation,
coreBorrowInterface,
Expand All @@ -49,7 +52,7 @@ const func: DeployFunction = async ({ deployments, ethers, network }) => {
console.log('The contract will be initialized with the following governor and guardian addresses');
console.log(governor, guardian);

await deploy('CoreBorrow', {
await deploy('CoreMerkl', {
contract: 'TransparentUpgradeableProxy',
from: deployer.address,
args: [coreBorrowImplementation, proxyAdmin, dataCoreBorrow],
Expand Down
2 changes: 1 addition & 1 deletion deploy/2_agTokenImplementation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const func: DeployFunction = async ({ deployments, ethers, network }) => {
} else {
implementationName = 'AgTokenSideChainMultiBridge';
proxyAdmin = registry(network.config.chainId as ChainId)?.ProxyAdmin!;
proxyAdmin = '0x9a5b060Bd7b8f86c4C0D720a17367729670AfB19';
proxyAdmin = '0x1D941EF0D3Bba4ad67DBfBCeE5262F4CEE53A32b';
}

console.log(`Now deploying the implementation for AgToken on ${network.name}`);
Expand Down
4 changes: 2 additions & 2 deletions deploy/3_treasury.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ const func: DeployFunction = async ({ deployments, ethers, network }) => {
} else {
proxyAdmin = registry(network.config.chainId as ChainId)?.ProxyAdmin!;
coreBorrow = registry(network.config.chainId as ChainId)?.CoreBorrow!;
proxyAdmin = '0x9a5b060Bd7b8f86c4C0D720a17367729670AfB19';
coreBorrow = '0x3E399AE5B4D8bc0021e53b51c8BCdD66DD62c03b';
proxyAdmin = '0x1D941EF0D3Bba4ad67DBfBCeE5262F4CEE53A32b';
coreBorrow = '0x4b1E2c2762667331Bc91648052F646d1b0d35984';
}

let treasuryImplementation: string;
Expand Down
14 changes: 7 additions & 7 deletions deploy/bridges/LayerZeroBridgeToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,24 @@ const func: DeployFunction = async ({ ethers, network, deployments }) => {
const deploymentName = 'LayerZeroBridgeToken_V1_0_Implementation';
const name = 'LayerZeroBridgeToken';
const { deploy } = deployments;

/*
await deploy(deploymentName, {
contract: name,
from: deployer.address,
log: !argv.ci,
});
*/
const implementationAddress = (await ethers.getContract(deploymentName)).address;

console.log(`Successfully deployed ${deploymentName} at ${implementationAddress}`);

/*
const treasury = await ethers.getContract('Treasury_EUR');
const proxyAdmin = await ethers.getContract('ProxyAdmin');
console.log(`LayerZero Bridge ag${stable}`, `LZ-ag${stable}`, endpointAddr, treasury.address, parseEther('0'));

await deployProxy(
`LayerZeroBridge_${stable}`,
layerZeroBridgeImplem,
implementationAddress,
proxyAdmin.address,
LayerZeroBridgeToken__factory.createInterface().encodeFunctionData('initialize', [
`LayerZero Bridge ag${stable}`,
Expand All @@ -42,14 +44,12 @@ const func: DeployFunction = async ({ ethers, network, deployments }) => {
parseEther('0'),
]),
);
*/

/* The following things need to be done after this deployment:
- setSources on the LayerZeroBridgeToken
- setTrustedRemote on the LayerZeroBridgeToken -> for all the supported bridge tokens
- addBridgeToken in the canonical agEUR -> limit should be higher than the limit which has already been minted in the contract
- setChainTotalHourlyLimit in the canonical agEUR
- setUseCustomAdapterParams
- And depending on the value of the EXTRA_GAS constant: setMinDstGasLookup to all the chains
- setUseCustomAdapterParams in the lz-agEUR contract
*/
};

Expand Down
1 change: 1 addition & 0 deletions deploy/bridges/LayerZeroSetSources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const func: DeployFunction = async ({ ethers, network }) => {
bsc: '0xe9f183FC656656f1F17af1F2b0dF79b8fF9ad8eD',
celo: '0xf1dDcACA7D17f8030Ab2eb54f2D9811365EFe123',
gnosis: '0xFA5Ed56A203466CbBC2430a43c66b9D8723528E7',
polygonzkevm: '0x2859a4eBcB58c8Dd5cAC1419C4F63A071b642B20',
};

const local = OFTs[network.name];
Expand Down
1 change: 1 addition & 0 deletions deploy/constants/layerzeroChainIds.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"fantom": 112,
"celo": 125,
"gnosis": 145,
"polygonzkevm": 158,
"zksync": 165,
"rinkeby": 10001,
"bsc-testnet": 10002,
Expand Down
1 change: 1 addition & 0 deletions deploy/constants/layerzeroEndpoints.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"fantom": "0xb6319cC6c8c27A8F5dAF0dD3DF91EA35C4720dd7",
"celo": "0x3A73033C0b1407574C76BdBAc67f126f6b4a9AA9",
"gnosis": "0x9740FF91F1985D8d2B71494aE1A2f723bb3Ed9E4",
"polygonzkevm": "0x9740FF91F1985D8d2B71494aE1A2f723bb3Ed9E4",
"zksync": "0x9b896c0e23220469C7AE69cb4BbAE391eAa4C8da",
"rinkeby": "0x79a63d6d8BBD5c6dfc774dA79bCcD948EAcb53FA",
"bsc-testnet": "0x6Fcb97553D41516Cb228ac03FdC8B9a0a9df04A1",
Expand Down
5 changes: 5 additions & 0 deletions deploy/networks/polygonzkevm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"angleLabs": "0x9439B96E39dA5AD7EAA75d7a136383D1D9737055",
"governor": "0x2a42Aeec7519883713272ec10FE44461a2Dfe354",
"guardian": "0x10DeF8a92c51C8082087356186a1485301078DCd"
}
1 change: 1 addition & 0 deletions deployments/polygonzkevm/.chainId
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1101
Loading

0 comments on commit bb4fafb

Please sign in to comment.