Skip to content

Commit

Permalink
Merge pull request #7 from Ion-Protocol/carson/createxcustom
Browse files Browse the repository at this point in the history
Sei Mainnet deployment and custom createx
  • Loading branch information
CarsonCase authored Aug 9, 2024
2 parents cc0b494 + e475f85 commit a79095c
Show file tree
Hide file tree
Showing 15 changed files with 212 additions and 83 deletions.
32 changes: 30 additions & 2 deletions deployment-config/chains/1.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,45 @@
"NOTE_THESE_KEYS_MUST_NOT_BE_CHECKSUMMED": 0,
"0xcd5fe23c85820f7b72d0926fc9b05b43e359b7ee": {
"priceFeed": "0x5c9C449BbC9a6075A2c061dF312a35fd1E05fF22",
"rateProvider": "0x0000000000000000000000000000000000000000",
"rateProvider": "0x51a9319B45F41c405eFA1EcbCcE530607A694862",
"decimals": 18,
"description": "weETH / ETH",
"priceFeedType": 0
},
"0xbf5495efe5db9ce00f80364c8b423567e58d2110": {
"priceFeed": "0x636A000262F6aA9e1F094ABF0aD8f645C44f641C",
"rateProvider": "0x0000000000000000000000000000000000000000",
"rateProvider": "0xb9B1eD92d3902eBEca23F931a629343D4C46c38D",
"decimals": 18,
"description": "ezETH / ETH",
"priceFeedType": 0
},
"0xa1290d69c65a6fe4df752f95823fae25cb99e5a7":{
"priceFeed": "0x03c68933f7a3F76875C0bc670a58e69294cDFD01",
"rateProvider": "0xB140e881E206E94B18e143f1739d5f212C59C859",
"decimals": 18,
"description": "RSETH / ETH",
"priceFeedType": 0
},
"0xfae103dc9cf190ed75350761e95403b7b8afa6c0": {
"priceFeed": "0xb613CfebD0b6e95abDDe02677d6bC42394FdB857",
"rateProvider": "0x4E323185C91Ef73e36f0CD2DdDcE54fb33112949",
"decimals": 18,
"description": "rswETH / ETH",
"priceFeedType": 0
},
"0xd9a442856c234a39a81a089c06451ebaa4306a72": {
"priceFeed": "0x76A495b0bFfb53ef3F0E94ef0763e03cE410835C",
"rateProvider": "0xEE8259373fCf5dc12F511867551F7f6FA6fcb0FB",
"decimals": 18,
"description": "pufETH/ETH",
"priceFeedType": 1
},
"0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0": {
"priceFeed": "",
"rateProvider": "0xa360Df495d0560bDDc5d681B54991629965ae170",
"decimals": 18,
"description": "",
"priceFeedType": 0
}
}
}
4 changes: 2 additions & 2 deletions deployment-config/chains/1329.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"base": "0x160345fC359604fC6e70E3c5fAcbdE5F7A9342d8",
"balancerVault": "0xBA12222222228d8Ba445958a75a0704d566BF2C8",
"opMessenger": "0x25ace71c97B33Cc4729CF772ae268934F7ab5fA1",
"balancerVault": "0x0000000000000000000000000000000000000000",
"opMessenger": "0x0000000000000000000000000000000000000000",
"lzEndpoint": "0x1a44076050125825900e736c501f859c50fE728c"
}
8 changes: 1 addition & 7 deletions deployment-config/mydeploy.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,6 @@
"decoderSalt": "0x48b53893da2e0b0248268c00000000000000000000000000000000000000000a",

"address": "0x00000000004F96C07B83e86600D86F0000000000"
},

"rateProvider": {
"maxTimeFromLastUpdate": "86400",
"rateProviderSalt": "0x0000000000000000000000000000000000000000000000000000000000000000",

"address": "0x00000000004F96C07B83e86600D86F0000000000"
}

}
59 changes: 59 additions & 0 deletions deployment-config/sei-eth-l1-08-08-24.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"protocolAdmin": "0x0000000000417626Ef34D62C4DC189b021603f2F",

"boringVault":{
"boringVaultSalt": "0x1000000000000000000000000000000000000000000000000000000000000000",
"boringVaultName": "Sei Native Yield Nucleus Token",
"boringVaultSymbol": "seiyanETH",

"address": "0x0000000000000000000000000000000000000000"
},

"manager":{
"managerSalt": "0x2000000000000000000000000000000000000000000000000000000000000000",

"address": "0x0000000000000000000000000000000000000000"
},

"accountant":{
"accountantSalt": "0x3000000000000000000000000000000000000000000000000000000000000000",
"payoutAddress": "0x0000000000417626Ef34D62C4DC189b021603f2F",
"allowedExchangeRateChangeUpper": "10030",
"allowedExchangeRateChangeLower": "9980",
"minimumUpdateDelayInSeconds": "3600",
"managementFee": "0",

"address": "0x0000000000000000000000000000000000000000"
},

"teller": {
"tellerSalt": "0x4000000000000000000000000000000000000000000000000000000000000000",
"maxGasForPeer": 200000,
"minGasForPeer": 60000,
"peerEid": 30280,
"tellerContractName": "MultiChainLayerZeroTellerWithMultiAssetSupport",
"assets": [
"0xcd5fe23c85820f7b72d0926fc9b05b43e359b7ee",
"0xbf5495efe5db9ce00f80364c8b423567e58d2110",
"0xA1290d69c65A6Fe4DF752f95823fae25cB99e5A7",
"0xFAe103DC9cf190eD75350761e95403b7b8aFa6c0",
"0xD9A442856C234a39a81a089C06451EBAa4306a72",
"0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0"
],
"address": "0x0000000000000000000000000000000000000000"
},
"rolesAuthority": {
"rolesAuthoritySalt": "0x5000000000000000000000000000000000000000000000000000000000000000",
"strategist": "0x0000000000417626Ef34D62C4DC189b021603f2F",
"exchangeRateBot": "0x0000000000417626Ef34D62C4DC189b021603f2F",

"address": "0x0000000000000000000000000000000000000000"
},

"decoder": {
"decoderSalt": "0x6000000000000000000000000000000000000000000000000000000000000000",

"address": "0x0000000000000000000000000000000000000000"
}

}
53 changes: 53 additions & 0 deletions deployment-config/sei-eth-l2-08-08-24.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"protocolAdmin": "0xF2dE1311C5b2C1BD94de996DA13F80010453e505",

"boringVault":{
"boringVaultSalt": "0x1000000000000000000000000000000000000000000000000000000000000000",
"boringVaultName": "Sei Native Yield Nucleus Token",
"boringVaultSymbol": "seiyanETH",

"address": "0x0000000000000000000000000000000000000000"
},

"manager":{
"managerSalt": "0x2000000000000000000000000000000000000000000000000000000000000000",

"address": "0x0000000000000000000000000000000000000000"
},

"accountant":{
"accountantSalt": "0x3000000000000000000000000000000000000000000000000000000000000000",
"payoutAddress": "0xF2dE1311C5b2C1BD94de996DA13F80010453e505",
"allowedExchangeRateChangeUpper": "10030",
"allowedExchangeRateChangeLower": "9980",
"minimumUpdateDelayInSeconds": "3600",
"managementFee": "0",

"address": "0x0000000000000000000000000000000000000000"
},

"teller": {
"tellerSalt": "0x4000000000000000000000000000000000000000000000000000000000000000",
"maxGasForPeer": 200000,
"minGasForPeer": 60000,
"peerEid": 30101,
"tellerContractName": "MultiChainLayerZeroTellerWithMultiAssetSupport",
"assets": [
],
"address": "0x0000000000000000000000000000000000000000"
},
"rolesAuthority": {
"rolesAuthoritySalt": "0x5000000000000000000000000000000000000000000000000000000000000000",
"strategist": "0xF2dE1311C5b2C1BD94de996DA13F80010453e505",
"exchangeRateBot": "0xF2dE1311C5b2C1BD94de996DA13F80010453e505",

"address": "0x0000000000000000000000000000000000000000"
},

"decoder": {
"decoderSalt": "0x6000000000000000000000000000000000000000000000000000000000000000",

"address": "0x0000000000000000000000000000000000000000"
}

}
1 change: 0 additions & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[profile.default]
# Sets the concrete solc version to use
# This overrides the `auto_detect_solc` value
solc_version = '0.8.21'
auto_detect_solc = false
evm_version = 'shanghai'
optimizer = true
Expand Down
44 changes: 3 additions & 41 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,47 +7,9 @@
"coverage": "./coverage.sh",
"solhint": "solhint -w 0 'src/**/*.sol'",
"slither": "slither src",
"01_DeployBoringVault:deployment:test": "forge test --mc DeployYieldOracleTest --ffi --nmp \"\"",
"01_DeployBoringVault:deployment:deploy:anvil": "forge script script/deploy/01_DeployBoringVault.s.sol --rpc-url http://localhost:8545 --private-key $PRIVATE_KEY --slow",
"01_DeployBoringVault:deployment:deploy:tenderly": "forge script script/deploy/01_DeployBoringVault.s.sol --rpc-url $TENDERLY_RPC_URL --private-key $PRIVATE_KEY --slow",
"01_DeployBoringVault:deployment:deploy:sepolia": "forge script script/deploy/01_DeployBoringVault.s.sol --rpc-url $SEPOLIA_RPC_URL --private-key $PRIVATE_KEY --slow",
"01_DeployBoringVault:deployment:deploy:mainnet": "forge script script/deploy/01_DeployBoringVault.s.sol --rpc-url $MAINNET_RPC_URL --private-key $PRIVATE_KEY --slow",
"02_DeployManagerWithMerkleVerification:deployment:test": "forge test --mc DeployManagerWithMerkleVerification --ffi --nmp \"\"",
"02_DeployManagerWithMerkleVerification:deployment:deploy:anvil": "forge script script/deploy/02_DeployManagerWithMerkleVerification.s.sol --rpc-url http://localhost:8545 --private-key $PRIVATE_KEY --slow",
"02_DeployManagerWithMerkleVerification:deployment:deploy:tenderly": "forge script script/deploy/02_DeployManagerWithMerkleVerification.s.sol --rpc-url $TENDERLY_RPC_URL --private-key $PRIVATE_KEY --slow",
"02_DeployManagerWithMerkleVerification:deployment:deploy:sepolia": "forge script script/deploy/02_DeployManagerWithMerkleVerification.s.sol --rpc-url $SEPOLIA_RPC_URL --private-key $PRIVATE_KEY --slow",
"02_DeployManagerWithMerkleVerification:deployment:deploy:mainnet": "forge script script/deploy/02_DeployManagerWithMerkleVerification.s.sol --rpc-url $MAINNET_RPC_URL --private-key $PRIVATE_KEY --slow",
"03_DeployAccountantWithRateProviders:deployment:test": "forge test --mc DeployManagerWithMerkleVerification --ffi --nmp \"\"",
"03_DeployAccountantWithRateProviders:deployment:deploy:anvil": "forge script script/deploy/03_DeployAccountantWithRateProviders.s.sol --rpc-url http://localhost:8545 --private-key $PRIVATE_KEY --slow",
"03_DeployAccountantWithRateProviders:deployment:deploy:tenderly": "forge script script/deploy/03_DeployAccountantWithRateProviders.s.sol --rpc-url $TENDERLY_RPC_URL --private-key $PRIVATE_KEY --slow",
"03_DeployAccountantWithRateProviders:deployment:deploy:sepolia": "forge script script/deploy/03_DeployAccountantWithRateProviders.s.sol --rpc-url $SEPOLIA_RPC_URL --private-key $PRIVATE_KEY --slow",
"03_DeployAccountantWithRateProviders:deployment:deploy:mainnet": "forge script script/deploy/03_DeployAccountantWithRateProviders.s.sol --rpc-url $MAINNET_RPC_URL --private-key $PRIVATE_KEY --slow",
"04_DeployTellerWithMultiAssetSupport:deployment:test": "forge test --mc DeployManagerWithMerkleVerification --ffi --nmp \"\"",
"04_DeployTellerWithMultiAssetSupport:deployment:deploy:anvil": "forge script script/deploy/04_DeployTellerWithMultiAssetSupport.s.sol --rpc-url http://localhost:8545 --private-key $PRIVATE_KEY --slow",
"04_DeployTellerWithMultiAssetSupport:deployment:deploy:tenderly": "forge script script/deploy/04_DeployTellerWithMultiAssetSupport.s.sol --rpc-url $TENDERLY_RPC_URL --private-key $PRIVATE_KEY --slow",
"04_DeployTellerWithMultiAssetSupport:deployment:deploy:sepolia": "forge script script/deploy/04_DeployTellerWithMultiAssetSupport.s.sol --rpc-url $SEPOLIA_RPC_URL --private-key $PRIVATE_KEY --slow",
"04_DeployTellerWithMultiAssetSupport:deployment:deploy:mainnet": "forge script script/deploy/04_DeployTellerWithMultiAssetSupport.s.sol --rpc-url $MAINNET_RPC_URL --private-key $PRIVATE_KEY --slow",
"05_DeployRolesAuthority:deployment:test": "forge test --mc DeployManagerWithMerkleVerification --ffi --nmp \"\"",
"05_DeployRolesAuthority:deployment:deploy:anvil": "forge script script/deploy/05_DeployRolesAuthority.s.sol --rpc-url http://localhost:8545 --private-key $PRIVATE_KEY --slow",
"05_DeployRolesAuthority:deployment:deploy:tenderly": "forge script script/deploy/05_DeployRolesAuthority.s.sol --rpc-url $TENDERLY_RPC_URL --private-key $PRIVATE_KEY --slow",
"05_DeployRolesAuthority:deployment:deploy:sepolia": "forge script script/deploy/05_DeployRolesAuthority.s.sol --rpc-url $SEPOLIA_RPC_URL --private-key $PRIVATE_KEY --slow",
"05_DeployRolesAuthority:deployment:deploy:mainnet": "forge script script/deploy/05_DeployRolesAuthority.s.sol --rpc-url $MAINNET_RPC_URL --private-key $PRIVATE_KEY --slow",
"06_SetAuthorityAndTransferOwnerships:deployment:test": "forge test --mc 06_SetAuthorityAndTransferOwnerships --ffi --nmp \"\"",
"06_SetAuthorityAndTransferOwnerships:deployment:deploy:anvil": "forge script script/deploy/06_SetAuthorityAndTransferOwnerships.s.sol.s.sol --rpc-url http://localhost:8545 --private-key $PRIVATE_KEY --slow",
"06_SetAuthorityAndTransferOwnerships:deployment:deploy:tenderly": "forge script script/deploy/06_SetAuthorityAndTransferOwnerships.s.sol --rpc-url $TENDERLY_RPC_URL --private-key $PRIVATE_KEY --slow",
"06_SetAuthorityAndTransferOwnerships:deployment:deploy:sepolia": "forge script script/deploy/06_SetAuthorityAndTransferOwnerships.s.sol --rpc-url $SEPOLIA_RPC_URL --private-key $PRIVATE_KEY --slow",
"06_SetAuthorityAndTransferOwnerships:deployment:deploy:mainnet": "forge script script/deploy/06_SetAuthorityAndTransferOwnerships.s.sol --rpc-url $MAINNET_RPC_URL --private-key $PRIVATE_KEY --slow",
"07_DeployDecoderAndSanitizer:deployment:test": "forge test --mc 06_TransferOwnerships --ffi --nmp \"\"",
"07_DeployDecoderAndSanitizer:deployment:deploy:anvil": "forge script script/deploy/07_DeployDecoderAndSanitizer.s.sol.s.sol --rpc-url http://localhost:8545 --private-key $PRIVATE_KEY --slow",
"07_DeployDecoderAndSanitizer:deployment:deploy:tenderly": "forge script script/deploy/07_DeployDecoderAndSanitizer.s.sol --rpc-url $TENDERLY_RPC_URL --private-key $PRIVATE_KEY --slow",
"07_DeployDecoderAndSanitizer:deployment:deploy:sepolia": "forge script script/deploy/07_DeployDecoderAndSanitizer.s.sol --rpc-url $SEPOLIA_RPC_URL --private-key $PRIVATE_KEY --slow",
"07_DeployDecoderAndSanitizer:deployment:deploy:mainnet": "forge script script/deploy/07_DeployDecoderAndSanitizer.s.sol --rpc-url $MAINNET_RPC_URL --private-key $PRIVATE_KEY --slow",
"08_DeployRateProviders:deployment:test": "forge test --mc 06_TransferOwnerships --ffi --nmp \"\"",
"08_DeployRateProviders:deployment:deploy:anvil": "forge script script/deploy/08_DeployRateProviders.s.sol --rpc-url http://localhost:8545 --private-key $PRIVATE_KEY --slow",
"08_DeployRateProviders:deployment:deploy:tenderly": "forge script script/deploy/08_DeployRateProviders.s.sol --rpc-url $TENDERLY_RPC_URL --private-key $PRIVATE_KEY --slow",
"08_DeployRateProviders:deployment:deploy:sepolia": "forge script script/deploy/08_DeployRateProviders.s.sol --rpc-url $SEPOLIA_RPC_URL --private-key $PRIVATE_KEY --slow",
"08_DeployRateProviders:deployment:deploy:mainnet": "forge script script/deploy/08_DeployRateProviders.s.sol --rpc-url $MAINNET_RPC_URL --private-key $PRIVATE_KEY --slow",
"prepare": "husky"
"prepare": "husky",
"deploy-mainnet": "forge script script/deploy/deployAll.s.sol -f $MAINNET_RPC_URL --private-key=$PRIVATE_KEY --slow",
"deploy-l2": "forge script script/deploy/deployAll.s.sol -f $L2_RPC_URL --private-key=$PRIVATE_KEY --slow"
},
"devDependencies": {
"@layerzerolabs/lz-definitions": "^2.3.25",
Expand Down
8 changes: 2 additions & 6 deletions script/Base.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ abstract contract BaseScript is Script {
string constant CONFIG_CHAIN_ROOT = "./deployment-config/chains/";

/// Custom base params
ICreateX CREATEX = ICreateX(0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed);
ICreateX CREATEX = ICreateX(0xD7d6e6C50507d278b9F43f62Bc7b9310ECeff2C5);

/// @dev Included to enable compilation of the script without a $MNEMONIC environment variable.
string internal constant TEST_MNEMONIC = "test test test test test test test test test test test junk";
Expand Down Expand Up @@ -48,18 +48,15 @@ abstract contract BaseScript is Script {
deployCreate2 = vm.envOr({ name: "CREATE2", defaultValue: true });
address from = vm.envOr({ name: "ETH_FROM", defaultValue: address(0) });
if (from != address(0)) {
console.log("using env provided wallet");
broadcaster = from;
} else {
console.log("Using default mnemonic wallet");
mnemonic = vm.envOr({ name: "MNEMONIC", defaultValue: TEST_MNEMONIC });
(broadcaster,) = deriveRememberKey({ mnemonic: mnemonic, index: 0 });
}
console2.log("broadcaster", broadcaster);

// if this chain doesn't have a CREATEX deployment, deploy it ourselves
if (address(CREATEX).code.length == 0) {
revert("CREATEX Not Deployed on this chain. Use the Library to forge deploy it");
revert("CREATEX Not Deployed on this chain. Use the DeployCustomCreatex script to deploy it");
}
}

Expand All @@ -82,7 +79,6 @@ abstract contract BaseScript is Script {
}

function getChainConfigFile() internal view returns (string memory) {
console2.log("Deployment Chain ID:", block.chainid);
return vm.readFile(string.concat(CONFIG_CHAIN_ROOT, Strings.toString(block.chainid), ".json"));
}

Expand Down
15 changes: 6 additions & 9 deletions script/ConfigReader.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ library ConfigReader {
bytes32 managerSalt;
address balancerVault;
bytes32 tellerSalt;
uint32 peerEid;
address accountant;
address opMessenger;
uint256 maxGasForPeer;
uint256 minGasForPeer;
uint64 maxGasForPeer;
uint64 minGasForPeer;
address lzEndpoint;
bytes32 rolesAuthoritySalt;
address manager;
Expand Down Expand Up @@ -76,10 +77,11 @@ library ConfigReader {
// Reading from the 'teller' section
config.teller = _config.readAddress(".teller.address");
config.tellerSalt = _config.readBytes32(".teller.tellerSalt");
config.maxGasForPeer = _config.readUint(".teller.maxGasForPeer");
config.minGasForPeer = _config.readUint(".teller.minGasForPeer");
config.maxGasForPeer = uint64(_config.readUint(".teller.maxGasForPeer"));
config.minGasForPeer = uint64(_config.readUint(".teller.minGasForPeer"));
config.tellerContractName = _config.readString(".teller.tellerContractName");
config.assets = _config.readAddressArray(".teller.assets");
config.peerEid = uint32(_config.readUint(".teller.peerEid"));

// Reading from the 'rolesAuthority' section
config.rolesAuthority = _config.readAddress(".rolesAuthority.address");
Expand All @@ -91,11 +93,6 @@ library ConfigReader {
config.decoderSalt = _config.readBytes32(".decoder.decoderSalt");
config.decoder = _config.readAddress(".decoder.address");

// Reading from the 'rateProvider' section
config.rateProvider = _config.readAddress(".rateProvider.address");
config.rateProviderSalt = _config.readBytes32(".rateProvider.rateProviderSalt");
config.maxTimeFromLastUpdate = uint32(_config.readUint(".rateProvider.maxTimeFromLastUpdate"));

// Reading from the 'chainConfig' section
config.base = _chainConfig.readAddress(".base");
config.balancerVault = _chainConfig.readAddress(".balancerVault");
Expand Down
40 changes: 40 additions & 0 deletions script/DeployCustomCreatex.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity =0.8.23;

import { console } from "forge-std/console.sol";
import { CreateX } from "lib/createx/src/CreateX.sol";
import { Script, stdJson } from "@forge-std/Script.sol";

contract DeployCustomCreateX is Script {
address broadcaster;
string internal mnemonic;
string internal constant TEST_MNEMONIC = "test test test test test test test test test test test junk";

address constant EXPECTED = 0xD7d6e6C50507d278b9F43f62Bc7b9310ECeff2C5;
bytes32 constant SALT = 0x8888888833388888888000000000000000000000000000000000000000000000;

constructor() {
address from = vm.envOr({ name: "ETH_FROM", defaultValue: address(0) });
if (from != address(0)) {
broadcaster = from;
} else {
mnemonic = vm.envOr({ name: "MNEMONIC", defaultValue: TEST_MNEMONIC });
(broadcaster,) = deriveRememberKey({ mnemonic: mnemonic, index: 0 });
}
}

modifier broadcast() {
vm.startBroadcast(broadcaster);
_;
vm.stopBroadcast();
}

function run() public broadcast {
require(EXPECTED.code.length == 0, "Createx already exists on this chain");

CreateX createx = new CreateX{ salt: SALT }();

console.log(address(createx));
require(address(createx) == EXPECTED, "address is not expected");
}
}
Loading

0 comments on commit a79095c

Please sign in to comment.