Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
6dbdf26
#421: start to implement bridge for STBL
Oct 28, 2025
96ed612
Merge branch 'main' into 421-bridge-stbl
Oct 29, 2025
9873cd3
merge, rename STBLBridged to BridgedSTBL
Oct 29, 2025
c9b26c6
add dependencies, draft test to send token through stbl bridge
Oct 29, 2025
d6483a1
Draft implementation of testSendToAvalanche()
Oct 29, 2025
972987d
#421: tests for bridge in two directions
Oct 30, 2025
468e370
#421: tests for bridgedSTBL passed
Oct 30, 2025
8991abb
#424: draft implementation of PriceAggregatorOApp and BridgedPriceOracle
Oct 31, 2025
eef86cb
#424: add tests for PriceAggregatorOapp
Nov 3, 2025
2110f39
fix tests
Nov 3, 2025
68aeba1
#424: send config for sender and receiver, fix tests
Nov 3, 2025
d95eff1
#424: optimization, minor fixes
Nov 4, 2025
9052619
fix formatting for forge 1.4.4
Nov 4, 2025
159894c
#424: refactoring - add tests for plasma
Nov 5, 2025
be583b3
run tests for PriceAggregatorOApp on Plasma
Nov 5, 2025
c4aae2f
#424: make universal BridgedToken and StabilityOFTAdapter
Nov 5, 2025
2f73b89
Add StdConfig. Add deploy scripts for bridges
Nov 6, 2025
9703754
fix address of storage
Nov 6, 2025
1d5a078
workflow: Check forge-std version
Nov 6, 2025
256ab39
Use forge install repository/@tag for OZ, forge-std and solady
Nov 6, 2025
a130ad1
workflow: Ensure submodules are on correct commits
Nov 6, 2025
4e0c565
Downgrade forge-std to v1.10.0 temporally
Nov 7, 2025
d60a580
Upgrade forge-std to v1.11.0
Nov 7, 2025
acc561f
Merge branch 'main' into 424-bridge-priceaggregator-prices
Nov 7, 2025
9c1ea4f
merge, move actions/checkout@v3 => actions/checkout@v4
Nov 7, 2025
77530cf
Merge branch 'main' into 424-bridge-priceaggregator-prices
Nov 7, 2025
38646d9
fix config.toml, add config.d.toml for storing deployed addresses, fi…
Nov 7, 2025
1a7b3c8
#424: fix deploy scripts
Nov 26, 2025
aeb6c79
#424: start to implement moving xSTBL between chains
Nov 26, 2025
da98fde
#424: XTokenBridge implemented. Add bridge-related functions to XSTBL…
Nov 27, 2025
4142e49
#424: tests for XTokenBridge...
Nov 27, 2025
5e1f028
#424: XTokenBridge is composer...
Nov 28, 2025
e78225f
#424: testSendXSTBLFromSonicToPlasma starts to work
Nov 28, 2025
24c198c
#424: more tests for xTokenBridge
Nov 28, 2025
ea71770
#424: add test for XTokenBridge
Dec 1, 2025
5cc87dc
Draft implementation of StabilityDAO 1.1.0
Dec 2, 2025
ec419fb
#424: prepare to make test with low gas limits
Dec 2, 2025
90acc6f
XTokenBridge: remove support of lzTokens
Dec 3, 2025
f40ac91
Create test testReceiveThroughEndpoint
Dec 3, 2025
9d4c661
#424: StabilityDAO => DAO. Add tests for new DAO functions, draft
Dec 3, 2025
1119067
#424: reimplement getVotes through getPowers
Dec 4, 2025
17b1977
#424: simplify dao.getPowers
Dec 4, 2025
56f8232
Add deploy scripts for XSTBL and XTokenBridge
Dec 4, 2025
0dd4d01
Add draf tests for setup bridges
Dec 4, 2025
73022a4
Pause for whole bridge
Dec 4, 2025
d151cfe
Huge renaming: StabilityDAO => DAO, xSTBL => xToken, StabilityOFTAdap…
Dec 4, 2025
608faf7
fix formatting
Dec 4, 2025
59bc139
CI: disable recursive submodules update because CI doesn't work corre…
Dec 4, 2025
1d42e97
Update forge-std to v1.12.0
Dec 4, 2025
a83c6a9
merge
Dec 4, 2025
66baea3
fix tests
Dec 4, 2025
558dd49
fix formatting
Dec 4, 2025
9457014
Add LZ-delegate to constructors of bridge-related contracts. PriceAgg…
Dec 5, 2025
7aef3c7
Setup scripts for PriceOracle's oapps
Dec 5, 2025
6522d34
merge
Dec 5, 2025
dc3b2e7
fix imports
Dec 5, 2025
2d268ae
fix warnings
Dec 6, 2025
c9950fa
Fix deploy scripts for bridges. Deploy PriceAggregatorOApp on sonic a…
Dec 6, 2025
f174b3f
fix formatting
Dec 6, 2025
8451cba
Deploy OAPP TokenOFTAdapter on Sonic and BridgedToken on Plasma
Dec 8, 2025
482bca3
fix deploy scripts
Dec 8, 2025
5f48189
Add setName, setSymbol to xToken, DAO, TokenBridged. Check implementa…
Dec 8, 2025
f11a208
fix tests
Dec 9, 2025
ff660ff
Deploy XToken, XStaking, DAO on Plasma
Dec 9, 2025
70c6e42
Add RecoveryRelayer, add setters to RevenueRouter
Dec 9, 2025
db81a14
Add deploy script for RecoveryRelayer
Dec 9, 2025
e2397cd
Deploy Recovery Relayer
Dec 9, 2025
01ea429
Add buildOptions function to IOFPausable and IXTokenBridge
Dec 11, 2025
64ec7b9
upgrade platform 25.12.1-alpha
Dec 12, 2025
3574899
remove unused imports
Dec 15, 2025
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
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ VAULT_BATCH_TEST_AVALANCHE_BLOCK=
LENDING_BATCH_TEST_SONIC_BLOCK=

FOUNDRY_PROFILE=lite

# Address of delegator required to deploy LZ-bridges
LZ_DELEGATOR=
2 changes: 1 addition & 1 deletion .github/workflows/fmt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
name: Formatter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive

Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,17 @@ jobs:
name: Test, coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
fetch-tags: true

- name: Ensure submodules are on correct commits
run: |
git submodule sync --recursive
git submodule update --init --recursive
git submodule status

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
Expand Down Expand Up @@ -74,7 +82,7 @@ jobs:
id: coverage

- name: Upload coverage lcov report to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}

Expand Down
9 changes: 9 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,12 @@
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
[submodule "lib/devtools"]
path = lib/devtools
url = https://github.com/layerzero-labs/devtools
[submodule "lib/LayerZero-v2"]
path = lib/LayerZero-v2
url = https://github.com/layerzero-labs/LayerZero-v2
[submodule "lib/solidity-bytes-utils"]
path = lib/solidity-bytes-utils
url = https://github.com/GNSPS/solidity-bytes-utils.git
15 changes: 15 additions & 0 deletions chains/avalanche/AvalancheConstantsLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,21 @@ library AvalancheConstantsLib {
address public constant SILO_MANAGED_VAULT_AUSD_VARLAMOURE = 0x3d7B0c3997E48fA3FC96cd057d1fb4E5F891835B;
address public constant SILO_MANAGED_VAULT_USDt_VARLAMOURE = 0x6c09bfdc1df45D6c4Ff78Dc9F1C13aF29eB335d4;

// ---------------------------------- LayerZero-v2 https://docs.layerzero.network/v2/deployments/chains/avalanche
uint32 public constant LAYER_ZERO_V2_ENDPOINT_ID = 30106;
address public constant LAYER_ZERO_V2_ENDPOINT = 0x1a44076050125825900e736c501f859c50fE728c;
address public constant LAYER_ZERO_V2_SEND_ULN_302 = 0x197D1333DEA5Fe0D6600E9b396c7f1B1cFCc558a;
address public constant LAYER_ZERO_V2_RECEIVE_ULN_302 = 0xbf3521d309642FA9B1c91A08609505BA09752c61;
address public constant LAYER_ZERO_V2_READ_LIB_1002 = 0x8839D3f169f473193423b402BDC4B5c51daAABDc;
address public constant LAYER_ZERO_V2_EXECUTOR = 0x90E595783E43eb89fF07f63d27B8430e6B44bD9c;
address public constant LAYER_ZERO_V2_BLOCKED_MESSAGE_LIBRARY = 0x1ccBf0db9C192d969de57E25B3fF09A25bb1D862;
address public constant LAYER_ZERO_V2_DEAD_DVN = 0x90cCA24D1338Bd284C25776D9c12f96764Bde5e1;

// https://docs.layerzero.network/v2/deployments/chains/avalanche
address internal constant AVALANCHE_DVN_LAYER_ZERO_PULL = 0x0Ffe02DF012299A370D5dd69298A5826EAcaFdF8; // LayerZero Labs (lzRead)
address internal constant AVALANCHE_DVN_LAYER_ZERO_PUSH = 0x962F502A63F5FBeB44DC9ab932122648E8352959;
address internal constant AVALANCHE_DVN_NETHERMIND_PULL = 0x1308151a7ebaC14f435d3Ad5fF95c34160D539A5; // Nethermind (lzRead)
address internal constant AVALANCHE_DVN_HORIZON_PULL = 0x1a5Df1367F21d55B13D5E2f8778AD644BC97aC6d; // Horizen (lzRead)

// DeX aggregators
/// @notice Aggregator router V6
Expand Down
15 changes: 15 additions & 0 deletions chains/plasma/PlasmaConstantsLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ library PlasmaConstantsLib {
address public constant AAVE_V3_POOL_DATA_PROVIDER = 0xf2D6E38B407e31E7E7e4a16E6769728b76c7419F;
address public constant AAVE_V3_POOL = 0x925a2A7214Ed92428B5b1B090F80b25700095e12;
address public constant AAVE_V3_POOL_USDT0 = 0x5D72a9d9A9510Cd8cBdBA12aC62593A58930a948;

address public constant AAVE_V3_POOL_WETH = 0xf1aB7f60128924d69f6d7dE25A20eF70bBd43d07;
address public constant AAVE_V3_POOL_SUSDE = 0xC1A318493fF07a68fE438Cee60a7AD0d0DBa300E;
address public constant AAVE_V3_POOL_WEETH = 0xAf1a7a488c8348b41d5860C04162af7d3D38A996;
Expand All @@ -63,4 +64,18 @@ library PlasmaConstantsLib {

address public constant POOL_SOLIDLY_WETH_WEETH = 0x355705857c9548E71E866087b01bB5b0A1fd671b;

// ---------------------------------- LayerZero-v2 https://docs.layerzero.network/v2/deployments/chains/plasma
uint32 public constant LAYER_ZERO_V2_ENDPOINT_ID = 30383;
address public constant LAYER_ZERO_V2_ENDPOINT = 0x6F475642a6e85809B1c36Fa62763669b1b48DD5B;
address public constant LAYER_ZERO_V2_SEND_ULN_302 = 0xC39161c743D0307EB9BCc9FEF03eeb9Dc4802de7;
address public constant LAYER_ZERO_V2_RECEIVE_ULN_302 = 0xe1844c5D63a9543023008D332Bd3d2e6f1FE1043;
address public constant LAYER_ZERO_V2_READ_LIB_1002 = 0x860E8D714944E7accE4F9e6247923ec5d30c0471;
address public constant LAYER_ZERO_V2_EXECUTOR = 0x4208D6E27538189bB48E603D6123A94b8Abe0A0b;
address public constant LAYER_ZERO_V2_BLOCKED_MESSAGE_LIBRARY = 0xC1cE56B2099cA68720592583C7984CAb4B6d7E7a;
address public constant LAYER_ZERO_V2_DEAD_DVN = 0x6788f52439ACA6BFF597d3eeC2DC9a44B8FEE842;

// https://docs.layerzero.network/v2/deployments/chains/plasma
address internal constant PLASMA_DVN_LAYER_ZERO_PUSH = 0x282b3386571f7f794450d5789911a9804FA346b4; // LayerZero Labs (push based)
address internal constant PLASMA_DVN_NETHERMIND_PUSH = 0xa51cE237FaFA3052D5d3308Df38A024724Bb1274; // Nethermind (push based)
address internal constant PLASMA_DVN_HORIZON_PUSH = 0xd4CE45957FBCb88b868ad2c759C7DB9BC2741e56; // Horizen (push based)
}
17 changes: 17 additions & 0 deletions chains/sonic/SonicConstantsLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -603,4 +603,21 @@ library SonicConstantsLib {
// ---------------------------------- Mainstreet
address internal constant MSUSD_MINTER = 0xb1E423c251E989bd4e49228eF55aC4747D63F54D;

// ---------------------------------- LayerZero-v2 https://docs.layerzero.network/v2/deployments/chains/sonic
uint32 public constant LAYER_ZERO_V2_ENDPOINT_ID = 30332;
address public constant LAYER_ZERO_V2_ENDPOINT = 0x6F475642a6e85809B1c36Fa62763669b1b48DD5B;
address public constant LAYER_ZERO_V2_SEND_ULN_302 = 0xC39161c743D0307EB9BCc9FEF03eeb9Dc4802de7;
address public constant LAYER_ZERO_V2_RECEIVE_ULN_302 = 0xe1844c5D63a9543023008D332Bd3d2e6f1FE1043;
address public constant LAYER_ZERO_V2_READ_LIB_1002 = 0x860E8D714944E7accE4F9e6247923ec5d30c0471;
address public constant LAYER_ZERO_V2_EXECUTOR = 0x4208D6E27538189bB48E603D6123A94b8Abe0A0b;
address public constant LAYER_ZERO_V2_BLOCKED_MESSAGE_LIBRARY = 0xC1cE56B2099cA68720592583C7984CAb4B6d7E7a;
address public constant LAYER_ZERO_V2_DEAD_DVN = 0x6788f52439ACA6BFF597d3eeC2DC9a44B8FEE842;

// https://docs.layerzero.network/v2/deployments/chains/sonic
address internal constant SONIC_DVN_NETHERMIND_PULL = 0x3b0531eB02Ab4aD72e7a531180beeF9493a00dD2; // Nethermind (lzRead)
address internal constant SONIC_DVN_LAYER_ZERO_PULL = 0x78f607fc38e071cEB8630B7B12c358eE01C31E96; // LayerZero Labs (lzRead)
address internal constant SONIC_DVN_LAYER_ZERO_PUSH = 0x282b3386571f7f794450d5789911a9804FA346b4;
address internal constant SONIC_DVN_HORIZEN_PUSH = 0x54dD79f5cE72b51FCBbcb170Dd01E32034323565;
address internal constant SONIC_DVN_HORIZEN_PULL = 0xCA764b512E2d2fD15fcA1c0a38F7cFE9153148F0; // Horizen (lzRead)

}
18 changes: 18 additions & 0 deletions config.d.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[sonic.address]
xToken = "0x902215dd96a291b256a3Aef6c4Dee62d2A9B80Cb"
xStaking = "0x17a7Cf838A7C91DE47552a9f65822B547F9A6997"
DAO = "0x77773Cb473aD1bfE991bA299a127F64b45C17777"
PRICE_AGGREGATOR_OAPP_MAIN_TOKEN = "0x61752dB3C155f73Cc7Dda1e70d065b804Bce5e9B"
OAPP_MAIN_TOKEN = "0xD6a8b05f08834Ed2f205E3d591CD6D1A84b7C19B"
XTokenBridge = "0x533A0c7869e36D1640D4058Bac4604DB6b4d7AD5"

[9745.address]
BRIDGED_PRICE_ORACLE_MAIN_TOKEN = "0x1984C54B371273Ba37030e56121Cd9d18537b2D6"
OAPP_MAIN_TOKEN = "0xfdf91362B7E9330F232e500c0236a02B0DE3e492"
xToken = "0xF40D0724599282CaF9dfb66feB630e936bC0CFBE"
xStaking = "0x601572b91DC054Be500392A6d3e15c690140998D"
DAO = "0x87C51aa090587790A5298ea4C2d0DBbcCD0026A6"
XTokenBridge = "0x4E3F0A27bbF443Ba81FCf17E28F4100f35b1b51B"
recoveryRelayer = "0x046e7a007C331e0d4DafA66104744dB14a52bBBb"

[avalanche.address]
43 changes: 43 additions & 0 deletions config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# -------------------------------------------------- Sonic
[sonic]

[sonic.address]
PLATFORM = "0x4Aca671A420eEB58ecafE83700686a2AD06b20D8"
MULTISIG = "0xF564EBaC1182578398E94868bea1AbA6ba339652"

TOKEN_USDC = "0x29219dd400f2Bf60E5a23d13Be72B486D4038894"
TOKEN_STBL = "0x78a76316F66224CBaCA6e70acB24D5ee5b2Bd2c7"

LAYER_ZERO_V2_ENDPOINT = "0x6F475642a6e85809B1c36Fa62763669b1b48DD5B"

[sonic.uint]
LAYER_ZERO_V2_ENDPOINT_ID = 30332

# -------------------------------------------------- 9745 (Plasma)
[9745]

[9745.address]
PLATFORM = "0xd4D6ad656f64E8644AFa18e7CCc9372E0Cd256f0"
MULTISIG = "0xE929438B5B53984FdBABf8562046e141e90E8099"

TOKEN_USDT0 = "0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb"

LAYER_ZERO_V2_ENDPOINT = "0x6F475642a6e85809B1c36Fa62763669b1b48DD5B"

[9745.uint]
LAYER_ZERO_V2_ENDPOINT_ID = 30383

# -------------------------------------------------- Avalanche
[avalanche]

[avalanche.address]
PLATFORM = "0x72b931a12aaCDa6729b4f8f76454855CB5195941"
MULTISIG = "0x06111E02BEb85B57caebEf15F5f90Bc82D54da3A"

TOKEN_USDC = "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"
TOKEN_USDT = "0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7"

LAYER_ZERO_V2_ENDPOINT = "0x1a44076050125825900e736c501f859c50fE728c"

[avalanche.uint]
LAYER_ZERO_V2_ENDPOINT_ID = 30106
29 changes: 25 additions & 4 deletions foundry.lock
Original file line number Diff line number Diff line change
@@ -1,14 +1,35 @@
{
"lib/LayerZero-v2": {
"rev": "3801b9929281261b907eb3482a82364ad00d7868"
},
"lib/devtools": {
"rev": "77ba15585252d58e1f613d69bef5013b15be0240"
},
"lib/forge-std": {
"rev": "1eea5bae12ae557d589f9f0f0edae2faa47cb262"
"tag": {
"name": "v1.11.0",
"rev": "8e40513d678f392f398620b3ef2b418648b33e89"
}
},
"lib/openzeppelin-contracts": {
"rev": "932fddf69a699a9a80fd2396fd1a2ab91cdda123"
"tag": {
"name": "v5.4.0",
"rev": "c64a1edb67b6e3f4a15cca8909c9482ad33a02b0"
}
},
"lib/openzeppelin-contracts-upgradeable": {
"rev": "625fb3c2b2696f1747ba2e72d1e1113066e6c177"
"tag": {
"name": "v5.4.0",
"rev": "e725abddf1e01cf05ace496e950fc8e243cc7cab"
}
},
"lib/solady": {
"rev": "fe918e7d7b560dee66e657f49ef75645ec10f2e4"
"tag": {
"name": "v0.1.26",
"rev": "acd959aa4bd04720d640bf4e6a5c71037510cc4b"
}
},
"lib/solidity-bytes-utils": {
"rev": "fc502455bb2a7e26a743378df042612dd50d1eb9"
}
}
2 changes: 2 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ arbitrum = "${ARBITRUM_RPC_URL}"
ethereum = "${ETHEREUM_RPC_URL}"
real = "${REAL_RPC_URL}"
sonic = "${SONIC_RPC_URL}"
146 = "${SONIC_RPC_URL}" # required for StdConfig
avalanche = "${AVALANCHE_RPC_URL}"
plasma = "${PLASMA_RPC_URL}"
9745 = "${PLASMA_RPC_URL}" # required for StdConfig

[etherscan]
polygon = { key = "${POLYGONSCAN_API_KEY}", chain = 137 }
Expand Down
1 change: 1 addition & 0 deletions lib/LayerZero-v2
Submodule LayerZero-v2 added at 3801b9
1 change: 1 addition & 0 deletions lib/devtools
Submodule devtools added at 77ba15
1 change: 1 addition & 0 deletions lib/solidity-bytes-utils
Submodule solidity-bytes-utils added at fc5024
7 changes: 7 additions & 0 deletions remappings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,10 @@ openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/
openzeppelin/=lib/openzeppelin-contracts-upgradeable/contracts/
solady/=lib/solady/
openzeppelin-contracts/=lib/openzeppelin-contracts/
@layerzerolabs/lz-evm-protocol-v2/=lib/LayerZero-v2/packages/layerzero-v2/evm/protocol
@layerzerolabs/lz-evm-messagelib-v2/=lib/LayerZero-v2/packages/layerzero-v2/evm/messagelib
@layerzerolabs/oapp-evm/=lib/devtools/packages/oapp-evm/
@layerzerolabs/oft-evm/=lib/devtools/packages/oft-evm/
@layerzerolabs/oft-evm-upgradeable/=lib/devtools/packages/oft-evm-upgradeable/
@layerzerolabs/oapp-evm-upgradeable/=lib/devtools/packages/oapp-evm-upgradeable/
solidity-bytes-utils/=lib/solidity-bytes-utils/
47 changes: 47 additions & 0 deletions script/deploy-periphery/BridgedPriceOracle.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;

import {StdConfig} from "forge-std/StdConfig.sol";
import {Variable, LibVariable} from "forge-std/LibVariable.sol";
import {Script} from "forge-std/Script.sol";
import {Proxy} from "../../src/core/proxy/Proxy.sol";
import {BridgedPriceOracle} from "../../src/periphery/BridgedPriceOracle.sol";

contract DeployBridgedPriceOracle is Script {
using LibVariable for Variable;

function run() external {
uint deployerPrivateKey = vm.envUint("PRIVATE_KEY");
address delegator = vm.envAddress("LZ_DELEGATOR");
require(delegator != address(0), "delegator is not set");

// ---------------------- Initialize
StdConfig config = new StdConfig("./config.toml", false); // read only config
StdConfig configDeployed = new StdConfig("./config.d.toml", true); // auto-write deployed addresses

require(
uint(configDeployed.get("BRIDGED_PRICE_ORACLE_MAIN_TOKEN").ty.kind) == 0,
"BridgedPriceOracle already deployed"
);

// ---------------------- Deploy
vm.startBroadcast(deployerPrivateKey);
Proxy proxy = new Proxy();
{
address implementation = address(new BridgedPriceOracle(config.get("LAYER_ZERO_V2_ENDPOINT").toAddress()));
proxy.initProxy(implementation);
require(proxy.implementation() == implementation, "BridgedPriceOracle: implementation mismatch");
}

// @dev assume here that we deploy price oracle for STBL token
BridgedPriceOracle(address(proxy)).initialize(config.get("PLATFORM").toAddress(), "STBL", delegator);

// ---------------------- Write results
vm.stopBroadcast();

// @dev assume here that we deploy price oracle for STBL token
configDeployed.set("BRIDGED_PRICE_ORACLE_MAIN_TOKEN", address(proxy));
}

function testDeployScript() external {}
}
52 changes: 52 additions & 0 deletions script/deploy-periphery/PriceAggregatorOApp.Sonic.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;

import {StdConfig} from "forge-std/StdConfig.sol";
import {Variable, LibVariable} from "forge-std/LibVariable.sol";
import {Script} from "forge-std/Script.sol";
import {Proxy} from "../../src/core/proxy/Proxy.sol";
import {PriceAggregatorOApp} from "../../src/periphery/PriceAggregatorOApp.sol";

contract DeployPriceAggregatorOAppSonic is Script {
using LibVariable for Variable;

function run() external {
uint deployerPrivateKey = vm.envUint("PRIVATE_KEY");
address delegator = vm.envAddress("LZ_DELEGATOR");
require(delegator != address(0), "delegator is not set");

// ---------------------- Initialize
StdConfig config = new StdConfig("./config.toml", false); // read only config
StdConfig configDeployed = new StdConfig("./config.d.toml", true); // auto-write deployed addresses

require(
block.chainid == 146,
"PriceAggregatorOApp is used on the Sonic only (the chain where native STBL is deployed)"
);
require(
uint(configDeployed.get("PRICE_AGGREGATOR_OAPP_MAIN_TOKEN").ty.kind) == 0,
"PriceAggregatorOApp already deployed"
);

// ---------------------- Deploy
vm.startBroadcast(deployerPrivateKey);
Proxy proxy = new Proxy();
{
address implementation = address(new PriceAggregatorOApp(config.get("LAYER_ZERO_V2_ENDPOINT").toAddress()));
proxy.initProxy(implementation);
require(proxy.implementation() == implementation, "PriceAggregatorOApp: implementation mismatch");
}

// @dev assume here that we deploy price oracle for STBL token
PriceAggregatorOApp(address(proxy))
.initialize(config.get("PLATFORM").toAddress(), config.get("TOKEN_STBL").toAddress(), delegator);

// ---------------------- Write results
vm.stopBroadcast();

// @dev assume here that we deploy price oracle for main-token
configDeployed.set("PRICE_AGGREGATOR_OAPP_MAIN_TOKEN", address(proxy));
}

function testDeployScript() external {}
}
24 changes: 24 additions & 0 deletions script/deploy-tokenomics/BridgedToken.Upgrade.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;

import {StdConfig} from "forge-std/StdConfig.sol";
import {Variable, LibVariable} from "forge-std/LibVariable.sol";
import {Script} from "forge-std/Script.sol";
import {BridgedToken} from "../../src/tokenomics/BridgedToken.sol";

contract DeployBridgedTokenImplementation is Script {
using LibVariable for Variable;

function run() external {
uint deployerPrivateKey = vm.envUint("PRIVATE_KEY");

StdConfig config = new StdConfig("./config.toml", false); // read only config

vm.startBroadcast(deployerPrivateKey);
new BridgedToken(config.get("LAYER_ZERO_V2_ENDPOINT").toAddress());

vm.stopBroadcast();
}

function testDeployScript() external {}
}
Loading
Loading