From 2977898719a79026c0209e29c46f0fef008aa2b9 Mon Sep 17 00:00:00 2001 From: Carson Date: Tue, 6 Aug 2024 13:58:21 -0400 Subject: [PATCH 01/24] test: test ids are unique on bridge even with the same bridge data --- ...ssChainOPTellerWithMultiAssetSupport.t.sol | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/test/CrossChain/CrossChainOPTellerWithMultiAssetSupport.t.sol b/test/CrossChain/CrossChainOPTellerWithMultiAssetSupport.t.sol index e4cb430..074c19e 100644 --- a/test/CrossChain/CrossChainOPTellerWithMultiAssetSupport.t.sol +++ b/test/CrossChain/CrossChainOPTellerWithMultiAssetSupport.t.sol @@ -88,6 +88,35 @@ contract CrossChainOPTellerWithMultiAssetSupportTest is CrossChainBaseTest { assertEq(boringVault.balanceOf(address(this)), balBefore - sharesToBridge, "Should have burned shares."); } + function testUniqueIDs() public virtual{ + CrossChainOPTellerWithMultiAssetSupport sourceTeller = CrossChainOPTellerWithMultiAssetSupport(sourceTellerAddr); + CrossChainOPTellerWithMultiAssetSupport destinationTeller = + CrossChainOPTellerWithMultiAssetSupport(destinationTellerAddr); + + uint sharesToBridge = 12; + + // Bridge shares. + address to = vm.addr(1); + + BridgeData memory data = BridgeData({ + chainSelector: DESTINATION_SELECTOR, + destinationChainReceiver: to, + bridgeFeeToken: WETH, + messageGas: 80_000, + data: "" + }); + + uint256 quote = 0; + + uint256 balBefore = boringVault.balanceOf(address(this)); + bytes32 id1 = sourceTeller.bridge{ value: quote }(sharesToBridge, data); + + // preform the exact same bridge again and assert the ids are not the same + bytes32 id2 = sourceTeller.bridge{ value: quote }(sharesToBridge, data); + + assertNotEq(id1, id2, "Id's must be unique"); + } + function testDepositAndBridge(uint256 amount) external { CrossChainOPTellerWithMultiAssetSupport sourceTeller = CrossChainOPTellerWithMultiAssetSupport(sourceTellerAddr); CrossChainOPTellerWithMultiAssetSupport destinationTeller = From 5755243e095125ec8cd6cd63f470d6317a4c995f Mon Sep 17 00:00:00 2001 From: Jamie Pickett Date: Wed, 14 Aug 2024 08:53:48 -0400 Subject: [PATCH 02/24] feat: added fraxtal deploy config and updated createX addrs --- deployment-config/chains/252.json | 6 +++ .../fraxtal-eth-l1-08-13-24.json | 48 +++++++++++++++++++ .../fraxtal-eth-l2-08-13-24.json | 41 ++++++++++++++++ script/Base.s.sol | 2 +- script/DeployCustomCreatex.s.sol | 6 +-- 5 files changed, 99 insertions(+), 4 deletions(-) create mode 100644 deployment-config/chains/252.json create mode 100644 deployment-config/fraxtal-eth-l1-08-13-24.json create mode 100644 deployment-config/fraxtal-eth-l2-08-13-24.json diff --git a/deployment-config/chains/252.json b/deployment-config/chains/252.json new file mode 100644 index 0000000..5135590 --- /dev/null +++ b/deployment-config/chains/252.json @@ -0,0 +1,6 @@ +{ + "base": "0xFC00000000000000000000000000000000000006", + "balancerVault": "0x0000000000000000000000000000000000000000", + "opMessenger": "0x4200000000000000000000000000000000000007", + "lzEndpoint": "0x1a44076050125825900e736c501f859c50fE728c" +} \ No newline at end of file diff --git a/deployment-config/fraxtal-eth-l1-08-13-24.json b/deployment-config/fraxtal-eth-l1-08-13-24.json new file mode 100644 index 0000000..9e356cb --- /dev/null +++ b/deployment-config/fraxtal-eth-l1-08-13-24.json @@ -0,0 +1,48 @@ +{ + "protocolAdmin": "0x0000000000417626Ef34D62C4DC189b021603f2F", + "boringVault": { + "boringVaultSalt": "0x1000000000000000000000000000000000000000000000000000000000000002", + "boringVaultName": "Fraxtal Native Yield Nucleus Token", + "boringVaultSymbol": "frxtlETH", + "address": "0x0000000000000000000000000000000000000000" + }, + "manager": { + "managerSalt": "0x2000000000000000000000000000000000000000000000000000000000000002", + "address": "0x0000000000000000000000000000000000000000" + }, + "accountant": { + "accountantSalt": "0x3000000000000000000000000000000000000000000000000000000000000002", + "payoutAddress": "0x0000000000417626Ef34D62C4DC189b021603f2F", + "allowedExchangeRateChangeUpper": "10030", + "allowedExchangeRateChangeLower": "9980", + "minimumUpdateDelayInSeconds": "3600", + "managementFee": "0", + "address": "0x0000000000000000000000000000000000000000" + }, + "teller": { + "tellerSalt": "0x4000000000000000000000000000000000000000000000000000000000000002", + "maxGasForPeer": 200000, + "minGasForPeer": 60000, + "peerEid": 30255, + "tellerContractName": "MultiChainLayerZeroTellerWithMultiAssetSupport", + "assets": [ + "0xcd5fe23c85820f7b72d0926fc9b05b43e359b7ee", + "0xbf5495efe5db9ce00f80364c8b423567e58d2110", + "0xA1290d69c65A6Fe4DF752f95823fae25cB99e5A7", + "0xFAe103DC9cf190eD75350761e95403b7b8aFa6c0", + "0xD9A442856C234a39a81a089C06451EBAa4306a72", + "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0" + ], + "address": "0x0000000000000000000000000000000000000000" + }, + "rolesAuthority": { + "rolesAuthoritySalt": "0x5000000000000000000000000000000000000000000000000000000000000002", + "strategist": "0x0000000000417626Ef34D62C4DC189b021603f2F", + "exchangeRateBot": "0x0000000000417626Ef34D62C4DC189b021603f2F", + "address": "0x0000000000000000000000000000000000000000" + }, + "decoder": { + "decoderSalt": "0x6000000000000000000000000000000000000000000000000000000000000002", + "address": "0x0000000000000000000000000000000000000000" + } +} \ No newline at end of file diff --git a/deployment-config/fraxtal-eth-l2-08-13-24.json b/deployment-config/fraxtal-eth-l2-08-13-24.json new file mode 100644 index 0000000..a166dba --- /dev/null +++ b/deployment-config/fraxtal-eth-l2-08-13-24.json @@ -0,0 +1,41 @@ +{ + "protocolAdmin": "0x0888c3D797E13892C5e67cD802F93Ffe55Ea2826", + "boringVault": { + "boringVaultSalt": "0x1000000000000000000000000000000000000000000000000000000000000002", + "boringVaultName": "Fraxtal Native Yield Nucleus Token", + "boringVaultSymbol": "frxtlETH", + "address": "0x0000000000000000000000000000000000000000" + }, + "manager": { + "managerSalt": "0x2000000000000000000000000000000000000000000000000000000000000002", + "address": "0x0000000000000000000000000000000000000000" + }, + "accountant": { + "accountantSalt": "0x3000000000000000000000000000000000000000000000000000000000000002", + "payoutAddress": "0x0888c3D797E13892C5e67cD802F93Ffe55Ea2826", + "allowedExchangeRateChangeUpper": "10030", + "allowedExchangeRateChangeLower": "9980", + "minimumUpdateDelayInSeconds": "3600", + "managementFee": "0", + "address": "0x0000000000000000000000000000000000000000" + }, + "teller": { + "tellerSalt": "0x4000000000000000000000000000000000000000000000000000000000000002", + "maxGasForPeer": 200000, + "minGasForPeer": 60000, + "peerEid": 30101, + "tellerContractName": "MultiChainLayerZeroTellerWithMultiAssetSupport", + "assets": [], + "address": "0x0000000000000000000000000000000000000000" + }, + "rolesAuthority": { + "rolesAuthoritySalt": "0x5000000000000000000000000000000000000000000000000000000000000002", + "strategist": "0x0888c3D797E13892C5e67cD802F93Ffe55Ea2826", + "exchangeRateBot": "0x0888c3D797E13892C5e67cD802F93Ffe55Ea2826", + "address": "0x0000000000000000000000000000000000000000" + }, + "decoder": { + "decoderSalt": "0x6000000000000000000000000000000000000000000000000000000000000002", + "address": "0x0000000000000000000000000000000000000000" + } +} \ No newline at end of file diff --git a/script/Base.s.sol b/script/Base.s.sol index aab67ba..b246ffe 100644 --- a/script/Base.s.sol +++ b/script/Base.s.sol @@ -19,7 +19,7 @@ abstract contract BaseScript is Script { string constant CONFIG_CHAIN_ROOT = "./deployment-config/chains/"; /// Custom base params - ICreateX CREATEX = ICreateX(0xD7d6e6C50507d278b9F43f62Bc7b9310ECeff2C5); + ICreateX CREATEX = ICreateX(0x1077f8ea07EA34D9F23BC39256BF234665FB391f); /// @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"; diff --git a/script/DeployCustomCreatex.s.sol b/script/DeployCustomCreatex.s.sol index 2dba87c..bc1fff0 100644 --- a/script/DeployCustomCreatex.s.sol +++ b/script/DeployCustomCreatex.s.sol @@ -10,7 +10,7 @@ contract DeployCustomCreateX is Script { string internal mnemonic; string internal constant TEST_MNEMONIC = "test test test test test test test test test test test junk"; - address constant EXPECTED = 0xD7d6e6C50507d278b9F43f62Bc7b9310ECeff2C5; + address constant EXPECTED = 0x1077f8ea07EA34D9F23BC39256BF234665FB391f; bytes32 constant SALT = 0x8888888833388888888000000000000000000000000000000000000000000000; constructor() { @@ -30,11 +30,11 @@ contract DeployCustomCreateX is Script { } function run() public broadcast { - require(EXPECTED.code.length == 0, "Createx already exists on this chain"); + //require(EXPECTED.code.length == 0, "Createx already exists on this chain"); CreateX createx = new CreateX{ salt: SALT }(); - console.log(address(createx)); + //console.logBytes(address(createx).code); require(address(createx) == EXPECTED, "address is not expected"); } } From 65f1a5ab21dd3bec2e058acf92c0e21ef41233f5 Mon Sep 17 00:00:00 2001 From: jpick713 <54317750+jpick713@users.noreply.github.com> Date: Wed, 14 Aug 2024 08:57:59 -0400 Subject: [PATCH 03/24] chore: cleaned up logs --- script/DeployCustomCreatex.s.sol | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/script/DeployCustomCreatex.s.sol b/script/DeployCustomCreatex.s.sol index bc1fff0..e2be751 100644 --- a/script/DeployCustomCreatex.s.sol +++ b/script/DeployCustomCreatex.s.sol @@ -30,11 +30,10 @@ contract DeployCustomCreateX is Script { } function run() public broadcast { - //require(EXPECTED.code.length == 0, "Createx already exists on this chain"); + require(EXPECTED.code.length == 0, "Createx already exists on this chain"); CreateX createx = new CreateX{ salt: SALT }(); console.log(address(createx)); - //console.logBytes(address(createx).code); require(address(createx) == EXPECTED, "address is not expected"); } } From db48f768458c9e84b6fa0323634ec2926cde40ed Mon Sep 17 00:00:00 2001 From: Carson Date: Wed, 14 Aug 2024 13:19:54 -0400 Subject: [PATCH 04/24] fix: op messenger and config updated to deployment specific --- deployment-config/boba-eth-l1-08-09-24.json | 7 ++++--- deployment-config/boba-eth-l2-08-09-24.json | 7 ++++--- deployment-config/chains/1329.json | 1 - deployment-config/chains/288.json | 1 - deployment-config/mydeploy.json | 3 ++- deployment-config/sei-eth-l1-08-08-24.json | 1 + deployment-config/sei-eth-l2-08-08-24.json | 1 + deployment-config/seidry.json | 1 + lib/ccip | 1 - script/ConfigReader.s.sol | 2 +- 10 files changed, 14 insertions(+), 11 deletions(-) delete mode 160000 lib/ccip diff --git a/deployment-config/boba-eth-l1-08-09-24.json b/deployment-config/boba-eth-l1-08-09-24.json index 0606039..99b9d3d 100644 --- a/deployment-config/boba-eth-l1-08-09-24.json +++ b/deployment-config/boba-eth-l1-08-09-24.json @@ -6,7 +6,7 @@ "boringVaultName": "Boba Native Yield Nucleus Token", "boringVaultSymbol": "bobaETH", - "address": "0x0000000000000000000000000000000000000000" + "address": "0x52E4d8989fa8b3E1C06696e7b16DEf5d7707A0d1" }, "manager":{ @@ -23,15 +23,16 @@ "minimumUpdateDelayInSeconds": "3600", "managementFee": "0", - "address": "0x0000000000000000000000000000000000000000" + "address": "0x78cba912751dB70CBd77C1111A4d1aDD077AD99A" }, "teller": { - "tellerSalt": "0x4000000000000000000000000000000000000000000000000000000000000001", + "tellerSalt": "0x4000000000000000000000000000000000000000000000000000000000000002", "maxGasForPeer": 200000, "minGasForPeer": 60000, "peerEid": 0, "tellerContractName": "CrossChainOPTellerWithMultiAssetSupport", + "opMessenger": "0x6D4528d192dB72E282265D6092F4B872f9Dff69e", "assets": [ "0xcd5fe23c85820f7b72d0926fc9b05b43e359b7ee", "0xbf5495efe5db9ce00f80364c8b423567e58d2110", diff --git a/deployment-config/boba-eth-l2-08-09-24.json b/deployment-config/boba-eth-l2-08-09-24.json index 6110342..6ad7875 100644 --- a/deployment-config/boba-eth-l2-08-09-24.json +++ b/deployment-config/boba-eth-l2-08-09-24.json @@ -6,7 +6,7 @@ "boringVaultName": "Boba Native Yield Nucleus Token", "boringVaultSymbol": "bobaETH", - "address": "0x0000000000000000000000000000000000000000" + "address": "0x52E4d8989fa8b3E1C06696e7b16DEf5d7707A0d1" }, "manager":{ @@ -23,15 +23,16 @@ "minimumUpdateDelayInSeconds": "3600", "managementFee": "0", - "address": "0x0000000000000000000000000000000000000000" + "address": "0x78cba912751dB70CBd77C1111A4d1aDD077AD99A" }, "teller": { - "tellerSalt": "0x4000000000000000000000000000000000000000000000000000000000000001", + "tellerSalt": "0x4000000000000000000000000000000000000000000000000000000000000002", "maxGasForPeer": 200000, "minGasForPeer": 60000, "peerEid": 0, "tellerContractName": "CrossChainOPTellerWithMultiAssetSupport", + "opMessenger": "0x4200000000000000000000000000000000000007", "assets": [ ], "address": "0x0000000000000000000000000000000000000000" diff --git a/deployment-config/chains/1329.json b/deployment-config/chains/1329.json index c547e36..d3691e2 100644 --- a/deployment-config/chains/1329.json +++ b/deployment-config/chains/1329.json @@ -1,6 +1,5 @@ { "base": "0x160345fC359604fC6e70E3c5fAcbdE5F7A9342d8", "balancerVault": "0x0000000000000000000000000000000000000000", - "opMessenger": "0x0000000000000000000000000000000000000000", "lzEndpoint": "0x1a44076050125825900e736c501f859c50fE728c" } \ No newline at end of file diff --git a/deployment-config/chains/288.json b/deployment-config/chains/288.json index d106ef3..82b445f 100644 --- a/deployment-config/chains/288.json +++ b/deployment-config/chains/288.json @@ -1,6 +1,5 @@ { "base": "0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000", "balancerVault": "0x0000000000000000000000000000000000000000", - "opMessenger": "0x4200000000000000000000000000000000000010", "lzEndpoint": "0x0000000000000000000000000000000000000000" } \ No newline at end of file diff --git a/deployment-config/mydeploy.json b/deployment-config/mydeploy.json index 24e301b..9f02eca 100644 --- a/deployment-config/mydeploy.json +++ b/deployment-config/mydeploy.json @@ -32,7 +32,8 @@ "maxGasForPeer": 100000, "minGasForPeer": 0, "peerEid": 0, - "tellerContractName": "MultiChainLayerZeroTellerWithMultiAssetSupport", + "tellerContractName": "MultiChainLayerZeroTellerWithMultiAssetSupport", + "opMessenger": "0x0000000000000000000000000000000000000000", "assets": [ "0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee", "0xbf5495Efe5DB9ce00f80364C8B423567e58d2110" diff --git a/deployment-config/sei-eth-l1-08-08-24.json b/deployment-config/sei-eth-l1-08-08-24.json index 7200aa4..404936c 100644 --- a/deployment-config/sei-eth-l1-08-08-24.json +++ b/deployment-config/sei-eth-l1-08-08-24.json @@ -32,6 +32,7 @@ "minGasForPeer": 60000, "peerEid": 30280, "tellerContractName": "MultiChainLayerZeroTellerWithMultiAssetSupport", + "opMessenger": "0x0000000000000000000000000000000000000000", "assets": [ "0xcd5fe23c85820f7b72d0926fc9b05b43e359b7ee", "0xbf5495efe5db9ce00f80364c8b423567e58d2110", diff --git a/deployment-config/sei-eth-l2-08-08-24.json b/deployment-config/sei-eth-l2-08-08-24.json index 1e5064e..bad0b23 100644 --- a/deployment-config/sei-eth-l2-08-08-24.json +++ b/deployment-config/sei-eth-l2-08-08-24.json @@ -32,6 +32,7 @@ "minGasForPeer": 60000, "peerEid": 30101, "tellerContractName": "MultiChainLayerZeroTellerWithMultiAssetSupport", + "opMessenger": "0x0000000000000000000000000000000000000000", "assets": [ ], "address": "0x0000000000000000000000000000000000000000" diff --git a/deployment-config/seidry.json b/deployment-config/seidry.json index cb4b46b..4982d23 100644 --- a/deployment-config/seidry.json +++ b/deployment-config/seidry.json @@ -32,6 +32,7 @@ "minGasForPeer": 0, "peerEid": 1, "tellerContractName": "MultiChainLayerZeroTellerWithMultiAssetSupport", + "opMessenger": "0x0000000000000000000000000000000000000000", "assets": [ ], "address": "0x0000000000000000000000000000000000000000" diff --git a/lib/ccip b/lib/ccip deleted file mode 160000 index 9eb2708..0000000 --- a/lib/ccip +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9eb2708908536544c26ad67a4be96b5974d2d9d0 diff --git a/script/ConfigReader.s.sol b/script/ConfigReader.s.sol index 40d2fdd..b75f017 100644 --- a/script/ConfigReader.s.sol +++ b/script/ConfigReader.s.sol @@ -82,6 +82,7 @@ library ConfigReader { config.tellerContractName = _config.readString(".teller.tellerContractName"); config.assets = _config.readAddressArray(".teller.assets"); config.peerEid = uint32(_config.readUint(".teller.peerEid")); + config.opMessenger = _config.readAddress(".teller.opMessenger"); // Reading from the 'rolesAuthority' section config.rolesAuthority = _config.readAddress(".rolesAuthority.address"); @@ -96,7 +97,6 @@ library ConfigReader { // Reading from the 'chainConfig' section config.base = _chainConfig.readAddress(".base"); config.balancerVault = _chainConfig.readAddress(".balancerVault"); - config.opMessenger = _chainConfig.readAddress(".opMessenger"); config.lzEndpoint = _chainConfig.readAddress(".lzEndpoint"); return config; From 7f6bc65d220d94d30f007eb446c5cf851c34253b Mon Sep 17 00:00:00 2001 From: Jun Kim <64379343+junkim012@users.noreply.github.com> Date: Thu, 15 Aug 2024 19:52:58 +0900 Subject: [PATCH 05/24] feat: script to check whether the teller upgrade was done correctly --- script/Base.s.sol | 6 +- .../single/06_DeployRolesAuthority.s.sol | 11 +- .../deploy/upgrade/CheckTellerUpgrade.s.sol | 111 ++++++++++++++++++ 3 files changed, 120 insertions(+), 8 deletions(-) create mode 100644 script/deploy/upgrade/CheckTellerUpgrade.s.sol diff --git a/script/Base.s.sol b/script/Base.s.sol index aab67ba..895f378 100644 --- a/script/Base.s.sol +++ b/script/Base.s.sol @@ -6,10 +6,8 @@ import { ICreateX } from "lib/createx/src/ICreateX.sol"; import { Strings } from "@openzeppelin/contracts/utils/Strings.sol"; import { Script, stdJson } from "@forge-std/Script.sol"; -import { console2 } from "@forge-std/console2.sol"; import { ConfigReader, IAuthority } from "./ConfigReader.s.sol"; -import { console } from "forge-std/Test.sol"; abstract contract BaseScript is Script { using stdJson for string; @@ -72,7 +70,9 @@ abstract contract BaseScript is Script { vm.stopBroadcast(); } - function deploy(ConfigReader.Config memory config) public virtual returns (address); + function deploy(ConfigReader.Config memory config) public virtual returns (address) { + revert("deploy() Not Implemented"); + } function getConfig() public returns (ConfigReader.Config memory) { return ConfigReader.toConfig(requestConfigFileFromUser(), getChainConfigFile()); diff --git a/script/deploy/single/06_DeployRolesAuthority.s.sol b/script/deploy/single/06_DeployRolesAuthority.s.sol index 09604d9..b2a2352 100644 --- a/script/deploy/single/06_DeployRolesAuthority.s.sol +++ b/script/deploy/single/06_DeployRolesAuthority.s.sol @@ -11,17 +11,18 @@ import { ConfigReader } from "../../ConfigReader.s.sol"; import { CrossChainTellerBase } from "../../../src/base/Roles/CrossChain/CrossChainTellerBase.sol"; import { stdJson as StdJson } from "@forge-std/StdJson.sol"; +uint8 constant STRATEGIST_ROLE = 1; +uint8 constant MANAGER_ROLE = 2; +uint8 constant TELLER_ROLE = 3; +uint8 constant UPDATE_EXCHANGE_RATE_ROLE = 4; +uint8 constant SOLVER_ROLE = 5; + /** * NOTE Deploys with `Authority` set to zero bytes. */ contract DeployRolesAuthority is BaseScript { using StdJson for string; - uint8 public constant STRATEGIST_ROLE = 1; - uint8 public constant MANAGER_ROLE = 2; - uint8 public constant TELLER_ROLE = 3; - uint8 public constant UPDATE_EXCHANGE_RATE_ROLE = 4; - function run() public virtual returns (address rolesAuthority) { return deploy(getConfig()); } diff --git a/script/deploy/upgrade/CheckTellerUpgrade.s.sol b/script/deploy/upgrade/CheckTellerUpgrade.s.sol new file mode 100644 index 0000000..a5ce8bb --- /dev/null +++ b/script/deploy/upgrade/CheckTellerUpgrade.s.sol @@ -0,0 +1,111 @@ +import { BaseScript } from "../../Base.s.sol"; +import { TELLER_ROLE, SOLVER_ROLE } from "../single/06_DeployRolesAuthority.s.sol"; + +import { TellerWithMultiAssetSupport } from "../../../src/base/Roles/TellerWithMultiAssetSupport.sol"; +import { CrossChainTellerBase } from "../../../src/base/Roles/CrossChain/CrossChainTellerBase.sol"; + +import { RolesAuthority } from "@solmate/auth/authorities/RolesAuthority.sol"; + +// forge script script/deploy/ --sig run(address, address) --rpc-url +contract CheckTellerUpgrade is BaseScript { + function run(address oldTeller, address newTeller) public { + require(oldTeller != address(0)); + require(newTeller != address(0)); + + TellerWithMultiAssetSupport typedOldTeller = TellerWithMultiAssetSupport(oldTeller); + TellerWithMultiAssetSupport typedNewTeller = TellerWithMultiAssetSupport(newTeller); + + RolesAuthority authority = RolesAuthority(address(typedOldTeller.authority())); + + require(authority == typedNewTeller.authority()); + require(typedOldTeller.vault() == typedNewTeller.vault()); + require(typedOldTeller.accountant() == typedNewTeller.accountant()); + + // --- Old Teller Must Be Disabled --- + + // Public capabilities. + + // functions that were previously public + require( + !authority.isCapabilityPublic(oldTeller, TellerWithMultiAssetSupport.deposit.selector), + "oldTeller deposit must not be public" + ); + require( + !authority.isCapabilityPublic(oldTeller, CrossChainTellerBase.bridge.selector), + "oldTeller bridge must not be public" + ); + require( + !authority.isCapabilityPublic(oldTeller, CrossChainTellerBase.depositAndBridge.selector), + "oldTeller depositAndBridge must not be public" + ); + + // functions that should never be public + require( + !authority.isCapabilityPublic(oldTeller, TellerWithMultiAssetSupport.refundDeposit.selector), + "oldTeller refundDeposit must not be public" + ); + require( + !authority.isCapabilityPublic(oldTeller, TellerWithMultiAssetSupport.depositWithPermit.selector), + "oldTeller depositWithPermit must not be public" + ); + require( + !authority.isCapabilityPublic(oldTeller, TellerWithMultiAssetSupport.bulkDeposit.selector), + "oldTeller bulkDeposit must not be public" + ); + require( + !authority.isCapabilityPublic(oldTeller, TellerWithMultiAssetSupport.bulkWithdraw.selector), + "oldTeller bulkWithdraw must not be public" + ); + + require(typedOldTeller.isPaused(), "oldTeller must be paused"); + + // roles + require(!authority.doesUserHaveRole(oldTeller, TELLER_ROLE), "oldTeller must not have the TELLER_ROLE"); + require( + !authority.doesRoleHaveCapability(SOLVER_ROLE, oldTeller, TellerWithMultiAssetSupport.bulkWithdraw.selector), + "SOLVER_ROLE must not be able to call oldTeller's bulkWithdraw" + ); + + // --- New Teller Must Be Enabled--- + // Public capabilities. + require( + authority.isCapabilityPublic(newTeller, TellerWithMultiAssetSupport.deposit.selector), + "newTeller deposit must be public" + ); + require( + authority.isCapabilityPublic(newTeller, CrossChainTellerBase.bridge.selector), + "newTeller bridge must be public" + ); + require( + authority.isCapabilityPublic(newTeller, CrossChainTellerBase.depositAndBridge.selector), + "newTeller depositAndBridge must be public" + ); + + // functions that should never be public + require( + !authority.isCapabilityPublic(newTeller, TellerWithMultiAssetSupport.refundDeposit.selector), + "newTeller refundDeposit must not be public" + ); + require( + !authority.isCapabilityPublic(newTeller, TellerWithMultiAssetSupport.depositWithPermit.selector), + "newTeller depositWithPermit must not be public" + ); + require( + !authority.isCapabilityPublic(newTeller, TellerWithMultiAssetSupport.bulkDeposit.selector), + "newTeller bulkDeposit must not be public" + ); + require( + !authority.isCapabilityPublic(newTeller, TellerWithMultiAssetSupport.bulkWithdraw.selector), + "newTeller bulkWithdraw must not be public" + ); + + require(!typedNewTeller.isPaused(), "newTeller must not be paused"); + + // roles + require(authority.doesUserHaveRole(newTeller, TELLER_ROLE), "newTeller must have the TELLER_ROLE"); + require( + authority.doesRoleHaveCapability(SOLVER_ROLE, newTeller, TellerWithMultiAssetSupport.bulkWithdraw.selector), + "SOLVER_ROLE must be able to call newTeller's bulkWithdraw" + ); + } +} From 4b0891b68479d6d5f2d3db70e7387c5fc0f54771 Mon Sep 17 00:00:00 2001 From: Jamie Pickett Date: Thu, 15 Aug 2024 09:43:07 -0400 Subject: [PATCH 06/24] feat: edited opMessenger key to move from chain config to l1 and l2 scripts --- deployment-config/boba-eth-l1-08-09-24.json | 24 ++++++------------ deployment-config/boba-eth-l2-08-09-24.json | 27 ++++++--------------- deployment-config/chains/252.json | 1 - 3 files changed, 15 insertions(+), 37 deletions(-) diff --git a/deployment-config/boba-eth-l1-08-09-24.json b/deployment-config/boba-eth-l1-08-09-24.json index 0606039..389c1cf 100644 --- a/deployment-config/boba-eth-l1-08-09-24.json +++ b/deployment-config/boba-eth-l1-08-09-24.json @@ -1,33 +1,27 @@ { "protocolAdmin": "0x0000000000417626Ef34D62C4DC189b021603f2F", - - "boringVault":{ + "boringVault": { "boringVaultSalt": "0x1000000000000000000000000000000000000000000000000000000000000001", - "boringVaultName": "Boba Native Yield Nucleus Token", + "boringVaultName": "Boba Native Yield Nucleus Token", "boringVaultSymbol": "bobaETH", - - "address": "0x0000000000000000000000000000000000000000" + "address": "0x0000000000000000000000000000000000000000" }, - - "manager":{ + "manager": { "managerSalt": "0x2000000000000000000000000000000000000000000000000000000000000001", - "address": "0x0000000000000000000000000000000000000000" }, - - "accountant":{ + "accountant": { "accountantSalt": "0x3000000000000000000000000000000000000000000000000000000000000001", "payoutAddress": "0x0000000000417626Ef34D62C4DC189b021603f2F", "allowedExchangeRateChangeUpper": "10030", "allowedExchangeRateChangeLower": "9980", "minimumUpdateDelayInSeconds": "3600", "managementFee": "0", - "address": "0x0000000000000000000000000000000000000000" }, - "teller": { "tellerSalt": "0x4000000000000000000000000000000000000000000000000000000000000001", + "opMessenger": "0x4200000000000000000000000000000000000007", "maxGasForPeer": 200000, "minGasForPeer": 60000, "peerEid": 0, @@ -46,14 +40,10 @@ "rolesAuthoritySalt": "0x5000000000000000000000000000000000000000000000000000000000000001", "strategist": "0x0000000000417626Ef34D62C4DC189b021603f2F", "exchangeRateBot": "0x0000000000417626Ef34D62C4DC189b021603f2F", - "address": "0x0000000000000000000000000000000000000000" }, - "decoder": { "decoderSalt": "0x6000000000000000000000000000000000000000000000000000000000000001", - - "address": "0x0000000000000000000000000000000000000000" + "address": "0x0000000000000000000000000000000000000000" } - } \ No newline at end of file diff --git a/deployment-config/boba-eth-l2-08-09-24.json b/deployment-config/boba-eth-l2-08-09-24.json index 6110342..3062a26 100644 --- a/deployment-config/boba-eth-l2-08-09-24.json +++ b/deployment-config/boba-eth-l2-08-09-24.json @@ -1,53 +1,42 @@ { "protocolAdmin": "0x0888c3D797E13892C5e67cD802F93Ffe55Ea2826", - - "boringVault":{ + "boringVault": { "boringVaultSalt": "0x1000000000000000000000000000000000000000000000000000000000000001", - "boringVaultName": "Boba Native Yield Nucleus Token", + "boringVaultName": "Boba Native Yield Nucleus Token", "boringVaultSymbol": "bobaETH", - - "address": "0x0000000000000000000000000000000000000000" + "address": "0x0000000000000000000000000000000000000000" }, - - "manager":{ + "manager": { "managerSalt": "0x2000000000000000000000000000000000000000000000000000000000000001", - "address": "0x0000000000000000000000000000000000000000" }, - - "accountant":{ + "accountant": { "accountantSalt": "0x3000000000000000000000000000000000000000000000000000000000000001", "payoutAddress": "0x0888c3D797E13892C5e67cD802F93Ffe55Ea2826", "allowedExchangeRateChangeUpper": "10030", "allowedExchangeRateChangeLower": "9980", "minimumUpdateDelayInSeconds": "3600", "managementFee": "0", - "address": "0x0000000000000000000000000000000000000000" }, - "teller": { "tellerSalt": "0x4000000000000000000000000000000000000000000000000000000000000001", + "opMessenger": "0x4200000000000000000000000000000000000007", "maxGasForPeer": 200000, "minGasForPeer": 60000, "peerEid": 0, "tellerContractName": "CrossChainOPTellerWithMultiAssetSupport", - "assets": [ - ], + "assets": [], "address": "0x0000000000000000000000000000000000000000" }, "rolesAuthority": { "rolesAuthoritySalt": "0x5000000000000000000000000000000000000000000000000000000000000001", "strategist": "0x0888c3D797E13892C5e67cD802F93Ffe55Ea2826", "exchangeRateBot": "0x0888c3D797E13892C5e67cD802F93Ffe55Ea2826", - "address": "0x0000000000000000000000000000000000000000" }, - "decoder": { "decoderSalt": "0x6000000000000000000000000000000000000000000000000000000000000001", - - "address": "0x0000000000000000000000000000000000000000" + "address": "0x0000000000000000000000000000000000000000" } - } \ No newline at end of file diff --git a/deployment-config/chains/252.json b/deployment-config/chains/252.json index 5135590..1e7aea7 100644 --- a/deployment-config/chains/252.json +++ b/deployment-config/chains/252.json @@ -1,6 +1,5 @@ { "base": "0xFC00000000000000000000000000000000000006", "balancerVault": "0x0000000000000000000000000000000000000000", - "opMessenger": "0x4200000000000000000000000000000000000007", "lzEndpoint": "0x1a44076050125825900e736c501f859c50fE728c" } \ No newline at end of file From 239532324766d07d8c87a48b95171f5a42751d5a Mon Sep 17 00:00:00 2001 From: Carson Date: Thu, 15 Aug 2024 09:45:58 -0400 Subject: [PATCH 07/24] codespell fix --- ..._DeployManagerWithMerkleVerification.s.sol | 5 ++++- .../EtherFiLiquidDecoderAndSanitizer.sol | 4 +++- .../EtherFiLiquidEthDecoderAndSanitizer.sol | 4 +++- .../EtherFiLiquidUsdDecoderAndSanitizer.sol | 12 ++++++++--- .../LidoLiquidDecoderAndSanitizer.sol | 4 +++- ...igenLayerLSTStakingDecoderAndSanitizer.sol | 4 +++- .../UniswapV3DecoderAndSanitizer.sol | 20 ++++++++++++++----- ...rossChainOPTellerWithMultiAssetSupport.sol | 2 +- src/interfaces/EtherFiLiquid1.sol | 4 +++- src/interfaces/IStaking.sol | 4 +++- .../RawDataDecoderAndSanitizerInterfaces.sol | 4 +++- .../test-evm-foundry-custom/OptionsHelper.sol | 16 +++++++++++---- .../SendUln302Mock.sol | 4 +++- ...ssChainOPTellerWithMultiAssetSupport.t.sol | 6 +++--- 14 files changed, 68 insertions(+), 25 deletions(-) diff --git a/script/deploy/single/03_DeployManagerWithMerkleVerification.s.sol b/script/deploy/single/03_DeployManagerWithMerkleVerification.s.sol index 8c7124f..0b0e553 100644 --- a/script/deploy/single/03_DeployManagerWithMerkleVerification.s.sol +++ b/script/deploy/single/03_DeployManagerWithMerkleVerification.s.sol @@ -18,7 +18,10 @@ contract DeployManagerWithMerkleVerification is BaseScript { require(config.managerSalt != bytes32(0), "manager salt must not be zero"); require(config.boringVault != address(0), "boring vault address must not be zero"); require(address(config.boringVault).code.length != 0, "boring vault must have code"); - require(address(config.balancerVault).code.length != 0 || address(config.balancerVault) == address(0), "balancer vault must have code or be zero address"); + require( + address(config.balancerVault).code.length != 0 || address(config.balancerVault) == address(0), + "balancer vault must have code or be zero address" + ); // Create Contract bytes memory creationCode = type(ManagerWithMerkleVerification).creationCode; diff --git a/src/base/DecodersAndSanitizers/EtherFiLiquidDecoderAndSanitizer.sol b/src/base/DecodersAndSanitizers/EtherFiLiquidDecoderAndSanitizer.sol index b496764..a34cdb8 100644 --- a/src/base/DecodersAndSanitizers/EtherFiLiquidDecoderAndSanitizer.sol +++ b/src/base/DecodersAndSanitizers/EtherFiLiquidDecoderAndSanitizer.sol @@ -77,7 +77,9 @@ contract EtherFiLiquidDecoderAndSanitizer is * @notice BalancerV2, NativeWrapper, Curve, and Gearbox all specify a `withdraw(uint256)`, * all cases are handled the same way. */ - function withdraw(uint256) + function withdraw( + uint256 + ) external pure override( diff --git a/src/base/DecodersAndSanitizers/EtherFiLiquidEthDecoderAndSanitizer.sol b/src/base/DecodersAndSanitizers/EtherFiLiquidEthDecoderAndSanitizer.sol index 5fe07a7..18e52ca 100644 --- a/src/base/DecodersAndSanitizers/EtherFiLiquidEthDecoderAndSanitizer.sol +++ b/src/base/DecodersAndSanitizers/EtherFiLiquidEthDecoderAndSanitizer.sol @@ -86,7 +86,9 @@ contract EtherFiLiquidEthDecoderAndSanitizer is * @notice BalancerV2, NativeWrapper, Curve, and Gearbox all specify a `withdraw(uint256)`, * all cases are handled the same way. */ - function withdraw(uint256) + function withdraw( + uint256 + ) external pure override( diff --git a/src/base/DecodersAndSanitizers/EtherFiLiquidUsdDecoderAndSanitizer.sol b/src/base/DecodersAndSanitizers/EtherFiLiquidUsdDecoderAndSanitizer.sol index 675aa2e..cbbdcef 100644 --- a/src/base/DecodersAndSanitizers/EtherFiLiquidUsdDecoderAndSanitizer.sol +++ b/src/base/DecodersAndSanitizers/EtherFiLiquidUsdDecoderAndSanitizer.sol @@ -79,7 +79,9 @@ contract EtherFiLiquidUsdDecoderAndSanitizer is * @notice BalancerV2, NativeWrapper, Curve, and Gearbox all specify a `withdraw(uint256)`, * all cases are handled the same way. */ - function withdraw(uint256) + function withdraw( + uint256 + ) external pure override( @@ -114,7 +116,9 @@ contract EtherFiLiquidUsdDecoderAndSanitizer is * @notice EtherFi, and Lido all specify a `wrap(uint256)`, * all cases are handled the same way. */ - function wrap(uint256) + function wrap( + uint256 + ) external pure override(EtherFiDecoderAndSanitizer, LidoDecoderAndSanitizer) @@ -128,7 +132,9 @@ contract EtherFiLiquidUsdDecoderAndSanitizer is * @notice EtherFi, and Lido all specify a `unwrap(uint256)`, * all cases are handled the same way. */ - function unwrap(uint256) + function unwrap( + uint256 + ) external pure override(EtherFiDecoderAndSanitizer, LidoDecoderAndSanitizer) diff --git a/src/base/DecodersAndSanitizers/LidoLiquidDecoderAndSanitizer.sol b/src/base/DecodersAndSanitizers/LidoLiquidDecoderAndSanitizer.sol index 3efcb16..0be64ca 100644 --- a/src/base/DecodersAndSanitizers/LidoLiquidDecoderAndSanitizer.sol +++ b/src/base/DecodersAndSanitizers/LidoLiquidDecoderAndSanitizer.sol @@ -64,7 +64,9 @@ contract LidoLiquidDecoderAndSanitizer is * @notice BalancerV2, NativeWrapper, Curve, and Gearbox all specify a `withdraw(uint256)`, * all cases are handled the same way. */ - function withdraw(uint256) + function withdraw( + uint256 + ) external pure override( diff --git a/src/base/DecodersAndSanitizers/Protocols/EigenLayerLSTStakingDecoderAndSanitizer.sol b/src/base/DecodersAndSanitizers/Protocols/EigenLayerLSTStakingDecoderAndSanitizer.sol index c345bac..31ea765 100644 --- a/src/base/DecodersAndSanitizers/Protocols/EigenLayerLSTStakingDecoderAndSanitizer.sol +++ b/src/base/DecodersAndSanitizers/Protocols/EigenLayerLSTStakingDecoderAndSanitizer.sol @@ -23,7 +23,9 @@ abstract contract EigenLayerLSTStakingDecoderAndSanitizer is BaseDecoderAndSanit addressesFound = abi.encodePacked(strategy, token); } - function queueWithdrawals(DecoderCustomTypes.QueuedWithdrawalParams[] calldata queuedWithdrawalParams) + function queueWithdrawals( + DecoderCustomTypes.QueuedWithdrawalParams[] calldata queuedWithdrawalParams + ) external pure virtual diff --git a/src/base/DecodersAndSanitizers/Protocols/UniswapV3DecoderAndSanitizer.sol b/src/base/DecodersAndSanitizers/Protocols/UniswapV3DecoderAndSanitizer.sol index 41bf656..3fce397 100644 --- a/src/base/DecodersAndSanitizers/Protocols/UniswapV3DecoderAndSanitizer.sol +++ b/src/base/DecodersAndSanitizers/Protocols/UniswapV3DecoderAndSanitizer.sol @@ -23,7 +23,9 @@ abstract contract UniswapV3DecoderAndSanitizer is BaseDecoderAndSanitizer { //============================== UNISWAP V3 =============================== - function exactInput(DecoderCustomTypes.ExactInputParams calldata params) + function exactInput( + DecoderCustomTypes.ExactInputParams calldata params + ) external pure virtual @@ -44,7 +46,9 @@ abstract contract UniswapV3DecoderAndSanitizer is BaseDecoderAndSanitizer { addressesFound = abi.encodePacked(addressesFound, params.recipient); } - function mint(DecoderCustomTypes.MintParams calldata params) + function mint( + DecoderCustomTypes.MintParams calldata params + ) external pure virtual @@ -55,7 +59,9 @@ abstract contract UniswapV3DecoderAndSanitizer is BaseDecoderAndSanitizer { addressesFound = abi.encodePacked(params.token0, params.token1, params.recipient); } - function increaseLiquidity(DecoderCustomTypes.IncreaseLiquidityParams calldata params) + function increaseLiquidity( + DecoderCustomTypes.IncreaseLiquidityParams calldata params + ) external view virtual @@ -71,7 +77,9 @@ abstract contract UniswapV3DecoderAndSanitizer is BaseDecoderAndSanitizer { addressesFound = abi.encodePacked(operator, token0, token1); } - function decreaseLiquidity(DecoderCustomTypes.DecreaseLiquidityParams calldata params) + function decreaseLiquidity( + DecoderCustomTypes.DecreaseLiquidityParams calldata params + ) external view virtual @@ -88,7 +96,9 @@ abstract contract UniswapV3DecoderAndSanitizer is BaseDecoderAndSanitizer { return addressesFound; } - function collect(DecoderCustomTypes.CollectParams calldata params) + function collect( + DecoderCustomTypes.CollectParams calldata params + ) external view virtual diff --git a/src/base/Roles/CrossChain/CrossChainOPTellerWithMultiAssetSupport.sol b/src/base/Roles/CrossChain/CrossChainOPTellerWithMultiAssetSupport.sol index a690598..7b381e7 100644 --- a/src/base/Roles/CrossChain/CrossChainOPTellerWithMultiAssetSupport.sol +++ b/src/base/Roles/CrossChain/CrossChainOPTellerWithMultiAssetSupport.sol @@ -86,7 +86,7 @@ contract CrossChainOPTellerWithMultiAssetSupport is CrossChainTellerBase { unchecked { messageId = keccak256(abi.encodePacked(++nonce, address(this), block.chainid)); } - + messenger.sendMessage( peer, abi.encodeCall(this.receiveBridgeMessage, (data.destinationChainReceiver, shareAmount, messageId)), diff --git a/src/interfaces/EtherFiLiquid1.sol b/src/interfaces/EtherFiLiquid1.sol index 14d5ffc..080242e 100644 --- a/src/interfaces/EtherFiLiquid1.sol +++ b/src/interfaces/EtherFiLiquid1.sol @@ -72,7 +72,9 @@ interface EtherFiLiquid1 { function addPosition(uint32 index, uint32 positionId, bytes memory configurationData, bool inDebtArray) external; function addPositionToCatalogue(uint32 positionId) external; function allowance(address, address) external view returns (uint256); - function alternativeAssetData(address) + function alternativeAssetData( + address + ) external view returns (bool isSupported, uint32 holdingPosition, uint32 depositFee); diff --git a/src/interfaces/IStaking.sol b/src/interfaces/IStaking.sol index 5abf6ee..f1d953a 100644 --- a/src/interfaces/IStaking.sol +++ b/src/interfaces/IStaking.sol @@ -84,7 +84,9 @@ interface IUNSTETH { bool isClaimed; } - function getWithdrawalStatus(uint256[] calldata _requestIds) + function getWithdrawalStatus( + uint256[] calldata _requestIds + ) external view returns (WithdrawalRequestStatus[] memory statuses); diff --git a/src/interfaces/RawDataDecoderAndSanitizerInterfaces.sol b/src/interfaces/RawDataDecoderAndSanitizerInterfaces.sol index 0e5705b..6cb7bfb 100644 --- a/src/interfaces/RawDataDecoderAndSanitizerInterfaces.sol +++ b/src/interfaces/RawDataDecoderAndSanitizerInterfaces.sol @@ -24,7 +24,9 @@ interface INonFungiblePositionManager { } function ownerOf(uint256 tokenId) external view returns (address); - function positions(uint256 tokenId) + function positions( + uint256 tokenId + ) external view returns ( diff --git a/test/CrossChain/@layerzerolabs-custom/test-evm-foundry-custom/OptionsHelper.sol b/test/CrossChain/@layerzerolabs-custom/test-evm-foundry-custom/OptionsHelper.sol index 0bd63c0..f0f2cb4 100644 --- a/test/CrossChain/@layerzerolabs-custom/test-evm-foundry-custom/OptionsHelper.sol +++ b/test/CrossChain/@layerzerolabs-custom/test-evm-foundry-custom/OptionsHelper.sol @@ -8,7 +8,9 @@ import { UlnOptions } from "@layerzerolabs/lz-evm-messagelib-v2/contracts/uln/li contract UlnOptionsMock { using UlnOptions for bytes; - function decode(bytes calldata _options) + function decode( + bytes calldata _options + ) public pure returns (bytes memory executorOptions, bytes memory dvnOptions) @@ -31,7 +33,9 @@ contract OptionsHelper { (gas, value) = this.decodeLzReceiveOption(option); } - function _parseExecutorNativeDropOption(bytes memory _options) + function _parseExecutorNativeDropOption( + bytes memory _options + ) internal view returns (uint256 amount, bytes32 receiver) @@ -42,7 +46,9 @@ contract OptionsHelper { (amount, receiver) = this.decodeNativeDropOption(option); } - function _parseExecutorLzComposeOption(bytes memory _options) + function _parseExecutorLzComposeOption( + bytes memory _options + ) internal view returns (uint16 index, uint256 gas, uint256 value) @@ -103,7 +109,9 @@ contract OptionsHelper { return ExecutorOptions.decodeNativeDropOption(_option); } - function decodeLzComposeOption(bytes calldata _option) + function decodeLzComposeOption( + bytes calldata _option + ) external pure returns (uint16 index, uint128 gas, uint128 value) diff --git a/test/CrossChain/@layerzerolabs-custom/test-evm-foundry-custom/SendUln302Mock.sol b/test/CrossChain/@layerzerolabs-custom/test-evm-foundry-custom/SendUln302Mock.sol index 78ab9b0..7ac7df9 100644 --- a/test/CrossChain/@layerzerolabs-custom/test-evm-foundry-custom/SendUln302Mock.sol +++ b/test/CrossChain/@layerzerolabs-custom/test-evm-foundry-custom/SendUln302Mock.sol @@ -101,7 +101,9 @@ contract SendUln302Mock is SendUlnBase, SendLibBaseE2 { (otherWorkerFees, encodedPacket) = _payDVNs(fees, _packet, _options); } - function _splitOptions(bytes calldata _options) + function _splitOptions( + bytes calldata _options + ) internal pure override diff --git a/test/CrossChain/CrossChainOPTellerWithMultiAssetSupport.t.sol b/test/CrossChain/CrossChainOPTellerWithMultiAssetSupport.t.sol index 074c19e..3337772 100644 --- a/test/CrossChain/CrossChainOPTellerWithMultiAssetSupport.t.sol +++ b/test/CrossChain/CrossChainOPTellerWithMultiAssetSupport.t.sol @@ -88,12 +88,12 @@ contract CrossChainOPTellerWithMultiAssetSupportTest is CrossChainBaseTest { assertEq(boringVault.balanceOf(address(this)), balBefore - sharesToBridge, "Should have burned shares."); } - function testUniqueIDs() public virtual{ + function testUniqueIDs() public virtual { CrossChainOPTellerWithMultiAssetSupport sourceTeller = CrossChainOPTellerWithMultiAssetSupport(sourceTellerAddr); CrossChainOPTellerWithMultiAssetSupport destinationTeller = CrossChainOPTellerWithMultiAssetSupport(destinationTellerAddr); - uint sharesToBridge = 12; + uint256 sharesToBridge = 12; // Bridge shares. address to = vm.addr(1); @@ -111,7 +111,7 @@ contract CrossChainOPTellerWithMultiAssetSupportTest is CrossChainBaseTest { uint256 balBefore = boringVault.balanceOf(address(this)); bytes32 id1 = sourceTeller.bridge{ value: quote }(sharesToBridge, data); - // preform the exact same bridge again and assert the ids are not the same + // perform the exact same bridge again and assert the ids are not the same bytes32 id2 = sourceTeller.bridge{ value: quote }(sharesToBridge, data); assertNotEq(id1, id2, "Id's must be unique"); From 974aeaff57c81f7c8bf5fd20205f4873eaf59b81 Mon Sep 17 00:00:00 2001 From: Jamie Pickett Date: Thu, 15 Aug 2024 09:49:00 -0400 Subject: [PATCH 08/24] feat: added in correct spot in l1 and l2 configs opMessenger flag --- deployment-config/fraxtal-eth-l1-08-13-24.json | 1 + deployment-config/fraxtal-eth-l2-08-13-24.json | 1 + 2 files changed, 2 insertions(+) diff --git a/deployment-config/fraxtal-eth-l1-08-13-24.json b/deployment-config/fraxtal-eth-l1-08-13-24.json index 9e356cb..7ae54ac 100644 --- a/deployment-config/fraxtal-eth-l1-08-13-24.json +++ b/deployment-config/fraxtal-eth-l1-08-13-24.json @@ -21,6 +21,7 @@ }, "teller": { "tellerSalt": "0x4000000000000000000000000000000000000000000000000000000000000002", + "opMessenger": "0x4200000000000000000000000000000000000007", "maxGasForPeer": 200000, "minGasForPeer": 60000, "peerEid": 30255, diff --git a/deployment-config/fraxtal-eth-l2-08-13-24.json b/deployment-config/fraxtal-eth-l2-08-13-24.json index a166dba..014d00e 100644 --- a/deployment-config/fraxtal-eth-l2-08-13-24.json +++ b/deployment-config/fraxtal-eth-l2-08-13-24.json @@ -21,6 +21,7 @@ }, "teller": { "tellerSalt": "0x4000000000000000000000000000000000000000000000000000000000000002", + "opMessenger": "0x4200000000000000000000000000000000000007", "maxGasForPeer": 200000, "minGasForPeer": 60000, "peerEid": 30101, From 2ff6581613d3f431030c6354248c624e4a3889ea Mon Sep 17 00:00:00 2001 From: Jamie Pickett Date: Thu, 15 Aug 2024 10:38:00 -0400 Subject: [PATCH 09/24] fix: wrong addrs on boba and fraxtal messenger in config --- deployment-config/boba-eth-l1-08-09-24.json | 2 +- deployment-config/boba-eth-l2-08-09-24.json | 2 +- deployment-config/fraxtal-eth-l1-08-13-24.json | 2 +- deployment-config/fraxtal-eth-l2-08-13-24.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/deployment-config/boba-eth-l1-08-09-24.json b/deployment-config/boba-eth-l1-08-09-24.json index 389c1cf..c6eff2e 100644 --- a/deployment-config/boba-eth-l1-08-09-24.json +++ b/deployment-config/boba-eth-l1-08-09-24.json @@ -21,11 +21,11 @@ }, "teller": { "tellerSalt": "0x4000000000000000000000000000000000000000000000000000000000000001", - "opMessenger": "0x4200000000000000000000000000000000000007", "maxGasForPeer": 200000, "minGasForPeer": 60000, "peerEid": 0, "tellerContractName": "CrossChainOPTellerWithMultiAssetSupport", + "opMessenger": "0x6D4528d192dB72E282265D6092F4B872f9Dff69e", "assets": [ "0xcd5fe23c85820f7b72d0926fc9b05b43e359b7ee", "0xbf5495efe5db9ce00f80364c8b423567e58d2110", diff --git a/deployment-config/boba-eth-l2-08-09-24.json b/deployment-config/boba-eth-l2-08-09-24.json index 3062a26..d3889f2 100644 --- a/deployment-config/boba-eth-l2-08-09-24.json +++ b/deployment-config/boba-eth-l2-08-09-24.json @@ -21,11 +21,11 @@ }, "teller": { "tellerSalt": "0x4000000000000000000000000000000000000000000000000000000000000001", - "opMessenger": "0x4200000000000000000000000000000000000007", "maxGasForPeer": 200000, "minGasForPeer": 60000, "peerEid": 0, "tellerContractName": "CrossChainOPTellerWithMultiAssetSupport", + "opMessenger": "0x4200000000000000000000000000000000000007", "assets": [], "address": "0x0000000000000000000000000000000000000000" }, diff --git a/deployment-config/fraxtal-eth-l1-08-13-24.json b/deployment-config/fraxtal-eth-l1-08-13-24.json index 7ae54ac..d2fad36 100644 --- a/deployment-config/fraxtal-eth-l1-08-13-24.json +++ b/deployment-config/fraxtal-eth-l1-08-13-24.json @@ -21,11 +21,11 @@ }, "teller": { "tellerSalt": "0x4000000000000000000000000000000000000000000000000000000000000002", - "opMessenger": "0x4200000000000000000000000000000000000007", "maxGasForPeer": 200000, "minGasForPeer": 60000, "peerEid": 30255, "tellerContractName": "MultiChainLayerZeroTellerWithMultiAssetSupport", + "opMessenger": "0x126bcc31Bc076B3d515f60FBC81FddE0B0d542Ed", "assets": [ "0xcd5fe23c85820f7b72d0926fc9b05b43e359b7ee", "0xbf5495efe5db9ce00f80364c8b423567e58d2110", diff --git a/deployment-config/fraxtal-eth-l2-08-13-24.json b/deployment-config/fraxtal-eth-l2-08-13-24.json index 014d00e..b168066 100644 --- a/deployment-config/fraxtal-eth-l2-08-13-24.json +++ b/deployment-config/fraxtal-eth-l2-08-13-24.json @@ -21,11 +21,11 @@ }, "teller": { "tellerSalt": "0x4000000000000000000000000000000000000000000000000000000000000002", - "opMessenger": "0x4200000000000000000000000000000000000007", "maxGasForPeer": 200000, "minGasForPeer": 60000, "peerEid": 30101, "tellerContractName": "MultiChainLayerZeroTellerWithMultiAssetSupport", + "opMessenger": "0x4200000000000000000000000000000000000007", "assets": [], "address": "0x0000000000000000000000000000000000000000" }, From 9a44fe83b5735e078f83c3803088f71e19859a1c Mon Sep 17 00:00:00 2001 From: Jun Kim <64379343+junkim012@users.noreply.github.com> Date: Thu, 15 Aug 2024 23:41:29 +0900 Subject: [PATCH 10/24] chore: remove ccip in lib --- lib/ccip | 1 - 1 file changed, 1 deletion(-) delete mode 160000 lib/ccip diff --git a/lib/ccip b/lib/ccip deleted file mode 160000 index 9eb2708..0000000 --- a/lib/ccip +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9eb2708908536544c26ad67a4be96b5974d2d9d0 From e3707381aa64ad235666d0049a22df7be4a47977 Mon Sep 17 00:00:00 2001 From: Jun Kim <64379343+junkim012@users.noreply.github.com> Date: Thu, 22 Aug 2024 18:24:05 +0900 Subject: [PATCH 11/24] feat: generic rate provider test and deployment for swBTC --- .../rates/DeployGenericRateProvider.json | 7 ++ package.json | 4 +- script/ConfigReader.s.sol | 3 +- script/deploy/DeployGenericRateProvider.s.sol | 34 ++++++++++ ...LayerZeroTellerWithMultiAssetSupport.s.sol | 3 +- src/helper/Constants.sol | 2 + test/ion/oracles/GenericRateProvider.t.sol | 64 +++++++++++++++++++ 7 files changed, 113 insertions(+), 4 deletions(-) create mode 100644 deployment-config/rates/DeployGenericRateProvider.json create mode 100644 script/deploy/DeployGenericRateProvider.s.sol create mode 100644 test/ion/oracles/GenericRateProvider.t.sol diff --git a/deployment-config/rates/DeployGenericRateProvider.json b/deployment-config/rates/DeployGenericRateProvider.json new file mode 100644 index 0000000..febfe7b --- /dev/null +++ b/deployment-config/rates/DeployGenericRateProvider.json @@ -0,0 +1,7 @@ +{ + "target": "0x8DB2350D78aBc13f5673A411D4700BCF87864dDE", + "signature": "pricePerShare()", + "expectedMin": "100000000", + "expectedMax": "100000000", + "salt": "0x1000000000000000000000000000000000000000000000000000000000000000" +} \ No newline at end of file diff --git a/package.json b/package.json index 5438095..9668c7b 100644 --- a/package.json +++ b/package.json @@ -8,8 +8,8 @@ "solhint": "solhint -w 0 'src/**/*.sol'", "slither": "slither src", "prepare": "husky", - "deploy-createx-l1": "forge script script/DeployCustomCreatex.s.sol --rpc-url $L1_RPC_URL --private-key $PRIVATE_KEY --slow", - "deploy-createx-l2": "forge script script/DeployCustomCreatex.s.sol --rpc-url $L2_RPC_URL --private-key $PRIVATE_KEY --slow", + "deploy-createx-l1": "forge script script/DeployCustomCreatex.s.sol --rpc-url $L1_RPC_URL --private-key $PRIVATE_KEY --slow --no-metadata", + "deploy-createx-l2": "forge script script/DeployCustomCreatex.s.sol --rpc-url $L2_RPC_URL --private-key $PRIVATE_KEY --slow --no-metadata", "deploy-l1": "forge script script/deploy/deployAll.s.sol -f $L1_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" }, diff --git a/script/ConfigReader.s.sol b/script/ConfigReader.s.sol index d8fda41..f86f4d0 100644 --- a/script/ConfigReader.s.sol +++ b/script/ConfigReader.s.sol @@ -85,7 +85,8 @@ library ConfigReader { config.assets = _config.readAddressArray(".teller.assets"); config.peerEid = uint32(_config.readUint(".teller.peerEid")); config.dvnIfNoDefault = _config.readAddress(".teller.dvnIfNoDefault"); - config.dvnBlockConfirmationsRequiredIfNoDefault = uint64(_config.readUint(".teller.dvnBlockConfirmationsRequiredIfNoDefault")); + config.dvnBlockConfirmationsRequiredIfNoDefault = + uint64(_config.readUint(".teller.dvnBlockConfirmationsRequiredIfNoDefault")); // Reading from the 'rolesAuthority' section config.rolesAuthority = _config.readAddress(".rolesAuthority.address"); diff --git a/script/deploy/DeployGenericRateProvider.s.sol b/script/deploy/DeployGenericRateProvider.s.sol new file mode 100644 index 0000000..0b46cde --- /dev/null +++ b/script/deploy/DeployGenericRateProvider.s.sol @@ -0,0 +1,34 @@ +// SPDX-License-Identifier: Apache-2.0 +pragma solidity 0.8.21; + +import { GenericRateProvider } from "./../../src/helper/GenericRateProvider.sol"; +import { BaseScript } from "../Base.s.sol"; +import { stdJson as StdJson } from "@forge-std/StdJson.sol"; + +using StdJson for string; + +// NOTE Currently assumes that function signature arguments are empty. +contract DeployGenericRateProvider is BaseScript { + string configPath = "./deployment-config/rates/DeployGenericRateProvider.json"; + string config = vm.readFile(configPath); + + uint256 expectedMin = config.readUint("expectedMin"); + uint256 expectedMax = config.readUint("expectedMax"); + address target = config.readAddress("target"); + string signature = config.readString("signature"); + bytes32 salt = config.readBytes32("salt"); + + function run() public returns (address rateProvider) { + bytes4 functionSig = bytes4(keccak256(bytes(signature))); + + bytes memory creationCode = type(GenericRateProvider).creationCode; + GenericRateProvider rateProvider = + GenericRateProvider(CREATEX.deployCreate3(salt, abi.encodePacked(functionSig))); + + uint256 rate = rateProvider.getRate(); + + require(rate != 0, "rate must not be zero"); + require(rate >= expectedMin, "rate must be greater than or equal to min"); + require(rate <= expectedMax, "rate must be less than or equal to max"); + } +} diff --git a/script/deploy/single/05b_DeployMultiChainLayerZeroTellerWithMultiAssetSupport.s.sol b/script/deploy/single/05b_DeployMultiChainLayerZeroTellerWithMultiAssetSupport.s.sol index 519b25f..bbbc83c 100644 --- a/script/deploy/single/05b_DeployMultiChainLayerZeroTellerWithMultiAssetSupport.s.sol +++ b/script/deploy/single/05b_DeployMultiChainLayerZeroTellerWithMultiAssetSupport.s.sol @@ -99,7 +99,8 @@ contract DeployMultiChainLayerZeroTellerWithMultiAssetSupport is BaseScript { requiredDVNs[0] = config.dvnIfNoDefault; - bytes memory ulnConfigBytes = abi.encode(UlnConfig(config.dvnBlockConfirmationsRequiredIfNoDefault, 1, 0, 0, requiredDVNs, optionalDVNs)); + bytes memory ulnConfigBytes = + abi.encode(UlnConfig(config.dvnBlockConfirmationsRequiredIfNoDefault, 1, 0, 0, requiredDVNs, optionalDVNs)); SetConfigParam[] memory setConfigParams = new SetConfigParam[](1); setConfigParams[0] = SetConfigParam(config.peerEid, 2, ulnConfigBytes); diff --git a/src/helper/Constants.sol b/src/helper/Constants.sol index 9cd9048..367be16 100644 --- a/src/helper/Constants.sol +++ b/src/helper/Constants.sol @@ -8,3 +8,5 @@ IPriceFeed constant ETH_PER_EZETH_CHAINLINK = IPriceFeed(0x636A000262F6aA9e1F094 IPriceFeed constant ETH_PER_RSETH_CHAINLINK = IPriceFeed(0x03c68933f7a3F76875C0bc670a58e69294cDFD01); IPriceFeed constant ETH_PER_RSWETH_CHAINLINK = IPriceFeed(0xb613CfebD0b6e95abDDe02677d6bC42394FdB857); IPriceFeed constant ETH_PER_PUFETH_REDSTONE = IPriceFeed(0x76A495b0bFfb53ef3F0E94ef0763e03cE410835C); + +address constant SWBTC = 0x8DB2350D78aBc13f5673A411D4700BCF87864dDE; diff --git a/test/ion/oracles/GenericRateProvider.t.sol b/test/ion/oracles/GenericRateProvider.t.sol new file mode 100644 index 0000000..d40c3e1 --- /dev/null +++ b/test/ion/oracles/GenericRateProvider.t.sol @@ -0,0 +1,64 @@ +// SPDX-License-Identifier: Apache-2.0 +pragma solidity 0.8.21; + +import { GenericRateProvider } from "./../../../src/helper/GenericRateProvider.sol"; +import { SWBTC } from "./../../../src/helper/Constants.sol"; + +import "forge-std/Test.sol"; + +abstract contract GenericRateProviderTest is Test { + GenericRateProvider rateProvider; + address target; + bytes4 selector; + bytes32 staticArgument0; + bytes32 staticArgument1; + bytes32 staticArgument2; + bytes32 staticArgument3; + + uint8 decimals; + + function setUp() public virtual { + vm.createSelectFork(vm.envString(_getRpcUrl())); + + _initialize(); + + require(address(rateProvider) != address(0), "rate provider not set"); + require(decimals > 0, "decimals not set"); + require(target != address(0), "target not set"); + require(bytes4(selector).length > 0, "selector not set"); + } + + function test_GetRateWithinExpectedBounds() public { + uint256 rate = rateProvider.getRate(); + (uint256 min, uint256 max) = _expectedRateMinMax(); + + require(rate >= min, "rate must be greater than or equal to min"); + require(rate <= max, "rate must be less than or equal to max"); + } + + function _initialize() public virtual; + + function _expectedRateMinMax() public virtual returns (uint256, uint256); + + function _getRpcUrl() public pure virtual returns (string memory); +} + +contract SwBtcRateProviderTest is GenericRateProviderTest { + function _initialize() public override { + target = SWBTC; + selector = bytes4(keccak256("pricePerShare()")); + decimals = 8; + staticArgument0 = bytes32(uint256(123)); + + rateProvider = new GenericRateProvider(target, selector, staticArgument0, 0, 0, 0, 0, 0, 0, 0); + } + + function _expectedRateMinMax() public view override returns (uint256 min, uint256 max) { + min = 1 * 10 ** decimals; + max = 1 * 10 ** decimals; + } + + function _getRpcUrl() public pure override returns (string memory) { + return "MAINNET_RPC_URL"; + } +} From 115063898e7611151f5a92a295cf4e25acdd6094 Mon Sep 17 00:00:00 2001 From: Jun Kim <64379343+junkim012@users.noreply.github.com> Date: Thu, 22 Aug 2024 18:37:54 +0900 Subject: [PATCH 12/24] feat: deployment script for generic rate provider --- script/deploy/DeployGenericRateProvider.s.sol | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/script/deploy/DeployGenericRateProvider.s.sol b/script/deploy/DeployGenericRateProvider.s.sol index 0b46cde..72c40fd 100644 --- a/script/deploy/DeployGenericRateProvider.s.sol +++ b/script/deploy/DeployGenericRateProvider.s.sol @@ -4,6 +4,7 @@ pragma solidity 0.8.21; import { GenericRateProvider } from "./../../src/helper/GenericRateProvider.sol"; import { BaseScript } from "../Base.s.sol"; import { stdJson as StdJson } from "@forge-std/StdJson.sol"; +import { console2 } from "forge-std/console2.sol"; using StdJson for string; @@ -12,21 +13,28 @@ contract DeployGenericRateProvider is BaseScript { string configPath = "./deployment-config/rates/DeployGenericRateProvider.json"; string config = vm.readFile(configPath); - uint256 expectedMin = config.readUint("expectedMin"); - uint256 expectedMax = config.readUint("expectedMax"); - address target = config.readAddress("target"); - string signature = config.readString("signature"); - bytes32 salt = config.readBytes32("salt"); + uint256 expectedMin = config.readUint(".expectedMin"); + uint256 expectedMax = config.readUint(".expectedMax"); + address target = config.readAddress(".target"); + string signature = config.readString(".signature"); + bytes32 salt = config.readBytes32(".salt"); - function run() public returns (address rateProvider) { + function run() public returns (GenericRateProvider rateProvider) { bytes4 functionSig = bytes4(keccak256(bytes(signature))); + console2.logBytes4(functionSig); bytes memory creationCode = type(GenericRateProvider).creationCode; - GenericRateProvider rateProvider = - GenericRateProvider(CREATEX.deployCreate3(salt, abi.encodePacked(functionSig))); + + rateProvider = GenericRateProvider( + CREATEX.deployCreate3( + salt, abi.encodePacked(creationCode, abi.encode(target, functionSig, 0, 0, 0, 0, 0, 0, 0, 0)) + ) + ); uint256 rate = rateProvider.getRate(); + console2.log("rate: ", rate); + require(rate != 0, "rate must not be zero"); require(rate >= expectedMin, "rate must be greater than or equal to min"); require(rate <= expectedMax, "rate must be less than or equal to max"); From 32b51d6d0b92cacd692920904d10370ccf13cfe1 Mon Sep 17 00:00:00 2001 From: Jun Kim <64379343+junkim012@users.noreply.github.com> Date: Thu, 22 Aug 2024 19:19:32 +0900 Subject: [PATCH 13/24] chore: rswBTC deployment config --- deployment-config/chains/1.json | 4 ++ deployment-config/mydeploy.json | 59 ------------------ deployment-config/rswBTC-l1.json | 57 ++++++++++++++++++ deployment-config/seidry.json | 60 ------------------- script/ConfigReader.s.sol | 6 +- script/deploy/DeployGenericRateProvider.s.sol | 2 +- script/deploy/deployAll.s.sol | 2 + ...04_DeployAccountantWithRateProviders.s.sol | 8 ++- src/helper/Constants.sol | 1 + 9 files changed, 76 insertions(+), 123 deletions(-) delete mode 100644 deployment-config/mydeploy.json create mode 100644 deployment-config/rswBTC-l1.json delete mode 100644 deployment-config/seidry.json diff --git a/deployment-config/chains/1.json b/deployment-config/chains/1.json index aad1b0f..42a3ea0 100644 --- a/deployment-config/chains/1.json +++ b/deployment-config/chains/1.json @@ -46,6 +46,10 @@ "decimals": 18, "description": "", "priceFeedType": 0 + }, + "0x8db2350d78abc13f5673a411d4700bcf87864dde": { + "rateProvider": "0x318Da095d602C08eF41319f4c4bA0646d318C906", + "decimals": 8 } } } \ No newline at end of file diff --git a/deployment-config/mydeploy.json b/deployment-config/mydeploy.json deleted file mode 100644 index 9f02eca..0000000 --- a/deployment-config/mydeploy.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "protocolAdmin": "0xC2d99d76bb9D46BF8Ec9449E4DfAE48C30CF0839", - - "boringVault":{ - "boringVaultSalt": "0x1ddd634c506ad203da17ff00000000000000000000000000000000000000000a", - "boringVaultName": "Ion Vault", - "boringVaultSymbol": "IVT", - - "address": "0x0000000000E7Ab44153eEBEF2343ba5289F65dAC" - }, - - "manager":{ - "managerSalt": "0x30432d4b4ec00003b4a25000000000000000000000000000000000000000000a", - - "address": "0x0000000000fAd6Db23abdC1a85621B97bd1Dc82f" - }, - - "accountant":{ - "accountantSalt": "0x6a184dbea6f3cc0318679f00000000000000000000000000000000000000000a", - "payoutAddress": "0x0000000000417626Ef34D62C4DC189b021603f2F", - "base": "0x5f207d42F869fd1c71d7f0f81a2A67Fc20FF7323", - "allowedExchangeRateChangeUpper": "10003", - "allowedExchangeRateChangeLower": "9998", - "minimumUpdateDelayInSeconds": "3600", - "managementFee": "2000", - - "address": "0x00000000004F96C07B83e86600D86F9479bB43fa" - }, - - "teller": { - "tellerSalt": "0x51f8968749a56d01202c9100000000000000000000000000000000000000000a", - "maxGasForPeer": 100000, - "minGasForPeer": 0, - "peerEid": 0, - "tellerContractName": "MultiChainLayerZeroTellerWithMultiAssetSupport", - "opMessenger": "0x0000000000000000000000000000000000000000", - "assets": [ - "0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee", - "0xbf5495Efe5DB9ce00f80364C8B423567e58d2110" - ], - - "address": "0x00000000004F96C07B83e86600D86F0000000000" - }, - - "rolesAuthority": { - "rolesAuthoritySalt": "0x66bbc3b3b3000b01466a3a00000000000000000000000000000000000000000a", - "strategist": "0xC2d99d76bb9D46BF8Ec9449E4DfAE48C30CF0839", - "exchangeRateBot": "0x00000000004F96C07B83e86600D86F0000000000", - - "address": "0x00000000004F96C07B83e86600D86F0000000000" - }, - - "decoder": { - "decoderSalt": "0x48b53893da2e0b0248268c00000000000000000000000000000000000000000a", - - "address": "0x00000000004F96C07B83e86600D86F0000000000" - } - -} \ No newline at end of file diff --git a/deployment-config/rswBTC-l1.json b/deployment-config/rswBTC-l1.json new file mode 100644 index 0000000..ce53341 --- /dev/null +++ b/deployment-config/rswBTC-l1.json @@ -0,0 +1,57 @@ +{ + "protocolAdmin": "0x0000000000417626Ef34D62C4DC189b021603f2F", + "base": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + "baseDecimals": "8", + + "boringVault":{ + "boringVaultSalt": "0x100000000000000000000000000000000000000000000000000000000000000b", + "boringVaultName": "Swell Native Yield Nucleus Token", + "boringVaultSymbol": "rswBTC", + + "address": "0x0000000000000000000000000000000000000000" + }, + + "manager":{ + "managerSalt": "0x200000000000000000000000000000000000000000000000000000000000000b", + + "address": "0x0000000000000000000000000000000000000000" + }, + + "accountant":{ + "accountantSalt": "0x300000000000000000000000000000000000000000000000000000000000000b", + "payoutAddress": "0x0000000000417626Ef34D62C4DC189b021603f2F", + "allowedExchangeRateChangeUpper": "10030", + "allowedExchangeRateChangeLower": "9980", + "minimumUpdateDelayInSeconds": "3600", + "managementFee": "0", + + "address": "0x0000000000000000000000000000000000000000" + }, + + "teller": { + "tellerSalt": "0x400000000000000000000000000000000000000000000000000000000000000a", + "maxGasForPeer": 200000, + "minGasForPeer": 60000, + "peerEid": 0, + "tellerContractName": "TellerWithMultiAssetSupport", + "opMessenger": "0x0000000000000000000000000000000000000000", + "assets": [ + "0x8DB2350D78aBc13f5673A411D4700BCF87864dDE" + ], + "address": "0x0000000000000000000000000000000000000000" + }, + "rolesAuthority": { + "rolesAuthoritySalt": "0x500000000000000000000000000000000000000000000000000000000000000b", + "strategist": "0x0000000000417626Ef34D62C4DC189b021603f2F", + "exchangeRateBot": "0x0000000000417626Ef34D62C4DC189b021603f2F", + + "address": "0x0000000000000000000000000000000000000000" + }, + + "decoder": { + "decoderSalt": "0x6000000000000000000000000000000000000000000000000000000000000000", + + "address": "0x0000000000000000000000000000000000000000" + } + +} \ No newline at end of file diff --git a/deployment-config/seidry.json b/deployment-config/seidry.json deleted file mode 100644 index 4982d23..0000000 --- a/deployment-config/seidry.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "protocolAdmin": "0xbcef4940d7000e94c0048f071e28bfe91bc5066d", - - "boringVault":{ - "boringVaultSalt": "0x1ddd634c506ad203da17ff00000000000000000000000000000000000000000a", - "boringVaultName": "Ion Vault", - "boringVaultSymbol": "IVT", - - "address": "0x0000000000000000000000000000000000000000" - }, - - "manager":{ - "managerSalt": "0x30432d4b4ec00003b4a25000000000000000000000000000000000000000000a", - - "address": "0x0000000000000000000000000000000000000000" - }, - - "accountant":{ - "accountantSalt": "0x6a184dbea6f3cc0318679f00000000000000000000000000000000000000000a", - "payoutAddress": "0x0000000000417626Ef34D62C4DC189b021603f2F", - "allowedExchangeRateChangeUpper": "10003", - "allowedExchangeRateChangeLower": "9998", - "minimumUpdateDelayInSeconds": "3600", - "managementFee": "2000", - - "address": "0x0000000000000000000000000000000000000000" - }, - - "teller": { - "tellerSalt": "0x51f8968749a56d01202c9100000000000000000000000000000000000000000a", - "maxGasForPeer": 100000, - "minGasForPeer": 0, - "peerEid": 1, - "tellerContractName": "MultiChainLayerZeroTellerWithMultiAssetSupport", - "opMessenger": "0x0000000000000000000000000000000000000000", - "assets": [ - ], - "address": "0x0000000000000000000000000000000000000000" - }, - "rolesAuthority": { - "rolesAuthoritySalt": "0x66bbc3b3b3000b01466a3a00000000000000000000000000000000000000000a", - "strategist": "0xbcef4940d7000e94c0048f071e28bfe91bc5066d", - "exchangeRateBot": "0x00000000004F96C07B83e86600D86F0000000000", - - "address": "0x0000000000000000000000000000000000000000" - }, - - "decoder": { - "decoderSalt": "0x48b53893da2e0b0248268c00000000000000000000000000000000000000000a", - - "address": "0x0000000000000000000000000000000000000000" - }, - - "rateProvider": { - "maxTimeFromLastUpdate": "86400", - "rateProviderSalt": "0x0000000000000000000000000000000000000000000000000000000000000000", - - "address": "0x0000000000000000000000000000000000000000" - } -} \ No newline at end of file diff --git a/script/ConfigReader.s.sol b/script/ConfigReader.s.sol index 1012ee9..2cdb0e7 100644 --- a/script/ConfigReader.s.sol +++ b/script/ConfigReader.s.sol @@ -14,6 +14,8 @@ library ConfigReader { struct Config { address protocolAdmin; + address base; + uint8 baseDecimals; bytes32 accountantSalt; address boringVault; address payoutAddress; @@ -50,12 +52,13 @@ library ConfigReader { address[] assets; address[] rateProviders; address[] priceFeeds; - address base; } function toConfig(string memory _config, string memory _chainConfig) internal pure returns (Config memory config) { // Reading the 'protocolAdmin' config.protocolAdmin = _config.readAddress(".protocolAdmin"); + config.base = _config.readAddress(".base"); + config.baseDecimals = uint8(_config.readUint(".baseDecimals")); // Reading from the 'accountant' section config.accountant = _config.readAddress(".accountant.address"); @@ -97,7 +100,6 @@ library ConfigReader { config.decoder = _config.readAddress(".decoder.address"); // Reading from the 'chainConfig' section - config.base = _chainConfig.readAddress(".base"); config.balancerVault = _chainConfig.readAddress(".balancerVault"); config.lzEndpoint = _chainConfig.readAddress(".lzEndpoint"); diff --git a/script/deploy/DeployGenericRateProvider.s.sol b/script/deploy/DeployGenericRateProvider.s.sol index 72c40fd..c9e39a8 100644 --- a/script/deploy/DeployGenericRateProvider.s.sol +++ b/script/deploy/DeployGenericRateProvider.s.sol @@ -19,7 +19,7 @@ contract DeployGenericRateProvider is BaseScript { string signature = config.readString(".signature"); bytes32 salt = config.readBytes32(".salt"); - function run() public returns (GenericRateProvider rateProvider) { + function run() public broadcast returns (GenericRateProvider rateProvider) { bytes4 functionSig = bytes4(keccak256(bytes(signature))); console2.logBytes4(functionSig); diff --git a/script/deploy/deployAll.s.sol b/script/deploy/deployAll.s.sol index d02c159..a9a72fd 100644 --- a/script/deploy/deployAll.s.sol +++ b/script/deploy/deployAll.s.sol @@ -90,6 +90,8 @@ contract DeployAll is BaseScript { teller = new DeployCrossChainOPTellerWithMultiAssetSupport().deploy(config); } else if (compareStrings(config.tellerContractName, "MultiChainLayerZeroTellerWithMultiAssetSupport")) { teller = new DeployMultiChainLayerZeroTellerWithMultiAssetSupport().deploy(config); + } else if (compareStrings(config.tellerContractName, "TellerWithMultiAssetSupport")) { + teller = new DeployTellerWithMultiAssetSupport().deploy(config); } else { revert INVALID_TELLER_CONTRACT_NAME(); } diff --git a/script/deploy/single/04_DeployAccountantWithRateProviders.s.sol b/script/deploy/single/04_DeployAccountantWithRateProviders.s.sol index 2b5325e..a761cd0 100644 --- a/script/deploy/single/04_DeployAccountantWithRateProviders.s.sol +++ b/script/deploy/single/04_DeployAccountantWithRateProviders.s.sol @@ -30,7 +30,13 @@ contract DeployAccountantWithRateProviders is BaseScript { require(config.allowedExchangeRateChangeLower >= 0.997e4, "allowedExchangeRateChangeLower lower bound"); require(config.minimumUpdateDelayInSeconds >= 3600, "minimumUpdateDelayInSeconds"); require(config.managementFee < 1e4, "managementFee"); - require(startingExchangeRate == 1e18, "starting exchange rate must be 1e18"); + require( + startingExchangeRate == 10 ** config.baseDecimals, + "starting exchange rate must be equal to base decimals" + ); + // TODO This could now be removed since starting exchange rate must always be enforced to be equal to base + // decimals. + // require(startingExchangeRate == 1e18, "starting exchange rate must be 1e18"); } // Create Contract bytes memory creationCode = type(AccountantWithRateProviders).creationCode; diff --git a/src/helper/Constants.sol b/src/helper/Constants.sol index 367be16..17cc9cc 100644 --- a/src/helper/Constants.sol +++ b/src/helper/Constants.sol @@ -10,3 +10,4 @@ IPriceFeed constant ETH_PER_RSWETH_CHAINLINK = IPriceFeed(0xb613CfebD0b6e95abDDe IPriceFeed constant ETH_PER_PUFETH_REDSTONE = IPriceFeed(0x76A495b0bFfb53ef3F0E94ef0763e03cE410835C); address constant SWBTC = 0x8DB2350D78aBc13f5673A411D4700BCF87864dDE; +address constant WBTC_ETHEREUM = 0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599; From b8036ab33bbd6f7b9ae0d374d27ed1e75f8a1c84 Mon Sep 17 00:00:00 2001 From: Jun Kim <64379343+junkim012@users.noreply.github.com> Date: Thu, 22 Aug 2024 23:14:38 +0900 Subject: [PATCH 14/24] chore: fix spelling error and remove base from chain specific config to deployment specific config --- deployment-config/boba-eth-l1-08-09-24.json | 2 ++ deployment-config/boba-eth-l2-08-09-24.json | 2 ++ deployment-config/chains/1.json | 1 - deployment-config/chains/1329.json | 1 - deployment-config/chains/252.json | 1 - deployment-config/chains/288.json | 1 - deployment-config/fraxtal-eth-l1-08-13-24.json | 2 ++ deployment-config/fraxtal-eth-l2-08-13-24.json | 2 ++ deployment-config/sei-eth-l1-08-08-24.json | 3 ++- deployment-config/sei-eth-l2-08-08-24.json | 3 ++- .../deploy/single/04_DeployAccountantWithRateProviders.s.sol | 3 --- src/helper/GenericRateProvider.sol | 4 ++-- 12 files changed, 14 insertions(+), 11 deletions(-) diff --git a/deployment-config/boba-eth-l1-08-09-24.json b/deployment-config/boba-eth-l1-08-09-24.json index e7da60c..ad107ea 100644 --- a/deployment-config/boba-eth-l1-08-09-24.json +++ b/deployment-config/boba-eth-l1-08-09-24.json @@ -1,5 +1,7 @@ { "protocolAdmin": "0x0000000000417626Ef34D62C4DC189b021603f2F", + "base": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", + "baseDecimals": "18", "boringVault": { "boringVaultSalt": "0x1000000000000000000000000000000000000000000000000000000000000001", "boringVaultName": "Boba Native Yield Nucleus Token", diff --git a/deployment-config/boba-eth-l2-08-09-24.json b/deployment-config/boba-eth-l2-08-09-24.json index 548680c..547df94 100644 --- a/deployment-config/boba-eth-l2-08-09-24.json +++ b/deployment-config/boba-eth-l2-08-09-24.json @@ -1,5 +1,7 @@ { "protocolAdmin": "0x0888c3D797E13892C5e67cD802F93Ffe55Ea2826", + "base": "0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000", + "baseDecimals": "18", "boringVault": { "boringVaultSalt": "0x1000000000000000000000000000000000000000000000000000000000000001", "boringVaultName": "Boba Native Yield Nucleus Token", diff --git a/deployment-config/chains/1.json b/deployment-config/chains/1.json index 42a3ea0..fc8de28 100644 --- a/deployment-config/chains/1.json +++ b/deployment-config/chains/1.json @@ -1,5 +1,4 @@ { - "base": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "balancerVault": "0xBA12222222228d8Ba445958a75a0704d566BF2C8", "opMessenger": "0x25ace71c97B33Cc4729CF772ae268934F7ab5fA1", "lzEndpoint": "0x1a44076050125825900e736c501f859c50fE728c", diff --git a/deployment-config/chains/1329.json b/deployment-config/chains/1329.json index d3691e2..67171d8 100644 --- a/deployment-config/chains/1329.json +++ b/deployment-config/chains/1329.json @@ -1,5 +1,4 @@ { - "base": "0x160345fC359604fC6e70E3c5fAcbdE5F7A9342d8", "balancerVault": "0x0000000000000000000000000000000000000000", "lzEndpoint": "0x1a44076050125825900e736c501f859c50fE728c" } \ No newline at end of file diff --git a/deployment-config/chains/252.json b/deployment-config/chains/252.json index 1e7aea7..68c5b63 100644 --- a/deployment-config/chains/252.json +++ b/deployment-config/chains/252.json @@ -1,5 +1,4 @@ { - "base": "0xFC00000000000000000000000000000000000006", "balancerVault": "0x0000000000000000000000000000000000000000", "lzEndpoint": "0x1a44076050125825900e736c501f859c50fE728c" } \ No newline at end of file diff --git a/deployment-config/chains/288.json b/deployment-config/chains/288.json index 82b445f..1d0cca9 100644 --- a/deployment-config/chains/288.json +++ b/deployment-config/chains/288.json @@ -1,5 +1,4 @@ { - "base": "0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000", "balancerVault": "0x0000000000000000000000000000000000000000", "lzEndpoint": "0x0000000000000000000000000000000000000000" } \ No newline at end of file diff --git a/deployment-config/fraxtal-eth-l1-08-13-24.json b/deployment-config/fraxtal-eth-l1-08-13-24.json index d2fad36..a688703 100644 --- a/deployment-config/fraxtal-eth-l1-08-13-24.json +++ b/deployment-config/fraxtal-eth-l1-08-13-24.json @@ -1,5 +1,7 @@ { "protocolAdmin": "0x0000000000417626Ef34D62C4DC189b021603f2F", + "base": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", + "baseDecimals": "18", "boringVault": { "boringVaultSalt": "0x1000000000000000000000000000000000000000000000000000000000000002", "boringVaultName": "Fraxtal Native Yield Nucleus Token", diff --git a/deployment-config/fraxtal-eth-l2-08-13-24.json b/deployment-config/fraxtal-eth-l2-08-13-24.json index b168066..d618a44 100644 --- a/deployment-config/fraxtal-eth-l2-08-13-24.json +++ b/deployment-config/fraxtal-eth-l2-08-13-24.json @@ -1,5 +1,7 @@ { "protocolAdmin": "0x0888c3D797E13892C5e67cD802F93Ffe55Ea2826", + "base": "0xFC00000000000000000000000000000000000006", + "baseDecimals": "18", "boringVault": { "boringVaultSalt": "0x1000000000000000000000000000000000000000000000000000000000000002", "boringVaultName": "Fraxtal Native Yield Nucleus Token", diff --git a/deployment-config/sei-eth-l1-08-08-24.json b/deployment-config/sei-eth-l1-08-08-24.json index ccb2cec..588851f 100644 --- a/deployment-config/sei-eth-l1-08-08-24.json +++ b/deployment-config/sei-eth-l1-08-08-24.json @@ -1,6 +1,7 @@ { "protocolAdmin": "0x0000000000417626Ef34D62C4DC189b021603f2F", - + "base": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", + "baseDecimals": "18", "boringVault":{ "boringVaultSalt": "0x100000000000000000000000000000000000000000000000000000000000000a", "boringVaultName": "Sei Native Yield Nucleus Token", diff --git a/deployment-config/sei-eth-l2-08-08-24.json b/deployment-config/sei-eth-l2-08-08-24.json index bad0b23..852d858 100644 --- a/deployment-config/sei-eth-l2-08-08-24.json +++ b/deployment-config/sei-eth-l2-08-08-24.json @@ -1,6 +1,7 @@ { "protocolAdmin": "0xF2dE1311C5b2C1BD94de996DA13F80010453e505", - + "base": "0x160345fC359604fC6e70E3c5fAcbdE5F7A9342d8", + "baseDecimals": "18", "boringVault":{ "boringVaultSalt": "0x1000000000000000000000000000000000000000000000000000000000000000", "boringVaultName": "Sei Native Yield Nucleus Token", diff --git a/script/deploy/single/04_DeployAccountantWithRateProviders.s.sol b/script/deploy/single/04_DeployAccountantWithRateProviders.s.sol index a761cd0..4782180 100644 --- a/script/deploy/single/04_DeployAccountantWithRateProviders.s.sol +++ b/script/deploy/single/04_DeployAccountantWithRateProviders.s.sol @@ -34,9 +34,6 @@ contract DeployAccountantWithRateProviders is BaseScript { startingExchangeRate == 10 ** config.baseDecimals, "starting exchange rate must be equal to base decimals" ); - // TODO This could now be removed since starting exchange rate must always be enforced to be equal to base - // decimals. - // require(startingExchangeRate == 1e18, "starting exchange rate must be 1e18"); } // Create Contract bytes memory creationCode = type(AccountantWithRateProviders).creationCode; diff --git a/src/helper/GenericRateProvider.sol b/src/helper/GenericRateProvider.sol index 8f4a9e6..4e8d8da 100644 --- a/src/helper/GenericRateProvider.sol +++ b/src/helper/GenericRateProvider.sol @@ -32,7 +32,7 @@ contract GenericRateProvider is IRateProvider { constructor( address _target, - bytes4 _selctor, + bytes4 _selector, bytes32 _staticArgument0, bytes32 _staticArgument1, bytes32 _staticArgument2, @@ -43,7 +43,7 @@ contract GenericRateProvider is IRateProvider { bytes32 _staticArgument7 ) { target = _target; - selector = _selctor; + selector = _selector; staticArgument0 = _staticArgument0; staticArgument1 = _staticArgument1; staticArgument2 = _staticArgument2; From dcc199ef7e7f357e5c6024aa01c800cfdf41f26f Mon Sep 17 00:00:00 2001 From: Jun Kim <64379343+junkim012@users.noreply.github.com> Date: Fri, 23 Aug 2024 00:27:41 +0900 Subject: [PATCH 15/24] fix: do not hardcode boring vault decimals --- deployment-config/boba-eth-l1-08-09-24.json | 2 +- deployment-config/boba-eth-l2-08-09-24.json | 2 +- deployment-config/fraxtal-eth-l1-08-13-24.json | 2 +- deployment-config/fraxtal-eth-l2-08-13-24.json | 2 +- deployment-config/sei-eth-l1-08-08-24.json | 2 +- deployment-config/sei-eth-l2-08-08-24.json | 2 +- .../{rswBTC-l1.json => swell-btc-l1-08-22-24.json} | 14 +++++++------- script/ConfigReader.s.sol | 4 ++-- script/deploy/single/02_DeployBoringVault.s.sol | 7 +++++-- .../04_DeployAccountantWithRateProviders.s.sol | 4 ++-- 10 files changed, 22 insertions(+), 19 deletions(-) rename deployment-config/{rswBTC-l1.json => swell-btc-l1-08-22-24.json} (87%) diff --git a/deployment-config/boba-eth-l1-08-09-24.json b/deployment-config/boba-eth-l1-08-09-24.json index ad107ea..33eda44 100644 --- a/deployment-config/boba-eth-l1-08-09-24.json +++ b/deployment-config/boba-eth-l1-08-09-24.json @@ -1,7 +1,7 @@ { "protocolAdmin": "0x0000000000417626Ef34D62C4DC189b021603f2F", "base": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", - "baseDecimals": "18", + "boringVaultAndBaseDecimals": "18", "boringVault": { "boringVaultSalt": "0x1000000000000000000000000000000000000000000000000000000000000001", "boringVaultName": "Boba Native Yield Nucleus Token", diff --git a/deployment-config/boba-eth-l2-08-09-24.json b/deployment-config/boba-eth-l2-08-09-24.json index 547df94..9aa29f4 100644 --- a/deployment-config/boba-eth-l2-08-09-24.json +++ b/deployment-config/boba-eth-l2-08-09-24.json @@ -1,7 +1,7 @@ { "protocolAdmin": "0x0888c3D797E13892C5e67cD802F93Ffe55Ea2826", "base": "0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000", - "baseDecimals": "18", + "boringVaultAndBaseDecimals": "18", "boringVault": { "boringVaultSalt": "0x1000000000000000000000000000000000000000000000000000000000000001", "boringVaultName": "Boba Native Yield Nucleus Token", diff --git a/deployment-config/fraxtal-eth-l1-08-13-24.json b/deployment-config/fraxtal-eth-l1-08-13-24.json index a688703..b57624c 100644 --- a/deployment-config/fraxtal-eth-l1-08-13-24.json +++ b/deployment-config/fraxtal-eth-l1-08-13-24.json @@ -1,7 +1,7 @@ { "protocolAdmin": "0x0000000000417626Ef34D62C4DC189b021603f2F", "base": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", - "baseDecimals": "18", + "boringVaultAndBaseDecimals": "18", "boringVault": { "boringVaultSalt": "0x1000000000000000000000000000000000000000000000000000000000000002", "boringVaultName": "Fraxtal Native Yield Nucleus Token", diff --git a/deployment-config/fraxtal-eth-l2-08-13-24.json b/deployment-config/fraxtal-eth-l2-08-13-24.json index d618a44..29fd832 100644 --- a/deployment-config/fraxtal-eth-l2-08-13-24.json +++ b/deployment-config/fraxtal-eth-l2-08-13-24.json @@ -1,7 +1,7 @@ { "protocolAdmin": "0x0888c3D797E13892C5e67cD802F93Ffe55Ea2826", "base": "0xFC00000000000000000000000000000000000006", - "baseDecimals": "18", + "boringVaultAndBaseDecimals": "18", "boringVault": { "boringVaultSalt": "0x1000000000000000000000000000000000000000000000000000000000000002", "boringVaultName": "Fraxtal Native Yield Nucleus Token", diff --git a/deployment-config/sei-eth-l1-08-08-24.json b/deployment-config/sei-eth-l1-08-08-24.json index 588851f..97b662e 100644 --- a/deployment-config/sei-eth-l1-08-08-24.json +++ b/deployment-config/sei-eth-l1-08-08-24.json @@ -1,7 +1,7 @@ { "protocolAdmin": "0x0000000000417626Ef34D62C4DC189b021603f2F", "base": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", - "baseDecimals": "18", + "boringVaultAndBaseDecimals": "18", "boringVault":{ "boringVaultSalt": "0x100000000000000000000000000000000000000000000000000000000000000a", "boringVaultName": "Sei Native Yield Nucleus Token", diff --git a/deployment-config/sei-eth-l2-08-08-24.json b/deployment-config/sei-eth-l2-08-08-24.json index 852d858..93766a6 100644 --- a/deployment-config/sei-eth-l2-08-08-24.json +++ b/deployment-config/sei-eth-l2-08-08-24.json @@ -1,7 +1,7 @@ { "protocolAdmin": "0xF2dE1311C5b2C1BD94de996DA13F80010453e505", "base": "0x160345fC359604fC6e70E3c5fAcbdE5F7A9342d8", - "baseDecimals": "18", + "boringVaultAndBaseDecimals": "18", "boringVault":{ "boringVaultSalt": "0x1000000000000000000000000000000000000000000000000000000000000000", "boringVaultName": "Sei Native Yield Nucleus Token", diff --git a/deployment-config/rswBTC-l1.json b/deployment-config/swell-btc-l1-08-22-24.json similarity index 87% rename from deployment-config/rswBTC-l1.json rename to deployment-config/swell-btc-l1-08-22-24.json index ce53341..c84c007 100644 --- a/deployment-config/rswBTC-l1.json +++ b/deployment-config/swell-btc-l1-08-22-24.json @@ -1,24 +1,24 @@ { "protocolAdmin": "0x0000000000417626Ef34D62C4DC189b021603f2F", "base": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", - "baseDecimals": "8", + "boringVaultAndBaseDecimals": "8", "boringVault":{ - "boringVaultSalt": "0x100000000000000000000000000000000000000000000000000000000000000b", - "boringVaultName": "Swell Native Yield Nucleus Token", + "boringVaultSalt": "0x100000000000000000000000000000000000000000000000000000000000000c", + "boringVaultName": "Swell BTC Native Yield Nucleus Token", "boringVaultSymbol": "rswBTC", "address": "0x0000000000000000000000000000000000000000" }, "manager":{ - "managerSalt": "0x200000000000000000000000000000000000000000000000000000000000000b", + "managerSalt": "0x200000000000000000000000000000000000000000000000000000000000000c", "address": "0x0000000000000000000000000000000000000000" }, "accountant":{ - "accountantSalt": "0x300000000000000000000000000000000000000000000000000000000000000b", + "accountantSalt": "0x300000000000000000000000000000000000000000000000000000000000000c", "payoutAddress": "0x0000000000417626Ef34D62C4DC189b021603f2F", "allowedExchangeRateChangeUpper": "10030", "allowedExchangeRateChangeLower": "9980", @@ -29,7 +29,7 @@ }, "teller": { - "tellerSalt": "0x400000000000000000000000000000000000000000000000000000000000000a", + "tellerSalt": "0x400000000000000000000000000000000000000000000000000000000000000c", "maxGasForPeer": 200000, "minGasForPeer": 60000, "peerEid": 0, @@ -41,7 +41,7 @@ "address": "0x0000000000000000000000000000000000000000" }, "rolesAuthority": { - "rolesAuthoritySalt": "0x500000000000000000000000000000000000000000000000000000000000000b", + "rolesAuthoritySalt": "0x500000000000000000000000000000000000000000000000000000000000000c", "strategist": "0x0000000000417626Ef34D62C4DC189b021603f2F", "exchangeRateBot": "0x0000000000417626Ef34D62C4DC189b021603f2F", diff --git a/script/ConfigReader.s.sol b/script/ConfigReader.s.sol index 2cdb0e7..efe99cd 100644 --- a/script/ConfigReader.s.sol +++ b/script/ConfigReader.s.sol @@ -15,7 +15,7 @@ library ConfigReader { struct Config { address protocolAdmin; address base; - uint8 baseDecimals; + uint8 boringVaultAndBaseDecimals; bytes32 accountantSalt; address boringVault; address payoutAddress; @@ -58,7 +58,7 @@ library ConfigReader { // Reading the 'protocolAdmin' config.protocolAdmin = _config.readAddress(".protocolAdmin"); config.base = _config.readAddress(".base"); - config.baseDecimals = uint8(_config.readUint(".baseDecimals")); + config.boringVaultAndBaseDecimals = uint8(_config.readUint(".boringVaultAndBaseDecimals")); // Reading from the 'accountant' section config.accountant = _config.readAddress(".accountant.address"); diff --git a/script/deploy/single/02_DeployBoringVault.s.sol b/script/deploy/single/02_DeployBoringVault.s.sol index ea4ddea..263eefe 100644 --- a/script/deploy/single/02_DeployBoringVault.s.sol +++ b/script/deploy/single/02_DeployBoringVault.s.sol @@ -4,6 +4,7 @@ pragma solidity 0.8.21; import { BoringVault } from "./../../../src/base/BoringVault.sol"; import { BaseScript } from "./../../Base.s.sol"; import { ConfigReader } from "../../ConfigReader.s.sol"; +import { ERC20 } from "@solmate/tokens/ERC20.sol"; import { stdJson as StdJson } from "@forge-std/StdJson.sol"; contract DeployIonBoringVaultScript is BaseScript { @@ -31,7 +32,7 @@ contract DeployIonBoringVaultScript is BaseScript { broadcaster, config.boringVaultName, config.boringVaultSymbol, - 18 // decimals + config.boringVaultAndBaseDecimals // decimals ) ) ) @@ -41,7 +42,9 @@ contract DeployIonBoringVaultScript is BaseScript { // Post Deploy Checks require(boringVault.owner() == broadcaster, "owner should be the deployer"); require(address(boringVault.hook()) == address(0), "before transfer hook should be zero"); - + require( + boringVault.decimals() == ERC20(config.base).decimals(), "boringVault decimals should be the same as base" + ); return address(boringVault); } } diff --git a/script/deploy/single/04_DeployAccountantWithRateProviders.s.sol b/script/deploy/single/04_DeployAccountantWithRateProviders.s.sol index 4782180..90ae876 100644 --- a/script/deploy/single/04_DeployAccountantWithRateProviders.s.sol +++ b/script/deploy/single/04_DeployAccountantWithRateProviders.s.sol @@ -31,8 +31,8 @@ contract DeployAccountantWithRateProviders is BaseScript { require(config.minimumUpdateDelayInSeconds >= 3600, "minimumUpdateDelayInSeconds"); require(config.managementFee < 1e4, "managementFee"); require( - startingExchangeRate == 10 ** config.baseDecimals, - "starting exchange rate must be equal to base decimals" + startingExchangeRate == 10 ** config.boringVaultAndBaseDecimals, + "starting exchange rate must be equal to the boringVault and base decimals" ); } // Create Contract From 34eb07b6a7bd6d65d1ec061a14a3b7e584c91561 Mon Sep 17 00:00:00 2001 From: Carson Date: Thu, 29 Aug 2024 21:36:24 -0400 Subject: [PATCH 16/24] chore: chain config sepolia --- deployment-config/chains/11155111.json | 6 ++ .../form-testnet-l1-08-30-24.json | 56 +++++++++++++++++++ script/Base.s.sol | 2 +- script/DeployCustomCreatex.s.sol | 2 +- 4 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 deployment-config/chains/11155111.json create mode 100644 deployment-config/form-testnet-l1-08-30-24.json diff --git a/deployment-config/chains/11155111.json b/deployment-config/chains/11155111.json new file mode 100644 index 0000000..5f29a22 --- /dev/null +++ b/deployment-config/chains/11155111.json @@ -0,0 +1,6 @@ +{ + "base": "0xb16F35c0Ae2912430DAc15764477E179D9B9EbEa", + "balancerVault": "0xBA12222222228d8Ba445958a75a0704d566BF2C8", + "opMessenger": "0x58Cc85b8D04EA49cC6DBd3CbFFd00B4B8D6cb3ef", + "lzEndpoint": "0x6EDCE65403992e310A62460808c4b910D972f10f" + } \ No newline at end of file diff --git a/deployment-config/form-testnet-l1-08-30-24.json b/deployment-config/form-testnet-l1-08-30-24.json new file mode 100644 index 0000000..5a49730 --- /dev/null +++ b/deployment-config/form-testnet-l1-08-30-24.json @@ -0,0 +1,56 @@ +{ + "protocolAdmin": "0x0000000000417626Ef34D62C4DC189b021603f2F", + "boringVault": { + "boringVaultSalt": "0x1ddd634c506ad203da17ff00000000000000000000000000000000000000000e", + "boringVaultName": "Form ETH", + "boringVaultSymbol": "FETH", + "address": "0x0000000000000000000000000000000000000000" + }, + "manager": { + "managerSalt": "0x30432d4b4ec00003b4a25000000000000000000000000000000000000000000e", + "address": "0x0000000000000000000000000000000000000000" + }, + "accountant": { + "accountantSalt": "0x6a184dbea6f3cc0318679f00000000000000000000000000000000000000000e", + "payoutAddress": "0x0000000000417626Ef34D62C4DC189b021603f2F", + "allowedExchangeRateChangeUpper": "10003", + "allowedExchangeRateChangeLower": "9998", + "minimumUpdateDelayInSeconds": "3600", + "managementFee": "0", + "address": "0x0000000000000000000000000000000000000000" + }, + "teller": { + "tellerSalt": "0x51f8968749a56d01202c9100000000000000000000000000000000000000000e", + "maxGasForPeer": 100000, + "minGasForPeer": 0, + "peerEid": 40270, + "tellerContractName": "MultiChainLayerZeroTellerWithMultiAssetSupport", + "assets": [ + + ], + "dvnIfNoDefault": { + "required": [ + "0x589dEDbD617e0CBcB916A9223F4d1300c294236b" + ], + "optional": [ + "0x380275805876Ff19055EA900CDb2B46a94ecF20D", + "0x8FafAE7Dd957044088b3d0F67359C327c6200d18", + "0xa59BA433ac34D2927232918Ef5B2eaAfcF130BA5", + "0xe552485d02EDd3067FE7FCbD4dd56BB1D3A998D2" + ], + "blockConfirmationsRequiredIfNoDefault": 15, + "optionalThreshold": 1 + }, + "address": "0x0000000000000000000000000000000000000000" + }, + "rolesAuthority": { + "rolesAuthoritySalt": "0x66bbc3b3b3000b01466a3a00000000000000000000000000000000000000000e", + "strategist": "0x0000000000417626Ef34D62C4DC189b021603f2F", + "exchangeRateBot": "0x0000000000417626Ef34D62C4DC189b021603f2F", + "address": "0x0000000000000000000000000000000000000000" + }, + "decoder": { + "decoderSalt": "0x48b53893da2e0b0248268c00000000000000000000000000000000000000000e", + "address": "0x0000000000000000000000000000000000000000" + } + } \ No newline at end of file diff --git a/script/Base.s.sol b/script/Base.s.sol index c832210..e5dbc4b 100644 --- a/script/Base.s.sol +++ b/script/Base.s.sol @@ -19,7 +19,7 @@ abstract contract BaseScript is Script { string constant CONFIG_CHAIN_ROOT = "./deployment-config/chains/"; /// Custom base params - ICreateX CREATEX = ICreateX(0xD7d6e6C50507d278b9F43f62Bc7b9310ECeff2C5); + ICreateX CREATEX = ICreateX(0x1C64d5eBCf22AC237d00cF7bB9Be6395e59B23b7); /// @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"; diff --git a/script/DeployCustomCreatex.s.sol b/script/DeployCustomCreatex.s.sol index 2dba87c..21f882c 100644 --- a/script/DeployCustomCreatex.s.sol +++ b/script/DeployCustomCreatex.s.sol @@ -10,7 +10,7 @@ contract DeployCustomCreateX is Script { string internal mnemonic; string internal constant TEST_MNEMONIC = "test test test test test test test test test test test junk"; - address constant EXPECTED = 0xD7d6e6C50507d278b9F43f62Bc7b9310ECeff2C5; + address constant EXPECTED = 0x1C64d5eBCf22AC237d00cF7bB9Be6395e59B23b7; bytes32 constant SALT = 0x8888888833388888888000000000000000000000000000000000000000000000; constructor() { From cbe0b2e4fb524a8c71439fe6ca7cd1e8221c6caa Mon Sep 17 00:00:00 2001 From: Carson Date: Sun, 1 Sep 2024 17:46:41 -0400 Subject: [PATCH 17/24] build: form deployment on sepolia --- Makefile | 19 ++- .../form-btc-testnet-l1-08-30-24.json | 110 +++++++++--------- .../form-eth-testnet-l1-08-30-24.json | 2 +- .../form-usd-testnet-l1-08-30-24.json | 110 +++++++++--------- 4 files changed, 127 insertions(+), 114 deletions(-) diff --git a/Makefile b/Makefile index 4bf4c2f..630343d 100644 --- a/Makefile +++ b/Makefile @@ -6,4 +6,21 @@ checkL1: checkL2: @echo "Setting environment variable LIVE_DEPLOY_READ_FILE_NAME to $(file)" - @export LIVE_DEPLOY_READ_FILE_NAME=$(file) && forge test --mp test/LiveDeploy.t.sol --fork-url=${L2_RPC_URL} \ No newline at end of file + @export LIVE_DEPLOY_READ_FILE_NAME=$(file) && forge test --mp test/LiveDeploy.t.sol --fork-url=${L2_RPC_URL} + +deployL1: + @echo "Setting environment variable LIVE_DEPLOY_READ_FILE_NAME to $(file)" + @export LIVE_DEPLOY_READ_FILE_NAME=$(file) && forge script script/deploy/deployAll.s.sol --sig "run(string)" $(file) --fork-url=${L1_RPC_URL} + +deployL2: + @echo "Setting environment variable LIVE_DEPLOY_READ_FILE_NAME to $(file)" + @export LIVE_DEPLOY_READ_FILE_NAME=$(file) && forge script script/deploy/deployAll.s.sol --sig "run(string)" $(file) --fork-url=${L1_RPC_URL} + +live-deployL1: + @echo "Setting environment variable LIVE_DEPLOY_READ_FILE_NAME to $(file)" + @export LIVE_DEPLOY_READ_FILE_NAME=$(file) && forge script script/deploy/deployAll.s.sol --sig "run(string)" $(file) --fork-url=${L1_RPC_URL} --private-key=$(PRIVATE_KEY) --broadcast --slow --verify + +live- deployL2: + @echo "Setting environment variable LIVE_DEPLOY_READ_FILE_NAME to $(file)" + @export LIVE_DEPLOY_READ_FILE_NAME=$(file) && forge script script/deploy/deployAll.s.sol --sig "run(string)" $(file) --fork-url=${L1_RPC_URL} --private-key=$(PRIVATE_KEY) --broadcast --slow --verify + diff --git a/deployment-config/form-btc-testnet-l1-08-30-24.json b/deployment-config/form-btc-testnet-l1-08-30-24.json index 7dccdc1..5805959 100644 --- a/deployment-config/form-btc-testnet-l1-08-30-24.json +++ b/deployment-config/form-btc-testnet-l1-08-30-24.json @@ -1,59 +1,57 @@ { - "base": "0x92f3B59a79bFf5dc60c0d59eA13a44D082B2bdFC", - "protocolAdmin": "0x0000000000417626Ef34D62C4DC189b021603f2F", - "boringVaultAndBaseDecimals": "8", - "boringVault": { - "boringVaultSalt": "0x1ddd634c506ad203da17ff00000000000000000000000000000000000000000e", - "boringVaultName": "Form ETH", - "boringVaultSymbol": "FETH", - "address": "0x0000000000000000000000000000000000000000" - }, - "manager": { - "managerSalt": "0x30432d4b4ec00003b4a25000000000000000000000000000000000000000000e", - "address": "0x0000000000000000000000000000000000000000" - }, - "accountant": { - "accountantSalt": "0x6a184dbea6f3cc0318679f00000000000000000000000000000000000000000e", - "payoutAddress": "0x0000000000417626Ef34D62C4DC189b021603f2F", - "allowedExchangeRateChangeUpper": "10003", - "allowedExchangeRateChangeLower": "9998", - "minimumUpdateDelayInSeconds": "3600", - "managementFee": "0", - "address": "0x0000000000000000000000000000000000000000" - }, - "teller": { - "tellerSalt": "0x51f8968749a56d01202c9100000000000000000000000000000000000000000e", - "maxGasForPeer": 100000, - "minGasForPeer": 0, - "peerEid": 40270, - "tellerContractName": "TellerWithMultiAssetSupport", - "opMessenger": "0x58Cc85b8D04EA49cC6DBd3CbFFd00B4B8D6cb3ef", - "assets": [ - + "base": "0x0893A950E8f80B21658ba35D39d9AB00cCa95589", + "protocolAdmin": "0x0000000000417626Ef34D62C4DC189b021603f2F", + "boringVaultAndBaseDecimals": "8", + "boringVault": { + "boringVaultSalt": "0x1ddd634c506ad203da17ff000000000000000000000000000000000000000011", + "boringVaultName": "Form BTC", + "boringVaultSymbol": "FBTC", + "address": "0x0000000000000000000000000000000000000000" + }, + "manager": { + "managerSalt": "0x30432d4b4ec00003b4a250000000000000000000000000000000000000000011", + "address": "0x0000000000000000000000000000000000000000" + }, + "accountant": { + "accountantSalt": "0x6a184dbea6f3cc0318679f000000000000000000000000000000000000000011", + "payoutAddress": "0x0000000000417626Ef34D62C4DC189b021603f2F", + "allowedExchangeRateChangeUpper": "10003", + "allowedExchangeRateChangeLower": "9998", + "minimumUpdateDelayInSeconds": "3600", + "managementFee": "0", + "address": "0x0000000000000000000000000000000000000000" + }, + "teller": { + "tellerSalt": "0x51f8968749a56d01202c91000000000000000000000000000000000000000011", + "maxGasForPeer": 100000, + "minGasForPeer": 0, + "peerEid": 40270, + "tellerContractName": "TellerWithMultiAssetSupport", + "opMessenger": "0x58Cc85b8D04EA49cC6DBd3CbFFd00B4B8D6cb3ef", + "assets": [], + "dvnIfNoDefault": { + "required": [ + "0x589dEDbD617e0CBcB916A9223F4d1300c294236b" ], - "dvnIfNoDefault": { - "required": [ - "0x589dEDbD617e0CBcB916A9223F4d1300c294236b" - ], - "optional": [ - "0x380275805876Ff19055EA900CDb2B46a94ecF20D", - "0x8FafAE7Dd957044088b3d0F67359C327c6200d18", - "0xa59BA433ac34D2927232918Ef5B2eaAfcF130BA5", - "0xe552485d02EDd3067FE7FCbD4dd56BB1D3A998D2" - ], - "blockConfirmationsRequiredIfNoDefault": 15, - "optionalThreshold": 1 - }, - "address": "0x0000000000000000000000000000000000000000" - }, - "rolesAuthority": { - "rolesAuthoritySalt": "0x66bbc3b3b3000b01466a3a00000000000000000000000000000000000000000e", - "strategist": "0x0000000000417626Ef34D62C4DC189b021603f2F", - "exchangeRateBot": "0x0000000000417626Ef34D62C4DC189b021603f2F", - "address": "0x0000000000000000000000000000000000000000" + "optional": [ + "0x380275805876Ff19055EA900CDb2B46a94ecF20D", + "0x8FafAE7Dd957044088b3d0F67359C327c6200d18", + "0xa59BA433ac34D2927232918Ef5B2eaAfcF130BA5", + "0xe552485d02EDd3067FE7FCbD4dd56BB1D3A998D2" + ], + "blockConfirmationsRequiredIfNoDefault": 15, + "optionalThreshold": 1 }, - "decoder": { - "decoderSalt": "0x48b53893da2e0b0248268c00000000000000000000000000000000000000000e", - "address": "0x0000000000000000000000000000000000000000" - } - } \ No newline at end of file + "address": "0x0000000000000000000000000000000000000000" + }, + "rolesAuthority": { + "rolesAuthoritySalt": "0x66bbc3b3b3000b01466a3a000000000000000000000000000000000000000011", + "strategist": "0x0000000000417626Ef34D62C4DC189b021603f2F", + "exchangeRateBot": "0x0000000000417626Ef34D62C4DC189b021603f2F", + "address": "0x0000000000000000000000000000000000000000" + }, + "decoder": { + "decoderSalt": "0x48b53893da2e0b0248268c000000000000000000000000000000000000000011", + "address": "0x0000000000000000000000000000000000000000" + } +} \ No newline at end of file diff --git a/deployment-config/form-eth-testnet-l1-08-30-24.json b/deployment-config/form-eth-testnet-l1-08-30-24.json index b8041a5..bcb0cb6 100644 --- a/deployment-config/form-eth-testnet-l1-08-30-24.json +++ b/deployment-config/form-eth-testnet-l1-08-30-24.json @@ -1,5 +1,5 @@ { - "base": "0xb16F35c0Ae2912430DAc15764477E179D9B9EbEa", + "base": "0xee44150250AfF3E6aC25539765F056EDb7F85D7B", "protocolAdmin": "0x0000000000417626Ef34D62C4DC189b021603f2F", "boringVaultAndBaseDecimals": "18", "boringVault": { diff --git a/deployment-config/form-usd-testnet-l1-08-30-24.json b/deployment-config/form-usd-testnet-l1-08-30-24.json index 2401f6e..6206524 100644 --- a/deployment-config/form-usd-testnet-l1-08-30-24.json +++ b/deployment-config/form-usd-testnet-l1-08-30-24.json @@ -1,59 +1,57 @@ { - "base": "0x51fCe89b9f6D4c530698f181167043e1bB4abf89", - "protocolAdmin": "0x0000000000417626Ef34D62C4DC189b021603f2F", - "boringVaultAndBaseDecimals": "6", - "boringVault": { - "boringVaultSalt": "0x1ddd634c506ad203da17ff00000000000000000000000000000000000000000e", - "boringVaultName": "Form ETH", - "boringVaultSymbol": "FETH", - "address": "0x0000000000000000000000000000000000000000" - }, - "manager": { - "managerSalt": "0x30432d4b4ec00003b4a25000000000000000000000000000000000000000000e", - "address": "0x0000000000000000000000000000000000000000" - }, - "accountant": { - "accountantSalt": "0x6a184dbea6f3cc0318679f00000000000000000000000000000000000000000e", - "payoutAddress": "0x0000000000417626Ef34D62C4DC189b021603f2F", - "allowedExchangeRateChangeUpper": "10003", - "allowedExchangeRateChangeLower": "9998", - "minimumUpdateDelayInSeconds": "3600", - "managementFee": "0", - "address": "0x0000000000000000000000000000000000000000" - }, - "teller": { - "tellerSalt": "0x51f8968749a56d01202c9100000000000000000000000000000000000000000e", - "maxGasForPeer": 100000, - "minGasForPeer": 0, - "peerEid": 40270, - "tellerContractName": "TellerWithMultiAssetSupport", - "opMessenger": "0x58Cc85b8D04EA49cC6DBd3CbFFd00B4B8D6cb3ef", - "assets": [ - + "base": "0x66248001cdB1B26B66a89aA7227424Bb14937eCD", + "protocolAdmin": "0x0000000000417626Ef34D62C4DC189b021603f2F", + "boringVaultAndBaseDecimals": "6", + "boringVault": { + "boringVaultSalt": "0x1ddd634c506ad203da17ff000000000000000000000000000000000000000012", + "boringVaultName": "Form USDC", + "boringVaultSymbol": "FUSDC", + "address": "0x0000000000000000000000000000000000000000" + }, + "manager": { + "managerSalt": "0x30432d4b4ec00003b4a250000000000000000000000000000000000000000012", + "address": "0x0000000000000000000000000000000000000000" + }, + "accountant": { + "accountantSalt": "0x6a184dbea6f3cc0318679f000000000000000000000000000000000000000012", + "payoutAddress": "0x0000000000417626Ef34D62C4DC189b021603f2F", + "allowedExchangeRateChangeUpper": "10003", + "allowedExchangeRateChangeLower": "9998", + "minimumUpdateDelayInSeconds": "3600", + "managementFee": "0", + "address": "0x0000000000000000000000000000000000000000" + }, + "teller": { + "tellerSalt": "0x51f8968749a56d01202c91000000000000000000000000000000000000000012", + "maxGasForPeer": 100000, + "minGasForPeer": 0, + "peerEid": 40270, + "tellerContractName": "TellerWithMultiAssetSupport", + "opMessenger": "0x58Cc85b8D04EA49cC6DBd3CbFFd00B4B8D6cb3ef", + "assets": [], + "dvnIfNoDefault": { + "required": [ + "0x589dEDbD617e0CBcB916A9223F4d1300c294236b" ], - "dvnIfNoDefault": { - "required": [ - "0x589dEDbD617e0CBcB916A9223F4d1300c294236b" - ], - "optional": [ - "0x380275805876Ff19055EA900CDb2B46a94ecF20D", - "0x8FafAE7Dd957044088b3d0F67359C327c6200d18", - "0xa59BA433ac34D2927232918Ef5B2eaAfcF130BA5", - "0xe552485d02EDd3067FE7FCbD4dd56BB1D3A998D2" - ], - "blockConfirmationsRequiredIfNoDefault": 15, - "optionalThreshold": 1 - }, - "address": "0x0000000000000000000000000000000000000000" - }, - "rolesAuthority": { - "rolesAuthoritySalt": "0x66bbc3b3b3000b01466a3a00000000000000000000000000000000000000000e", - "strategist": "0x0000000000417626Ef34D62C4DC189b021603f2F", - "exchangeRateBot": "0x0000000000417626Ef34D62C4DC189b021603f2F", - "address": "0x0000000000000000000000000000000000000000" + "optional": [ + "0x380275805876Ff19055EA900CDb2B46a94ecF20D", + "0x8FafAE7Dd957044088b3d0F67359C327c6200d18", + "0xa59BA433ac34D2927232918Ef5B2eaAfcF130BA5", + "0xe552485d02EDd3067FE7FCbD4dd56BB1D3A998D2" + ], + "blockConfirmationsRequiredIfNoDefault": 15, + "optionalThreshold": 1 }, - "decoder": { - "decoderSalt": "0x48b53893da2e0b0248268c00000000000000000000000000000000000000000e", - "address": "0x0000000000000000000000000000000000000000" - } - } \ No newline at end of file + "address": "0x0000000000000000000000000000000000000000" + }, + "rolesAuthority": { + "rolesAuthoritySalt": "0x66bbc3b3b3000b01466a3a000000000000000000000000000000000000000012", + "strategist": "0x0000000000417626Ef34D62C4DC189b021603f2F", + "exchangeRateBot": "0x0000000000417626Ef34D62C4DC189b021603f2F", + "address": "0x0000000000000000000000000000000000000000" + }, + "decoder": { + "decoderSalt": "0x48b53893da2e0b0248268c000000000000000000000000000000000000000012", + "address": "0x0000000000000000000000000000000000000000" + } +} \ No newline at end of file From aa5da38e6894aa774385f23502ee53302ed33e38 Mon Sep 17 00:00:00 2001 From: Carson Date: Sun, 1 Sep 2024 18:14:53 -0400 Subject: [PATCH 18/24] example changed --- deployment-config/exampleL1.json | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/deployment-config/exampleL1.json b/deployment-config/exampleL1.json index 8fea879..801e989 100644 --- a/deployment-config/exampleL1.json +++ b/deployment-config/exampleL1.json @@ -1,18 +1,19 @@ { - "protocolAdmin": "0xC2d99d76bb9D46BF8Ec9449E4DfAE48C30CF0839", + "base": "0xee44150250AfF3E6aC25539765F056EDb7F85D7B", + "protocolAdmin": "0x0000000000417626Ef34D62C4DC189b021603f2F", "boringVaultAndBaseDecimals": "18", "boringVault": { - "boringVaultSalt": "0x1ddd634c506ad203da17ff00000000000000000000000000000000000000000e", + "boringVaultSalt": "0x1ddd634c506ad203da17ff00000000000000000000000000000000000000001c", "boringVaultName": "Nucleus Vault", "boringVaultSymbol": "NV", "address": "0x0000000000E7Ab44153eEBEF2343ba5289F65dAC" }, "manager": { - "managerSalt": "0x30432d4b4ec00003b4a25000000000000000000000000000000000000000000e", + "managerSalt": "0x30432d4b4ec00003b4a25000000000000000000000000000000000000000001c", "address": "0x0000000000fAd6Db23abdC1a85621B97bd1Dc82f" }, "accountant": { - "accountantSalt": "0x6a184dbea6f3cc0318679f00000000000000000000000000000000000000000e", + "accountantSalt": "0x6a184dbea6f3cc0318679f00000000000000000000000000000000000000001c", "payoutAddress": "0x0000000000417626Ef34D62C4DC189b021603f2F", "base": "0x5f207d42F869fd1c71d7f0f81a2A67Fc20FF7323", "allowedExchangeRateChangeUpper": "10003", @@ -22,7 +23,7 @@ "address": "0x00000000004F96C07B83e86600D86F9479bB43fa" }, "teller": { - "tellerSalt": "0x51f8968749a56d01202c9100000000000000000000000000000000000000000e", + "tellerSalt": "0x51f8968749a56d01202c9100000000000000000000000000000000000000001c", "maxGasForPeer": 100000, "minGasForPeer": 0, "peerEid": 30280, @@ -47,13 +48,13 @@ "address": "0x00000000004F96C07B83e86600D86F0000000000" }, "rolesAuthority": { - "rolesAuthoritySalt": "0x66bbc3b3b3000b01466a3a00000000000000000000000000000000000000000e", + "rolesAuthoritySalt": "0x66bbc3b3b3000b01466a3a00000000000000000000000000000000000000001c", "strategist": "0xC2d99d76bb9D46BF8Ec9449E4DfAE48C30CF0839", "exchangeRateBot": "0x00000000004F96C07B83e86600D86F0000000000", "address": "0x00000000004F96C07B83e86600D86F0000000000" }, "decoder": { - "decoderSalt": "0x48b53893da2e0b0248268c00000000000000000000000000000000000000000e", + "decoderSalt": "0x48b53893da2e0b0248268c00000000000000000000000000000000000000001c", "address": "0x00000000004F96C07B83e86600D86F0000000000" } } \ No newline at end of file From 799dbdd027f0d9ea071c1492716e2c7111d83ebd Mon Sep 17 00:00:00 2001 From: Carson Date: Thu, 5 Sep 2024 12:17:40 -0400 Subject: [PATCH 19/24] refactor: comment to clarify why CREATEX is different --- script/Base.s.sol | 1 + 1 file changed, 1 insertion(+) diff --git a/script/Base.s.sol b/script/Base.s.sol index cb758d9..055b4b3 100644 --- a/script/Base.s.sol +++ b/script/Base.s.sol @@ -17,6 +17,7 @@ abstract contract BaseScript is Script { string constant CONFIG_CHAIN_ROOT = "./deployment-config/chains/"; /// Custom base params + // Address for Sepolia ICreateX CREATEX = ICreateX(0x1C64d5eBCf22AC237d00cF7bB9Be6395e59B23b7); /// @dev Included to enable compilation of the script without a $MNEMONIC environment variable. From 2ed232cc004feff709b6a2da790ea550226da81c Mon Sep 17 00:00:00 2001 From: Carson Date: Thu, 5 Sep 2024 12:29:09 -0400 Subject: [PATCH 20/24] refactor: no assets in example --- deployment-config/exampleL1.json | 4 +--- deployment-config/exampleL2.json | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/deployment-config/exampleL1.json b/deployment-config/exampleL1.json index 801e989..9726e93 100644 --- a/deployment-config/exampleL1.json +++ b/deployment-config/exampleL1.json @@ -27,10 +27,8 @@ "maxGasForPeer": 100000, "minGasForPeer": 0, "peerEid": 30280, - "tellerContractName": "MultiChainLayerZeroTellerWithMultiAssetSupport", + "tellerContractName": "TellerWithMultiAssetSupport", "assets": [ - "0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee", - "0xbf5495Efe5DB9ce00f80364C8B423567e58d2110" ], "dvnIfNoDefault": { "required": [ diff --git a/deployment-config/exampleL2.json b/deployment-config/exampleL2.json index 01fd6d2..16fb01c 100644 --- a/deployment-config/exampleL2.json +++ b/deployment-config/exampleL2.json @@ -26,7 +26,7 @@ "maxGasForPeer": 100000, "minGasForPeer": 0, "peerEid": 30280, - "tellerContractName": "MultiChainLayerZeroTellerWithMultiAssetSupport", + "tellerContractName": "TellerWithMultiAssetSupport", "assets": [], "dvnIfNoDefault": { "required": [ From f0c86ffa34db913215d9bb5a9b83756c929bf6d0 Mon Sep 17 00:00:00 2001 From: Carson Date: Fri, 6 Sep 2024 14:21:52 -0400 Subject: [PATCH 21/24] fix: makefile fix --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 630343d..c92795e 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ live-deployL1: @echo "Setting environment variable LIVE_DEPLOY_READ_FILE_NAME to $(file)" @export LIVE_DEPLOY_READ_FILE_NAME=$(file) && forge script script/deploy/deployAll.s.sol --sig "run(string)" $(file) --fork-url=${L1_RPC_URL} --private-key=$(PRIVATE_KEY) --broadcast --slow --verify -live- deployL2: +live-deployL2: @echo "Setting environment variable LIVE_DEPLOY_READ_FILE_NAME to $(file)" @export LIVE_DEPLOY_READ_FILE_NAME=$(file) && forge script script/deploy/deployAll.s.sol --sig "run(string)" $(file) --fork-url=${L1_RPC_URL} --private-key=$(PRIVATE_KEY) --broadcast --slow --verify From 882e6c3d8bdda4711526b7c6dfab92bfd138bcaf Mon Sep 17 00:00:00 2001 From: Carson Date: Fri, 6 Sep 2024 14:32:15 -0400 Subject: [PATCH 22/24] fix: innacurate chain config data --- deployment-config/chains/1.json | 5 +++-- deployment-config/chains/11155111.json | 1 + deployment-config/chains/1329.json | 1 + deployment-config/chains/252.json | 1 + deployment-config/chains/288.json | 1 + 5 files changed, 7 insertions(+), 2 deletions(-) diff --git a/deployment-config/chains/1.json b/deployment-config/chains/1.json index 195e5b6..5c2bcbb 100644 --- a/deployment-config/chains/1.json +++ b/deployment-config/chains/1.json @@ -1,4 +1,5 @@ { + "name": "Ethereum", "balancerVault": "0xBA12222222228d8Ba445958a75a0704d566BF2C8", "opMessenger": "0x25ace71c97B33Cc4729CF772ae268934F7ab5fA1", "lzEndpoint": "0x1a44076050125825900e736c501f859c50fE728c", @@ -50,11 +51,11 @@ "rateProvider": "0x318Da095d602C08eF41319f4c4bA0646d318C906", "decimals": 8 }, - "":{ + "0x9ba021b0a9b958b5e75ce9f6dff97c7ee52cb3e6":{ "priceFeed": "0x19219bc90f48dee4d5cf202e09c438faacfd8bea", "rateProvider": "", "decimals": 18, - "description": "STETH / ETH", + "description": "apxETH/ETH", "priceFeedType": 1 } diff --git a/deployment-config/chains/11155111.json b/deployment-config/chains/11155111.json index 68a80b5..e900a9a 100644 --- a/deployment-config/chains/11155111.json +++ b/deployment-config/chains/11155111.json @@ -1,4 +1,5 @@ { + "name": "Ethereum Sepolia", "balancerVault": "0xBA12222222228d8Ba445958a75a0704d566BF2C8", "lzEndpoint": "0x6EDCE65403992e310A62460808c4b910D972f10f" } \ No newline at end of file diff --git a/deployment-config/chains/1329.json b/deployment-config/chains/1329.json index 67171d8..4596379 100644 --- a/deployment-config/chains/1329.json +++ b/deployment-config/chains/1329.json @@ -1,4 +1,5 @@ { + "name": "Sei", "balancerVault": "0x0000000000000000000000000000000000000000", "lzEndpoint": "0x1a44076050125825900e736c501f859c50fE728c" } \ No newline at end of file diff --git a/deployment-config/chains/252.json b/deployment-config/chains/252.json index 68c5b63..b7c0c39 100644 --- a/deployment-config/chains/252.json +++ b/deployment-config/chains/252.json @@ -1,4 +1,5 @@ { + "name": "Fraxtal", "balancerVault": "0x0000000000000000000000000000000000000000", "lzEndpoint": "0x1a44076050125825900e736c501f859c50fE728c" } \ No newline at end of file diff --git a/deployment-config/chains/288.json b/deployment-config/chains/288.json index 1d0cca9..21e0d49 100644 --- a/deployment-config/chains/288.json +++ b/deployment-config/chains/288.json @@ -1,4 +1,5 @@ { + "name": "Boba", "balancerVault": "0x0000000000000000000000000000000000000000", "lzEndpoint": "0x0000000000000000000000000000000000000000" } \ No newline at end of file From b3bdef2b17bc1b43db71686dab58f8beb528b693 Mon Sep 17 00:00:00 2001 From: Carson Date: Fri, 6 Sep 2024 14:39:37 -0400 Subject: [PATCH 23/24] chore: scripts moved to makefile --- .vscode/settings.json | 5 +++++ Makefile | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..df50115 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "cSpell.enableFiletypes": [ + "makefile" + ] +} \ No newline at end of file diff --git a/Makefile b/Makefile index c92795e..935477e 100644 --- a/Makefile +++ b/Makefile @@ -24,3 +24,23 @@ live-deployL2: @echo "Setting environment variable LIVE_DEPLOY_READ_FILE_NAME to $(file)" @export LIVE_DEPLOY_READ_FILE_NAME=$(file) && forge script script/deploy/deployAll.s.sol --sig "run(string)" $(file) --fork-url=${L1_RPC_URL} --private-key=$(PRIVATE_KEY) --broadcast --slow --verify +prettier: + prettier --write '**/*.{md,yml,yaml,ts,js}' + +solhint: + solhint -w 0 'src/**/*.sol' + +slither: + slither src + +prepare: + husky + +deploy-createx-l1: + forge script script/DeployCustomCreatex.s.sol --rpc-url $L1_RPC_URL --private-key $PRIVATE_KEY --slow --no-metadata + +deploy-createx-l2: + forge script script/DeployCustomCreatex.s.sol --rpc-url $L2_RPC_URL --private-key $PRIVATE_KEY --slow --no-metadata + +check-configs: + bun lzConfigCheck.cjs \ No newline at end of file From c15a117d44018d9621f9a99e4aadd6c947858d35 Mon Sep 17 00:00:00 2001 From: Carson Date: Fri, 6 Sep 2024 14:56:49 -0400 Subject: [PATCH 24/24] test: generic rate provider require has asserts --- test/ion/oracles/GenericRateProvider.t.sol | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/ion/oracles/GenericRateProvider.t.sol b/test/ion/oracles/GenericRateProvider.t.sol index d40c3e1..0ddb4a0 100644 --- a/test/ion/oracles/GenericRateProvider.t.sol +++ b/test/ion/oracles/GenericRateProvider.t.sol @@ -22,18 +22,18 @@ abstract contract GenericRateProviderTest is Test { _initialize(); - require(address(rateProvider) != address(0), "rate provider not set"); - require(decimals > 0, "decimals not set"); - require(target != address(0), "target not set"); - require(bytes4(selector).length > 0, "selector not set"); + assertNotEq(address(rateProvider), address(0), "rate provider not set"); + assertGt(decimals, 0, "decimals not set"); + assertNotEq(target, address(0), "target not set"); + assertGt(bytes4(selector).length, 0, "selector not set"); } function test_GetRateWithinExpectedBounds() public { uint256 rate = rateProvider.getRate(); (uint256 min, uint256 max) = _expectedRateMinMax(); - require(rate >= min, "rate must be greater than or equal to min"); - require(rate <= max, "rate must be less than or equal to max"); + assertGe(rate, min, "rate must be greater than or equal to min"); + assertLe(rate, max, "rate must be less than or equal to max"); } function _initialize() public virtual;