Skip to content

Commit

Permalink
fix: savings now compile
Browse files Browse the repository at this point in the history
  • Loading branch information
0xtekgrinder committed Jun 14, 2024
1 parent 055c586 commit 29fe50b
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions lib/angle-transmuter
Submodule angle-transmuter added at d592dd
4 changes: 3 additions & 1 deletion remappings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ chainlink/=lib/chainlink/contracts/
utils/=lib/utils/
contracts/=contracts/
chainlink/=lib/chainlink/contracts/
layer-zero/=lib/LayerZero/contracts/
layer-zero/=lib/LayerZero/contracts/
transmuter/=lib/angle-transmuter/contracts/
test/=test/
20 changes: 17 additions & 3 deletions scripts/DeploySavings.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ 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;

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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 29fe50b

Please sign in to comment.