From 29fe50b616fffc67898edd54a9a428ef33f59b6e Mon Sep 17 00:00:00 2001 From: 0xtekgrinder <0xtekgrinder@protonmail.com> Date: Fri, 14 Jun 2024 12:05:22 +0200 Subject: [PATCH] fix: savings now compile --- .gitmodules | 3 +++ lib/angle-transmuter | 1 + remappings.txt | 4 +++- scripts/DeploySavings.s.sol | 20 +++++++++++++++++--- 4 files changed, 24 insertions(+), 4 deletions(-) create mode 160000 lib/angle-transmuter diff --git a/.gitmodules b/.gitmodules index 2a230a9..2bfde6f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -16,3 +16,6 @@ [submodule "lib/LayerZero"] path = lib/LayerZero url = https://github.com/LayerZero-Labs/LayerZero +[submodule "lib/angle-transmuter"] + path = lib/angle-transmuter + url = https://github.com/AngleProtocol/angle-transmuter diff --git a/lib/angle-transmuter b/lib/angle-transmuter new file mode 160000 index 0000000..d592dd9 --- /dev/null +++ b/lib/angle-transmuter @@ -0,0 +1 @@ +Subproject commit d592dd9106c97bd8864532bb3001bba5afa511db diff --git a/remappings.txt b/remappings.txt index c0843c1..c20bbfb 100644 --- a/remappings.txt +++ b/remappings.txt @@ -6,4 +6,6 @@ chainlink/=lib/chainlink/contracts/ utils/=lib/utils/ contracts/=contracts/ chainlink/=lib/chainlink/contracts/ -layer-zero/=lib/LayerZero/contracts/ \ No newline at end of file +layer-zero/=lib/LayerZero/contracts/ +transmuter/=lib/angle-transmuter/contracts/ +test/=test/ \ No newline at end of file diff --git a/scripts/DeploySavings.s.sol b/scripts/DeploySavings.s.sol index be863ae..812cd12 100644 --- a/scripts/DeploySavings.s.sol +++ b/scripts/DeploySavings.s.sol @@ -8,6 +8,7 @@ import { TokenSideChainMultiBridge } from "contracts/agToken/TokenSideChainMulti import { LayerZeroBridgeTokenERC20 } from "contracts/agToken/layerZero/LayerZeroBridgeTokenERC20.sol"; import { ImmutableCreate2Factory } from "contracts/interfaces/external/create2/ImmutableCreate2Factory.sol"; import { ICoreBorrow } from "contracts/interfaces/ICoreBorrow.sol"; +import { Savings, IAccessControlManager, IERC20MetadataUpgradeable } from "transmuter/savings/Savings.sol"; contract DeploySavings is Script, CommonUtils { using stdJson for string; @@ -15,6 +16,7 @@ contract DeploySavings is Script, CommonUtils { function run() external { /** TODO complete */ string memory stableName = vm.envString("STABLE_NAME"); + ContractType stableType = ContractType.AgEUR; /** END complete */ uint256 deployerPrivateKey = vm.deriveKey(vm.envString("MNEMONIC_MAINNET"), "m/44'/60'/0'/0/", 0); @@ -43,12 +45,24 @@ contract DeploySavings is Script, CommonUtils { if (vm.keyExistsJson(json, ".agToken")) { agToken = vm.parseJsonAddress(json, ".agToken"); } else { - agToken = _chainToContract(chainId, ContractType.AgToken); + agToken = _chainToContract(chainId, stableType); } } else { proxyAdmin = _chainToContract(chainId, ContractType.ProxyAdmin); coreBorrow = _chainToContract(chainId, ContractType.CoreBorrow); - agToken = _chainToContract(chainId, ContractType.AgEUR); + agToken = _chainToContract(chainId, stableType); + } + address expectedAddress; + if (vm.envExists("EXPECTED_ADDRESS")) { + expectedAddress = vm.envAddress("EXPECTED_ADDRESS"); + } else { + // TODO compute the expected address once one of the address has been deployed + if (keccak256(abi.encodePacked(stableName)) == keccak256("USD")) { + expectedAddress = _chainToContract(CHAIN_ETHEREUM, ContractType.AgUSD); + } + if (keccak256(abi.encodePacked(stableName)) == keccak256("EUR")) { + expectedAddress = _chainToContract(CHAIN_ETHEREUM, ContractType.AgEUR); + } } vm.startBroadcast(deployerPrivateKey); @@ -83,7 +97,7 @@ contract DeploySavings is Script, CommonUtils { json2.serialize(keys[i], json.readAddress(string.concat(".", keys[i]))); } } - json2.serialize("stAgToken", address(angleProxy)); + json2.serialize("stAgToken", address(saving)); json2.write(JSON_ADDRESSES_PATH); vm.stopBroadcast();