Skip to content
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
1 change: 1 addition & 0 deletions chains/avalanche/AvalancheConstantsLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ library AvalancheConstantsLib {
address public constant AAVE_aAvaUSDC = 0x625E7708f30cA75bfd92586e17077590C60eb4cD;

// Silo
address public constant SILO_LENS = 0x228A8688C0d8Fd6D4834c33664E5Fa775C91d11c; // old version 0x319f7155cC65F693E84689535aFb1343C704C0B8;
address public constant SILO_VAULT_USDC_125 = 0xE0345f66318F482aCCcd67244A921C7FDC410957;
address public constant SILO_VAULT_BTCb_130 = 0x7437ac81457Fa98fFB2d0C8f9943ecfE4813e2f1;
address public constant SILO_VAULT_BTCb_121 = 0xD8a26DFEba3E9B558Bd79d10722636Dfb4dc2bF4;
Expand Down
2 changes: 1 addition & 1 deletion script/setup-bridges/Setup.BridgedPriceOracle.Plasma.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ contract BridgedPriceOracleSetupPlasmaScript is Test {

address[] memory requiredDVNs = new address[](2);
requiredDVNs[0] = PlasmaConstantsLib.PLASMA_DVN_LAYER_ZERO_PUSH;
requiredDVNs[1] = PlasmaConstantsLib.PLASMA_DVN_NETHERMIND_PUSH;
requiredDVNs[1] = PlasmaConstantsLib.PLASMA_DVN_HORIZON_PUSH;
// requiredDVNs[2] = PLASMA_DVN_HORIZON;

BridgeTestLib._setupOAppOnChain(
Expand Down
2 changes: 1 addition & 1 deletion script/setup-bridges/Setup.BridgedToken.Plasma.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ contract BridgedTokenSetupPlasmaScript is Test {

address[] memory requiredDVNs = new address[](2);
requiredDVNs[0] = PlasmaConstantsLib.PLASMA_DVN_LAYER_ZERO_PUSH;
requiredDVNs[1] = PlasmaConstantsLib.PLASMA_DVN_NETHERMIND_PUSH;
requiredDVNs[1] = PlasmaConstantsLib.PLASMA_DVN_HORIZON_PUSH;
// requiredDVNs[2] = PLASMA_DVN_HORIZON;

BridgeTestLib._setupOAppOnChain(
Expand Down
21 changes: 21 additions & 0 deletions script/upgrade-core/PrepareUpgrade.25.12.2-alpha.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import {Script} from "forge-std/Script.sol";
import {FeeTreasury} from "../../src/tokenomics/FeeTreasury.sol";

contract PrepareUpgrade25121alpha is Script {
uint internal constant SONIC_CHAIN_ID = 146;

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

// FeeTreasury 1.1.1
new FeeTreasury();

vm.stopBroadcast();
}

function testPrepareUpgrade() external {}
}
2 changes: 1 addition & 1 deletion src/interfaces/IBridgedPriceOracle.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.22;

import {IAggregatorInterfaceMinimal} from "../integrations/chainlink/IAggregatorInterfaceMinimal.sol";
Expand Down
4 changes: 2 additions & 2 deletions src/interfaces/IPriceAggregatorOApp.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.22;
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import {MessagingFee} from "@layerzerolabs/oapp-evm-upgradeable/contracts/oapp/OAppUpgradeable.sol";

Expand Down
4 changes: 2 additions & 2 deletions src/periphery/BridgedPriceOracle.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.22;
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import {OAppUpgradeable, Origin} from "@layerzerolabs/oapp-evm-upgradeable/contracts/oapp/OAppUpgradeable.sol";
import {IControllable, Controllable} from "../core/base/Controllable.sol";
Expand Down
4 changes: 2 additions & 2 deletions src/periphery/PriceAggregatorOApp.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.22;
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import {
OAppUpgradeable,
Expand Down
4 changes: 2 additions & 2 deletions src/tokenomics/BridgedToken.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.22;
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import {OFTUpgradeable} from "@layerzerolabs/oft-evm-upgradeable/contracts/oft/OFTUpgradeable.sol";
import {IControllable, Controllable} from "../core/base/Controllable.sol";
Expand Down
19 changes: 13 additions & 6 deletions src/tokenomics/FeeTreasury.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {IFeeTreasury} from "../interfaces/IFeeTreasury.sol";

/// @title Performance fee treasury that distribute fees to claimers
/// Changelog:
/// 1.1.1: fix removeAssets, add assets()
/// 1.1.0: assets, harvest, fixes
/// @author Alien Deployer (https://github.com/a17)
contract FeeTreasury is Controllable, IFeeTreasury {
Expand All @@ -22,7 +23,7 @@ contract FeeTreasury is Controllable, IFeeTreasury {
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

/// @inheritdoc IControllable
string public constant VERSION = "1.1.0";
string public constant VERSION = "1.1.1";

uint public constant TOTAL_SHARES = 100;

Expand Down Expand Up @@ -114,7 +115,7 @@ contract FeeTreasury is Controllable, IFeeTreasury {

function removeAssets(address[] memory assets_) external onlyOperator {
FeeTreasuryStorage storage $ = _getTreasuryStorage();
uint len = $.assets.length();
uint len = assets_.length;
for (uint i; i < len; ++i) {
$.assets.remove(assets_[i]);
}
Expand Down Expand Up @@ -152,13 +153,13 @@ contract FeeTreasury is Controllable, IFeeTreasury {
}
}

function claim(address[] memory assets) external onlyClaimer {
function claim(address[] memory assets_) external onlyClaimer {
FeeTreasuryStorage storage $ = _getTreasuryStorage();
uint len = assets.length;
uint len = assets_.length;
for (uint i; i < len; ++i) {
uint toClaim = $.toClaim[assets[i]][msg.sender];
uint toClaim = $.toClaim[assets_[i]][msg.sender];
if (toClaim != 0) {
_claimAsset($, assets[i], toClaim);
_claimAsset($, assets_[i], toClaim);
}
}
}
Expand All @@ -182,6 +183,12 @@ contract FeeTreasury is Controllable, IFeeTreasury {
}
}

/// @notice Get list of all registered assets
function assets() external view returns (address[] memory) {
FeeTreasuryStorage storage $ = _getTreasuryStorage();
return $.assets.values();
}

/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* INTERNAL LOGIC */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
Expand Down
4 changes: 2 additions & 2 deletions src/tokenomics/TokenOFTAdapter.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.22;
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import {OFTAdapterUpgradeable} from "@layerzerolabs/oft-evm-upgradeable/contracts/oft/OFTAdapterUpgradeable.sol";
import {IControllable, Controllable} from "../core/base/Controllable.sol";
Expand Down
57 changes: 57 additions & 0 deletions test/tokenomics/FeeTreasury.Upgrade.Sonic.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import {Test} from "forge-std/Test.sol";
import {SonicConstantsLib} from "../../chains/sonic/SonicConstantsLib.sol";
import {IPlatform} from "../../src/interfaces/IPlatform.sol";
import {IRevenueRouter} from "../../src/tokenomics/RevenueRouter.sol";
import {IFeeTreasury, FeeTreasury} from "../../src/tokenomics/FeeTreasury.sol";

contract FeeTreasuryUpgradeTest is Test {
uint public constant FORK_BLOCK = 58970278;
address public multisig;
IRevenueRouter public revenueRouter;
IFeeTreasury internal feeTreasury;

constructor() {
vm.selectFork(vm.createFork(vm.envString("SONIC_RPC_URL"), FORK_BLOCK));
multisig = IPlatform(SonicConstantsLib.PLATFORM).multisig();
revenueRouter = IRevenueRouter(IPlatform(SonicConstantsLib.PLATFORM).revenueRouter());
feeTreasury = IFeeTreasury(revenueRouter.units()[0].feeTreasury);
_upgradeFeeTreasury();
}

function testAddRemoveAssets() public {
address[] memory assets = new address[](3);
assets[0] = 0xb90a84F285aE8D3c0ceD37deD6Fc0f943f7279b7;
assets[1] = 0x46b2E96725F03873Cb586a7f84c22545F2835F31;
assets[2] = 0x00886bC6a12d8D5ad0ef51e041a8AB37A0E59251;

vm.prank(SonicConstantsLib.MULTISIG);
FeeTreasury(0x3950b3a43fa0687561Bc5c8E32D2EE826D88a661).addAssets(assets);

assets = new address[](6);
assets[0] = 0xdDfBF8e25Be0e36351dE8C2a811A0319Ec42E0fD;
assets[1] = 0x7A41DF9418509725AB5637f1984F3e6d6E6C899b;
assets[2] = 0x64d0071044EF8F98B8E5ecFCb4A6c12Cb8BC1Ec0;
assets[3] = 0x9154f0a385eef5d48ceF78D9FEA19995A92718a9;
assets[4] = 0x61bC5Ce0639aA0A24Ab7ea8B574D4B0D6b619833;
assets[5] = 0x62E8eEe1aAAc7978672f90da21e4de766213b574;

vm.prank(SonicConstantsLib.MULTISIG);
FeeTreasury(0x3950b3a43fa0687561Bc5c8E32D2EE826D88a661).removeAssets(assets);
}

function _upgradeFeeTreasury() internal {
address[] memory proxies = new address[](1);
proxies[0] = address(feeTreasury);
address[] memory implementations = new address[](1);
implementations[0] = address(new FeeTreasury());
vm.startPrank(multisig);
IPlatform(SonicConstantsLib.PLATFORM).announcePlatformUpgrade("2025.12.2-alpha", proxies, implementations);
skip(18 hours);
IPlatform(SonicConstantsLib.PLATFORM).upgrade();
vm.stopPrank();
rewind(17 hours);
}
}
Loading