Skip to content

Commit 6dd3d78

Browse files
Linea deployment (#227)
* first batch of test done * update final hash of vaultManager implementation * feat: linea deployment for agEUR * feat: mantle deployment --------- Co-authored-by: gs8nrv <55771972+GuillaumeNervoXS@users.noreply.github.com>
1 parent ffd3a76 commit 6dd3d78

38 files changed

Lines changed: 16577 additions & 51 deletions

deploy/0_proxyAdmin.ts

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// To be used in other chains than mainnet to deploy proxy admin for our upgradeable contracts
22
import { ChainId, CONTRACTS_ADDRESSES } from '@angleprotocol/sdk';
33
import { DeployFunction } from 'hardhat-deploy/types';
4+
// import { DeployFunction } from '@matterlabs/hardhat-zksync-deploy';
45
import yargs from 'yargs';
56

67
import { ProxyAdmin, ProxyAdmin__factory } from '../typechain';
@@ -10,30 +11,31 @@ const func: DeployFunction = async ({ deployments, ethers, network }) => {
1011
const { deploy } = deployments;
1112
const { deployer } = await ethers.getNamedSigners();
1213
let proxyAdmin: ProxyAdmin;
13-
let guardian: string;
14-
let governor: string;
15-
16-
if (!network.live) {
17-
// If we're in mainnet fork, we're using the `ProxyAdmin` address from mainnet
18-
guardian = CONTRACTS_ADDRESSES[ChainId.MAINNET]?.Guardian!;
19-
governor = CONTRACTS_ADDRESSES[ChainId.MAINNET]?.Governor!;
20-
} else {
21-
// Otherwise, we're using the proxy admin address from the desired network
22-
guardian = CONTRACTS_ADDRESSES[network.config.chainId as ChainId]?.Guardian!;
23-
guardian = '0xe4BB74804edf5280c9203f034036f7CB15196078';
24-
governor = '0x7DF37fc774843b678f586D55483819605228a0ae';
25-
}
26-
console.log(`Now deploying ProxyAdmin on the chain ${network.config.chainId}`);
27-
// governor = guardian;
14+
const json = await import('./networks/' + network.name + '.json');
15+
let governor;
16+
let name;
17+
const guardian = json.guardian;
18+
19+
name = 'ProxyAdmin';
20+
governor = json.governor;
21+
22+
// TODO uncomment if deploying ProxyAdminGuardian
23+
24+
governor = guardian;
25+
name = 'ProxyAdminGuardian';
26+
27+
console.log(governor, guardian);
28+
29+
console.log(`Now deploying ${name} on the chain ${network.config.chainId}`);
2830
console.log('Governor address is ', governor);
2931

30-
await deploy('ProxyAdmin', {
32+
await deploy(name, {
3133
contract: 'ProxyAdmin',
3234
from: deployer.address,
3335
log: !argv.ci,
3436
});
3537

36-
const proxyAdminAddress = (await ethers.getContract('ProxyAdmin')).address;
38+
const proxyAdminAddress = (await ethers.getContract(name)).address;
3739

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

deploy/1_coreBorrow.ts

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ const func: DeployFunction = async ({ deployments, ethers, network }) => {
1010
const { deploy } = deployments;
1111
const { deployer } = await ethers.getNamedSigners();
1212
const json = await import('./networks/' + network.name + '.json');
13-
let governor = json.governor;
14-
const guardian = json.guardian;
13+
let governor;
14+
let guardian;
15+
let name;
16+
name = 'CoreBorrow';
17+
governor = json.governor;
18+
guardian = json.guardian;
1519
const angleLabs = json.angleLabs;
1620
let proxyAdmin: string;
1721

@@ -20,15 +24,22 @@ const func: DeployFunction = async ({ deployments, ethers, network }) => {
2024
proxyAdmin = CONTRACTS_ADDRESSES[ChainId.MAINNET]?.ProxyAdmin!;
2125
} else {
2226
// Otherwise, we're using the proxy admin address from the desired network
23-
proxyAdmin = (await deployments.get('ProxyAdminGuardian')).address;
27+
proxyAdmin = (await deployments.get('ProxyAdmin')).address;
2428
}
2529

30+
// TODO: uncomment if deploying CoreMerkl
31+
32+
governor = angleLabs;
33+
name = 'CoreMerkl';
34+
proxyAdmin = (await deployments.get('ProxyAdminGuardian')).address;
35+
2636
console.log('Let us get started with deployment');
2737

28-
/*
2938
console.log('Now deploying CoreBorrow');
3039
console.log('Starting with the implementation');
3140

41+
// TODO: comment if implementation has already been deployed
42+
/*
3243
await deploy('CoreBorrow_Implementation', {
3344
contract: 'CoreBorrow',
3445
from: deployer.address,
@@ -43,26 +54,24 @@ const func: DeployFunction = async ({ deployments, ethers, network }) => {
4354

4455
const coreBorrowInterface = CoreBorrow__factory.createInterface();
4556

46-
governor = angleLabs;
47-
4857
const dataCoreBorrow = new ethers.Contract(
4958
coreBorrowImplementation,
5059
coreBorrowInterface,
5160
).interface.encodeFunctionData('initialize', [governor, guardian]);
5261

53-
console.log('Now deploying the Proxy');
62+
console.log(`Now deploying the Proxy for ${name}`);
5463
console.log('The contract will be initialized with the following governor and guardian addresses');
5564
console.log(governor, guardian);
5665

57-
await deploy('CoreMerkl', {
66+
await deploy(name, {
5867
contract: 'TransparentUpgradeableProxy',
5968
from: deployer.address,
6069
args: [coreBorrowImplementation, proxyAdmin, dataCoreBorrow],
6170
log: !argv.ci,
6271
});
6372

64-
const coreBorrow = (await deployments.get('CoreMerkl')).address;
65-
console.log(`Successfully deployed CoreBorrow at the address ${coreBorrow}`);
73+
const coreBorrow = (await deployments.get(name)).address;
74+
console.log(`Successfully deployed ${name} at the address ${coreBorrow}`);
6675

6776
console.log(`${coreBorrow} ${coreBorrowImplementation} ${proxyAdmin} ${dataCoreBorrow} `);
6877
console.log('');

deploy/2_agTokenImplementation.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ const func: DeployFunction = async ({ deployments, ethers, network }) => {
1717
proxyAdmin = registry(ChainId.MAINNET)?.ProxyAdmin!;
1818
} else {
1919
implementationName = 'AgTokenSideChainMultiBridge';
20-
proxyAdmin = registry(network.config.chainId as ChainId)?.ProxyAdmin!;
21-
proxyAdmin = '0x31429d1856aD1377A8A0079410B297e1a9e214c2';
20+
proxyAdmin = (await deployments.get('ProxyAdmin')).address;
2221
}
2322

2423
console.log(`Now deploying the implementation for AgToken on ${network.name}`);

deploy/3_treasury.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,8 @@ const func: DeployFunction = async ({ deployments, ethers, network }) => {
2222
proxyAdmin = registry(ChainId.MAINNET)?.ProxyAdmin!;
2323
coreBorrow = registry(ChainId.MAINNET)?.CoreBorrow!;
2424
} else {
25-
proxyAdmin = registry(network.config.chainId as ChainId)?.ProxyAdmin!;
26-
coreBorrow = registry(network.config.chainId as ChainId)?.CoreBorrow!;
27-
proxyAdmin = '0x31429d1856aD1377A8A0079410B297e1a9e214c2';
28-
coreBorrow = '0x4b1E2c2762667331Bc91648052F646d1b0d35984';
25+
proxyAdmin = (await deployments.get('ProxyAdmin')).address;
26+
coreBorrow = (await deployments.get('CoreBorrow')).address;
2927
}
3028

3129
let treasuryImplementation: string;
@@ -63,5 +61,5 @@ const func: DeployFunction = async ({ deployments, ethers, network }) => {
6361
};
6462

6563
func.tags = ['treasury'];
66-
func.dependencies = ['agTokenImplementation'];
64+
// func.dependencies = ['agTokenImplementation'];
6765
export default func;

deploy/bridges/LayerZeroBridgeToken.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const func: DeployFunction = async ({ ethers, network, deployments }) => {
4545
);
4646

4747
/* The following things need to be done after this deployment:
48-
- setTrustedRemote on the LayerZeroBridgeToken -> for all the supported bridge tokens
48+
- setTrustedRemote on the LayerZeroBridgeToken -> for all the supported bridge tokens. Use LayerZeroSetSources for this
4949
- addBridgeToken in the canonical agEUR -> limit should be higher than the limit which has already been minted in the contract
5050
- setChainTotalHourlyLimit in the canonical agEUR
5151
- setUseCustomAdapterParams in the lz-agEUR contract

deploy/bridges/LayerZeroSetSources.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { DeployFunction } from 'hardhat-deploy/types';
44
import { LayerZeroBridge, LayerZeroBridge__factory } from '../../typechain';
55
import LZ_CHAINIDS from '../constants/layerzeroChainIds.json';
66

7+
// For more details on trustedRemote, check: https://layerzero.gitbook.io/docs/evm-guides/master/set-trusted-remotes
8+
// LayerZero chains: https://layerzero.gitbook.io/docs/technical-reference/mainnet/supported-chain-ids
79
const func: DeployFunction = async ({ ethers, network }) => {
810
const { deployer } = await ethers.getNamedSigners();
911

@@ -18,11 +20,15 @@ const func: DeployFunction = async ({ ethers, network }) => {
1820
gnosis: '0xFA5Ed56A203466CbBC2430a43c66b9D8723528E7',
1921
polygonzkevm: '0x2859a4eBcB58c8Dd5cAC1419C4F63A071b642B20',
2022
base: '0x2859a4eBcB58c8Dd5cAC1419C4F63A071b642B20',
23+
linea: '0x12f31B73D812C6Bb0d735a218c086d44D5fe5f89',
24+
mantle: '0x2859a4eBcB58c8Dd5cAC1419C4F63A071b642B20',
2125
};
2226

2327
const local = OFTs[network.name];
2428
const contractAngleOFT = new Contract(local, LayerZeroBridge__factory.abi, deployer) as LayerZeroBridge;
2529

30+
console.log('Getting payloads to execute on the new chain');
31+
console.log('--------------------------------------------');
2632
for (const chain of Object.keys(OFTs)) {
2733
if (chain !== network.name) {
2834
console.log(chain);
@@ -37,6 +43,31 @@ const func: DeployFunction = async ({ ethers, network }) => {
3743
console.log('');
3844
}
3945
}
46+
console.log('--------------------------------------------');
47+
console.log('');
48+
/*
49+
console.log('Getting payloads to execute on all the other chains');
50+
console.log('--------------------------------------------');
51+
for (const chain of Object.keys(OFTs)) {
52+
if (chain !== network.name) {
53+
console.log(chain);
54+
const trustedRemote = ethers.utils.solidityPack(['address', 'address'], [local, OFTs[chain]]);
55+
console.log(`Trusted remote ${trustedRemote}`);
56+
console.log(OFTs[chain]);
57+
console.log(
58+
contractAngleOFT.interface.encodeFunctionData('setTrustedRemote', [
59+
(LZ_CHAINIDS as any)[network.name],
60+
trustedRemote,
61+
]),
62+
);
63+
64+
console.log((LZ_CHAINIDS as any)[network.name], trustedRemote);
65+
console.log('');
66+
}
67+
}
68+
console.log('--------------------------------------------');
69+
console.log('');
70+
*/
4071
};
4172

4273
func.tags = ['LayerZeroSources'];

deploy/networks/linea.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"angleLabs": "0x65e043c894F15A899FD18d454BeeAd577e792B81",
3+
"governor": "0x7D47A94Bc2eA9f6A65aD7a46CF454d6F2b676CFb",
4+
"guardian": "0x007475B60d88B02663D6f975927b70BB4335e4b3"
5+
}

deploy/networks/mantle.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"angleLabs": "0xe5cFa764F35eB0Ce24b4599EDd50882C1833d20F",
3+
"governor": "0x852a4D6b6f202B05D7B3C0eA92891B69F4607239",
4+
"guardian": "0x3aaF12AA2c580eE29F8fFAA4B1509c31Ef0eDCe8"
5+
}

deploy/networks/zksync.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"angleLabs": "0x3d3Fd37af3aEaBD0154230AdcfC9C177E13142c8",
3+
"governor": "0xA7499Aa6464c078EeB940da2fc95C6aCd010c3Cc",
4+
"guardian": "0x13Bf4cC864916cB6d8a74A5c9A9ac56931e95125"
5+
}

deployments/linea/.chainId

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
59144

0 commit comments

Comments
 (0)