ERC-20
Source Code
Overview
Max Total Supply
67,176.586974449700682194 yv-SPR
Holders
30
Market
Onchain Market Cap
-
Circulating Supply Market Cap
-
Other Info
Token Contract (WITH 18 Decimals)
Balance
242.037307343202224269 yv-SPRValue
$0.00Loading...
Loading
Loading...
Loading
Loading...
Loading
| # | Exchange | Pair | Price | 24H Volume | % Volume |
|---|
Contract Name:
YieldVault
Compiler Version
v0.8.30+commit.73712a01
Optimization Enabled:
Yes with 200 runs
Other Settings:
prague EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.29;
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import {BaseContract} from "common-contracts/base-contracts/BaseContract.sol";
import {DEPOSIT_SCOPE, WITHDRAWAL_SCOPE} from "@src/common/constants/Scopes.sol";
import {OPERATOR_ROLE, EMERGENCY_ROLE} from "@src/common/access-management/Roles.sol";
import {ISPRVault} from "@src/spreads-vault/core/ISPRVault.sol";
import {
Staked,
Unstaked,
RewardsDistributed,
EmergencyPaused,
EmergencyUnpaused,
EmergencyWithdraw
} from "@src/spreads-vault/events/EventsV2.sol";
import "@src/common/constants/Contracts.sol";
import {IVaultManagerRepository} from "@src/spreads-vault/repositories/IVaultManagerRepository.sol";
contract YieldVault is ERC20, BaseContract, ReentrancyGuard {
using SafeERC20 for IERC20;
modifier nonZero(uint256 _amount) {
require(_amount > 0, "Amount must be greater than zero");
_;
}
bool public emergencyPaused;
constructor(address _beaconAddress) ERC20("Yield Vault Shares", "yv-SPR") BaseContract(_beaconAddress) {}
function _getRepo() internal view returns (IVaultManagerRepository) {
return IVaultManagerRepository(_getContractAddress(VAULT_MANAGER_REPO_CONTRACT));
}
function _getSPRToken() internal view returns (IERC20) {
return IERC20(_getRepo().getSPRToken());
}
function _getRewardDistributor() internal view returns (address) {
return _getRepo().getFarmVaultRewardDistributor();
}
function emergencyPause() external onlyRole(EMERGENCY_ROLE) {
emergencyPaused = true;
emit EmergencyPaused();
}
function emergencyUnpause() external onlyRole(EMERGENCY_ROLE) {
emergencyPaused = false;
emit EmergencyUnpaused();
}
function emergencyWithdraw(address token, address recipient) external onlyRole(EMERGENCY_ROLE) {
require(recipient != address(0), "Invalid recipient");
uint256 balance = IERC20(token).balanceOf(address(this));
require(balance > 0, "No balance to withdraw");
IERC20(token).safeTransfer(recipient, balance);
emit EmergencyWithdraw(token, recipient, balance);
}
function stake(uint256 sprAmount)
external
nonReentrant
whenScopeNotPaused(DEPOSIT_SCOPE)
returns (uint256 shares)
{
require(sprAmount > 0, "Zero amount");
require(!emergencyPaused, "Paused");
shares = _convertToShares(sprAmount);
IERC20 sprToken = _getSPRToken();
sprToken.safeTransferFrom(msg.sender, address(this), sprAmount);
_mint(msg.sender, shares);
emit Staked(msg.sender, sprAmount, shares);
}
function unstake(uint256 shares)
external
nonReentrant
whenScopeNotPaused(WITHDRAWAL_SCOPE)
returns (uint256 sprAmount)
{
require(shares > 0, "Zero shares");
require(balanceOf(msg.sender) >= shares, "Insufficient shares");
require(!emergencyPaused, "Paused");
sprAmount = _convertToAssets(shares);
_burn(msg.sender, shares);
IERC20 sprToken = _getSPRToken();
sprToken.safeTransfer(msg.sender, sprAmount);
emit Unstaked(msg.sender, shares, sprAmount);
}
function distributeRewards(uint256 rewardAmount) external {
require(msg.sender == _getRewardDistributor(), "Not distributor");
require(rewardAmount > 0, "Zero reward");
IERC20 sprToken = _getSPRToken();
sprToken.safeTransferFrom(msg.sender, address(this), rewardAmount);
emit RewardsDistributed(msg.sender, rewardAmount);
}
function totalAssets() public view returns (uint256) {
return _getSPRToken().balanceOf(address(this));
}
function pricePerShare() public view returns (uint256) {
uint256 supply = totalSupply();
if (supply == 0) return 1e18;
return (totalAssets() * 1e18) / supply;
}
function convertToShares(uint256 sprAmount) public view returns (uint256) {
return _convertToShares(sprAmount);
}
function convertToAssets(uint256 shares) public view returns (uint256) {
return _convertToAssets(shares);
}
function _convertToShares(uint256 sprAmount) internal view returns (uint256) {
uint256 supply = totalSupply();
if (supply == 0) return sprAmount;
return (sprAmount * supply) / totalAssets();
}
function _convertToAssets(uint256 shares) internal view returns (uint256) {
uint256 supply = totalSupply();
if (supply == 0) return shares;
return (shares * totalAssets()) / supply;
}
function collateralRewardToSPR(uint256 _amount)
external
whenNotPaused
nonReentrant
onlyRole(OPERATOR_ROLE)
nonZero(_amount)
{
IVaultManagerRepository repo = _getRepo();
address collateralToken = repo.getCollateralToken();
address sprVault = _getContractAddress(SPR_VAULT_CONTRACT);
IERC20(collateralToken).safeTransferFrom(msg.sender, address(this), _amount);
IERC20(collateralToken).approve(sprVault, _amount);
ISPRVault(sprVault).deposit(_amount);
}
function getTotalFarmSPR() external view returns (uint256) {
return totalSupply();
}
function receiveRebalance(uint256 amount, address token) external nonReentrant onlySystem {
require(amount > 0, "Zero amount");
require(token == address(_getSPRToken()), "Invalid token");
emit RewardsDistributed(msg.sender, amount);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "./IERC20.sol";
import {IERC20Metadata} from "./extensions/IERC20Metadata.sol";
import {Context} from "../../utils/Context.sol";
import {IERC20Errors} from "../../interfaces/draft-IERC6093.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
*
* TIP: For a detailed writeup see our guide
* https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* The default value of {decimals} is 18. To change this, you should override
* this function so it returns a different value.
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC-20
* applications.
*/
abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {
mapping(address account => uint256) private _balances;
mapping(address account => mapping(address spender => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* Both values are immutable: they can only be set once during construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the default value returned by this function, unless
* it's overridden.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual returns (uint8) {
return 18;
}
/// @inheritdoc IERC20
function totalSupply() public view virtual returns (uint256) {
return _totalSupply;
}
/// @inheritdoc IERC20
function balanceOf(address account) public view virtual returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - the caller must have a balance of at least `value`.
*/
function transfer(address to, uint256 value) public virtual returns (bool) {
address owner = _msgSender();
_transfer(owner, to, value);
return true;
}
/// @inheritdoc IERC20
function allowance(address owner, address spender) public view virtual returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* NOTE: If `value` is the maximum `uint256`, the allowance is not updated on
* `transferFrom`. This is semantically equivalent to an infinite approval.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 value) public virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, value);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Skips emitting an {Approval} event indicating an allowance update. This is not
* required by the ERC. See {xref-ERC20-_approve-address-address-uint256-bool-}[_approve].
*
* NOTE: Does not update the allowance if the current allowance
* is the maximum `uint256`.
*
* Requirements:
*
* - `from` and `to` cannot be the zero address.
* - `from` must have a balance of at least `value`.
* - the caller must have allowance for ``from``'s tokens of at least
* `value`.
*/
function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, value);
_transfer(from, to, value);
return true;
}
/**
* @dev Moves a `value` amount of tokens from `from` to `to`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* NOTE: This function is not virtual, {_update} should be overridden instead.
*/
function _transfer(address from, address to, uint256 value) internal {
if (from == address(0)) {
revert ERC20InvalidSender(address(0));
}
if (to == address(0)) {
revert ERC20InvalidReceiver(address(0));
}
_update(from, to, value);
}
/**
* @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`
* (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding
* this function.
*
* Emits a {Transfer} event.
*/
function _update(address from, address to, uint256 value) internal virtual {
if (from == address(0)) {
// Overflow check required: The rest of the code assumes that totalSupply never overflows
_totalSupply += value;
} else {
uint256 fromBalance = _balances[from];
if (fromBalance < value) {
revert ERC20InsufficientBalance(from, fromBalance, value);
}
unchecked {
// Overflow not possible: value <= fromBalance <= totalSupply.
_balances[from] = fromBalance - value;
}
}
if (to == address(0)) {
unchecked {
// Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.
_totalSupply -= value;
}
} else {
unchecked {
// Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.
_balances[to] += value;
}
}
emit Transfer(from, to, value);
}
/**
* @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).
* Relies on the `_update` mechanism
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* NOTE: This function is not virtual, {_update} should be overridden instead.
*/
function _mint(address account, uint256 value) internal {
if (account == address(0)) {
revert ERC20InvalidReceiver(address(0));
}
_update(address(0), account, value);
}
/**
* @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.
* Relies on the `_update` mechanism.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* NOTE: This function is not virtual, {_update} should be overridden instead
*/
function _burn(address account, uint256 value) internal {
if (account == address(0)) {
revert ERC20InvalidSender(address(0));
}
_update(account, address(0), value);
}
/**
* @dev Sets `value` as the allowance of `spender` over the `owner`'s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*
* Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
*/
function _approve(address owner, address spender, uint256 value) internal {
_approve(owner, spender, value, true);
}
/**
* @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.
*
* By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by
* `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any
* `Approval` event during `transferFrom` operations.
*
* Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to
* true using the following override:
*
* ```solidity
* function _approve(address owner, address spender, uint256 value, bool) internal virtual override {
* super._approve(owner, spender, value, true);
* }
* ```
*
* Requirements are the same as {_approve}.
*/
function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {
if (owner == address(0)) {
revert ERC20InvalidApprover(address(0));
}
if (spender == address(0)) {
revert ERC20InvalidSpender(address(0));
}
_allowances[owner][spender] = value;
if (emitEvent) {
emit Approval(owner, spender, value);
}
}
/**
* @dev Updates `owner`'s allowance for `spender` based on spent `value`.
*
* Does not update the allowance value in case of infinite allowance.
* Revert if not enough allowance is available.
*
* Does not emit an {Approval} event.
*/
function _spendAllowance(address owner, address spender, uint256 value) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance < type(uint256).max) {
if (currentAllowance < value) {
revert ERC20InsufficientAllowance(spender, currentAllowance, value);
}
unchecked {
_approve(owner, spender, currentAllowance - value, false);
}
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/IERC20.sol)
pragma solidity >=0.4.16;
/**
* @dev Interface of the ERC-20 standard as defined in the ERC.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 value) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 value) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
import {IERC1363} from "../../../interfaces/IERC1363.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC-20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
/**
* @dev An operation with an ERC-20 token failed.
*/
error SafeERC20FailedOperation(address token);
/**
* @dev Indicates a failed `decreaseAllowance` request.
*/
error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
}
/**
* @dev Variant of {safeTransfer} that returns a bool instead of reverting if the operation is not successful.
*/
function trySafeTransfer(IERC20 token, address to, uint256 value) internal returns (bool) {
return _callOptionalReturnBool(token, abi.encodeCall(token.transfer, (to, value)));
}
/**
* @dev Variant of {safeTransferFrom} that returns a bool instead of reverting if the operation is not successful.
*/
function trySafeTransferFrom(IERC20 token, address from, address to, uint256 value) internal returns (bool) {
return _callOptionalReturnBool(token, abi.encodeCall(token.transferFrom, (from, to, value)));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*
* IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
* smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
* this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
* that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
forceApprove(token, spender, oldAllowance + value);
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
* value, non-reverting calls are assumed to be successful.
*
* IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
* smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
* this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
* that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
unchecked {
uint256 currentAllowance = token.allowance(address(this), spender);
if (currentAllowance < requestedDecrease) {
revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
}
forceApprove(token, spender, currentAllowance - requestedDecrease);
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*
* NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function
* only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being
* set here.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no
* code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* Reverts if the returned value is other than `true`.
*/
function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
if (to.code.length == 0) {
safeTransfer(token, to, value);
} else if (!token.transferAndCall(to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target
* has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* Reverts if the returned value is other than `true`.
*/
function transferFromAndCallRelaxed(
IERC1363 token,
address from,
address to,
uint256 value,
bytes memory data
) internal {
if (to.code.length == 0) {
safeTransferFrom(token, from, to, value);
} else if (!token.transferFromAndCall(from, to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no
* code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.
* Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}
* once without retrying, and relies on the returned value to be true.
*
* Reverts if the returned value is other than `true`.
*/
function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
if (to.code.length == 0) {
forceApprove(token, to, value);
} else if (!token.approveAndCall(to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturnBool} that reverts if call fails to meet the requirements.
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
uint256 returnSize;
uint256 returnValue;
assembly ("memory-safe") {
let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
// bubble errors
if iszero(success) {
let ptr := mload(0x40)
returndatacopy(ptr, 0, returndatasize())
revert(ptr, returndatasize())
}
returnSize := returndatasize()
returnValue := mload(0)
}
if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturn} that silently catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
bool success;
uint256 returnSize;
uint256 returnValue;
assembly ("memory-safe") {
success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
returnSize := returndatasize()
returnValue := mload(0)
}
return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/ReentrancyGuard.sol)
pragma solidity ^0.8.20;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If EIP-1153 (transient storage) is available on the chain you're deploying at,
* consider using {ReentrancyGuardTransient} instead.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant NOT_ENTERED = 1;
uint256 private constant ENTERED = 2;
uint256 private _status;
/**
* @dev Unauthorized reentrant call.
*/
error ReentrancyGuardReentrantCall();
constructor() {
_status = NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be NOT_ENTERED
if (_status == ENTERED) {
revert ReentrancyGuardReentrantCall();
}
// Any calls to nonReentrant after this point will fail
_status = ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == ENTERED;
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.26;
import {SecureAccess} from "../access-management/SecureAccess.sol";
import {DataReader} from "../data/DataReader.sol";
import {BeaconWatcher} from "../beacon/BeaconWatcher.sol";
import {Pausable} from "../pausable/Pausable.sol";
/**
* @title BaseContract
* @dev This contract serves as the base contract for other contracts in the system.
* It inherits from the SecureAccess and DataReader contracts and provides a constructor
* to initialize the access manager and data store address.
*/
abstract contract BaseContract is
SecureAccess,
DataReader,
BeaconWatcher,
Pausable
{
constructor(
address _beaconAddress
)
BeaconWatcher(_beaconAddress)
SecureAccess(SecureAccess(_beaconAddress).getAccessManager())
DataReader(DataReader(_beaconAddress).getDataStore())
Pausable(Pausable(_beaconAddress).getPauser())
{}
}// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.29;
bytes32 constant DEPOSIT_SCOPE = keccak256("DEPOSIT");
bytes32 constant WITHDRAWAL_SCOPE = keccak256("WITHDRAWAL");
bytes32 constant LOCK_SCOPE = keccak256("LOCK");
bytes32 constant UNLOCK_SCOPE = keccak256("UNLOCK");// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.29;
bytes32 constant OPERATOR_ROLE = keccak256("OPERATOR");
bytes32 constant SYSTEM_ROLE = keccak256("SYSTEM");
bytes32 constant EMERGENCY_ROLE = keccak256("EMERGENCY");// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.29;
import {WithdrawalRequest} from "@src/spreads-vault/structs/WithdrawalRequest.sol";
interface ISPRVault {
/**
* @dev Deposit collateral and receive shares based on the current exchange rate.
* @param _amount The amount of collateral to deposit.
* Emits a {DepositV2} event.
*/
function deposit(uint256 _amount) external;
/**
* @dev Withdraw shares for collateral based on the current exchange rate.
* If vault has sufficient balance, immediate withdrawal occurs.
* Otherwise, a withdrawal request is queued for later allocation.
* @param _shareAmount The amount of shares to withdraw.
* Emits either {WithdrawV2} or {WithdrawalQueued} event.
*/
function withdraw(uint256 _shareAmount) external;
/**
* @dev Claim allocated collateral from processed withdrawal requests.
* Emits a {WithdrawalClaimed} event.
*/
function claim() external;
/**
* @dev Cancel a pending withdrawal request.
* @param _requestId The ID of the withdrawal request to cancel.
* Emits a {WithdrawalCancelled} event.
*/
function cancelWithdrawalRequest(uint256 _requestId) external;
/**
* @dev Process pending withdrawal requests in the queue.
* Allocates collateral to as many requests as possible with available vault balance.
* Users must then call claim() to receive their allocated funds.
* Emits {WithdrawalAllocated} events for each processed request.
* Emits a {QueueProcessed} event at the end.
*/
function processWithdrawalQueue(uint256 _maxRequests) external;
/**
* @dev Get pending withdrawal requests for a specific user.
* @param _user The address of the user.
* @return Array of withdrawal requests for the user.
*/
function getUserWithdrawalRequests(address _user) external view returns (WithdrawalRequest[] memory);
/**
* @dev Get all pending withdrawal requests in the queue.
* @return Array of all withdrawal requests.
*/
function getAllWithdrawalRequests() external view returns (WithdrawalRequest[] memory);
/**
* @dev Get the current exchange rate.
* @return rate The current exchange rate.
* @return lastUpdated Timestamp of last update.
*/
function getExchangeRate() external view returns (uint256 rate, uint256 lastUpdated);
/**
* @dev Calculate shares to mint for a given collateral amount.
* @param _collateralAmount The amount of collateral.
* @return shareAmount The amount of shares to mint (before fees).
* @return fee The deposit fee amount.
* @return netShares The net shares after fees.
*/
function calculateDeposit(uint256 _collateralAmount)
external
view
returns (uint256 shareAmount, uint256 fee, uint256 netShares);
/**
* @dev Calculate collateral to return for a given share amount.
* @param _shareAmount The amount of shares.
* @return collateralAmount The amount of collateral (before fees).
* @return fee The withdrawal fee amount.
* @return netCollateral The net collateral after fees.
*/
function calculateWithdrawal(uint256 _shareAmount)
external
view
returns (uint256 collateralAmount, uint256 fee, uint256 netCollateral);
/**
* @dev Get the available collateral balance in the vault.
* @return balance The available collateral balance.
*/
function getAvailableBalance() external view returns (uint256 balance);
/**
* @dev Get the total number of pending withdrawal requests.
* @return count The number of pending requests.
*/
function getPendingWithdrawalCount() external view returns (uint256 count);
/**
* @dev Get the claimable collateral balance for a user.
* @param _user The address of the user.
* @return amount The claimable collateral amount.
*/
function getClaimableBalance(address _user) external view returns (uint256 amount);
/**
* @dev Get the share token address.
* @return The address of the share token contract.
*/
function getSPRToken() external view returns (address);
function getMinimumDepositAmount() external view returns (uint256 minimumDeposit);
/**
* @dev Set the queue paused state.
* @param _paused Whether to pause the queue.
*/
function setQueuePaused(bool _paused) external;
/**
* @dev Get the current queue paused state.
* @return Whether the queue is paused.
*/
function isQueuePaused() external view returns (bool);
// /**
// * @dev Transfer collateral for rebalancing purposes (WaterfallAccounting only).
// * @param _recipient The address to transfer collateral to.
// * @param _amount The amount of collateral to transfer.
// */
// function transferForRebalance(address _recipient, uint256 _amount) external;
}// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.29;
import {WithdrawalRequest} from "@src/spreads-vault/structs/WithdrawalRequest.sol";
import {ReceiptTokens} from "@src/spreads-vault/structs/ReceiptTokens.sol";
event ExchangeRateUpdated(uint256 indexed rate, address indexed updater, uint256 timestamp);
event Deposit(
address indexed depositor, uint256 collateralAmount, uint256 sharesMinted, uint256 exchangeRate, uint256 fee
);
event Withdraw(
address indexed withdrawer, uint256 sharesAmount, uint256 collateralReceived, uint256 exchangeRate, uint256 fee
);
event WithdrawalQueued(address indexed requester, uint256 indexed requestId, uint256 shareAmount, uint256 timestamp);
event WithdrawalAllocated(
address indexed requester,
uint256 indexed requestId,
uint256 shareAmount,
uint256 collateralAmount,
uint256 timestamp
);
event WithdrawalClaimed(address indexed requester, uint256 collateralAmount, uint256 timestamp);
event WithdrawalCancelled(address indexed requester, uint256 indexed requestId, uint256 shareAmount);
event QueueProcessed(uint256 requestsAllocated, uint256 totalCollateralAllocated);
event SPRTokenInitialized(address indexed sprToken);
event Initialized(address sprToken, address rewardDistributor);
event RewardsClaimed(address indexed user, uint256 amount);
event Staked(address indexed user, uint256 sprAmount, uint256 shares);
event Unstaked(address indexed user, uint256 shares, uint256 sprAmount);
event RewardsDistributed(address indexed distributor, uint256 totalSPRMinted);
event EmergencyPaused();
event EmergencyUnpaused();
event EmergencyWithdraw(address indexed token, address indexed recipient, uint256 amount);
event SPRTokenSet(address indexed sprToken);
event CustodianSet(address indexed custodian);
event CustodianSet(address indexed custodian, address indexed setter);
event CancellationFeeCollected(address indexed user, uint256 requestId, uint256 feeAmount);
event MaxLocksPerUserSet(uint256 maxLocks);
event MinLockWeightSet(uint256 minWeight);
event MaxLockWeightSet(uint256 maxWeight);
event OptimalLockDurationSet(uint256 weekCount);
event WaterfallBaseAPRSet(uint256 baseAPR);
event WaterfallCapRatioSet(uint256 capRatio);
event InitialExchangeRateSet(uint256 rate);
event FarmVaultFeeRateSet(uint256 feeRate);
event CancellationFeeFactorSet(uint256 cancellationFeeFactor);
event CollateralTokenSet(address indexed token);
event ReceiptTokensSet(ReceiptTokens[] tokens);
event FarmVaultRewardDistributorSet(address indexed distributor);
event AirdropVaultRewardDistributorSet(address indexed distributor);
event RequestsCleaned(uint256 requestsRemoved);
event QueuePaused(address indexed pauser, uint256 timestamp);
event QueueUnpaused(address indexed unpauser, uint256 timestamp);
event MaxQueueSizeSet(uint256 maxSize);
event ExchangeRateUpdated(address indexed updater, uint256 indexed rate, uint256 timestamp);
event CollateralRewardsConverted(uint256 amount);// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.26;
// SPREADS Contracts
bytes32 constant SPREADS_VAULT_MANAGER_REPO_CONTRACT = keccak256("SPREADS_VAULT_MANAGER_REPO");
bytes32 constant SPREADS_VAULT_CALCULATOR_CONTRACT = keccak256("SPREADS_VAULT_CALCULATOR");
bytes32 constant SPREADS_VAULT_CONTRACT = keccak256("SPREADS_VAULT");
bytes32 constant SPREADS_VAULT_MANAGER_CONTRACT = keccak256("SPREADS_VAULT_MANAGER");
bytes32 constant STRATEGY_MANAGER = keccak256("STRATEGY_MANAGER");
bytes32 constant STRATEGY_MANAGER_REPO_CONTRACT = keccak256("STRATEGY_MANAGER_REPOSITORY");
bytes32 constant DERIVE_STRATEGY_REPO_CONTRACT = keccak256("DERIVE_STRATEGY_REPOSITORY");
bytes32 constant DERIVE_MULTISIG_CONTRACT = keccak256("DERIVE_MULTISIG");
bytes32 constant DERIVE_BRIDGE_REPO_CONTRACT = keccak256("DERIVE_BRIDGE_REPOSITORY");
bytes32 constant DERIVE_BRIDGE_CONTRACT = keccak256("DERIVE_BRIDGE");
// Additional contract constants for SPRVault
bytes32 constant VAULT_MANAGER_REPO_CONTRACT = keccak256("VAULT_MANAGER_REPO");
bytes32 constant SWAPPER_CONTRACT = keccak256("SWAPPER");
bytes32 constant TREASURY_CONTRACT = keccak256("TREASURY");
bytes32 constant STAKER_CONTRACT = keccak256("STAKER");
bytes32 constant WATERFALL_ACCOUNTING_CONTRACT = keccak256("WATERFALL_ACCOUNTING");
// Vault contracts
bytes32 constant YIELD_VAULT_CONTRACT = keccak256("YIELD_VAULT");
bytes32 constant AIRDROP_VAULT_CONTRACT = keccak256("AIRDROP_VAULT");
bytes32 constant SPR_VAULT_CONTRACT = keccak256("SPR_VAULT");
bytes32 constant VAULT_MANAGER_V2_CONTRACT = keccak256("VAULT_MANAGER_V2");// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.29;
import {ReceiptTokens} from "@src/spreads-vault/structs/ReceiptTokens.sol";
interface IVaultManagerRepository {
/**
* @dev Set the collateral token for the vault.
* @param _token The address of the collateral token.
*/
function setCollateralToken(address _token) external;
/**
* @dev Set the receipt tokens for the vault that will be minted at deposit.
* @param _tokens An array of addresses of the receipt tokens.
*/
function setReceiptTokens(ReceiptTokens[] memory _tokens) external;
/**
* @dev Set the deposit fee factor for the vault.
* @param _depositFeeFactor The deposit fee factor(PRECISION).
*/
function setDepositFeeFactor(uint256 _depositFeeFactor) external;
/**
* @dev Set the withdrawal fee factor for the vault.
* @param _withdrawalFeeFactor The withdrawal fee factor(PRECISION).
*/
function setWithdrawalFeeFactor(uint256 _withdrawalFeeFactor) external;
/**
* @dev Set the minimum deposit amount for the vault.
* @param _minimumDepositAmount The minimum deposit amount.
*/
function setMinimumDepositAmount(uint256 _minimumDepositAmount) external;
/**
* @dev Set the minimum withdrawal amount for the vault.
* @param _minimumWithdrawalAmount The minimum withdrawal amount.
*/
function setMinimumWithdrawalAmount(uint256 _minimumWithdrawalAmount) external;
/**
* @dev Set the desired token for fees for swap.
* @param _feesDesiredToken The address of the desired token for fees.
*/
function setFeesDesiredToken(address _feesDesiredToken) external;
/**
* @dev Get the collateral token for the vault.
* @return The address of the collateral token.
*/
function getCollateralToken() external view returns (address);
/**
* @dev Get the receipt tokens for the vault that will be minted at deposit.
* @return An array of addresses of the receipt tokens.
*/
function getReceiptTokens() external view returns (ReceiptTokens[] memory);
/**
* @dev Get the receipt tokens list for the vault.
* @return An array of addresses of the receipt tokens.
*/
function getReceiptTokensAddresses() external view returns (address[] memory);
/**
* @dev Get the deposit fee factor for the vault.
* @return The deposit fee factor(PRECISION).
*/
function getDepositFeeFactor() external view returns (uint256);
/**
* @dev Get the withdrawal fee factor for the vault.
* @return The withdrawal fee factor(PRECISION).
*/
function getWithdrawalFeeFactor() external view returns (uint256);
/**
* @dev Get the minimum deposit amount for the vault.
* @return The minimum deposit amount.
*/
function getMinimumDepositAmount() external view returns (uint256);
/**
* @dev Get the minimum withdrawal amount for the vault.
* @return The minimum withdrawal amount.
*/
function getMinimumWithdrawalAmount() external view returns (uint256);
/**
* @dev Get the address of the desired token for fees.
* @return The address of the desired token for fees.
*/
function getFeesDesiredToken() external view returns (address);
/**
* @dev Set the cancellation fee factor for withdrawal requests.
*/
function getCancellationFeeFactor() external view returns (uint256);
/**
* @dev Get the cancellation fee factor for withdrawal requests.
* @param _cancellationFeeFactor The cancellation fee factor (PRECISION).
*/
function setCancellationFeeFactor(uint256 _cancellationFeeFactor) external;
//****------------------- AirDropVault Parameters -------------------****//
/**
* @dev Set the maximum lock duration for the vault.
* @param _weeks The maximum lock duration in weeks.
*/
function setMaxLockDuration(uint256 _weeks) external;
/**
* @dev Set the minimum lock duration for the vault.
* @param _weeks The minimum lock duration in weeks.
*/
function setMinLockDuration(uint256 _weeks) external;
/**
* @dev Set the daily point emission for the vault.
* @param _points The daily point emission.
*/
function setDailyPointEmission(uint256 _points) external;
/**
* @dev Set the points distributor for the vault.
* @param _distributor The address of the points distributor.
*/
function setPointsDistributor(address _distributor) external;
/**
* @dev Set the minimum lock amount for the vault.
* @param _amount The minimum lock amount.
*/
function setMinimumLockAmount(uint256 _amount) external;
/**
* @dev Set the early unlock penalty rate for the vault.
* @param _rate The early unlock penalty rate.
*/
function setEarlyUnlockPenaltyRate(uint256 _rate) external;
/**
* @dev Get the maximum lock duration for the vault.
* @return The maximum lock duration in weeks.
*/
function getMaxLockDuration() external view returns (uint256);
/**
* @dev Get the minimum lock duration for the vault.
* @return The minimum lock duration in weeks.
*/
function getMinLockDuration() external view returns (uint256);
/**
* @dev Get the daily point emission for the vault.
* @return The daily point emission.
*/
function getDailyPointEmission() external view returns (uint256);
/**
* @dev Get the points distributor for the vault.
* @return The address of the points distributor.
*/
function getPointsDistributor() external view returns (address);
/**
* @dev Get the minimum lock amount for the vault.
* @return The minimum lock amount.
*/
function getMinimumLockAmount() external view returns (uint256);
/**
* @dev Get the early unlock penalty rate for the vault.
* @return The early unlock penalty rate.
*/
function getEarlyUnlockPenaltyRate() external view returns (uint256);
// ==================== SPR TOKEN ====================
/**
* @dev Set the SPR token address
* @param _sprToken The address of the SPR token
*/
function setSPRToken(address _sprToken) external;
/**
* @dev Get the SPR token address
* @return The address of the SPR token
*/
function getSPRToken() external view returns (address);
// ==================== REWARD DISTRIBUTORS ====================
/**
* @dev Set the reward distributor for FarmVault
* @param _distributor The address of the reward distributor
*/
function setFarmVaultRewardDistributor(address _distributor) external;
/**
* @dev Get the reward distributor for FarmVault
* @return The address of the reward distributor
*/
function getFarmVaultRewardDistributor() external view returns (address);
/**
* @dev Set the reward distributor for AirdropVault
* @param _distributor The address of the reward distributor
*/
function setAirdropVaultRewardDistributor(address _distributor) external;
/**
* @dev Get the reward distributor for AirdropVault
* @return The address of the reward distributor
*/
function getAirdropVaultRewardDistributor() external view returns (address);
function setCustodian(address _custodian) external;
function getCustodian() external view returns (address);
// ==================== DEPLOYMENT CONFIGURATION ====================
/// @notice Set waterfall base APR
function setWaterfallBaseAPR(uint256 _baseAPR) external;
/// @notice Get waterfall base APR
function getWaterfallBaseAPR() external view returns (uint256);
/// @notice Set waterfall cap ratio
function setWaterfallCapRatio(uint256 _capRatio) external;
/// @notice Get waterfall cap ratio
function getWaterfallCapRatio() external view returns (uint256);
/// @notice Set initial exchange rate
function setInitialExchangeRate(uint256 _rate) external;
/// @notice Get initial exchange rate
function getInitialExchangeRate() external view returns (uint256);
/// @notice Set farm vault fee rate
function setFarmVaultFeeRate(uint256 _feeRate) external;
/// @notice Get farm vault fee rate
function getFarmVaultFeeRate() external view returns (uint256);
// ==================== AIRDROP VAULT CONFIGURATION ====================
/// @notice Set maximum locks per user
function setMaxLocksPerUser(uint256 _maxLocks) external;
/// @notice Get maximum locks per user
function getMaxLocksPerUser() external view returns (uint256);
/// @notice Set minimum lock weight
function setMinLockWeight(uint256 _minWeight) external;
/// @notice Get minimum lock weight
function getMinLockWeight() external view returns (uint256);
/// @notice Set maximum lock weight
function setMaxLockWeight(uint256 _maxWeight) external;
/// @notice Get maximum lock weight
function getMaxLockWeight() external view returns (uint256);
/// @notice Set optimal lock duration
function setOptimalLockDuration(uint256 _weeks) external;
/// @notice Get optimal lock duration
function getOptimalLockDuration() external view returns (uint256);
// ==================== QUEUE CONFIGURATION ====================
/**
* @dev Set the maximum queue size for the vault.
* @param _maxQueueSize The maximum queue size.
*/
function setMaxQueueSize(uint256 _maxQueueSize) external;
/**
* @dev Get the maximum queue size for the vault.
* @return The maximum queue size.
*/
function getMaxQueueSize() external view returns (uint256);
// ==================== EXCHANGE RATE ====================
/**
* @dev Set the exchange rate for the vault.
* @param _rate The exchange rate.
* @param _timestamp The timestamp when the rate was set.
*/
function setExchangeRate(uint256 _rate, uint256 _timestamp) external;
/**
* @dev Get the exchange rate for the vault.
* @return rate The exchange rate.
* @return lastUpdated The timestamp when the rate was last updated.
*/
function getExchangeRate() external view returns (uint256 rate, uint256 lastUpdated);
// ==================== SHARE TOKEN ====================
/**
* @dev Set the share token address
* @param _shareToken The address of the share token
*/
function setShareToken(address _shareToken) external;
/**
* @dev Get the share token address
* @return The address of the share token
*/
function getShareToken() external view returns (address);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity >=0.6.2;
import {IERC20} from "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC-20 standard.
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/draft-IERC6093.sol)
pragma solidity >=0.8.4;
/**
* @dev Standard ERC-20 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 tokens.
*/
interface IERC20Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC20InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC20InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
* @param spender Address that may be allowed to operate on tokens without being their owner.
* @param allowance Amount of tokens a `spender` is allowed to operate with.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC20InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `spender` to be approved. Used in approvals.
* @param spender Address that may be allowed to operate on tokens without being their owner.
*/
error ERC20InvalidSpender(address spender);
}
/**
* @dev Standard ERC-721 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens.
*/
interface IERC721Errors {
/**
* @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-20.
* Used in balance queries.
* @param owner Address of the current owner of a token.
*/
error ERC721InvalidOwner(address owner);
/**
* @dev Indicates a `tokenId` whose `owner` is the zero address.
* @param tokenId Identifier number of a token.
*/
error ERC721NonexistentToken(uint256 tokenId);
/**
* @dev Indicates an error related to the ownership over a particular token. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param tokenId Identifier number of a token.
* @param owner Address of the current owner of a token.
*/
error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC721InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC721InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param tokenId Identifier number of a token.
*/
error ERC721InsufficientApproval(address operator, uint256 tokenId);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC721InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC721InvalidOperator(address operator);
}
/**
* @dev Standard ERC-1155 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 tokens.
*/
interface IERC1155Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
* @param tokenId Identifier number of a token.
*/
error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC1155InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC1155InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param owner Address of the current owner of a token.
*/
error ERC1155MissingApprovalForAll(address operator, address owner);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC1155InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC1155InvalidOperator(address operator);
/**
* @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
* Used in batch transfers.
* @param idsLength Length of the array of token identifiers
* @param valuesLength Length of the array of token amounts
*/
error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC1363.sol)
pragma solidity >=0.6.2;
import {IERC20} from "./IERC20.sol";
import {IERC165} from "./IERC165.sol";
/**
* @title IERC1363
* @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].
*
* Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract
* after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.
*/
interface IERC1363 is IERC20, IERC165 {
/*
* Note: the ERC-165 identifier for this interface is 0xb0202a11.
* 0xb0202a11 ===
* bytes4(keccak256('transferAndCall(address,uint256)')) ^
* bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^
* bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^
* bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^
* bytes4(keccak256('approveAndCall(address,uint256)')) ^
* bytes4(keccak256('approveAndCall(address,uint256,bytes)'))
*/
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferAndCall(address to, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @param data Additional data with no specified format, sent in call to `to`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param from The address which you want to send tokens from.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferFromAndCall(address from, address to, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param from The address which you want to send tokens from.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @param data Additional data with no specified format, sent in call to `to`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function approveAndCall(address spender, uint256 value) external returns (bool);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
* @param data Additional data with no specified format, sent in call to `spender`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.26;
import {ISecureAccess} from "./ISecureAccess.sol";
import {IAccessManager} from "./IAccessManager.sol";
import {SYSTEM_ADMIN_ROLE, SYSTEM_ROLE} from "./Roles.sol";
import {UnauthorizedAccess, InvalidAddress, AddressRequired} from "../errors/Errors.sol";
import {ERC165Validator} from "../utils/libs/ERC165Validator.sol";
/**
* @title SecureAccess
* @dev Abstract contract that provides role-based access control functionality using an external IAccessManager contract.
* Inherit from this contract to create secure contracts with role-based access control.
*/
abstract contract SecureAccess is ISecureAccess {
using ERC165Validator for address;
// Reference to the access manager contract that manages roles and permissions
IAccessManager public immutable accessManager;
/**
* @dev Modifier to restrict access to functions to only users with the ADMIN_ROLE.
*/
modifier onlyAdmin() {
accessManager.checkRole(SYSTEM_ADMIN_ROLE, msg.sender); // Check if the sender has the ADMIN_ROLE
_;
}
/**
* @dev Modifier to restrict access to functions to only users with a specific role.
*/
modifier onlySystem() {
accessManager.checkRole(SYSTEM_ROLE, msg.sender); // Check if the sender has the specified role
_;
}
/**
* @dev Modifier to restrict access to only the system or a specific role.
* @param _role The role that is allowed to access the function.
* @notice This modifier checks if the caller has the SYSTEM_ROLE or the specified role.
* If the caller has the required role, the function is executed.
* Otherwise, it reverts with an UnauthorizedAccess error, indicating the caller and the required role.
*/
modifier onlySystemOrRole(bytes32 _role) {
if (accessManager.hasRole(SYSTEM_ROLE, msg.sender) || accessManager.hasRole(_role, msg.sender)) {
_;
} else {
revert UnauthorizedAccess(msg.sender, _role);
}
}
/**
* @dev Modifier to restrict access to functions to only users with a specific role.
* @param _role The role required to access the function.
*/
modifier onlyRole(bytes32 _role) {
accessManager.checkRole(_role, msg.sender); // Check if the sender has the specified role
_;
}
/**
* @dev Constructor that initializes the access manager.
* @param _accessManager Address of the IAccessManager contract.
*/
constructor(address _accessManager) {
if (_accessManager == address(0)) {
revert AddressRequired();
} else if (!_accessManager.supportsInterface(type(IAccessManager).interfaceId)) {
revert InvalidAddress();
}
accessManager = IAccessManager(_accessManager);
}
/**
* @dev returns access manager's address.
*/
function getAccessManager() external view returns (address) {
return address(accessManager);
}
/**
* @dev Internal function to check if an account has a specific role.
* @param _role The role to check.
* @param _account The account to check the role for.
* @return bool True if the account has the role, false otherwise.
*/
function _hasRole(bytes32 _role, address _account) internal view virtual returns (bool) {
return accessManager.hasRole(_role, _account); // Use the access manager to check if the account has the role
}
/**
* @dev Internal function to enforce role-based access control.
* Reverts if the account does not have the specified role.
* @param _role The role required.
* @param _account The account to check the role for.
*/
function _checkRole(bytes32 _role, address _account) internal view {
accessManager.checkRole(_role, _account); // Use the access manager to check the role and revert if not met
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.26;
import {IDataReader} from "./IDataReader.sol";
import {IDataStore} from "./IDataStore.sol";
import {ERC165Validator} from "../utils/libs/ERC165Validator.sol";
import {UnauthorizedAccess, InvalidAddress, AddressRequired} from "../errors/Errors.sol";
/**
* @title DataReader
* @dev Abstract contract that provides access to data using an external IDataStore contract.
* Inherit from this contract to create access to datastore.
*/
abstract contract DataReader is IDataReader {
using ERC165Validator for address;
// Reference to the data store contract that manages data
IDataStore public immutable dataStore;
/**
* @dev Constructor that initializes the data store.
* @param _dataStoreAddress Address of the IDataStore contract.
*/
constructor(address _dataStoreAddress) {
_checkAddress(_dataStoreAddress);
dataStore = IDataStore(_dataStoreAddress);
}
/**
* @dev returns datastore's address.
*/
function getDataStore() external view returns (address) {
return address(dataStore);
}
/**
* @dev function to check address validity.
* @param _address Address of the new IDataStore contract need to be verified.
*/
function _checkAddress(address _address) internal view {
if (_address == address(0)) {
revert AddressRequired();
} else if (!_address.supportsInterface(type(IDataStore).interfaceId)) {
revert InvalidAddress();
}
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.26;
import {IBeacon} from "./IBeacon.sol";
import {IBeaconWatcher} from "./IBeaconWatcher.sol";
import {ERC165Validator} from "../utils/libs/ERC165Validator.sol";
import {UnauthorizedAccess, InvalidAddress, AddressRequired} from "../errors/Errors.sol";
abstract contract BeaconWatcher is IBeaconWatcher {
using ERC165Validator for address;
address internal immutable beacon;
constructor(address _beacon) {
if (_beacon == address(0)) {
revert AddressRequired();
} else if (!_beacon.supportsInterface(type(IBeacon).interfaceId)) {
revert InvalidAddress();
}
beacon = _beacon;
}
function getBeacon() external view override returns (address) {
return beacon;
}
function _getContractAddress(bytes32 _contractName) internal view returns (address) {
return IBeacon(beacon).getContractAddress(_contractName);
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.26;
import {IPauser} from "./IPauser.sol";
import {IPausable} from "./IPausable.sol";
import {Paused, NotPaused, PausedScope, NotPausedScope} from "../errors/Errors.sol";
contract Pausable is IPausable {
IPauser public immutable pauser;
constructor(address _pauser) {
pauser = IPauser(_pauser);
}
modifier whenScopeNotPaused(bytes32 _scope) {
if (pauser.isPausedScope(_scope)) revert PausedScope(_scope);
_;
}
modifier whenScopePaused(bytes32 _scope) {
if (!pauser.isPausedScope(_scope)) revert NotPausedScope(_scope);
_;
}
modifier whenNotPaused() {
if (pauser.isPaused()) revert Paused();
_;
}
modifier whenPaused() {
if (!pauser.isPaused()) revert NotPaused();
_;
}
function getPauser() external view returns (address) {
return address(pauser);
}
}// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.29;
struct WithdrawalRequest {
address requester;
uint256 shareAmount;
uint256 requestTimestamp;
uint256 requestId;
bool allocated;
uint256 allocatedAmount;
bool canceled; // Flag to mark the request as canceled
}// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.29;
struct ReceiptTokens {
address tokenAddress;
uint256 depositRatio;
uint256 withdrawalRatio;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC20.sol)
pragma solidity >=0.4.16;
import {IERC20} from "../token/ERC20/IERC20.sol";// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC165.sol)
pragma solidity >=0.4.16;
import {IERC165} from "../utils/introspection/IERC165.sol";// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.26;
/**
* @title ISecureAccess
* @dev Interface for Abstract contract that provides role-based access control functionality using an external IAccessManager contract.
*/
interface ISecureAccess {
/**
* @dev returns access manager's address.
*/
function getAccessManager() external view returns (address);
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.26;
interface IAccessManager {
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have `role`'s admin role.
*
* May emit a {RoleGranted} event.
*/
function grantRole(bytes32 role, address account) external returns (bool);
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleRevoked} event.
*/
function revokeRole(bytes32 role, address account) external returns (bool);
/**
* @dev Revokes all roles from `account`.
*
* WARNING: This function should be used only in emergency situations. can be quite expensive.
*/
function revokeAllRoles(address account) external;
/**
* @dev Delete a role.
*
* WARNING: This function should be used only in emergency situations. can be quite expensive.
*/
function deleteRole(bytes32 role) external;
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been revoked `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `callerConfirmation`.
*
* May emit a {RoleRevoked} event.
*/
function renounceRole(bytes32 role, address callerConfirmation) external;
function setRoleAdmin(bytes32 role, bytes32 adminRole) external;
/**
* @dev Returns the roles that an account has.
*/
function getRoles(address account) external view returns (bytes32[] memory);
/**
* @dev Returns the accounts that have been granted `role`.
*/
function getRoleMembers(bytes32 role) external view returns (address[] memory);
/**
* @dev Returns the number of accounts that have been granted `role`.
*/
function getRoleMemberCount(bytes32 role) external view returns (uint256);
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) external view returns (bytes32);
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) external view returns (bool);
/**
* @dev Reverts with an {UnauthorizedAccess} error if `_sender`
* is missing `role`.
*/
function checkRole(bytes32 role, address _sender) external view;
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.21;
/**
* @dev roles for access management
*/
bytes32 constant SYSTEM_ADMIN_ROLE = 0x00;
bytes32 constant SYSTEM_ROLE = keccak256("SYSTEM");
bytes32 constant DATA_STORE_OPERATOR_ROLE = keccak256("DATA_STORE_OPERATOR");
bytes32 constant OPERATOR_ROLE = keccak256("OPERATOR");
bytes32 constant RESCUE_ROLE = keccak256("RESCUE");// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.26; //common errors error UnauthorizedDataAccess(bytes32 tableKey, address account); error UnauthorizedAccess(address account, bytes32 role); error BadConformation(address callerConfirmation); error InvalidInput(string message); error InvalidAddress(); error AddressRequired(); error InvalidAmount(); error InvalidArrayLength(); error MissingContract(bytes32 contractName); error Paused(); error NotPaused(); error PausedScope(bytes32 scope); error NotPausedScope(bytes32 scope);
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.26;
import {ERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";
/**
* @title ERC165Validator
* @dev Library for validating ERC165 support
*/
library ERC165Validator {
function supportsInterface(address _contract, bytes4 _interfaceId) internal view returns (bool) {
return ERC165(_contract).supportsInterface(_interfaceId);
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.26;
import {IDataStore} from "./IDataStore.sol";
/**
* @title IDataReader
* @dev Interface for Abstract contract that provides access to data using an external IDataStore contract.
*/
interface IDataReader {
/**
* @dev returns datastore's address.
*/
function getDataStore() external view returns (address);
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.26;
/**
* @title IDataStore
* @dev Interface for accessing data from a data store.
*/
interface IDataStore {
/**
* @dev Retrieves a uint256 value from the data store.
* @param _tableKey The key of the table where the value is stored.
* @param _key The key of the value to retrieve.
* @return The retrieved uint256 value.
*/
function getUint(bytes32 _tableKey, bytes32 _key) external view returns (uint256);
/**
* @dev Retrieves an int256 value from the data store.
* @param _tableKey The key of the table where the value is stored.
* @param _key The key of the value to retrieve.
* @return The retrieved int256 value.
*/
function getInt(bytes32 _tableKey, bytes32 _key) external view returns (int256);
/**
* @dev Retrieves an address value from the data store.
* @param _tableKey The key of the table where the value is stored.
* @param _key The key of the value to retrieve.
* @return The retrieved address value.
*/
function getAddress(bytes32 _tableKey, bytes32 _key) external view returns (address);
/**
* @dev Retrieves a bool value from the data store.
* @param _tableKey The key of the table where the value is stored.
* @param _key The key of the value to retrieve.
* @return The retrieved bool value.
*/
function getBool(bytes32 _tableKey, bytes32 _key) external view returns (bool);
/**
* @dev Retrieves a string value from the data store.
* @param _tableKey The key of the table where the value is stored.
* @param _key The key of the value to retrieve.
* @return The retrieved string value.
*/
function getString(bytes32 _tableKey, bytes32 _key) external view returns (string memory);
/**
* @dev Retrieves a bytes32 value from the data store.
* @param _tableKey The key of the table where the value is stored.
* @param _key The key of the value to retrieve.
* @return The retrieved bytes32 value.
*/
function getBytes32(bytes32 _tableKey, bytes32 _key) external view returns (bytes32);
/**
* @dev Retrieves a bytes value from the data store.
* @param _tableKey The key of the table where the value is stored.
* @param _key The key of the value to retrieve.
* @return The retrieved bytes value.
*/
function getBytes(bytes32 _tableKey, bytes32 _key) external view returns (bytes memory);
/**
* @dev Sets a uint256 value in the data store.
* @param _tableKey The key of the table.
* @param _key The key of the value.
* @param _value The uint256 value to be set.
* @return The updated uint256 value.
*/
function setUint(bytes32 _tableKey, bytes32 _key, uint256 _value) external returns (uint256);
/**
* @dev Sets an int256 value in the data store.
* @param _tableKey The key of the table.
* @param _key The key of the value.
* @param _value The int256 value to be set.
* @return The updated int256 value.
*/
function setInt(bytes32 _tableKey, bytes32 _key, int256 _value) external returns (int256);
/**
* @dev Sets an address value in the data store.
* @param _tableKey The key of the table.
* @param _key The key of the value.
* @param _value The address value to be set.
* @return The updated address value.
*/
function setAddress(bytes32 _tableKey, bytes32 _key, address _value) external returns (address);
/**
* @dev Sets a bool value in the data store.
* @param _tableKey The key of the table.
* @param _key The key of the value.
* @param _value The bool value to be set.
* @return The updated bool value.
*/
function setBool(bytes32 _tableKey, bytes32 _key, bool _value) external returns (bool);
/**
* @dev Sets a string value in the data store.
* @param _tableKey The key of the table.
* @param _key The key of the value.
* @param _value The string value to be set.
* @return The updated string value.
*/
function setString(bytes32 _tableKey, bytes32 _key, string memory _value) external returns (string memory);
/**
* @dev Sets a bytes32 value in the data store.
* @param _tableKey The key of the table.
* @param _key The key of the value.
* @param _value The bytes32 value to be set.
* @return The updated bytes32 value.
*/
function setBytes32(bytes32 _tableKey, bytes32 _key, bytes32 _value) external returns (bytes32);
/**
* @dev Sets a bytes value in the data store.
* @param _tableKey The key of the table.
* @param _key The key of the value.
* @param _value The bytes value to be set.
* @return The updated bytes value.
*/
function setBytes(bytes32 _tableKey, bytes32 _key, bytes calldata _value) external returns (bytes memory);
/**
* @dev Removes a uint value from the data store.
* @param _tableKey The key of the table where the value is stored.
* @param _key The key of the value to be removed.
*/
function removeUint(bytes32 _tableKey, bytes32 _key) external;
/**
* @dev Removes an int value from the data store.
* @param _tableKey The key of the table where the value is stored.
* @param _key The key of the value to be removed.
*/
function removeInt(bytes32 _tableKey, bytes32 _key) external;
/**
* @dev Removes an address value from the data store.
* @param _tableKey The key of the table where the value is stored.
* @param _key The key of the value to be removed.
*/
function removeAddress(bytes32 _tableKey, bytes32 _key) external;
/**
* @dev Removes a bool value from the data store.
* @param _tableKey The key of the table where the value is stored.
* @param _key The key of the value to be removed.
*/
function removeBool(bytes32 _tableKey, bytes32 _key) external;
/**
* @dev Removes a string value from the data store.
* @param _tableKey The key of the table where the value is stored.
* @param _key The key of the value to be removed.
*/
function removeString(bytes32 _tableKey, bytes32 _key) external;
/**
* @dev Removes a bytes32 value from the data store.
* @param _tableKey The key of the table where the value is stored.
* @param _key The key of the value to be removed.
*/
function removeBytes32(bytes32 _tableKey, bytes32 _key) external;
/**
* @dev Removes a bytes value from the data store.
* @param _tableKey The key of the table where the value is stored.
* @param _key The key of the value to be removed.
*/
function removeBytes(bytes32 _tableKey, bytes32 _key) external;
/**
* @dev Increments the value associated with the given table key and key by the specified amount.
* @param _tableKey The table key.
* @param _key The key.
* @param _value The amount to increment by.
* @return The new value after incrementing.
*/
function incrementUint(bytes32 _tableKey, bytes32 _key, uint256 _value) external returns (uint256);
/**
* @dev Decrements the value associated with the given table key and key by the specified amount.
* @param _tableKey The table key.
* @param _key The key.
* @param _value The amount to decrement by.
* @return The new value after decrementing.
*/
function decrementUint(bytes32 _tableKey, bytes32 _key, uint256 _value) external returns (uint256);
/**
* @dev Increments the value associated with the given table key and key by the specified amount.
* @param _tableKey The table key.
* @param _key The key.
* @param _value The amount to increment by.
* @return The new value after incrementing.
*/
function incrementInt(bytes32 _tableKey, bytes32 _key, int256 _value) external returns (int256);
/**
* @dev Decrements the value associated with the given table key and key by the specified amount.
* @param _tableKey The table key.
* @param _key The key.
* @param _value The amount to decrement by.
* @return The new value after decrementing.
*/
function decrementInt(bytes32 _tableKey, bytes32 _key, int256 _value) external returns (int256);
/**
* @dev Retrieves an array of uint256 values associated with the given table key and key.
* @param _tableKey The table key.
* @param _key The key.
* @return An array of uint256 values.
*/
function getUintArray(bytes32 _tableKey, bytes32 _key) external view returns (uint256[] memory);
/**
* @dev Retrieves an array of int256 values associated with the given table key and key.
* @param _tableKey The table key.
* @param _key The key.
* @return An array of int256 values.
*/
function getIntArray(bytes32 _tableKey, bytes32 _key) external view returns (int256[] memory);
/**
* @dev Retrieves an array of address values associated with the given table key and key.
* @param _tableKey The table key.
* @param _key The key.
* @return An array of address values.
*/
function getAddressArray(bytes32 _tableKey, bytes32 _key) external view returns (address[] memory);
/**
* @dev Retrieves an array of bool values associated with the given table key and key.
* @param _tableKey The table key.
* @param _key The key.
* @return An array of bool values.
*/
function getBoolArray(bytes32 _tableKey, bytes32 _key) external view returns (bool[] memory);
/**
* @dev Retrieves an array of string values associated with the given table key and key.
* @param _tableKey The table key.
* @param _key The key.
* @return An array of string values.
*/
function getStringArray(bytes32 _tableKey, bytes32 _key) external view returns (string[] memory);
/**
* @dev Retrieves an array of bytes32 values associated with the given table key and key.
* @param _tableKey The table key.
* @param _key The key.
* @return An array of bytes32 values.
*/
function getBytes32Array(bytes32 _tableKey, bytes32 _key) external view returns (bytes32[] memory);
/**
* @dev Sets an array of uint256 values associated with the given table key and key.
* @param _tableKey The table key.
* @param _key The key.
* @param _value The array of uint256 values to set.
*/
function setUintArray(bytes32 _tableKey, bytes32 _key, uint256[] memory _value) external;
/**
* @dev Sets an array of int256 values associated with the given table key and key.
* @param _tableKey The table key.
* @param _key The key.
* @param _value The array of int256 values to set.
*/
function setIntArray(bytes32 _tableKey, bytes32 _key, int256[] memory _value) external;
/**
* @dev Sets an array of address values associated with the given table key and key.
* @param _tableKey The table key.
* @param _key The key.
* @param _value The array of address values to set.
*/
function setAddressArray(bytes32 _tableKey, bytes32 _key, address[] memory _value) external;
/**
* @dev Sets an array of bool values associated with the given table key and key.
* @param _tableKey The table key.
* @param _key The key.
* @param _value The array of bool values to set.
*/
function setBoolArray(bytes32 _tableKey, bytes32 _key, bool[] memory _value) external;
/**
* @dev Sets an array of string values associated with the given table key and key.
* @param _tableKey The table key.
* @param _key The key.
* @param _value The array of string values to set.
*/
function setStringArray(bytes32 _tableKey, bytes32 _key, string[] memory _value) external;
/**
* @dev Sets an array of bytes32 values associated with the given table key and key.
* @param _tableKey The table key.
* @param _key The key.
* @param _value The array of bytes32 values to set.
*/
function setBytes32Array(bytes32 _tableKey, bytes32 _key, bytes32[] memory _value) external;
/**
* @dev Returns the length of a uint256 array stored in the data store.
* @param _tableKey The key of the table where the array is stored.
* @param _key The key of the array within the table.
* @return The length of the uint256 array.
*/
function getUintArrayLength(bytes32 _tableKey, bytes32 _key) external view returns (uint256);
/**
* @dev Returns the length of an int256 array stored in the data store.
* @param _tableKey The key of the table where the array is stored.
* @param _key The key of the array within the table.
* @return The length of the int256 array.
*/
function getIntArrayLength(bytes32 _tableKey, bytes32 _key) external view returns (uint256);
/**
* @dev Returns the length of an address array stored in the data store.
* @param _tableKey The key of the table where the array is stored.
* @param _key The key of the array within the table.
* @return The length of the address array.
*/
function getAddressArrayLength(bytes32 _tableKey, bytes32 _key) external view returns (uint256);
/**
* @dev Returns the length of a bool array stored in the data store.
* @param _tableKey The key of the table where the array is stored.
* @param _key The key of the array within the table.
* @return The length of the bool array.
*/
function getBoolArrayLength(bytes32 _tableKey, bytes32 _key) external view returns (uint256);
/**
* @dev Returns the length of a string array stored in the data store.
* @param _tableKey The key of the table where the array is stored.
* @param _key The key of the array within the table.
* @return The length of the string array.
*/
function getStringArrayLength(bytes32 _tableKey, bytes32 _key) external view returns (uint256);
/**
* @dev Retrieves the length of a bytes32 array stored in the data store.
* @param _tableKey The key of the table where the array is stored.
* @param _key The key of the specific array within the table.
* @return The length of the bytes32 array.
*/
function getBytes32ArrayLength(bytes32 _tableKey, bytes32 _key) external view returns (uint256);
/**
* @dev Removes an array of uint values associated with a given table key and key.
* @param _tableKey The table key.
* @param _key The key.
*/
function removeUintArray(bytes32 _tableKey, bytes32 _key) external;
/**
* @dev Removes an array of int values associated with a given table key and key.
* @param _tableKey The table key.
* @param _key The key.
*/
function removeIntArray(bytes32 _tableKey, bytes32 _key) external;
/**
* @dev Removes an array of address values associated with a given table key and key.
* @param _tableKey The table key.
* @param _key The key.
*/
function removeAddressArray(bytes32 _tableKey, bytes32 _key) external;
/**
* @dev Removes an array of bool values associated with a given table key and key.
* @param _tableKey The table key.
* @param _key The key.
*/
function removeBoolArray(bytes32 _tableKey, bytes32 _key) external;
/**
* @dev Removes an array of string values associated with a given table key and key.
* @param _tableKey The table key.
* @param _key The key.
*/
function removeStringArray(bytes32 _tableKey, bytes32 _key) external;
/**
* @dev Removes an array of bytes32 values associated with a given table key and key.
* @param _tableKey The table key.
* @param _key The key.
*/
function removeBytes32Array(bytes32 _tableKey, bytes32 _key) external;
/**
* @dev Checks if a given value exists in a set of bytes32 values.
* @param _tableKey The key of the table containing the set.
* @param _key The key of the value to remove.
* @param _value The value to check for existence.
* @return A boolean indicating whether the value exists in the set.
*/
function containsBytes32(bytes32 _tableKey, bytes32 _key, bytes32 _value) external view returns (bool);
/**
* @dev Returns the number of values in a set of bytes32 values.
* @param _tableKey The key of the table containing the set.
* @param _key The key of the value to remove.
* @return The number of values in the set.
*/
function getBytes32SetCount(bytes32 _tableKey, bytes32 _key) external view returns (uint256);
/**
* @dev Returns an array of bytes32 values in a set within a specified range.
* @param _tableKey The key of the table containing the set.
* @param _key The key of the value to remove.
* @param _start The start index of the range.
* @param _end The end index of the range.
* @return An array of bytes32 values within the specified range.
*/
function getBytes32SetValuesAt(bytes32 _tableKey, bytes32 _key, uint256 _start, uint256 _end)
external
view
returns (bytes32[] memory);
/**
* @dev Returns an array of bytes32 values in a set.
* @param _tableKey The key of the table containing the set.
* @param _key The key of the value to remove.
* @return An array of bytes32 values.
*/
function getBytes32SetValues(bytes32 _tableKey, bytes32 _key) external view returns (bytes32[] memory);
/**
* @dev Adds a value to a set of bytes32 values.
* @param _tableKey The key of the table containing the set.
* @param _key The key of the value to remove.
* @param _value The value to add to the set.
*/
function addBytes32Set(bytes32 _tableKey, bytes32 _key, bytes32 _value) external;
/**
* @dev Removes a value from a set of bytes32 values.
* @param _tableKey The key of the table containing the set.
* @param _key The key of the value to remove.
* @param _value The value to remove from the set.
*/
function removeBytes32FromSet(bytes32 _tableKey, bytes32 _key, bytes32 _value) external;
/**
* @dev Checks if the specified address value exists in the data store.
* @param _tableKey The key of the table.
* @param _key The key of the value to remove.
* @param _value The address value to check.
* @return True if the address value exists, false otherwise.
*/
function containsAddress(bytes32 _tableKey, bytes32 _key, address _value) external view returns (bool);
/**
* @dev Returns the number of address values stored in the data store for the specified key.
* @param _tableKey The key of the table.
* @param _key The key of the value to remove.
* @return The number of address values stored.
*/
function getAddressSetCount(bytes32 _tableKey, bytes32 _key) external view returns (uint256);
/**
* @dev Returns an array of address values stored in the data store for the specified key, within the specified range.
* @param _tableKey The key of the table.
* @param _key The key of the value to remove.
* @param _start The start index of the range.
* @param _end The end index of the range.
* @return An array of address values.
*/
function getAddressSetValuesAt(bytes32 _tableKey, bytes32 _key, uint256 _start, uint256 _end)
external
view
returns (address[] memory);
/**
* @dev Returns an array of address values stored in the data store for the specified key.
* @param _tableKey The key of the table.
* @param _key The key of the value to remove.
* @return An array of address values.
*/
function getAddressSetValues(bytes32 _tableKey, bytes32 _key) external view returns (address[] memory);
/**
* @dev Adds an address value to the data store for the specified key.
* @param _tableKey The key of the table.
* @param _key The key of the value to remove.
* @param _value The address value to add.
*/
function addAddressSet(bytes32 _tableKey, bytes32 _key, address _value) external;
/**
* @dev Removes an address value from the data store for the specified key.
* @param _tableKey The key of the table.
* @param _value The address value to remove.
*/
function removeAddressSet(bytes32 _tableKey, bytes32 _key, address _value) external;
/**
* @dev Checks if a given value exists in the data store.
* @param _tableKey The key of the table.
* @param _key The key of the value to remove.
* @param _value The value to check for existence.
* @return True if the value exists, false otherwise.
*/
function containsUint(bytes32 _tableKey, bytes32 _key, uint256 _value) external view returns (bool);
/**
* @dev Returns the number of uint256 values associated with a given key in the data store.
* @param _tableKey The key of the table.
* @param _key The key of the value to remove.
* @return The number of uint256 values associated with the key.
*/
function getUintSetCount(bytes32 _tableKey, bytes32 _key) external view returns (uint256);
/**
* @dev Returns an array of uint256 values associated with a given key in the data store, within a specified range.
* @param _tableKey The key of the table.
* @param _key The key of the value to remove.
* @param _start The start index of the range.
* @param _end The end index of the range.
* @return An array of uint256 values within the specified range.
*/
function getUintSetValuesAt(bytes32 _tableKey, bytes32 _key, uint256 _start, uint256 _end)
external
view
returns (uint256[] memory);
/**
* @dev Returns an array of uint256 values associated with a given key in the data store.
* @param _tableKey The key of the table.
* @param _key The key of the value to remove.
* @return An array of uint256 values within the specified range.
*/
function getUintSetValues(bytes32 _tableKey, bytes32 _key) external view returns (uint256[] memory);
/**
* @dev Adds a uint256 value to the data store.
* @param _tableKey The key of the table.
* @param _key The key of the value to remove.
* @param _value The value to add.
*/
function addUintSet(bytes32 _tableKey, bytes32 _key, uint256 _value) external;
/**
* @dev Removes a uint256 value from the data store.
* @param _tableKey The key of the table.
* @param _key The key of the value to remove.
* @param _value The value to remove.
*/
function removeUintSet(bytes32 _tableKey, bytes32 _key, uint256 _value) external;
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.26;
interface IBeacon {
function setContractAddress(bytes32 _contractName, address _contractAddress) external;
function getContractAddress(bytes32 _contractName) external view returns (address);
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.26;
/**
* @title IBeaconWatcher
* @dev Interface for a contract that watches a beacon.
*/
interface IBeaconWatcher {
/**
* @dev Returns the address of the beacon.
* @return The address of the beacon.
*/
function getBeacon() external view returns (address);
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.26;
/**
* @title Pauser
* @dev Contract module which allows to implement an emergency stop mechanism that can be triggered by an authorized account.
* The contract allows pausing and unpausing of the entire contract as well as specific scopes.
* Inherits from SecureAccess to manage access control.
*/
interface IPauser {
/**
* @dev Triggers stopped state.
* Can only be called by an admin.
*/
function pause() external;
/**
* @dev Returns to normal state.
* Can only be called by an admin.
*/
function unpause() external;
/**
* @dev Triggers stopped state for a specific scope.
* Can only be called by an admin.
* @param _scope The scope to be paused.
*/
function pauseScope(bytes32 _scope) external;
/**
* @dev Returns to normal state for a specific scope.
* Can only be called by an admin.
* @param _scope The scope to be unpaused.
*/
function unpauseScope(bytes32 _scope) external;
/**
* @dev Returns true if the contract is paused, and false otherwise.
* @return True if the contract is paused, false otherwise.
*/
function isPaused() external view returns (bool);
/**
* @dev Returns true if the specific scope is paused or if the general paused state is true, and false otherwise.
* @param _scope The scope to check.
* @return True if the specific scope is paused or if the general paused state is true, false otherwise.
*/
function isPausedScope(bytes32 _scope) external view returns (bool);
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.26;
interface IPausable {
function getPauser() external view returns (address);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/IERC165.sol)
pragma solidity >=0.4.16;
/**
* @dev Interface of the ERC-165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[ERC].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/ERC165.sol)
pragma solidity ^0.8.20;
import {IERC165} from "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC-165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*/
abstract contract ERC165 is IERC165 {
/// @inheritdoc IERC165
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}{
"remappings": [
"common-contracts/=../common-contracts/contracts/",
"@base-common-contracts/=../common-contracts/contracts/",
"@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
"forge-std/=lib/forge-std/src/",
"@src/=src/",
"@contracts/=/Users/johnjurdak/Desktop/EV/Spreads-project/common-contracts/contracts/",
"@test/=/Users/johnjurdak/Desktop/EV/Spreads-project/common-contracts/test/",
"erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
"halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
"openzeppelin-contracts/=/Users/johnjurdak/Desktop/EV/Spreads-project/common-contracts/lib/openzeppelin-contracts/"
],
"optimizer": {
"enabled": true,
"runs": 200
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "prague",
"viaIR": true
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_beaconAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AddressRequired","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"allowance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientAllowance","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC20InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC20InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC20InvalidSender","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"}],"name":"ERC20InvalidSpender","type":"error"},{"inputs":[],"name":"InvalidAddress","type":"error"},{"inputs":[],"name":"Paused","type":"error"},{"inputs":[{"internalType":"bytes32","name":"scope","type":"bytes32"}],"name":"PausedScope","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[],"name":"EmergencyPaused","type":"event"},{"anonymous":false,"inputs":[],"name":"EmergencyUnpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"EmergencyWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"distributor","type":"address"},{"indexed":false,"internalType":"uint256","name":"totalSPRMinted","type":"uint256"}],"name":"RewardsDistributed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"sprAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"Staked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"sprAmount","type":"uint256"}],"name":"Unstaked","type":"event"},{"inputs":[],"name":"accessManager","outputs":[{"internalType":"contract IAccessManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"collateralRewardToSPR","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"convertToAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"sprAmount","type":"uint256"}],"name":"convertToShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dataStore","outputs":[{"internalType":"contract IDataStore","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"rewardAmount","type":"uint256"}],"name":"distributeRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"emergencyPause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"emergencyPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"emergencyUnpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"recipient","type":"address"}],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getAccessManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBeacon","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDataStore","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPauser","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalFarmSPR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pauser","outputs":[{"internalType":"contract IPauser","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pricePerShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"token","type":"address"}],"name":"receiveRebalance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"sprAmount","type":"uint256"}],"name":"stake","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"unstake","outputs":[{"internalType":"uint256","name":"sprAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
61010080604052346103915761002b906121d58038038091610021828561068b565b83398101906106ae565b6040519061003a60408361068b565b60128252715969656c64205661756c742053686172657360701b602083015260405161006760408261068b565b60068152653cbb16a9a82960d11b602080830191909152604051630e0116a960e31b8152936001600160a01b038416929185600481865afa94851561039d575f9561066a575b50604051637f2c132f60e11b815291602083600481875afa92831561039d575f93610649575b50604051639f4bc3c360e01b815291602083600481885afa92831561039d575f93610618575b508051906001600160401b03821161051b5760035490600182811c9216801561060e575b60208310146104fd5781601f8493116105a0575b50602090601f831160011461053a575f9261052f575b50508160011b915f199060031b1c1916176003555b8051906001600160401b03821161051b5760045490600182811c92168015610511575b60208310146104fd5781601f84931161048f575b50602090601f8311600114610429575f9261041e575b50508160011b915f199060031b1c1916176004555b6001600160a01b0316806101db57631c9670bb60e01b5f5260045ffd5b6040516301ffc9a760e01b8152630ba955e160e21b6004820152602081602481855afa90811561039d575f916103e3575b501561034f576080526001600160a01b03168061023257631c9670bb60e01b5f5260045ffd5b6040516301ffc9a760e01b81526333cf6a2b60e01b6004820152602081602481855afa90811561039d575f916103a8575b501561034f5760a0528061028057631c9670bb60e01b5f5260045ffd5b6040516301ffc9a760e01b8152633b48762760e21b600482015290602090829060249082905afa90811561039d575f9161035e575b501561034f5760c0526001600160a01b031660e0526001600555604051611b0790816106ce82396080518181816101c10152818161056b01528181610a2201528181610d4901528181610e860152610f63015260a05181818161017901526109ce015260c051818181610665015281816112c00152611a01015260e051818181610312015281816104c70152818161052301526110a20152f35b63e6c4247b60e01b5f5260045ffd5b90506020813d602011610395575b816103796020938361068b565b8101031261039157518015158103610391575f6102b5565b5f80fd5b3d915061036c565b6040513d5f823e3d90fd5b90506020813d6020116103db575b816103c36020938361068b565b8101031261039157518015158103610391575f610263565b3d91506103b6565b90506020813d602011610416575b816103fe6020938361068b565b8101031261039157518015158103610391575f61020c565b3d91506103f1565b015190505f806101a9565b60045f9081528281209350601f198516905b818110610477575090846001959493921061045f575b505050811b016004556101be565b01515f1960f88460031b161c191690555f8080610451565b9293602060018192878601518155019501930161043b565b60045f529091507f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b601f840160051c810191602085106104f3575b90601f859493920160051c01905b8181106104e55750610193565b5f81558493506001016104d8565b90915081906104ca565b634e487b7160e01b5f52602260045260245ffd5b91607f169161017f565b634e487b7160e01b5f52604160045260245ffd5b015190505f80610147565b60035f9081528281209350601f198516905b8181106105885750908460019594939210610570575b505050811b0160035561015c565b01515f1960f88460031b161c191690555f8080610562565b9293602060018192878601518155019501930161054c565b60035f529091507fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b601f840160051c81019160208510610604575b90601f859493920160051c01905b8181106105f65750610131565b5f81558493506001016105e9565b90915081906105db565b91607f169161011d565b61063b91935060203d602011610642575b610633818361068b565b8101906106ae565b915f6100f9565b503d610629565b61066391935060203d60201161064257610633818361068b565b915f6100d3565b61068491955060203d60201161064257610633818361068b565b935f6100ad565b601f909101601f19168101906001600160401b0382119082101761051b57604052565b9081602091031261039157516001600160a01b0381168103610391579056fe60806040526004361015610011575f80fd5b5f5f3560e01c806301e1d114146115a157806306fdde03146114ad57806307a2d13a1461148f578063095ea7b31461140d57806318160ddd146113f057806323b872dd1461131157806327c830a9146112ef5780632d6b3a6b146112ab5780632e17de781461104b578063313ce567146110305780634a4e3bd514610f5057806351858e2714610e7257806359717d8114610d2157806359974e3814610bfc5780636382d9ad146109fd578063660d0d67146109b85780637008b548146104b157806370a082311461098057806395d89b411461087757806399530b061461085c57806399610b7a146104f65780639f4bc3c3146101ab5780639fd0506d146104b1578063a694fc3a146102ba578063a9059cbb14610288578063c6e6f59214610261578063dd62ed3e1461020e578063e82750e9146101f0578063fdcb6068146101ab5763fe58265e14610164575f80fd5b346101a857806003193601126101a8576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b80fd5b50346101a857806003193601126101a8576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b50346101a857806003193601126101a8576020600254604051908152f35b50346101a85760403660031901126101a857604061022a6115e5565b916102336115fb565b9260018060a01b031681526001602052209060018060a01b03165f52602052602060405f2054604051908152f35b50346101a85760203660031901126101a8576020610280600435611a55565b604051908152f35b50346101a85760403660031901126101a8576102af6102a56115e5565b6024359033611875565b602060405160018152f35b50346101a85760203660031901126101a8576004356102d761191f565b60405163939e8d0f60e01b81527f87a7811f4bfedea3d341ad165680ae306b01aaeacc205d227629cf157dd9f82160048201526020816024817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa9081156104a6578391610477575b506104445761035a811515611702565b61036960ff60065416156116cd565b61037281611a55565b906103888161037f6117ec565b30903390611982565b33156104305760025482810180911161041c579260209360025533815280845260408120838154019055604051908382527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef853393a360405190815281838201527f1449c6dd7851abc30abf37f57715f492010519147cc2652fbc38202c18a6ee9060403392a26001600555604051908152f35b634e487b7160e01b84526011600452602484fd5b63ec442f0560e01b83526004839052602483fd5b63b81fa1e360e01b82527f87a7811f4bfedea3d341ad165680ae306b01aaeacc205d227629cf157dd9f821600452602482fd5b610499915060203d60201161049f575b6104918183611611565b8101906116b5565b5f61034a565b503d610487565b6040513d85823e3d90fd5b50346101a857806003193601126101a8576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b50346101a85760203660031901126101a8576040516358c3de9360e11b81526004803591906020908290817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa9081156104a657839161083d575b5061082e5761056861191f565b817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316803b1561082a5781604491604051928380926312d9a6ad60e01b82527f523a704056dcd17bcf83bed8b68c59416dac1119be77755efe3bde0a64e46e0c60048301523360248301525afa801561074a57610815575b505080156107d1578190600460206001600160a01b036106066119c6565b1660405192838092639642366360e01b82525afa9081156104a65783916107b2575b50604051630d2020dd60e01b81527fe1d8c5f1476b7277a797e9dbf9481fc522da9c474439056bfb77f7aa89b26d826004820152906020826024817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa918215610776578492610781575b506001600160a01b03166106b383303384611982565b60405163095ea7b360e01b81526001600160a01b038316600482015260248101849052906020908290604490829088905af1801561077657610759575b506001600160a01b031690813b1561075557829160248392604051948593849263b6b55f2560e01b845260048401525af1801561074a57610735575b50600160055580f35b8161073f91611611565b6101a857805f61072c565b6040513d84823e3d90fd5b5050fd5b6107719060203d60201161049f576104918183611611565b6106f0565b6040513d86823e3d90fd5b6107a491925060203d6020116107ab575b61079c8183611611565b8101906117cd565b905f61069d565b503d610792565b6107cb915060203d6020116107ab5761079c8183611611565b5f610628565b606460405162461bcd60e51b815260206004820152602060248201527f416d6f756e74206d7573742062652067726561746572207468616e207a65726f6044820152fd5b8161081f91611611565b61082a57815f6105e8565b5080fd5b6313d0ff5960e31b8252600482fd5b610856915060203d60201161049f576104918183611611565b5f61055b565b50346101a857806003193601126101a8576020610280611781565b50346101a857806003193601126101a8576040519080600454908160011c91600181168015610976575b6020841081146109625783865290811561093b57506001146108de575b6108da846108ce81860382611611565b604051918291826115bb565b0390f35b600481527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b939250905b808210610921575090915081016020016108ce826108be565b919260018160209254838588010152019101909291610908565b60ff191660208087019190915292151560051b850190920192506108ce91508390506108be565b634e487b7160e01b83526022600452602483fd5b92607f16926108a1565b50346101a85760203660031901126101a8576020906040906001600160a01b036109a86115e5565b1681528083522054604051908152f35b50346101a857806003193601126101a8576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b50346101a85760403660031901126101a857610a176115e5565b610a1f6115fb565b827f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316803b1561082a5781604491604051928380926312d9a6ad60e01b82527f76b1a12ac8d9ed64de3c0f66c2a19b21c0a3f9a1afec3f75bcd45f7b0794a1de60048301523360248301525afa801561074a57610be3575b50506001600160a01b038116918215610baa576040516370a0823160e01b81523060048201526001600160a01b039190911691602082602481865afa918215610b9f578592610b67575b508115610b295781610b1f7ff24ef89f38eadc1bde50701ad6e4d6d11a2dc24f7cf834a486991f3883328504936020938661193f565b604051908152a380f35b60405162461bcd60e51b81526020600482015260166024820152754e6f2062616c616e636520746f20776974686472617760501b6044820152606490fd5b9091506020813d602011610b97575b81610b8360209383611611565b81010312610b935751905f610ae9565b5f80fd5b3d9150610b76565b6040513d87823e3d90fd5b60405162461bcd60e51b8152602060048201526011602482015270125b9d985b1a59081c9958da5c1a595b9d607a1b6044820152606490fd5b81610bed91611611565b610bf857825f610a9f565b8280fd5b50346101a85760203660031901126101a857600480359060206001600160a01b03610c256119c6565b1660405192838092632868b4bf60e21b82525afa9081156104a6578391610d02575b506001600160a01b03163303610ccb578015610c9857610c698161037f6117ec565b6040519081527fdf29796aad820e4bb192f3a8d631b76519bcd2cbe77cc85af20e9df53cece08660203392a280f35b60405162461bcd60e51b815260206004820152600b60248201526a16995c9bc81c995dd85c9960aa1b6044820152606490fd5b60405162461bcd60e51b815260206004820152600f60248201526e2737ba103234b9ba3934b13aba37b960891b6044820152606490fd5b610d1b915060203d6020116107ab5761079c8183611611565b5f610c47565b50346101a85760403660031901126101a857600435610d3e6115fb565b610d4661191f565b827f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316803b1561082a5781604491604051928380926312d9a6ad60e01b82527f1d7d8843f0c1e1a93c132cfc3744403b38e2dc280a9cbff83c6f1219b210cf0260048301523360248301525afa801561074a57610e5d575b5050610dd3821515611702565b6001600160a01b03610de36117ec565b166001600160a01b0390911603610e28576040519081527fdf29796aad820e4bb192f3a8d631b76519bcd2cbe77cc85af20e9df53cece08660203392a2600160055580f35b60405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b2103a37b5b2b760991b6044820152606490fd5b81610e6791611611565b610bf857825f610dc6565b50346101a857806003193601126101a857807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316803b15610f4d5781604491604051928380926312d9a6ad60e01b82527f76b1a12ac8d9ed64de3c0f66c2a19b21c0a3f9a1afec3f75bcd45f7b0794a1de60048301523360248301525afa801561074a57610f38575b50600160ff1960065416176006557f4cb3183d0bf66f9634b15cfc3539fdddc96c2c9324848af89b56586a6739fec48180a180f35b81610f4291611611565b6101a857805f610f03565b50fd5b5034610b93575f366003190112610b93577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316803b15610b93575f604491604051928380926312d9a6ad60e01b82527f76b1a12ac8d9ed64de3c0f66c2a19b21c0a3f9a1afec3f75bcd45f7b0794a1de60048301523360248301525afa801561102557611012575b5060ff19600654166006557f15de7ad89d29fd1c6d2e6b1e878453569b4080edf34e0105faaa3bd52f0185308180a180f35b61101e91505f90611611565b5f5f610fe0565b6040513d5f823e3d90fd5b34610b93575f366003190112610b9357602060405160128152f35b34610b93576020366003190112610b935760043561106761191f565b60405163939e8d0f60e01b81527f738128fe393bef1bcd8a524796fff40618b938cd467c71fcf37850ab0ba4f7d760048201526020816024817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa908115611025575f9161128c575b5061125957801561122657335f525f6020528060405f2054106111eb5761110660ff60065416156116cd565b61110f8161184e565b33156111d857335f525f60205260405f20548281106111bd579180602093335f525f85520360405f205580600254036002555f6040518281527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef853392a361117f823361117a6117ec565b61193f565b60405190815281838201527f7fc4727e062e336010f2c282598ef5f14facb3de68cf8195c2f23e1454b2b74e60403392a26001600555604051908152f35b905063391434e360e21b5f523360045260245260445260645ffd5b634b637e8f60e11b5f525f60045260245ffd5b60405162461bcd60e51b8152602060048201526013602482015272496e73756666696369656e742073686172657360681b6044820152606490fd5b60405162461bcd60e51b815260206004820152600b60248201526a5a65726f2073686172657360a81b6044820152606490fd5b63b81fa1e360e01b5f527f738128fe393bef1bcd8a524796fff40618b938cd467c71fcf37850ab0ba4f7d760045260245ffd5b6112a5915060203d60201161049f576104918183611611565b826110da565b34610b93575f366003190112610b93576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b34610b93575f366003190112610b9357602060ff600654166040519015158152f35b34610b93576060366003190112610b935761132a6115e5565b6113326115fb565b6001600160a01b0382165f818152600160209081526040808320338452909152902054909260443592915f198110611370575b506102af9350611875565b8381106113d55784156113c25733156113af576102af945f52600160205260405f2060018060a01b0333165f526020528360405f209103905584611365565b634a1406b160e11b5f525f60045260245ffd5b63e602df0560e01b5f525f60045260245ffd5b8390637dc7a0d960e11b5f523360045260245260445260645ffd5b34610b93575f366003190112610b93576020600254604051908152f35b34610b93576040366003190112610b93576114266115e5565b6024359033156113c2576001600160a01b03169081156113af57335f52600160205260405f20825f526020528060405f20556040519081527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560203392a3602060405160018152f35b34610b93576020366003190112610b9357602061028060043561184e565b34610b93575f366003190112610b93576040515f6003548060011c90600181168015611597575b6020831081146115835782855290811561155f5750600114611501575b6108da836108ce81850382611611565b91905060035f527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b915f905b808210611545575090915081016020016108ce6114f1565b91926001816020925483858801015201910190929161152d565b60ff191660208086019190915291151560051b840190910191506108ce90506114f1565b634e487b7160e01b5f52602260045260245ffd5b91607f16916114d4565b34610b93575f366003190112610b93576020610280611647565b602060409281835280519182918282860152018484015e5f828201840152601f01601f1916010190565b600435906001600160a01b0382168203610b9357565b602435906001600160a01b0382168203610b9357565b90601f8019910116810190811067ffffffffffffffff82111761163357604052565b634e487b7160e01b5f52604160045260245ffd5b602460206001600160a01b0361165b6117ec565b16604051928380926370a0823160e01b82523060048301525afa908115611025575f91611686575090565b90506020813d6020116116ad575b816116a160209383611611565b81010312610b93575190565b3d9150611694565b90816020910312610b9357518015158103610b935790565b156116d457565b60405162461bcd60e51b815260206004820152600660248201526514185d5cd95960d21b6044820152606490fd5b1561170957565b60405162461bcd60e51b815260206004820152600b60248201526a16995c9bc8185b5bdd5b9d60aa1b6044820152606490fd5b8181029291811591840414171561174f57565b634e487b7160e01b5f52601160045260245ffd5b811561176d570490565b634e487b7160e01b5f52601260045260245ffd5b60025480156117c057611792611647565b90670de0b6b3a7640000820291808304670de0b6b3a7640000149015171561174f576117bd91611763565b90565b50670de0b6b3a764000090565b90816020910312610b9357516001600160a01b0381168103610b935790565b600460206001600160a01b036118006119c6565b1660405192838092632cdf7d8360e01b82525afa908115611025575f9161182f575b506001600160a01b031690565b611848915060203d6020116107ab5761079c8183611611565b5f611822565b60025480156118715761186c6117bd92611866611647565b9061173c565b611763565b5090565b6001600160a01b03169081156111d8576001600160a01b031691821561190c57815f525f60205260405f20548181106118f357817fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92602092855f525f84520360405f2055845f525f825260405f20818154019055604051908152a3565b8263391434e360e21b5f5260045260245260445260645ffd5b63ec442f0560e01b5f525f60045260245ffd5b600260055414611930576002600555565b633ee5aeb560e01b5f5260045ffd5b60405163a9059cbb60e01b60208201526001600160a01b039290921660248301526044808301939093529181526119809161197b606483611611565b611a79565b565b6040516323b872dd60e01b60208201526001600160a01b0392831660248201529290911660448301526064808301939093529181526119809161197b608483611611565b604051630d2020dd60e01b81527f5600185b051f65d311a9e3e3329905fc2fa701a8b22f3bbf8dfcbc10ccb6807160048201526020816024817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa908115611025575f91611a3c575090565b6117bd915060203d6020116107ab5761079c8183611611565b600254801561187157611a6b906117bd9261173c565b611a73611647565b90611763565b905f602091828151910182855af115611025575f513d611ac857506001600160a01b0381163b155b611aa85750565b635274afe760e01b5f9081526001600160a01b0391909116600452602490fd5b60011415611aa156fea26469706673582212206cdc09e18a01d4229389956378053caae371d1c4f18e8b835233851ac8a44fd064736f6c634300081e003300000000000000000000000097126771e887ef57f5562db332843f6d1890aee0
Deployed Bytecode
0x60806040526004361015610011575f80fd5b5f5f3560e01c806301e1d114146115a157806306fdde03146114ad57806307a2d13a1461148f578063095ea7b31461140d57806318160ddd146113f057806323b872dd1461131157806327c830a9146112ef5780632d6b3a6b146112ab5780632e17de781461104b578063313ce567146110305780634a4e3bd514610f5057806351858e2714610e7257806359717d8114610d2157806359974e3814610bfc5780636382d9ad146109fd578063660d0d67146109b85780637008b548146104b157806370a082311461098057806395d89b411461087757806399530b061461085c57806399610b7a146104f65780639f4bc3c3146101ab5780639fd0506d146104b1578063a694fc3a146102ba578063a9059cbb14610288578063c6e6f59214610261578063dd62ed3e1461020e578063e82750e9146101f0578063fdcb6068146101ab5763fe58265e14610164575f80fd5b346101a857806003193601126101a8576040517f000000000000000000000000a99da8f18c15f7afa1072b1667dfbf54ff3388656001600160a01b03168152602090f35b80fd5b50346101a857806003193601126101a8576040517f000000000000000000000000889d4580b7f5220038b62b44bcd76d58f37f45666001600160a01b03168152602090f35b50346101a857806003193601126101a8576020600254604051908152f35b50346101a85760403660031901126101a857604061022a6115e5565b916102336115fb565b9260018060a01b031681526001602052209060018060a01b03165f52602052602060405f2054604051908152f35b50346101a85760203660031901126101a8576020610280600435611a55565b604051908152f35b50346101a85760403660031901126101a8576102af6102a56115e5565b6024359033611875565b602060405160018152f35b50346101a85760203660031901126101a8576004356102d761191f565b60405163939e8d0f60e01b81527f87a7811f4bfedea3d341ad165680ae306b01aaeacc205d227629cf157dd9f82160048201526020816024817f00000000000000000000000015e953be163841d0cfd676a6b98fd674d5c241af6001600160a01b03165afa9081156104a6578391610477575b506104445761035a811515611702565b61036960ff60065416156116cd565b61037281611a55565b906103888161037f6117ec565b30903390611982565b33156104305760025482810180911161041c579260209360025533815280845260408120838154019055604051908382527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef853393a360405190815281838201527f1449c6dd7851abc30abf37f57715f492010519147cc2652fbc38202c18a6ee9060403392a26001600555604051908152f35b634e487b7160e01b84526011600452602484fd5b63ec442f0560e01b83526004839052602483fd5b63b81fa1e360e01b82527f87a7811f4bfedea3d341ad165680ae306b01aaeacc205d227629cf157dd9f821600452602482fd5b610499915060203d60201161049f575b6104918183611611565b8101906116b5565b5f61034a565b503d610487565b6040513d85823e3d90fd5b50346101a857806003193601126101a8576040517f00000000000000000000000015e953be163841d0cfd676a6b98fd674d5c241af6001600160a01b03168152602090f35b50346101a85760203660031901126101a8576040516358c3de9360e11b81526004803591906020908290817f00000000000000000000000015e953be163841d0cfd676a6b98fd674d5c241af6001600160a01b03165afa9081156104a657839161083d575b5061082e5761056861191f565b817f000000000000000000000000889d4580b7f5220038b62b44bcd76d58f37f45666001600160a01b0316803b1561082a5781604491604051928380926312d9a6ad60e01b82527f523a704056dcd17bcf83bed8b68c59416dac1119be77755efe3bde0a64e46e0c60048301523360248301525afa801561074a57610815575b505080156107d1578190600460206001600160a01b036106066119c6565b1660405192838092639642366360e01b82525afa9081156104a65783916107b2575b50604051630d2020dd60e01b81527fe1d8c5f1476b7277a797e9dbf9481fc522da9c474439056bfb77f7aa89b26d826004820152906020826024817f00000000000000000000000097126771e887ef57f5562db332843f6d1890aee06001600160a01b03165afa918215610776578492610781575b506001600160a01b03166106b383303384611982565b60405163095ea7b360e01b81526001600160a01b038316600482015260248101849052906020908290604490829088905af1801561077657610759575b506001600160a01b031690813b1561075557829160248392604051948593849263b6b55f2560e01b845260048401525af1801561074a57610735575b50600160055580f35b8161073f91611611565b6101a857805f61072c565b6040513d84823e3d90fd5b5050fd5b6107719060203d60201161049f576104918183611611565b6106f0565b6040513d86823e3d90fd5b6107a491925060203d6020116107ab575b61079c8183611611565b8101906117cd565b905f61069d565b503d610792565b6107cb915060203d6020116107ab5761079c8183611611565b5f610628565b606460405162461bcd60e51b815260206004820152602060248201527f416d6f756e74206d7573742062652067726561746572207468616e207a65726f6044820152fd5b8161081f91611611565b61082a57815f6105e8565b5080fd5b6313d0ff5960e31b8252600482fd5b610856915060203d60201161049f576104918183611611565b5f61055b565b50346101a857806003193601126101a8576020610280611781565b50346101a857806003193601126101a8576040519080600454908160011c91600181168015610976575b6020841081146109625783865290811561093b57506001146108de575b6108da846108ce81860382611611565b604051918291826115bb565b0390f35b600481527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b939250905b808210610921575090915081016020016108ce826108be565b919260018160209254838588010152019101909291610908565b60ff191660208087019190915292151560051b850190920192506108ce91508390506108be565b634e487b7160e01b83526022600452602483fd5b92607f16926108a1565b50346101a85760203660031901126101a8576020906040906001600160a01b036109a86115e5565b1681528083522054604051908152f35b50346101a857806003193601126101a8576040517f000000000000000000000000a99da8f18c15f7afa1072b1667dfbf54ff3388656001600160a01b03168152602090f35b50346101a85760403660031901126101a857610a176115e5565b610a1f6115fb565b827f000000000000000000000000889d4580b7f5220038b62b44bcd76d58f37f45666001600160a01b0316803b1561082a5781604491604051928380926312d9a6ad60e01b82527f76b1a12ac8d9ed64de3c0f66c2a19b21c0a3f9a1afec3f75bcd45f7b0794a1de60048301523360248301525afa801561074a57610be3575b50506001600160a01b038116918215610baa576040516370a0823160e01b81523060048201526001600160a01b039190911691602082602481865afa918215610b9f578592610b67575b508115610b295781610b1f7ff24ef89f38eadc1bde50701ad6e4d6d11a2dc24f7cf834a486991f3883328504936020938661193f565b604051908152a380f35b60405162461bcd60e51b81526020600482015260166024820152754e6f2062616c616e636520746f20776974686472617760501b6044820152606490fd5b9091506020813d602011610b97575b81610b8360209383611611565b81010312610b935751905f610ae9565b5f80fd5b3d9150610b76565b6040513d87823e3d90fd5b60405162461bcd60e51b8152602060048201526011602482015270125b9d985b1a59081c9958da5c1a595b9d607a1b6044820152606490fd5b81610bed91611611565b610bf857825f610a9f565b8280fd5b50346101a85760203660031901126101a857600480359060206001600160a01b03610c256119c6565b1660405192838092632868b4bf60e21b82525afa9081156104a6578391610d02575b506001600160a01b03163303610ccb578015610c9857610c698161037f6117ec565b6040519081527fdf29796aad820e4bb192f3a8d631b76519bcd2cbe77cc85af20e9df53cece08660203392a280f35b60405162461bcd60e51b815260206004820152600b60248201526a16995c9bc81c995dd85c9960aa1b6044820152606490fd5b60405162461bcd60e51b815260206004820152600f60248201526e2737ba103234b9ba3934b13aba37b960891b6044820152606490fd5b610d1b915060203d6020116107ab5761079c8183611611565b5f610c47565b50346101a85760403660031901126101a857600435610d3e6115fb565b610d4661191f565b827f000000000000000000000000889d4580b7f5220038b62b44bcd76d58f37f45666001600160a01b0316803b1561082a5781604491604051928380926312d9a6ad60e01b82527f1d7d8843f0c1e1a93c132cfc3744403b38e2dc280a9cbff83c6f1219b210cf0260048301523360248301525afa801561074a57610e5d575b5050610dd3821515611702565b6001600160a01b03610de36117ec565b166001600160a01b0390911603610e28576040519081527fdf29796aad820e4bb192f3a8d631b76519bcd2cbe77cc85af20e9df53cece08660203392a2600160055580f35b60405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b2103a37b5b2b760991b6044820152606490fd5b81610e6791611611565b610bf857825f610dc6565b50346101a857806003193601126101a857807f000000000000000000000000889d4580b7f5220038b62b44bcd76d58f37f45666001600160a01b0316803b15610f4d5781604491604051928380926312d9a6ad60e01b82527f76b1a12ac8d9ed64de3c0f66c2a19b21c0a3f9a1afec3f75bcd45f7b0794a1de60048301523360248301525afa801561074a57610f38575b50600160ff1960065416176006557f4cb3183d0bf66f9634b15cfc3539fdddc96c2c9324848af89b56586a6739fec48180a180f35b81610f4291611611565b6101a857805f610f03565b50fd5b5034610b93575f366003190112610b93577f000000000000000000000000889d4580b7f5220038b62b44bcd76d58f37f45666001600160a01b0316803b15610b93575f604491604051928380926312d9a6ad60e01b82527f76b1a12ac8d9ed64de3c0f66c2a19b21c0a3f9a1afec3f75bcd45f7b0794a1de60048301523360248301525afa801561102557611012575b5060ff19600654166006557f15de7ad89d29fd1c6d2e6b1e878453569b4080edf34e0105faaa3bd52f0185308180a180f35b61101e91505f90611611565b5f5f610fe0565b6040513d5f823e3d90fd5b34610b93575f366003190112610b9357602060405160128152f35b34610b93576020366003190112610b935760043561106761191f565b60405163939e8d0f60e01b81527f738128fe393bef1bcd8a524796fff40618b938cd467c71fcf37850ab0ba4f7d760048201526020816024817f00000000000000000000000015e953be163841d0cfd676a6b98fd674d5c241af6001600160a01b03165afa908115611025575f9161128c575b5061125957801561122657335f525f6020528060405f2054106111eb5761110660ff60065416156116cd565b61110f8161184e565b33156111d857335f525f60205260405f20548281106111bd579180602093335f525f85520360405f205580600254036002555f6040518281527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef853392a361117f823361117a6117ec565b61193f565b60405190815281838201527f7fc4727e062e336010f2c282598ef5f14facb3de68cf8195c2f23e1454b2b74e60403392a26001600555604051908152f35b905063391434e360e21b5f523360045260245260445260645ffd5b634b637e8f60e11b5f525f60045260245ffd5b60405162461bcd60e51b8152602060048201526013602482015272496e73756666696369656e742073686172657360681b6044820152606490fd5b60405162461bcd60e51b815260206004820152600b60248201526a5a65726f2073686172657360a81b6044820152606490fd5b63b81fa1e360e01b5f527f738128fe393bef1bcd8a524796fff40618b938cd467c71fcf37850ab0ba4f7d760045260245ffd5b6112a5915060203d60201161049f576104918183611611565b826110da565b34610b93575f366003190112610b93576040517f00000000000000000000000097126771e887ef57f5562db332843f6d1890aee06001600160a01b03168152602090f35b34610b93575f366003190112610b9357602060ff600654166040519015158152f35b34610b93576060366003190112610b935761132a6115e5565b6113326115fb565b6001600160a01b0382165f818152600160209081526040808320338452909152902054909260443592915f198110611370575b506102af9350611875565b8381106113d55784156113c25733156113af576102af945f52600160205260405f2060018060a01b0333165f526020528360405f209103905584611365565b634a1406b160e11b5f525f60045260245ffd5b63e602df0560e01b5f525f60045260245ffd5b8390637dc7a0d960e11b5f523360045260245260445260645ffd5b34610b93575f366003190112610b93576020600254604051908152f35b34610b93576040366003190112610b93576114266115e5565b6024359033156113c2576001600160a01b03169081156113af57335f52600160205260405f20825f526020528060405f20556040519081527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560203392a3602060405160018152f35b34610b93576020366003190112610b9357602061028060043561184e565b34610b93575f366003190112610b93576040515f6003548060011c90600181168015611597575b6020831081146115835782855290811561155f5750600114611501575b6108da836108ce81850382611611565b91905060035f527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b915f905b808210611545575090915081016020016108ce6114f1565b91926001816020925483858801015201910190929161152d565b60ff191660208086019190915291151560051b840190910191506108ce90506114f1565b634e487b7160e01b5f52602260045260245ffd5b91607f16916114d4565b34610b93575f366003190112610b93576020610280611647565b602060409281835280519182918282860152018484015e5f828201840152601f01601f1916010190565b600435906001600160a01b0382168203610b9357565b602435906001600160a01b0382168203610b9357565b90601f8019910116810190811067ffffffffffffffff82111761163357604052565b634e487b7160e01b5f52604160045260245ffd5b602460206001600160a01b0361165b6117ec565b16604051928380926370a0823160e01b82523060048301525afa908115611025575f91611686575090565b90506020813d6020116116ad575b816116a160209383611611565b81010312610b93575190565b3d9150611694565b90816020910312610b9357518015158103610b935790565b156116d457565b60405162461bcd60e51b815260206004820152600660248201526514185d5cd95960d21b6044820152606490fd5b1561170957565b60405162461bcd60e51b815260206004820152600b60248201526a16995c9bc8185b5bdd5b9d60aa1b6044820152606490fd5b8181029291811591840414171561174f57565b634e487b7160e01b5f52601160045260245ffd5b811561176d570490565b634e487b7160e01b5f52601260045260245ffd5b60025480156117c057611792611647565b90670de0b6b3a7640000820291808304670de0b6b3a7640000149015171561174f576117bd91611763565b90565b50670de0b6b3a764000090565b90816020910312610b9357516001600160a01b0381168103610b935790565b600460206001600160a01b036118006119c6565b1660405192838092632cdf7d8360e01b82525afa908115611025575f9161182f575b506001600160a01b031690565b611848915060203d6020116107ab5761079c8183611611565b5f611822565b60025480156118715761186c6117bd92611866611647565b9061173c565b611763565b5090565b6001600160a01b03169081156111d8576001600160a01b031691821561190c57815f525f60205260405f20548181106118f357817fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92602092855f525f84520360405f2055845f525f825260405f20818154019055604051908152a3565b8263391434e360e21b5f5260045260245260445260645ffd5b63ec442f0560e01b5f525f60045260245ffd5b600260055414611930576002600555565b633ee5aeb560e01b5f5260045ffd5b60405163a9059cbb60e01b60208201526001600160a01b039290921660248301526044808301939093529181526119809161197b606483611611565b611a79565b565b6040516323b872dd60e01b60208201526001600160a01b0392831660248201529290911660448301526064808301939093529181526119809161197b608483611611565b604051630d2020dd60e01b81527f5600185b051f65d311a9e3e3329905fc2fa701a8b22f3bbf8dfcbc10ccb6807160048201526020816024817f00000000000000000000000097126771e887ef57f5562db332843f6d1890aee06001600160a01b03165afa908115611025575f91611a3c575090565b6117bd915060203d6020116107ab5761079c8183611611565b600254801561187157611a6b906117bd9261173c565b611a73611647565b90611763565b905f602091828151910182855af115611025575f513d611ac857506001600160a01b0381163b155b611aa85750565b635274afe760e01b5f9081526001600160a01b0391909116600452602490fd5b60011415611aa156fea26469706673582212206cdc09e18a01d4229389956378053caae371d1c4f18e8b835233851ac8a44fd064736f6c634300081e0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000097126771e887ef57f5562db332843f6d1890aee0
-----Decoded View---------------
Arg [0] : _beaconAddress (address): 0x97126771E887ef57f5562Db332843F6D1890aee0
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 00000000000000000000000097126771e887ef57f5562db332843f6d1890aee0
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.
Add Token to MetaMask (Web3)