Skip to content

Commit

Permalink
fix: do not hardcode boring vault decimals
Browse files Browse the repository at this point in the history
  • Loading branch information
junkim012 committed Aug 22, 2024
1 parent b8036ab commit dcc199e
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 19 deletions.
2 changes: 1 addition & 1 deletion deployment-config/boba-eth-l1-08-09-24.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"protocolAdmin": "0x0000000000417626Ef34D62C4DC189b021603f2F",
"base": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"baseDecimals": "18",
"boringVaultAndBaseDecimals": "18",
"boringVault": {
"boringVaultSalt": "0x1000000000000000000000000000000000000000000000000000000000000001",
"boringVaultName": "Boba Native Yield Nucleus Token",
Expand Down
2 changes: 1 addition & 1 deletion deployment-config/boba-eth-l2-08-09-24.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"protocolAdmin": "0x0888c3D797E13892C5e67cD802F93Ffe55Ea2826",
"base": "0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000",
"baseDecimals": "18",
"boringVaultAndBaseDecimals": "18",
"boringVault": {
"boringVaultSalt": "0x1000000000000000000000000000000000000000000000000000000000000001",
"boringVaultName": "Boba Native Yield Nucleus Token",
Expand Down
2 changes: 1 addition & 1 deletion deployment-config/fraxtal-eth-l1-08-13-24.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"protocolAdmin": "0x0000000000417626Ef34D62C4DC189b021603f2F",
"base": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"baseDecimals": "18",
"boringVaultAndBaseDecimals": "18",
"boringVault": {
"boringVaultSalt": "0x1000000000000000000000000000000000000000000000000000000000000002",
"boringVaultName": "Fraxtal Native Yield Nucleus Token",
Expand Down
2 changes: 1 addition & 1 deletion deployment-config/fraxtal-eth-l2-08-13-24.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"protocolAdmin": "0x0888c3D797E13892C5e67cD802F93Ffe55Ea2826",
"base": "0xFC00000000000000000000000000000000000006",
"baseDecimals": "18",
"boringVaultAndBaseDecimals": "18",
"boringVault": {
"boringVaultSalt": "0x1000000000000000000000000000000000000000000000000000000000000002",
"boringVaultName": "Fraxtal Native Yield Nucleus Token",
Expand Down
2 changes: 1 addition & 1 deletion deployment-config/sei-eth-l1-08-08-24.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"protocolAdmin": "0x0000000000417626Ef34D62C4DC189b021603f2F",
"base": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"baseDecimals": "18",
"boringVaultAndBaseDecimals": "18",
"boringVault":{
"boringVaultSalt": "0x100000000000000000000000000000000000000000000000000000000000000a",
"boringVaultName": "Sei Native Yield Nucleus Token",
Expand Down
2 changes: 1 addition & 1 deletion deployment-config/sei-eth-l2-08-08-24.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"protocolAdmin": "0xF2dE1311C5b2C1BD94de996DA13F80010453e505",
"base": "0x160345fC359604fC6e70E3c5fAcbdE5F7A9342d8",
"baseDecimals": "18",
"boringVaultAndBaseDecimals": "18",
"boringVault":{
"boringVaultSalt": "0x1000000000000000000000000000000000000000000000000000000000000000",
"boringVaultName": "Sei Native Yield Nucleus Token",
Expand Down
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -29,7 +29,7 @@
},

"teller": {
"tellerSalt": "0x400000000000000000000000000000000000000000000000000000000000000a",
"tellerSalt": "0x400000000000000000000000000000000000000000000000000000000000000c",
"maxGasForPeer": 200000,
"minGasForPeer": 60000,
"peerEid": 0,
Expand All @@ -41,7 +41,7 @@
"address": "0x0000000000000000000000000000000000000000"
},
"rolesAuthority": {
"rolesAuthoritySalt": "0x500000000000000000000000000000000000000000000000000000000000000b",
"rolesAuthoritySalt": "0x500000000000000000000000000000000000000000000000000000000000000c",
"strategist": "0x0000000000417626Ef34D62C4DC189b021603f2F",
"exchangeRateBot": "0x0000000000417626Ef34D62C4DC189b021603f2F",

Expand Down
4 changes: 2 additions & 2 deletions script/ConfigReader.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ library ConfigReader {
struct Config {
address protocolAdmin;
address base;
uint8 baseDecimals;
uint8 boringVaultAndBaseDecimals;
bytes32 accountantSalt;
address boringVault;
address payoutAddress;
Expand Down Expand Up @@ -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");
Expand Down
7 changes: 5 additions & 2 deletions script/deploy/single/02_DeployBoringVault.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -31,7 +32,7 @@ contract DeployIonBoringVaultScript is BaseScript {
broadcaster,
config.boringVaultName,
config.boringVaultSymbol,
18 // decimals
config.boringVaultAndBaseDecimals // decimals
)
)
)
Expand All @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit dcc199e

Please sign in to comment.