Skip to content
Merged
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
5 changes: 5 additions & 0 deletions chains/plasma/PlasmaConstantsLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@ pragma solidity ^0.8.28;
library PlasmaConstantsLib {
address public constant MULTISIG = 0xE929438B5B53984FdBABf8562046e141e90E8099;
address public constant PLATFORM = 0xd4D6ad656f64E8644AFa18e7CCc9372E0Cd256f0;
address public constant REVENUE_ROUTER = 0xAf95468B1a624605bbFb862B0FB6e9C73Ad847b8;
address public constant XSTBL_XSTAKING = 0x601572b91DC054Be500392A6d3e15c690140998D;
address public constant RECOVERY = 0x046e7a007C331e0d4DafA66104744dB14a52bBBb;

// ERC20
address public constant TOKEN_STBL = 0xfdf91362B7E9330F232e500c0236a02B0DE3e492;
address public constant TOKEN_XSTBL = 0xF40D0724599282CaF9dfb66feB630e936bC0CFBE;
address public constant TOKEN_USDT0 = 0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb;
address public constant TOKEN_USDE = 0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34;
address public constant TOKEN_SUSDE = 0x211Cc4DD073734dA055fbF44a2b4667d5E5fE5d2;
Expand Down
23 changes: 14 additions & 9 deletions guides/AllDeployments.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,20 @@

### Core

* **Platform** `0xd4d6ad656f64e8644afa18e7ccc9372e0cd256f0` [plasmascan](https://plasmascan.to/address/0xd4D6ad656f64E8644AFa18e7CCc9372E0Cd256f0/contract/9745/readProxyContract)
* **Factory** `0x4c5758e3c454a260d98238706ca6f4802cc52746` [plasmascan](https://plasmascan.to/address/0x4C5758e3c454A260D98238706cA6F4802cc52746)
* **MetaVaultFactory** `0xbd5296dc2603942f116b375c8ee373674be86f56` [plasmascan](https://plasmascan.to/address/0xbd5296dc2603942f116b375c8ee373674be86f56)
* **PriceReader** `0xd4af1b538c826e1e90b695314042ab6fd0e7f4aa` [plasmascan](https://plasmascan.to/address/0xd4af1b538c826e1e90b695314042ab6fd0e7f4aa)
* **Swapper** `0x54f22378e03bea25a05a071b60357d31ce535bb9` [plasmascan](https://plasmascan.to/address/0x54f22378e03bea25a05a071b60357d31ce535bb9)
* **HardWorker** `0x73ae48f75ea304ff229d2a1374654672fa8388e7` [plasmascan](https://plasmascan.to/address/0x73ae48f75ea304ff229d2a1374654672fa8388e7)
* **VaultManager** `0x22d031e45a02d6472786b9d7a4fd78f1733d6990` [plasmascan](https://plasmascan.to/address/0x22d031e45a02d6472786b9d7a4fd78f1733d6990)
* **StrategyLogic** `0x5e670b7a1740e8a11aff06335984d696d537b7bc` [plasmascan](https://plasmascan.to/address/0x5e670b7a1740e8a11aff06335984d696d537b7bc)
* **Zap** `0xbc4ff9766074b53c7a4cb91964836c83188f333d` [plasmascan](https://plasmascan.to/address/0xbc4ff9766074b53c7a4cb91964836c83188f333d)
* **Platform** `0xd4d6ad656f64e8644afa18e7ccc9372e0cd256f0` [plasmascan](https://plasmascan.to/address/0xd4D6ad656f64E8644AFa18e7CCc9372E0Cd256f0#readProxyContract)
* **Factory** `0x4c5758e3c454a260d98238706ca6f4802cc52746` [plasmascan](https://plasmascan.to/address/0x4C5758e3c454A260D98238706cA6F4802cc52746#readProxyContract)
* **MetaVaultFactory** `0xbd5296dc2603942f116b375c8ee373674be86f56` [plasmascan](https://plasmascan.to/address/0xbd5296dc2603942f116b375c8ee373674be86f56#readProxyContract)
* **PriceReader** `0xd4af1b538c826e1e90b695314042ab6fd0e7f4aa` [plasmascan](https://plasmascan.to/address/0xd4af1b538c826e1e90b695314042ab6fd0e7f4aa#readProxyContract)
* **Swapper** `0x54f22378e03bea25a05a071b60357d31ce535bb9` [plasmascan](https://plasmascan.to/address/0x54f22378e03bea25a05a071b60357d31ce535bb9#readProxyContract)
* **HardWorker** `0x73ae48f75ea304ff229d2a1374654672fa8388e7` [plasmascan](https://plasmascan.to/address/0x73ae48f75ea304ff229d2a1374654672fa8388e7#readProxyContract)
* **VaultManager** `0x22d031e45a02d6472786b9d7a4fd78f1733d6990` [plasmascan](https://plasmascan.to/address/0x22d031e45a02d6472786b9d7a4fd78f1733d6990#readProxyContract)
* **StrategyLogic** `0x5e670b7a1740e8a11aff06335984d696d537b7bc` [plasmascan](https://plasmascan.to/address/0x5e670b7a1740e8a11aff06335984d696d537b7bc#readProxyContract)
* **Zap** `0xbc4ff9766074b53c7a4cb91964836c83188f333d` [plasmascan](https://plasmascan.to/address/0xbc4ff9766074b53c7a4cb91964836c83188f333d#readProxyContract)

### Tokenomics

* **RevenueRouter** `0xAf95468B1a624605bbFb862B0FB6e9C73Ad847b8` [plasmascan](https://plasmascan.to/address/0xAf95468B1a624605bbFb862B0FB6e9C73Ad847b8#readProxyContract)
* **XStaking** `0x601572b91DC054Be500392A6d3e15c690140998D` [plasmascan](https://plasmascan.to/address/0x601572b91DC054Be500392A6d3e15c690140998D#readProxyContract)

### Periphery

Expand Down
10 changes: 4 additions & 6 deletions guides/Deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@ It is important to verify during deployment. Otherwise, you will have to manuall

### Plasma

`forge script` now show error: `Error: Chain 9745 not supported`.

When deploying Platform via `forge create` we see `Error: Dynamic linking not supported in `create` command - deploy the following library contracts first, then provide the address to link at compile time`.

```shell
forge script --rpc-url plasma --slow --broadcast --verify --etherscan-api-key sonic --verifier-url 'https://api.routescan.io/v2/network/mainnet/evm/9745/etherscan' ./script/deploy-core/Deploy.Plasma.s.sol
forge script --rpc-url plasma --slow --broadcast --verify --etherscan-api-key plasma --verifier-url 'https://api.etherscan.io/v2/api?chainid=9745' ./script/deploy-core/Deploy.Plasma.s.sol
```

# verify single
```
# verify on routescan
forge verify-contract --rpc-url plasma --etherscan-api-key sonic --verifier-url 'https://api.routescan.io/v2/network/mainnet/evm/9745/etherscan' --watch 0x70e804364175e23F1c30dFa03BFb19d936E5E81c
```

Expand Down
16 changes: 16 additions & 0 deletions script/deploy-tokenomics/XStaking.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

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

contract DeployXStaking is Script {
function run() external {
uint deployerPrivateKey = vm.envUint("PRIVATE_KEY");
vm.startBroadcast(deployerPrivateKey);
new XStaking();
vm.stopBroadcast();
}

function testDeployScript() external {}
}
25 changes: 18 additions & 7 deletions src/interfaces/IRevenueRouter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface IRevenueRouter {
event UnitEpochRevenue(uint periodEnded, string unitName, uint stblRevenue);
event ProcessUnitRevenue(uint unitIndex, uint stblGot);
event SetAddresses(address[] addresses);
event SetXShare(uint newShare);
event BuyBackRate(uint bbRate);

/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* CUSTOM ERRORS */
Expand All @@ -34,7 +34,7 @@ interface IRevenueRouter {
address xToken;
address xStaking;
address feeTreasury;
uint xShare;
uint __deprecated_xShare;
uint activePeriod;
uint pendingRevenue;
Unit[] units;
Expand All @@ -43,6 +43,10 @@ interface IRevenueRouter {
EnumerableSet.AddressSet assetsAccumulated;
EnumerableMap.AddressToUintMap minSwapAmount;
EnumerableMap.AddressToUintMap maxSwapAmount;

// todo use DAO parameter
uint bbRate;
EnumerableMap.AddressToUintMap pendingRevenueAsset;
}

enum UnitType {
Expand Down Expand Up @@ -77,12 +81,12 @@ interface IRevenueRouter {
/// @notice Set max swap amounts for assets
function setMaxSwapAmounts(address[] calldata assets, uint[] calldata maxAmounts) external;

/// @notice Change revenue share for Vaults Unit
function setXShare(uint newShare) external;

/// @notice Set addresses of main-token, xToken, xStaking and feeTreasure token.
function setAddresses(address[] memory addresses_) external;

/// @notice Set buy-back rate for rewards
function setBuyBackRate(uint bbRate) external;

/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* USER ACTIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
Expand Down Expand Up @@ -144,6 +148,13 @@ interface IRevenueRouter {
/// @notice Get assets that contract hold on balance
function assetsAccumulated() external view returns (address[] memory);

/// @notice Get current xToken revenue share for Vaults Unit
function xShare() external view returns (uint);
/// @notice Buy-back rate for generated revenue
function buyBackRate() external view returns (uint);

/// @notice Asset with pending revenue for distribution
function pendingRevenueAssets() external view returns (address[] memory);

/// @notice Pending revenue in form of asset
/// @param asset Allowed asset address
function pendingRevenueAsset(address asset) external view returns (uint);
}
60 changes: 50 additions & 10 deletions src/interfaces/IXStaking.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,21 @@ interface IXStaking {
event Withdraw(address indexed from, uint amount);

event NotifyReward(address indexed from, uint amount);

event ClaimRewards(address indexed from, uint amount);

event NewDuration(uint oldDuration, uint newDuration);

event RewardTokenAllowed(address indexed token, bool allowed);
event NotifyRewardForToken(address indexed token, address indexed from, uint amount);
event ClaimRewardsForToken(address indexed token, address indexed from, uint amount);

/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* CUSTOM ERRORS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

error DaoNotInitialized();
error TokenNotAllowed(address token);

/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* WRITE FUNCTIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
Expand Down Expand Up @@ -48,12 +58,27 @@ interface IXStaking {
/// Otherwise, the user receives 1 DAO-token for each 1 xToken staked.
function syncDAOBalances(address[] calldata users) external;

/// @notice Allow or disallow reward token
/// @param token Address of reward token
/// @param allowed Allowed state
/// @custom:restricted Only operator
function allowRewardToken(address token, bool allowed) external;

/// @notice Used to notify pending xToken rebases and platform revenue share
/// @custom:restricted Only RevenueRouter or xToken
/// @param token Address of reward token
/// @param amount The amount of main token to be notified
function notifyRewardAmountToken(address token, uint amount) external;

/// @notice Claims pending rewards
/// @param token Address of reward token
function getRewardToken(address token) external;

/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* VIEW FUNCTIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

/// @notice Returns the last time the reward was modified or periodFinish if the reward has ended
function lastTimeRewardApplicable() external view returns (uint);
// common data

/// @notice The address of the xToken token (staking/voting token)
/// @return xToken address
Expand All @@ -62,6 +87,19 @@ interface IXStaking {
/// @notice Returns the total voting power (equal to total supply in the XStaking)
function totalSupply() external view returns (uint);

/// @notice The duration of notified rewards distribution
function duration() external view returns (uint);

/// @notice Staked amount
/// @param user the address to check
/// @return The staked balance
function balanceOf(address user) external view returns (uint);

// legacy data

/// @notice Returns the last time the reward was modified or periodFinish if the reward has ended
function lastTimeRewardApplicable() external view returns (uint);

/// @notice Last time the rewards system was updated
function lastUpdateTime() external view returns (uint);

Expand All @@ -74,9 +112,6 @@ interface IXStaking {
/// @notice Calculates the rewards distributed per second
function rewardRate() external view returns (uint);

/// @notice The duration of notified rewards distribution
function duration() external view returns (uint);

/// @dev Current calculated reward per token
/// @return The return value is scaled (multiplied) by PRECISION = 10 ** 18
function rewardPerToken() external view returns (uint);
Expand All @@ -92,8 +127,13 @@ interface IXStaking {
/// @notice User's earned reward
function earned(address account) external view returns (uint);

/// @notice Voting power
/// @param user the address to check
/// @return The staked balance
function balanceOf(address user) external view returns (uint);
// reward tokens data

/// @notice Is token allowed for rewards
function isTokenAllowed(address token) external view returns (bool);

/// @notice User's earned reward of token
/// @param token Address of reward token
/// @param account Address of user
function earnedToken(address token, address account) external view returns (uint);
}
Loading
Loading