Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

rswBTC Deployment #15

Merged
merged 8 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions deployment-config/chains/1.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@
"decimals": 18,
"description": "",
"priceFeedType": 0
},
"0x8db2350d78abc13f5673a411d4700bcf87864dde": {
"rateProvider": "0x318Da095d602C08eF41319f4c4bA0646d318C906",
"decimals": 8
}
}
}
59 changes: 0 additions & 59 deletions deployment-config/mydeploy.json

This file was deleted.

7 changes: 7 additions & 0 deletions deployment-config/rates/DeployGenericRateProvider.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"target": "0x8DB2350D78aBc13f5673A411D4700BCF87864dDE",
"signature": "pricePerShare()",
"expectedMin": "100000000",
"expectedMax": "100000000",
"salt": "0x1000000000000000000000000000000000000000000000000000000000000000"
}
57 changes: 57 additions & 0 deletions deployment-config/rswBTC-l1.json
Original file line number Diff line number Diff line change
@@ -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"
}

}
10 changes: 5 additions & 5 deletions deployment-config/sei-eth-l1-08-08-24.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@
"protocolAdmin": "0x0000000000417626Ef34D62C4DC189b021603f2F",

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

"address": "0x0000000000000000000000000000000000000000"
},

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

"address": "0x0000000000000000000000000000000000000000"
},

"accountant":{
"accountantSalt": "0x3000000000000000000000000000000000000000000000000000000000000000",
"accountantSalt": "0x300000000000000000000000000000000000000000000000000000000000000a",
"payoutAddress": "0x0000000000417626Ef34D62C4DC189b021603f2F",
"allowedExchangeRateChangeUpper": "10030",
"allowedExchangeRateChangeLower": "9980",
Expand All @@ -27,7 +27,7 @@
},

"teller": {
"tellerSalt": "0x4000000000000000000000000000000000000000000000000000000000000000",
"tellerSalt": "0x400000000000000000000000000000000000000000000000000000000000000a",
"maxGasForPeer": 200000,
"minGasForPeer": 60000,
"peerEid": 30280,
Expand All @@ -44,7 +44,7 @@
"address": "0x0000000000000000000000000000000000000000"
},
"rolesAuthority": {
"rolesAuthoritySalt": "0x5000000000000000000000000000000000000000000000000000000000000000",
"rolesAuthoritySalt": "0x500000000000000000000000000000000000000000000000000000000000000a",
"strategist": "0x0000000000417626Ef34D62C4DC189b021603f2F",
"exchangeRateBot": "0x0000000000417626Ef34D62C4DC189b021603f2F",

Expand Down
60 changes: 0 additions & 60 deletions deployment-config/seidry.json

This file was deleted.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
8 changes: 6 additions & 2 deletions script/ConfigReader.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ library ConfigReader {

struct Config {
address protocolAdmin;
address base;
uint8 baseDecimals;
bytes32 accountantSalt;
address boringVault;
address payoutAddress;
Expand All @@ -28,6 +30,8 @@ library ConfigReader {
address balancerVault;
bytes32 tellerSalt;
uint32 peerEid;
address dvnIfNoDefault;
uint64 dvnBlockConfirmationsRequiredIfNoDefault;
address accountant;
address opMessenger;
uint64 maxGasForPeer;
Expand All @@ -48,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");
Expand Down Expand Up @@ -95,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");

Expand Down
42 changes: 42 additions & 0 deletions script/deploy/DeployGenericRateProvider.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// 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";
import { console2 } from "forge-std/console2.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 broadcast returns (GenericRateProvider rateProvider) {
bytes4 functionSig = bytes4(keccak256(bytes(signature)));
console2.logBytes4(functionSig);

bytes memory creationCode = type(GenericRateProvider).creationCode;

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");
}
}
2 changes: 2 additions & 0 deletions script/deploy/deployAll.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading
Loading