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] 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