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

Carson/swell deployment #36

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
7 changes: 7 additions & 0 deletions deployment-config/chains/1923.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "Swell",
"balancerVault": "0x0000000000000000000000000000000000000000",
"lzEndpoint": "0xcb566e3B6934Fa77258d68ea18E931fa75e1aaAa",
"assetToRateProviderAndPriceFeed": {
}
}
81 changes: 81 additions & 0 deletions deployment-config/earnETH-L1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{
"protocolAdmin": "0x0000000000417626Ef34D62C4DC189b021603f2F",
"base": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"boringVaultAndBaseDecimals": "18",

"boringVault":{
"boringVaultSalt": "0x1000000000000000000000000000000000000000000000000000000000000014",
"boringVaultName": "Swell Earn ETH",
"boringVaultSymbol": "earnETH",

"address": "0x9Ed15383940CC380fAEF0a75edacE507cC775f22"
},

"manager":{
"managerSalt": "0x2000000000000000000000000000000000000000000000000000000000000014",

"address": "0x69FC700226E9e12D8c5E46a4b50A78efB64F50C0"
},

"accountant":{
"accountantSalt": "0x3000000000000000000000000000000000000000000000000000000000000014",
"payoutAddress": "0x0000000000417626Ef34D62C4DC189b021603f2F",
"allowedExchangeRateChangeUpper": "10003",
"allowedExchangeRateChangeLower": "10000",
"minimumUpdateDelayInSeconds": "3600",
"managementFee": "0",

"address": "0x411c78BC8c36c3c66784514f28c56209e1DF2755"
},

"teller": {
"tellerSalt": "0x4000000000000000000000000000000000000000000000000000000000000015",
"maxGasForPeer": 200000,
"minGasForPeer": 60000,
"peerEid": 30335,
"tellerContractName": "MultiChainLayerZeroTellerWithMultiAssetSupport",
"opMessenger": "0x0000000000000000000000000000000000000000",
"assets": [
"0xFAe103DC9cf190eD75350761e95403b7b8aFa6c0",
"0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0",
"0x9Ba021B0a9b958B5E75cE9f6dff97C7eE52cb3E6",
"0xf951e335afb289353dc249e82926178eac7ded78",
"0x04c154b66cb340f3ae24111cc767e0184ed00cc6",
"0x6ee2b5E19ECBa773a352E5B21415Dc419A700d1d",
"0xf7906F274c174A52d444175729E3fa98f9bde285",
"0x5cb12D56F5346a016DBBA8CA90635d82e6D1bcEa",
"0xc69Ad9baB1dEE23F4605a82b3354F8E40d1E5966",
"0xb26ff591f44b04e78de18f43b46f8b70c6676984",
"0x8a053350ca5F9352a16deD26ab333e2D251DAd7c",
"0x32bd822d615a3658a68b6fdd30c2fcb2c996d678",
"0x49446a0874197839d15395b908328a74ccc96bc0",
"0x5fD13359Ba15A84B76f7F87568309040176167cd",
"0xc329400492c6ff2438472d4651ad17389fcb843a"

],
"dvnIfNoDefault": {
"required": [
"0x589dEDbD617e0CBcB916A9223F4d1300c294236b"
],
"optional": [
],
"blockConfirmationsRequiredIfNoDefault": 15,
"optionalThreshold": 0
},
"address": "0x6d207874ddc8b1c3954a0bb2b21c6fce2aa18dba"
},
"rolesAuthority": {
"rolesAuthoritySalt": "0x5000000000000000000000000000000000000000000000000000000000000014",
"strategist": "0x0000000000417626Ef34D62C4DC189b021603f2F",
"exchangeRateBot": "0x0000000000417626Ef34D62C4DC189b021603f2F",
"pauser": "0xe5CcB29Cb9C886da329098A184302E2D5Ff0cD9E",
"address": "0x1F5dddF627C3796a589c6271b36A570f18d3a016"
},

"decoder": {
"decoderSalt": "0x6000000000000000000000000000000000000000000000000000000000000000",

"address": "0x0000000000000000000000000000000000000000"
}

}
66 changes: 66 additions & 0 deletions deployment-config/earnETH-L2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"protocolAdmin": "0xc6cC90808A3434DF28028824Fd3cefcaE4A93A88",
"base": "0x4200000000000000000000000000000000000006",
"boringVaultAndBaseDecimals": "18",

"boringVault":{
"boringVaultSalt": "0x1000000000000000000000000000000000000000000000000000000000000014",
"boringVaultName": "Swell Earn ETH",
"boringVaultSymbol": "earnETH",

"address": "0x9Ed15383940CC380fAEF0a75edacE507cC775f22"
},

"manager":{
"managerSalt": "0x2000000000000000000000000000000000000000000000000000000000000014",

"address": "0x69FC700226E9e12D8c5E46a4b50A78efB64F50C0"
},

"accountant":{
"accountantSalt": "0x3000000000000000000000000000000000000000000000000000000000000014",
"payoutAddress": "0xc6cC90808A3434DF28028824Fd3cefcaE4A93A88",
"allowedExchangeRateChangeUpper": "10003",
"allowedExchangeRateChangeLower": "10000",
"minimumUpdateDelayInSeconds": "3600",
"managementFee": "0",

"address": "0x411c78BC8c36c3c66784514f28c56209e1DF2755"
},

"teller": {
"tellerSalt": "0x4000000000000000000000000000000000000000000000000000000000000015",
"maxGasForPeer": 200000,
"minGasForPeer": 60000,
"peerEid": 30101,
"tellerContractName": "MultiChainLayerZeroTellerWithMultiAssetSupport",
"opMessenger": "0x0000000000000000000000000000000000000000",
"assets": [
],
"dvnIfNoDefault": {
"required": [
"0x6788f52439aca6bff597d3eec2dc9a44b8fee842"
],
"optional": [
],
"blockConfirmationsRequiredIfNoDefault": 15,
"optionalThreshold": 0
},

"address": "0x6d207874ddc8b1c3954a0bb2b21c6fce2aa18dba"
},
"rolesAuthority": {
"rolesAuthoritySalt": "0x5000000000000000000000000000000000000000000000000000000000000014",
"strategist": "0xc6cC90808A3434DF28028824Fd3cefcaE4A93A88",
"exchangeRateBot": "0xc6cC90808A3434DF28028824Fd3cefcaE4A93A88",
"pauser": "0xe5CcB29Cb9C886da329098A184302E2D5Ff0cD9E",
"address": "0x1F5dddF627C3796a589c6271b36A570f18d3a016"
},

"decoder": {
"decoderSalt": "0x6000000000000000000000000000000000000000000000000000000000000000",

"address": "0x0000000000000000000000000000000000000000"
}

}
7 changes: 7 additions & 0 deletions deployment-config/outL2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"boringVault": "0x66e47e6957b85cf62564610b76dd206bb04d831a",
"manager": "0x6cea0a42a44cabcc42b1ec31c3d714dcaae91e06",
"accountant": "0x6bbf58f1a95d22f497fd2e7f640fae94481b1a08",
"teller": "0x651f908702f23d794dc54fa36d77dfb6e35f0924",
"rolesAuthority": "0x05fae28773ab9dafd5c8997acee5099fa0d1f219"
}
42 changes: 26 additions & 16 deletions deployment-config/swell-btc-l1-08-22-24.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,52 +4,62 @@
"boringVaultAndBaseDecimals": "8",

"boringVault":{
"boringVaultSalt": "0x100000000000000000000000000000000000000000000000000000000000000c",
"boringVaultName": "Swell BTC Native Yield Nucleus Token",
"boringVaultSymbol": "rswBTC",
"boringVaultSalt": "0xf647aa2c3b1e5a37bb1f6a3bf259486198befe01f0dfaa029f3dfee6443c0687",
"boringVaultName": "Swell Earn BTC",
"boringVaultSymbol": "earnBTC",

"address": "0x0000000000000000000000000000000000000000"
"address": "0x66E47E6957B85Cf62564610B76dD206BB04d831a"
},

"manager":{
"managerSalt": "0x200000000000000000000000000000000000000000000000000000000000000c",
"managerSalt": "0x274b10892d2e9c817f85204f234d65406be964b9ebdb0f8984b4cf7b853d4d25",

"address": "0x0000000000000000000000000000000000000000"
"address": "0x6cEA0a42a44cABcc42b1Ec31c3D714DcAAE91e06"
},

"accountant":{
"accountantSalt": "0x300000000000000000000000000000000000000000000000000000000000000c",
"accountantSalt": "0x6a184dbea6f3cc0318679f00000000000000000000000000000000000000001c",
"payoutAddress": "0x0000000000417626Ef34D62C4DC189b021603f2F",
"allowedExchangeRateChangeUpper": "10030",
"allowedExchangeRateChangeLower": "9980",
"allowedExchangeRateChangeUpper": "10003",
"allowedExchangeRateChangeLower": "10000",
"minimumUpdateDelayInSeconds": "3600",
"managementFee": "0",

"address": "0x0000000000000000000000000000000000000000"
"address": "0x6bBf58f1A95D22f497fD2e7f640fAE94481b1A08"
},

"teller": {
"tellerSalt": "0x400000000000000000000000000000000000000000000000000000000000000c",
"tellerSalt": "0xbcd1092100c59cb9f6b270377929926e31de85f62cff158bd259bd33141120f2",
"maxGasForPeer": 200000,
"minGasForPeer": 60000,
"peerEid": 0,
"tellerContractName": "TellerWithMultiAssetSupport",
"peerEid": 30335,
"tellerContractName": "MultiChainLayerZeroTellerWithMultiAssetSupport",
"opMessenger": "0x0000000000000000000000000000000000000000",
"assets": [
"0x8DB2350D78aBc13f5673A411D4700BCF87864dDE"
],
"dvnIfNoDefault": {
"required": [
"0x6788f52439aca6bff597d3eec2dc9a44b8fee842"
],
"optional": [
],
"blockConfirmationsRequiredIfNoDefault": 15,
"optionalThreshold":0
},
"address": "0x0000000000000000000000000000000000000000"
},
"rolesAuthority": {
"rolesAuthoritySalt": "0x500000000000000000000000000000000000000000000000000000000000000c",
"rolesAuthoritySalt": "0x26d58067fee6a2f416fd89ac43456e7f4617e96069cbefa4353704ce84e4b715",
"strategist": "0x0000000000417626Ef34D62C4DC189b021603f2F",
"exchangeRateBot": "0x0000000000417626Ef34D62C4DC189b021603f2F",
"pauser": "0xe5CcB29Cb9C886da329098A184302E2D5Ff0cD9E",

"address": "0x0000000000000000000000000000000000000000"
"address": "0x05FAE28773ab9dAfD5C8997AcEe5099fa0D1f219"
},

"decoder": {
"decoderSalt": "0x6000000000000000000000000000000000000000000000000000000000000000",
"decoderSalt": "0xce7bdf78184bf171238f7f6cbe0533c2b4f05b4d3b3ff2138152df4357ca3aef",

"address": "0x0000000000000000000000000000000000000000"
}
Expand Down
66 changes: 66 additions & 0 deletions deployment-config/swell-btc-l2-12-16-24.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"protocolAdmin": "0xc6cC90808A3434DF28028824Fd3cefcaE4A93A88",
"base": "0xB140e881E206E94B18e143f1739d5f212C59C859",
"boringVaultAndBaseDecimals": "8",

"boringVault":{
"boringVaultSalt": "0xf647aa2c3b1e5a37bb1f6a3bf259486198befe01f0dfaa029f3dfee6443c0687",
"boringVaultName": "Swell Earn BTC",
"boringVaultSymbol": "earnBTC",

"address": "0x0000000000000000000000000000000000000000"
},

"manager":{
"managerSalt": "0x274b10892d2e9c817f85204f234d65406be964b9ebdb0f8984b4cf7b853d4d25",

"address": "0x0000000000000000000000000000000000000000"
},

"accountant":{
"accountantSalt": "0x6a184dbea6f3cc0318679f00000000000000000000000000000000000000001c",
"payoutAddress": "0xc6cC90808A3434DF28028824Fd3cefcaE4A93A88",
"allowedExchangeRateChangeUpper": "10003",
"allowedExchangeRateChangeLower": "10000",
"minimumUpdateDelayInSeconds": "3600",
"managementFee": "0",

"address": "0x0000000000000000000000000000000000000000"
},

"teller": {
"tellerSalt": "0xbcd1092100c59cb9f6b270377929926e31de85f62cff158bd259bd33141120f2",
"maxGasForPeer": 200000,
"minGasForPeer": 60000,
"peerEid": 30101,
"tellerContractName": "MultiChainLayerZeroTellerWithMultiAssetSupport",
"opMessenger": "0x0000000000000000000000000000000000000000",
"assets": [
],
"dvnIfNoDefault": {
"required": [
"0x6788f52439aca6bff597d3eec2dc9a44b8fee842"
],
"optional": [
],
"blockConfirmationsRequiredIfNoDefault": 15,
"optionalThreshold": 0
},
"address": "0x0000000000000000000000000000000000000000"
},
"rolesAuthority": {
"rolesAuthoritySalt": "0x26d58067fee6a2f416fd89ac43456e7f4617e96069cbefa4353704ce84e4b715",
"strategist": "0xc6cC90808A3434DF28028824Fd3cefcaE4A93A88",
"exchangeRateBot": "0x1755397BEc366a1e1160d8aE0106C60E7e344B56",
"pauser": "0xe5CcB29Cb9C886da329098A184302E2D5Ff0cD9E",

"address": "0x0000000000000000000000000000000000000000"
},

"decoder": {
"decoderSalt": "0xce7bdf78184bf171238f7f6cbe0533c2b4f05b4d3b3ff2138152df4357ca3aef",

"address": "0x0000000000000000000000000000000000000000"
}

}
2 changes: 1 addition & 1 deletion nucleus-deployments
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ contract DeployAccountantWithRateProviders is BaseScript {
require(config.base != address(0), "base address must not be zero");
require(config.allowedExchangeRateChangeUpper > 1e4, "allowedExchangeRateChangeUpper");
require(config.allowedExchangeRateChangeUpper <= 1.003e4, "allowedExchangeRateChangeUpper upper bound");
require(config.allowedExchangeRateChangeLower < 1e4, "allowedExchangeRateChangeLower");
require(config.allowedExchangeRateChangeLower <= 1e4, "allowedExchangeRateChangeLower");
require(config.allowedExchangeRateChangeLower >= 0.997e4, "allowedExchangeRateChangeLower lower bound");
require(config.minimumUpdateDelayInSeconds >= 3600, "minimumUpdateDelayInSeconds");
require(config.managementFee < 1e4, "managementFee");
Expand Down
16 changes: 16 additions & 0 deletions src/helper/BaseTokenStandIn.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.21;

import { STAND_IN_TOKEN_NAME } from "./Constants.sol";

contract BaseTokenStandIn {
uint8 public immutable decimals;

constructor(uint8 _decimals) {
decimals = _decimals;
}

function name() external pure returns (string memory) {
return STAND_IN_TOKEN_NAME;
}
}
2 changes: 2 additions & 0 deletions src/helper/Constants.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ uint8 constant TELLER_ROLE = 3;
uint8 constant UPDATE_EXCHANGE_RATE_ROLE = 4;
uint8 constant SOLVER_ROLE = 5;
uint8 constant PAUSER_ROLE = 6;

string constant STAND_IN_TOKEN_NAME = "NUCLEUS_STAND_IN_TOKEN";
43 changes: 43 additions & 0 deletions src/helper/PendlePTRateProvider.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
pragma solidity 0.8.21;

import { IRateProvider } from "src/interfaces/IRateProvider.sol";

import { IPMarket } from "lib/ion-protocol/lib/pendle-core-v2-public/contracts/interfaces/IPMarket.sol";

import { IStandardizedYield } from
"lib/ion-protocol/lib/pendle-core-v2-public/contracts/interfaces/IStandardizedYield.sol";

import { IPPrincipalToken } from "lib/ion-protocol/lib/pendle-core-v2-public/contracts/interfaces/IPPrincipalToken.sol";

import { IPPtLpOracle } from "lib/ion-protocol/lib/pendle-core-v2-public/contracts/interfaces/IPPtLpOracle.sol";

error PendlePTRateProvider__InvalidDecimals(uint256 decimals);

/**
* @title PendlePTRateProvider
* @custom:security-contact [email protected]
*/
contract PendlePTRateProvider is IRateProvider {
/// @notice constant values
IPPtLpOracle public constant ORACLE = IPPtLpOracle(0x14030836AEc15B2ad48bB097bd57032559339c92);
uint32 public constant DURATION = 1 days;

/// @notice the pendle market this rate provider serves
IPMarket public immutable market;

/// @param pendleMarket to serve the PT rate
constructor(IPMarket pendleMarket) {
market = pendleMarket;
}
Comment on lines +29 to +31
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duration should be in the constructor and immutable for this contract to be reusable across multiple durations


/// @notice getRate for a Pendle PT token
function getRate() external view returns (uint256) {
(IStandardizedYield sy, IPPrincipalToken pt,) = market.readTokens();
uint256 syRate = sy.exchangeRate();
uint256 ptRate = ORACLE.getPtToAssetRate(address(market), DURATION);
if (sy.decimals() != 18 || pt.decimals() != 18) {
revert PendlePTRateProvider__InvalidDecimals(sy.decimals());
}
return syRate * ptRate / 1e18;
}
}
Loading
Loading