Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/script migration #2

Merged
merged 77 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
5a66f8c
feat: deployAgTokenSideChain script
0xtekgrinder May 3, 2024
e00d733
feat: DeployChain script
0xtekgrinder May 3, 2024
adc10d3
feat: deployTokenSideChain script
0xtekgrinder May 3, 2024
c8081c9
feat: remove BasicScript
0xtekgrinder May 3, 2024
52a6e85
chore: update fs_permissions in foundry.toml
0xtekgrinder May 3, 2024
2ea1e7a
refactor: rename angleImpl to agTokenImpl
0xtekgrinder May 3, 2024
53ca2e9
feat: deploy proxy with create2
0xtekgrinder May 3, 2024
151d543
feat: rename to new A naming
0xtekgrinder May 3, 2024
142b50d
chore: add optimizer in ci profile
0xtekgrinder May 3, 2024
f23df19
feat: hardcode symbol for ANGLE
0xtekgrinder May 3, 2024
c6cc599
feat: check expectedAddress before create2
0xtekgrinder May 3, 2024
738cdbc
refactor: rename script to deploy angle on sidechain
0xtekgrinder May 3, 2024
306f43c
feat: in case of a mock coreborrow, initialize contracts
0xtekgrinder May 3, 2024
f58f8cc
chore: update utils dependency
0xtekgrinder May 3, 2024
b1f2467
feat: immutable proxy first to deployer hen real implementation
0xtekgrinder May 3, 2024
8f6dd98
feat: env vvariable for governor / guardian
0xtekgrinder May 3, 2024
8d1f5b8
feat: remove guardian proxyAdmin from DeployCHain script
0xtekgrinder May 6, 2024
b16fae4
feat: store addresses in a json
0xtekgrinder May 6, 2024
186b8a3
feat: LayerZeroBridgeTokenERC20
0xtekgrinder May 6, 2024
22d4eeb
feat: remove mock governor when using scripts as mock
0xtekgrinder May 6, 2024
bf8632b
feat: treasury write to addresses json
0xtekgrinder May 6, 2024
415acc1
feat: add back require to check preocmputed address
0xtekgrinder May 6, 2024
7dccd5d
feat: vanity now loads everything from multiple files
0xtekgrinder May 6, 2024
1bae1a4
feat: create2 deploy for veANGLE
0xtekgrinder May 6, 2024
ec8b092
fix: vanity address script returns salt
0xtekgrinder May 6, 2024
9825e75
feat: expected address is env or chain to contract on mainnet
0xtekgrinder May 6, 2024
3462276
chore: remove via_ir in foundry.toml
0xtekgrinder May 6, 2024
ecc5c3c
chore: update forge-std to add envExists
0xtekgrinder May 6, 2024
a2d5090
feat: ir-minmum in coverage
0xtekgrinder May 6, 2024
9b20ce3
chore: remappings for slither
0xtekgrinder May 6, 2024
668096e
chore: add back foundry compile before
0xtekgrinder May 6, 2024
4b6fe6e
chore: ignore script and test for slither
0xtekgrinder May 6, 2024
d676a98
chore: specify version for slither in ci
0xtekgrinder May 6, 2024
863f130
chore: remove wrong src
0xtekgrinder May 6, 2024
956c163
chore: tmate
0xtekgrinder May 7, 2024
73d5e3d
chore: try to run slither manually
0xtekgrinder May 7, 2024
9ad11f4
chore: set sarif file
0xtekgrinder May 7, 2024
b3389ab
chore: debug ci
0xtekgrinder May 7, 2024
2cffd77
chore: use new version of slither ci
0xtekgrinder May 7, 2024
774babc
feat: scripts works even if addresses.json doesn't exists
0xtekgrinder May 10, 2024
56705bc
chore: update utils dependency
0xtekgrinder May 10, 2024
0be6d7d
fix: compile DeployAgTokenSideChain
0xtekgrinder May 10, 2024
d2943e4
chore: manual ci for slither
0xtekgrinder May 10, 2024
5afd516
chore: try to set output to a constant
0xtekgrinder May 10, 2024
7e34871
chore: try to rename sarif file
0xtekgrinder May 10, 2024
81db0ac
chore: add an && in stead of | in ci
0xtekgrinder May 10, 2024
3feb86e
chore: try to redirect output to stdout
0xtekgrinder May 10, 2024
34814e5
chore: results.sarif file
0xtekgrinder May 10, 2024
a735cbd
chore: upgrade utils dependency
0xtekgrinder May 13, 2024
bef4961
feat: change governor optional
0xtekgrinder May 16, 2024
7a14f59
feat: governor and guardian inside addresses.json
0xtekgrinder May 16, 2024
e728a7f
chore: loads slither errors
0xtekgrinder May 16, 2024
b78e9f8
chore: update utils dependency
0xtekgrinder May 17, 2024
9b25567
feat: update vanity of EURA
0xtekgrinder May 17, 2024
66ecf40
feat: new salt for EUR
0xtekgrinder May 17, 2024
e0c6ab9
chore: update foundry.toml to add base and linea etherscan api keys
0xtekgrinder May 17, 2024
488d8ab
feat: expected addresses for EURA and ANGLE
0xtekgrinder May 17, 2024
207b31c
chore: remove base from etherscan keys
0xtekgrinder May 17, 2024
3c031a7
feat: mantle
0xtekgrinder May 17, 2024
d32b217
feat: update name of AngleSideChain to ANGLE
0xtekgrinder Jun 10, 2024
e4e830e
feat: setuseCustomAdapterParams
0xtekgrinder Jun 11, 2024
b8fde5d
feat: useCustomAdapaters good interface
0xtekgrinder Jun 11, 2024
4b83dcc
feat: all steps to deploy a new chain
0xtekgrinder Jun 13, 2024
1769fc4
feat: transfer ownership of ProxyAdmin
0xtekgrinder Jun 13, 2024
3158f48
feat: add governor when deploying a new chain
0xtekgrinder Jun 13, 2024
fe188ad
feat: remove useless line
0xtekgrinder Jun 13, 2024
fcf0901
feat: finalize is optional
0xtekgrinder Jun 13, 2024
055c586
feat: deploy savings
0xtekgrinder Jun 14, 2024
29fe50b
fix: savings now compile
0xtekgrinder Jun 14, 2024
0c1a784
feat: change address for savings to arbitrum
0xtekgrinder Jun 14, 2024
50da920
fix: correct epxectedAddress
0xtekgrinder Jun 14, 2024
8504eb2
fix: write savings address in json
0xtekgrinder Jun 14, 2024
7eceaaf
feat: deduce stableType from STABLE_NAME
0xtekgrinder Jun 17, 2024
493d430
feat: add blast config
0xtekgrinder Jun 18, 2024
212423c
fix: forwardUtils
0xtekgrinder Jun 18, 2024
5f7275a
fix: deployChain works without sdk
0xtekgrinder Jun 24, 2024
e661aac
feat: governor and guardian addresses
0xtekgrinder Jun 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ optimizer = true
optimizer_runs = 1000
solc_version = "0.8.22"
ffi = true
fs_permissions = [{ access = "read-write", path = "./scripts/vanity.json"}]

[fuzz]
runs = 10000
Expand Down
24 changes: 0 additions & 24 deletions scripts/BasicScript.s.sol

This file was deleted.

94 changes: 94 additions & 0 deletions scripts/DeployAgTokenSideChainMultiBridge.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;

import "forge-std/Script.sol";
import "utils/src/CommonUtils.sol";
import { AgTokenSideChainMultiBridge } from "contracts/agToken/AgTokenSideChainMultiBridge.sol";
import { LayerZeroBridgeToken } from "contracts/agToken/layerZero/LayerZeroBridgeToken.sol";
import { ICoreBorrow } from "contracts/interfaces/ICoreBorrow.sol";
import { Treasury } from "contracts/treasury/Treasury.sol";
import { ImmutableCreate2Factory } from "contracts/interfaces/external/create2/ImmutableCreate2Factory.sol";

contract DeployAgTokenSideChainMultiBridge is Script, CommonUtils {
using stdJson for string;

string constant JSON_VANITY_PATH = "./scripts/vanity.json";

function run() external {
/** TODO complete */
string memory stableName = vm.envString("STABLE_NAME");
/** END complete */

uint256 deployerPrivateKey = vm.deriveKey(vm.envString("MNEMONIC_MAINNET"), "m/44'/60'/0'/0/", 0);
address deployer = vm.addr(deployerPrivateKey);
string memory json = vm.readFile(JSON_VANITY_PATH);
bytes32 salt = bytes32(abi.encodePacked(deployer, abi.encodePacked(uint96(json.readUint("$.init")))));
uint256 chainId = vm.envUint("CHAIN_ID");

address proxyAdmin = _chainToContract(chainId, ContractType.ProxyAdmin);
0xtekgrinder marked this conversation as resolved.
Show resolved Hide resolved
address coreBorrow = _chainToContract(chainId, ContractType.CoreBorrow);
ILayerZeroEndpoint lzEndpoint = _lzEndPoint(chainId);

vm.startBroadcast(deployerPrivateKey);

Treasury treasuryImpl = new Treasury();
console.log("Treasury Implementation deployed at", address(treasuryImpl));

Treasury treasuryProxy = Treasury(
address(
_deployUpgradeable(
proxyAdmin,
address(treasuryImpl),
abi.encodeWithSelector(
Treasury.initialize.selector,
coreBorrow,
ImmutableCreate2Factory(IMMUTABLE_CREATE2_FACTORY_ADDRESS).findCreate2Address(
salt,
type(AgTokenSideChainMultiBridge).creationCode
0xtekgrinder marked this conversation as resolved.
Show resolved Hide resolved
)
)
)
)
);
console.log("Treasury Proxy deployed at", address(treasuryProxy));

AgTokenSideChainMultiBridge angleImpl = new AgTokenSideChainMultiBridge();
0xtekgrinder marked this conversation as resolved.
Show resolved Hide resolved
console.log("AgTokenSideChainMultiBridge Implementation deployed at", address(angleImpl));

AgTokenSideChainMultiBridge angleProxy = AgTokenSideChainMultiBridge(
0xtekgrinder marked this conversation as resolved.
Show resolved Hide resolved
ImmutableCreate2Factory(IMMUTABLE_CREATE2_FACTORY_ADDRESS).safeCreate2(
salt,
type(AgTokenSideChainMultiBridge).creationCode
)
);
console.log("AgTokenSideChainMultiBridge Proxy deployed at", address(angleProxy));
0xtekgrinder marked this conversation as resolved.
Show resolved Hide resolved

angleProxy.initialize(
string.concat("Angle ag", stableName),
0xtekgrinder marked this conversation as resolved.
Show resolved Hide resolved
string.concat("ag", stableName),
address(treasuryProxy)
);

LayerZeroBridgeToken lzImpl = new LayerZeroBridgeToken();
console.log("LayerZeroBridgeToken Implementation deployed at", address(lzImpl));
LayerZeroBridgeToken lzProxy = LayerZeroBridgeToken(
address(
_deployUpgradeable(
proxyAdmin,
address(lzImpl),
abi.encodeWithSelector(
LayerZeroBridgeToken.initialize.selector,
string.concat("LayerZero Bridge ag", stableName),
0xtekgrinder marked this conversation as resolved.
Show resolved Hide resolved
string.concat("LZ-ag", stableName),
address(lzEndpoint),
address(treasuryProxy),
0
)
)
)
);
console.log("LayerZeroBridgeToken Proxy deployed at", address(lzProxy));

vm.stopBroadcast();
}
}
41 changes: 41 additions & 0 deletions scripts/DeployChain.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;

import "forge-std/Script.sol";
import "utils/src/CommonUtils.sol";
import { ProxyAdmin } from "contracts/external/ProxyAdmin.sol";
import { CoreBorrow } from "contracts/coreBorrow/CoreBorrow.sol";

contract DeployChain is Script, CommonUtils {
function run() external {
uint256 chainId = vm.envUint("CHAIN_ID");

address governor = _chainToContract(chainId, ContractType.GovernorMultisig);
address guardian = _chainToContract(chainId, ContractType.GuardianMultisig);

uint256 deployerPrivateKey = vm.deriveKey(vm.envString("MNEMONIC_MAINNET"), "m/44'/60'/0'/0/", 0);
vm.startBroadcast(deployerPrivateKey);

ProxyAdmin proxyAdmin = new ProxyAdmin();
console.log("ProxyAdmin deployed at", address(proxyAdmin));

ProxyAdmin proxyAdminGuadian = new ProxyAdmin();
0xtekgrinder marked this conversation as resolved.
Show resolved Hide resolved
console.log("ProxyAdminGuadian deployed at", address(proxyAdminGuadian));

CoreBorrow coreBorrowImpl = new CoreBorrow();
console.log("CoreBorrow Implementation deployed at", address(coreBorrowImpl));

CoreBorrow coreBorrowProxy = CoreBorrow(
address(
_deployUpgradeable(
address(proxyAdmin),
address(coreBorrowImpl),
abi.encodeWithSelector(CoreBorrow.initialize.selector, governor, guardian)
)
)
);
console.log("CoreBorrow Proxy deployed at", address(coreBorrowProxy));

vm.stopBroadcast();
}
}
69 changes: 69 additions & 0 deletions scripts/DeployTokenSideChainMultiBridge.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;

import "forge-std/Script.sol";
import "utils/src/CommonUtils.sol";
import { TokenSideChainMultiBridge } from "contracts/agToken/TokenSideChainMultiBridge.sol";
import { LayerZeroBridgeToken } from "contracts/agToken/layerZero/LayerZeroBridgeToken.sol";
import { ICoreBorrow } from "contracts/interfaces/ICoreBorrow.sol";

contract DeployTokenSideChainMultiBridge is Script, CommonUtils {
function run() external {
/** TODO complete */
string memory chainName = vm.envString("CHAIN_NAME");
string memory symbol = vm.envString("SYMBOL");
uint256 totalLimit = vm.envUint("TOTAL_LIMIT");
uint256 hourlyLimit = vm.envUint("HOURLY_LIMIT");
uint256 chainTotalHourlyLimit = vm.envUint("CHAIN_TOTAL_HOURLY_LIMIT");
/** END complete */

uint256 chainId = vm.envUint("CHAIN_ID");
uint256 deployerPrivateKey = vm.deriveKey(vm.envString("MNEMONIC_MAINNET"), "m/44'/60'/0'/0/", 0);
vm.startBroadcast(deployerPrivateKey);

address proxyAdmin = _chainToContract(chainId, ContractType.ProxyAdmin);
address coreBorrow = _chainToContract(chainId, ContractType.CoreBorrow);
ILayerZeroEndpoint lzEndpoint = _lzEndPoint(chainId);

TokenSideChainMultiBridge angleImpl = new TokenSideChainMultiBridge();
console.log("TokenSideChainMultiBridge Implementation deployed at", address(angleImpl));
TokenSideChainMultiBridge angleProxy = TokenSideChainMultiBridge(
address(_deployUpgradeable(proxyAdmin, address(angleImpl), ""))
);
console.log("TokenSideChainMultiBridge Proxy deployed at", address(angleProxy));

LayerZeroBridgeToken lzImpl = new LayerZeroBridgeToken();
console.log("LayerZeroBridgeToken Implementation deployed at", address(lzImpl));
LayerZeroBridgeToken lzProxy = LayerZeroBridgeToken(
address(
_deployUpgradeable(
proxyAdmin,
address(lzImpl),
abi.encodeWithSelector(
LayerZeroBridgeToken.initialize.selector,
string.concat("LayerZero Bridge ", symbol),
string.concat("LZ-", symbol),
lzEndpoint,
coreBorrow,
address(angleProxy)
)
)
)
);
console.log("LayerZeroBridgeToken Proxy deployed at", address(lzProxy));

angleProxy.initialize(
string.concat(symbol, "_", chainName),
symbol,
ICoreBorrow(coreBorrow),
address(lzProxy),
totalLimit,
hourlyLimit,
0,
false,
chainTotalHourlyLimit
);

vm.stopBroadcast();
}
}
Loading