This nametag was submitted by Kleros Curate.
Rollie Finance: Trading Vault
Source Code
More Info
Private Name Tags
ContractCreator
TokenTracker
Latest 25 from a total of 7,251 transactions
| Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Withdraw | 26932588 | 34 days ago | IN | 0 ETH | 0.0000007 | ||||
| Withdraw All | 21123402 | 134 days ago | IN | 0 ETH | 0.00000274 | ||||
| Approve | 19030305 | 165 days ago | IN | 0 ETH | 0.00000004 | ||||
| Withdraw All | 18842877 | 167 days ago | IN | 0 ETH | 0.00000002 | ||||
| Withdraw All | 17934204 | 178 days ago | IN | 0 ETH | 0.00000002 | ||||
| Withdraw All | 17923993 | 178 days ago | IN | 0 ETH | 0.00000308 | ||||
| Withdraw | 16796865 | 212 days ago | IN | 0 ETH | 0.00000308 | ||||
| Withdraw | 16463653 | 224 days ago | IN | 0 ETH | 0.00000294 | ||||
| Withdraw | 16459274 | 225 days ago | IN | 0 ETH | 0.00000295 | ||||
| Withdraw | 16458970 | 225 days ago | IN | 0 ETH | 0.0000045 | ||||
| Withdraw | 16441105 | 225 days ago | IN | 0 ETH | 0.00000299 | ||||
| Withdraw | 16385797 | 228 days ago | IN | 0 ETH | 0.00000415 | ||||
| Withdraw | 16306124 | 230 days ago | IN | 0 ETH | 0.00000468 | ||||
| Withdraw | 16147750 | 237 days ago | IN | 0 ETH | 0.00000607 | ||||
| Withdraw | 16147617 | 237 days ago | IN | 0 ETH | 0.00000419 | ||||
| Withdraw | 16147176 | 237 days ago | IN | 0 ETH | 0.0000022 | ||||
| Withdraw | 16147120 | 237 days ago | IN | 0 ETH | 0.00000263 | ||||
| Withdraw | 15978350 | 242 days ago | IN | 0 ETH | 0.00000475 | ||||
| Withdraw | 15948684 | 243 days ago | IN | 0 ETH | 0.0000062 | ||||
| Withdraw | 15947413 | 243 days ago | IN | 0 ETH | 0.00000621 | ||||
| Withdraw | 15873521 | 245 days ago | IN | 0 ETH | 0.00000464 | ||||
| Withdraw | 15690387 | 249 days ago | IN | 0 ETH | 0.00000565 | ||||
| Withdraw | 15680794 | 249 days ago | IN | 0 ETH | 0.00000692 | ||||
| Withdraw | 15535817 | 253 days ago | IN | 0 ETH | 0.00000411 | ||||
| Withdraw | 15523245 | 254 days ago | IN | 0 ETH | 0.00000465 |
Advanced mode: Intended for advanced users or developers and will display all Internal Transactions including zero value transfers.
Latest 25 internal transactions (View All)
Advanced mode:
| Parent Transaction Hash | Block | From | To | ||||
|---|---|---|---|---|---|---|---|
| 26932588 | 34 days ago | 0 ETH | |||||
| 26932588 | 34 days ago | 0 ETH | |||||
| 21123402 | 134 days ago | 0 ETH | |||||
| 21123402 | 134 days ago | 0 ETH | |||||
| 19030564 | 165 days ago | 0 ETH | |||||
| 19030564 | 165 days ago | 0 ETH | |||||
| 19030564 | 165 days ago | 0 ETH | |||||
| 18842877 | 167 days ago | 0 ETH | |||||
| 18842877 | 167 days ago | 0 ETH | |||||
| 18691442 | 169 days ago | 0 ETH | |||||
| 17934204 | 178 days ago | 0 ETH | |||||
| 17934204 | 178 days ago | 0 ETH | |||||
| 17923993 | 178 days ago | 0 ETH | |||||
| 17923993 | 178 days ago | 0 ETH | |||||
| 17921200 | 178 days ago | 0 ETH | |||||
| 16796865 | 212 days ago | 0 ETH | |||||
| 16796865 | 212 days ago | 0 ETH | |||||
| 16463653 | 224 days ago | 0 ETH | |||||
| 16463653 | 224 days ago | 0 ETH | |||||
| 16459274 | 225 days ago | 0 ETH | |||||
| 16459274 | 225 days ago | 0 ETH | |||||
| 16458970 | 225 days ago | 0 ETH | |||||
| 16458970 | 225 days ago | 0 ETH | |||||
| 16441105 | 225 days ago | 0 ETH | |||||
| 16441105 | 225 days ago | 0 ETH |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
TradingVault
Compiler Version
v0.8.15+commit.e14f2714
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable2Step.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "./interfaces/IVault.sol";
import "./interfaces/IPairInfos.sol";
contract TradingVault is IVault, ERC20, Ownable2Step, ReentrancyGuard {
using SafeMath for uint256;
using SafeERC20 for IERC20;
IPairInfos public pairInfo;
address public immutable standardToken;
uint8 private immutable _decimals;
uint public withdrawTimelock; // time
// 1. standardToken balance
uint256 public currentBalance;
// 2. standardToken staking rewards
uint public totalRewardsDistributed;
mapping(address => uint256) public userLastDepositTime;
mapping(address => uint) public standardTokenToClaim;
mapping(address => bool) public allowed;
mapping(address => bool) public allowedToInteract;
// EVENTS
event Deposited(address caller, uint amount, uint newCurrentBalance, uint shares);
event Withdrawn(address caller, uint amount, uint newCurrentBalance, uint shares);
event Sent(address caller, address trader, uint amount, uint newCurrentBalance);
event ToClaim(address caller, address trader, uint amount, uint currentBalance);
event Claimed(address trader, uint amount, uint newCurrentBalance);
event ReceivedFromTrader(
address caller,
address trader,
uint UstandardTokenAmount,
uint vaultFeeUSDT,
uint newCurrentBalance
);
event WithdrawTimelockSet(uint256 indexed _withdrawTimelock);
event AllowedToInteractSet(address indexed sender, bool status);
event AllowedSet(address indexed _allowed, bool status);
event StandardTokenSet(address indexed usdt);
event DistributeReward(uint256 _amount);
event SetPairInfo(address _pairInfo);
constructor(string memory _name, string memory _symbol, address _standardToken) ERC20(_name, _symbol) {
require(_standardToken != address(0), "address_0");
standardToken = _standardToken;
_decimals = ERC20(standardToken).decimals();
emit StandardTokenSet(_standardToken);
}
modifier onlyAllowed() {
require(allowedToInteract[msg.sender], "NOT_ALLOWED");
_;
}
function setAllowedToInteract(address _sender, bool _flag) public onlyOwner {
allowedToInteract[_sender] = _flag;
emit AllowedToInteractSet(_sender, _flag);
}
function setAllowed(address _allowed, bool _flag) public onlyOwner {
allowed[_allowed] = _flag;
emit AllowedSet(_allowed, _flag);
}
function setPairInfo(address _pairInfo) external onlyOwner {
pairInfo = IPairInfos(_pairInfo);
emit SetPairInfo(_pairInfo);
}
function setWithdrawTimelock(uint _withdrawTimelock) external onlyOwner {
withdrawTimelock = _withdrawTimelock;
emit WithdrawTimelockSet(_withdrawTimelock);
}
function getPricePerFullShare() public view returns (uint256) {
return totalSupply() == 0 ? 10 ** ERC20(standardToken).decimals() : currentBalance.mul(1e18).div(totalSupply());
}
function depositAll(address _user) external {
deposit(IERC20(standardToken).balanceOf(msg.sender), _user);
}
function deposit(uint _amount, address _user) public nonReentrant {
require(_amount > 0, "AMOUNT_0");
address user;
if (allowed[msg.sender]) {
user = _user;
} else {
user = msg.sender;
userLastDepositTime[user] = block.timestamp;
}
SafeERC20.safeTransferFrom(IERC20(standardToken), msg.sender, address(this), _amount);
uint256 shares = 0;
if (totalSupply() == 0) {
require(_amount > 1000, "Not Enough Shares for first mint");
shares = (_amount - 1000);
_mint(address(this), 1000);
} else {
shares = (_amount.mul(totalSupply())).div(currentBalance);
}
require(shares != 0, "Zero shares minted");
currentBalance += _amount;
_mint(user, shares);
emit Deposited(user, _amount, currentBalance, shares);
}
function withdrawAll() external {
withdraw(balanceOf(msg.sender));
}
function withdraw(uint _shares) public nonReentrant {
require(balanceOf(msg.sender) >= _shares, "Not Enough Shares");
require(_shares > 0, "AMOUNT_0");
uint256 userAsset = (currentBalance.mul(_shares)).div(totalSupply());
require(block.timestamp >= userLastDepositTime[msg.sender] + withdrawTimelock, "TOO_EARLY");
uint256 occupied = pairInfo.occupiedCollateral();
require(userAsset + occupied <= currentBalance, "occupied");
_burn(msg.sender, _shares);
currentBalance -= userAsset;
IERC20(standardToken).safeTransfer(msg.sender, userAsset);
emit Withdrawn(msg.sender, userAsset, currentBalance, _shares);
}
// USDT incentives
function distributeReward(uint _amount, bool _send) public override onlyAllowed {
currentBalance = currentBalance.add(_amount);
totalRewardsDistributed += _amount;
if (_send) {
IERC20(standardToken).safeTransferFrom(msg.sender, address(this), _amount);
}
require(IERC20(standardToken).balanceOf(address(this)) >= currentBalance, "Not send");
emit DistributeReward(_amount);
}
// Handle traders standardToken when a trade is closed
function sendToTrader(address _trader, uint _amount) external override onlyAllowed {
if (_amount < currentBalance) {
currentBalance = currentBalance.sub(_amount);
IERC20(standardToken).safeTransfer(_trader, _amount);
emit Sent(msg.sender, _trader, _amount, currentBalance);
} else {
standardTokenToClaim[_trader] += _amount;
emit ToClaim(msg.sender, _trader, _amount, currentBalance);
}
}
function claim() external {
uint amount = standardTokenToClaim[msg.sender];
require(amount > 0, "NOTHING_TO_CLAIM");
require(currentBalance > amount, "BALANCE_TOO_LOW");
unchecked {
currentBalance -= amount;
}
standardTokenToClaim[msg.sender] = 0;
IERC20(standardToken).safeTransfer(msg.sender, amount);
emit Claimed(msg.sender, amount, currentBalance);
}
// Handle standardToken from opened trades
function receiveFromTrader(
address _trader,
uint _amount,
uint _vaultFee,
bool _send
) external override onlyAllowed {
currentBalance += _amount;
if (_vaultFee > 0) {
distributeReward(_vaultFee, _send);
}
emit ReceivedFromTrader(msg.sender, _trader, _amount, _vaultFee, currentBalance);
}
function decimals() public view override returns (uint8) {
return _decimals;
}
function _transfer(address from, address to, uint256 amount) internal override {
require(block.timestamp >= userLastDepositTime[from] + withdrawTimelock, "TOO_EARLY");
super._transfer(from, to, amount);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable2Step.sol)
pragma solidity ^0.8.0;
import "./Ownable.sol";
/**
* @dev Contract module which provides access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership} and {acceptOwnership}.
*
* This module is used through inheritance. It will make available all functions
* from parent (Ownable).
*/
abstract contract Ownable2Step is Ownable {
address private _pendingOwner;
event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);
/**
* @dev Returns the address of the pending owner.
*/
function pendingOwner() public view virtual returns (address) {
return _pendingOwner;
}
/**
* @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual override onlyOwner {
_pendingOwner = newOwner;
emit OwnershipTransferStarted(owner(), newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual override {
delete _pendingOwner;
super._transferOwnership(newOwner);
}
/**
* @dev The new owner accepts the ownership transfer.
*/
function acceptOwnership() public virtual {
address sender = _msgSender();
require(pendingOwner() == sender, "Ownable2Step: caller is not the new owner");
_transferOwnership(sender);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @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 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;
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
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// 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: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.0;
import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.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}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* 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 ERC20
* applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* All two of these 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 override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override 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 override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override 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 `amount`.
*/
function transfer(address to, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_transfer(owner, to, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* NOTE: If `amount` 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 amount) public virtual override returns (bool) {
address owner = _msgSender();
_approve(owner, spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* 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 `amount`.
* - the caller must have allowance for ``from``'s tokens of at least
* `amount`.
*/
function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, amount);
_transfer(from, to, amount);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, allowance(owner, spender) + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
address owner = _msgSender();
uint256 currentAllowance = allowance(owner, spender);
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(owner, spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves `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.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
*/
function _transfer(address from, address to, uint256 amount) internal virtual {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(from, to, amount);
uint256 fromBalance = _balances[from];
require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[from] = fromBalance - amount;
// Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
// decrementing then incrementing.
_balances[to] += amount;
}
emit Transfer(from, to, amount);
_afterTokenTransfer(from, to, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
unchecked {
// Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
_balances[account] += amount;
}
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
// Overflow not possible: amount <= accountBalance <= totalSupply.
_totalSupply -= amount;
}
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
}
/**
* @dev Sets `amount` 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.
*/
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Updates `owner` s allowance for `spender` based on spent `amount`.
*
* Does not update the allowance amount in case of infinite allowance.
* Revert if not enough allowance is available.
*
* Might emit an {Approval} event.
*/
function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
require(currentAllowance >= amount, "ERC20: insufficient allowance");
unchecked {
_approve(owner, spender, currentAllowance - amount);
}
}
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* has been transferred to `to`.
* - when `from` is zero, `amount` tokens have been minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens have been burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
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 amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` 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 amount) 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 `amount` 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 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` 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 amount) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
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 v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 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 {
using Address for address;
/**
* @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.encodeWithSelector(token.transfer.selector, 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.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 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.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
}
}
/**
* @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.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
* Revert on invalid signature.
*/
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @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).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
/**
* @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 silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return
success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @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;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
* now has built in overflow checking.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the subtraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
import {TradeType} from "../libs/Types.sol";
interface IPairInfos {
function pairFeedId(uint _pairIndex) external view returns (bytes32);
function withinMaxSpread(
uint256 pairIndex,
TradeType tradeType,
uint256 limit,
uint256 current,
bool isLong
) external view returns (bool result);
function isExceedGroupsCollateralLimit(uint256 pairIndex, uint256 position, bool long) external view returns (bool);
function isInPairInterestLimit(uint pairIndex, uint256 position, bool isLong) external view returns (bool);
function legalPositionSizeAndLeverage(
uint256 pairIndex,
uint256 margin,
uint256 leverage
) external view returns (bool);
function pairSpreadP(uint _pairIndex) external view returns (uint);
function pairOpenFeeP(uint _pairIndex) external view returns (uint);
function pairCloseFeeP(uint _pairIndex) external view returns (uint);
function priceRollover(uint _pairIndex) external view returns (bool);
function guaranteedSlAndTPEnable(uint _pairIndex) external view returns (bool);
function occupiedCollateral() external view returns (uint256);
function getTradePriceImpact(
uint openPrice,
uint pairIndex,
bool long,
uint tradeOpenInterest
) external view returns (uint priceAfterImpact);
function updateGroupCollateral(uint _pairIndex, uint _amount, bool _long, bool _increase) external;
function updateOpenInterest(uint _pairIndex, uint _amount, bool _long, bool _increase) external;
function storeTradeInitialAccFees(uint256 orderId, uint256 pairIndex, bool long) external;
function delTradeInitialAccFees(uint256 orderId) external;
function getFundingAndRolloverFee(
uint256 orderId,
uint256 pairIndex,
uint256 position,
bool long
) external view returns (int256 fundingFee, uint256 rolloverFee);
function getTradeLiquidationPrice(
uint256 orderId,
uint pairIndex,
uint openPrice,
uint collateral,
uint leverage,
bool long
) external view returns (uint);
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
interface IVault {
function distributeReward(uint _amount, bool _send) external;
function currentBalance() external view returns (uint);
function sendToTrader(address _trader, uint _amount) external;
function receiveFromTrader(address _trader, uint _amount, uint _vaultFee, bool _send) external;
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
enum CloseType {
INITIATIVE,
LQI,
TP,
SL
}
enum TradeType {
MARKET,
LIMIT,
STOP
}
struct TradeBase {
address trader;
uint256 pairIndex;
uint256 margin;
bool long;
uint leverage; // x10?
uint tp;
uint sl;
}
struct OpenTrade {
TradeBase base;
uint256 openPrice; // x10**18
uint256 lastUpdateTime;
}
struct OpenRequest {
TradeType tradeType;
TradeBase base;
address callTarget;
uint256 maxPrice; // x10**18
uint256 minPrice; // x10**18
uint256 time;
}
struct CloseRequest {
uint256 closeMargin;
address callTarget;
uint256 time;
bool isDone;
}
struct Close {
uint256 requestAmount;
CloseRequest[] requests;
}{
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs",
"useLiteralContent": true
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": [],
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"address","name":"_standardToken","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_allowed","type":"address"},{"indexed":false,"internalType":"bool","name":"status","type":"bool"}],"name":"AllowedSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"bool","name":"status","type":"bool"}],"name":"AllowedToInteractSet","type":"event"},{"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":[{"indexed":false,"internalType":"address","name":"trader","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newCurrentBalance","type":"uint256"}],"name":"Claimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newCurrentBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"Deposited","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"DistributeReward","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"address","name":"trader","type":"address"},{"indexed":false,"internalType":"uint256","name":"UstandardTokenAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"vaultFeeUSDT","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newCurrentBalance","type":"uint256"}],"name":"ReceivedFromTrader","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"address","name":"trader","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newCurrentBalance","type":"uint256"}],"name":"Sent","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_pairInfo","type":"address"}],"name":"SetPairInfo","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"usdt","type":"address"}],"name":"StandardTokenSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"address","name":"trader","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"currentBalance","type":"uint256"}],"name":"ToClaim","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":"uint256","name":"_withdrawTimelock","type":"uint256"}],"name":"WithdrawTimelockSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newCurrentBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"Withdrawn","type":"event"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","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":"","type":"address"}],"name":"allowed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"allowedToInteract","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","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":[],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currentBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_user","type":"address"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"depositAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bool","name":"_send","type":"bool"}],"name":"distributeReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getPricePerFullShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pairInfo","outputs":[{"internalType":"contract IPairInfos","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_trader","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_vaultFee","type":"uint256"},{"internalType":"bool","name":"_send","type":"bool"}],"name":"receiveFromTrader","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_trader","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"sendToTrader","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_allowed","type":"address"},{"internalType":"bool","name":"_flag","type":"bool"}],"name":"setAllowed","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_sender","type":"address"},{"internalType":"bool","name":"_flag","type":"bool"}],"name":"setAllowedToInteract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_pairInfo","type":"address"}],"name":"setPairInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_withdrawTimelock","type":"uint256"}],"name":"setWithdrawTimelock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"standardToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"standardTokenToClaim","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalRewardsDistributed","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":"amount","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":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userLastDepositTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawTimelock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]Contract Creation Code
60c06040523480156200001157600080fd5b50604051620027dc380380620027dc8339810160408190526200003491620002bd565b82826003620000448382620003d9565b506004620000538282620003d9565b505050620000706200006a6200017060201b60201c565b62000174565b60016007556001600160a01b038116620000bc5760405162461bcd60e51b81526020600482015260096024820152680616464726573735f360bc1b604482015260640160405180910390fd5b6001600160a01b03811660808190526040805163313ce56760e01b8152905163313ce567916004808201926020929091908290030181865afa15801562000107573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200012d9190620004a5565b60ff1660a0526040516001600160a01b038216907ff11f4eb38e295f533e05a53048351dd29dccd97a901f3a10c7b4829f5833780190600090a2505050620004d1565b3390565b600680546001600160a01b03191690556200019b816200019e602090811b6200141417901c565b50565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200021857600080fd5b81516001600160401b0380821115620002355762000235620001f0565b604051601f8301601f19908116603f01168101908282118183101715620002605762000260620001f0565b816040528381526020925086838588010111156200027d57600080fd5b600091505b83821015620002a1578582018301518183018401529082019062000282565b83821115620002b35760008385830101525b9695505050505050565b600080600060608486031215620002d357600080fd5b83516001600160401b0380821115620002eb57600080fd5b620002f98783880162000206565b945060208601519150808211156200031057600080fd5b506200031f8682870162000206565b604086015190935090506001600160a01b03811681146200033f57600080fd5b809150509250925092565b600181811c908216806200035f57607f821691505b6020821081036200038057634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620003d457600081815260208120601f850160051c81016020861015620003af5750805b601f850160051c820191505b81811015620003d057828155600101620003bb565b5050505b505050565b81516001600160401b03811115620003f557620003f5620001f0565b6200040d816200040684546200034a565b8462000386565b602080601f8311600181146200044557600084156200042c5750858301515b600019600386901b1c1916600185901b178555620003d0565b600085815260208120601f198616915b82811015620004765788860151825594840194600190910190840162000455565b5085821015620004955787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600060208284031215620004b857600080fd5b815160ff81168114620004ca57600080fd5b9392505050565b60805160a0516122ad6200052f60003960006102d501526000818161034d0152818161086201528181610a1e01528181610b1101528181610cec01528181610e5d01528181610fe301528181611231015261127101526122ad6000f3fe608060405234801561001057600080fd5b50600436106102325760003560e01c806379ba509711610130578063ce845d1d116100b8578063e30c39781161007c578063e30c397814610508578063ee17254614610519578063f2fde38b14610522578063f49a9b8a14610535578063fc2a5b1d1461054857600080fd5b8063ce845d1d146104a3578063ceb5caa5146104ac578063d63a8e11146104bf578063dd62ed3e146104e2578063dfa15f02146104f557600080fd5b806395d89b41116100ff57806395d89b411461044f5780639d1765f6146104575780639f0d5f271461046a578063a457c2d71461047d578063a9059cbb1461049057600080fd5b806379ba50971461041b578063853828b6146104235780638da5cb5b1461042b57806392da35f21461043c57600080fd5b806341200844116101be578063665714a911610182578063665714a9146103af5780636e553f65146103cf57806370a08231146103e2578063715018a61461040b57806377c7b8fc1461041357600080fd5b806341200844146103125780634697f05d146103355780634c7d7d3f146103485780634e71d92d146103875780635d1b0d381461038f57600080fd5b80631eefa740116102055780631eefa7401461029357806323b872dd146102a85780632e1a7d4d146102bb578063313ce567146102ce57806339509351146102ff57600080fd5b80630661c6ce1461023757806306fdde0314610253578063095ea7b31461026857806318160ddd1461028b575b600080fd5b61024060095481565b6040519081526020015b60405180910390f35b61025b61055b565b60405161024a9190611e39565b61027b610276366004611e88565b6105ed565b604051901515815260200161024a565b600254610240565b6102a66102a1366004611eb2565b610607565b005b61027b6102b6366004611ecb565b610642565b6102a66102c9366004611eb2565b610666565b60405160ff7f000000000000000000000000000000000000000000000000000000000000000016815260200161024a565b61027b61030d366004611e88565b6108e2565b61027b610320366004611f07565b600f6020526000908152604090205460ff1681565b6102a6610343366004611f30565b610904565b61036f7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161024a565b6102a661096c565b61024061039d366004611f07565b600d6020526000908152604090205481565b6102406103bd366004611f07565b600c6020526000908152604090205481565b6102a66103dd366004611f67565b610a96565b6102406103f0366004611f07565b6001600160a01b031660009081526020819052604090205490565b6102a6610ca0565b610240610cb4565b6102a6610d77565b6102a6610dee565b6005546001600160a01b031661036f565b6102a661044a366004611e88565b610e07565b61025b610f5b565b6102a6610465366004611f30565b610f6a565b6102a6610478366004611f07565b610fca565b61027b61048b366004611e88565b61105c565b61027b61049e366004611e88565b6110d7565b610240600a5481565b6102a66104ba366004611f93565b6110e5565b61027b6104cd366004611f07565b600e6020526000908152604090205460ff1681565b6102406104f0366004611fdb565b61119a565b6102a6610503366004612005565b6111c5565b6006546001600160a01b031661036f565b610240600b5481565b6102a6610530366004611f07565b61134d565b6102a6610543366004611f07565b6113be565b60085461036f906001600160a01b031681565b60606003805461056a9061202a565b80601f01602080910402602001604051908101604052809291908181526020018280546105969061202a565b80156105e35780601f106105b8576101008083540402835291602001916105e3565b820191906000526020600020905b8154815290600101906020018083116105c657829003601f168201915b5050505050905090565b6000336105fb818585611466565b60019150505b92915050565b61060f61158a565b600981905560405181907f06f87285860835b469490eb0f9b0e028d3565828b49497ebb80e736e6ca0514e90600090a250565b6000336106508582856115e4565b61065b85858561165e565b506001949350505050565b61066e6116cf565b336000908152602081905260409020548111156106c65760405162461bcd60e51b81526020600482015260116024820152704e6f7420456e6f7567682053686172657360781b60448201526064015b60405180910390fd5b600081116107015760405162461bcd60e51b81526020600482015260086024820152670414d4f554e545f360c41b60448201526064016106bd565b600061072261070f60025490565b600a5461071c9085611728565b9061173b565b600954336000908152600c60205260409020549192506107419161207a565b42101561077c5760405162461bcd60e51b8152602060048201526009602482015268544f4f5f4541524c5960b81b60448201526064016106bd565b60085460408051630380602760e21b815290516000926001600160a01b031691630e01809c9160048083019260209291908290030181865afa1580156107c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ea9190612092565b600a549091506107fa828461207a565b11156108335760405162461bcd60e51b81526020600482015260086024820152671bd8d8dd5c1a595960c21b60448201526064016106bd565b61083d3384611747565b81600a600082825461084f91906120ab565b9091555061088990506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163384611879565b600a5460408051338152602081018590528082019290925260608201859052517f75e161b3e824b114fc1a33274bd7091918dd4e639cede50b78b15a4eea956a219181900360800190a150506108df6001600755565b50565b6000336105fb8185856108f5838361119a565b6108ff919061207a565b611466565b61090c61158a565b6001600160a01b0382166000818152600e6020908152604091829020805460ff191685151590811790915591519182527fc5217903bd71390e046be1c1ee589f3af533c8fe5b67ee0a7dade2f8a853badd91015b60405180910390a25050565b336000908152600d6020526040902054806109bc5760405162461bcd60e51b815260206004820152601060248201526f4e4f5448494e475f544f5f434c41494d60801b60448201526064016106bd565b80600a54116109ff5760405162461bcd60e51b815260206004820152600f60248201526e42414c414e43455f544f4f5f4c4f5760881b60448201526064016106bd565b600a80548290039055336000818152600d6020526040812055610a4d907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169083611879565b600a546040805133815260208101849052908101919091527f987d620f307ff6b94d58743cb7a7509f24071586a77759b77c2d4e29f75a2f9a906060015b60405180910390a150565b610a9e6116cf565b60008211610ad95760405162461bcd60e51b81526020600482015260086024820152670414d4f554e545f360c41b60448201526064016106bd565b336000908152600e602052604081205460ff1615610af8575080610b0c565b50336000818152600c602052604090204290555b610b387f00000000000000000000000000000000000000000000000000000000000000003330866118dc565b6000610b4360025490565b600003610bba576103e88411610b9b5760405162461bcd60e51b815260206004820181905260248201527f4e6f7420456e6f7567682053686172657320666f72206669727374206d696e7460448201526064016106bd565b610ba76103e8856120ab565b9050610bb5306103e8611914565b610bd6565b610bd3600a5461071c610bcc60025490565b8790611728565b90505b80600003610c1b5760405162461bcd60e51b815260206004820152601260248201527116995c9bc81cda185c995cc81b5a5b9d195960721b60448201526064016106bd565b83600a6000828254610c2d919061207a565b90915550610c3d90508282611914565b600a54604080516001600160a01b0385168152602081018790528082019290925260608201839052517f91ede45f04a37a7c170f5c1207df3b6bc748dc1e04ad5e917a241d0f52feada39181900360800190a15050610c9c6001600755565b5050565b610ca861158a565b610cb260006119d3565b565b6000610cbf60025490565b15610cea57610ce5610cd060025490565b600a5461071c90670de0b6b3a7640000611728565b905090565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6c91906120c2565b610ce590600a6121c9565b60065433906001600160a01b03168114610de55760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084016106bd565b6108df816119d3565b33600090815260208190526040902054610cb290610666565b336000908152600f602052604090205460ff16610e365760405162461bcd60e51b81526004016106bd906121d8565b600a54811015610edd57600a54610e4d90826119ec565b600a55610e846001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168383611879565b600a54604080513381526001600160a01b038516602082015290810183905260608101919091527f34355b4c5dff25f21b90975d65f648edf2c50bea228323bb74333bfe5f015f3c906080015b60405180910390a15050565b6001600160a01b0382166000908152600d602052604081208054839290610f0590849061207a565b9091555050600a54604080513381526001600160a01b038516602082015290810183905260608101919091527f5084298b6a649fa60b059555adae31e4f916067c54a48c56b76a106266f9136f90608001610ed1565b60606004805461056a9061202a565b610f7261158a565b6001600160a01b0382166000818152600f6020908152604091829020805460ff191685151590811790915591519182527f77711358779674597f238fdb43e9f28618347bc0e217ae42c982656c0b7f6be89101610960565b6040516370a0823160e01b81523360048201526108df907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015611032573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110569190612092565b82610a96565b6000338161106a828661119a565b9050838110156110ca5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016106bd565b61065b8286868403611466565b6000336105fb81858561165e565b336000908152600f602052604090205460ff166111145760405162461bcd60e51b81526004016106bd906121d8565b82600a6000828254611126919061207a565b9091555050811561113b5761113b82826111c5565b600a54604080513381526001600160a01b0387166020820152808201869052606081018590526080810192909252517f6e22aa31121e8218696ecd7dc44c424a92f3d6f62814106f18b9311159fefcb29181900360a00190a150505050565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b336000908152600f602052604090205460ff166111f45760405162461bcd60e51b81526004016106bd906121d8565b600a5461120190836119f8565b600a8190555081600b6000828254611219919061207a565b90915550508015611259576112596001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163330856118dc565b600a546040516370a0823160e01b81523060048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa1580156112c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112e49190612092565b101561131d5760405162461bcd60e51b8152602060048201526008602482015267139bdd081cd95b9960c21b60448201526064016106bd565b6040518281527f231c2f80c902aff4c7d9f505b7c6d4e74f0dfa149d7cc269419632710952324a90602001610ed1565b61135561158a565b600680546001600160a01b0383166001600160a01b031990911681179091556113866005546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6113c661158a565b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527f498f61784682d2a34a04afb8c518b7d38e0e59907bd66601a0a41ed6fb79ff9e90602001610a8b565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b0383166114c85760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016106bd565b6001600160a01b0382166115295760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016106bd565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6005546001600160a01b03163314610cb25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016106bd565b60006115f0848461119a565b90506000198114611658578181101561164b5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016106bd565b6116588484848403611466565b50505050565b6009546001600160a01b0384166000908152600c6020526040902054611684919061207a565b4210156116bf5760405162461bcd60e51b8152602060048201526009602482015268544f4f5f4541524c5960b81b60448201526064016106bd565b6116ca838383611a04565b505050565b6002600754036117215760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016106bd565b6002600755565b600061173482846121fd565b9392505050565b6000611734828461221c565b6001600160a01b0382166117a75760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084016106bd565b6001600160a01b0382166000908152602081905260409020548181101561181b5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b60648201526084016106bd565b6001600160a01b0383166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b6040516001600160a01b0383166024820152604481018290526116ca90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611ba8565b6040516001600160a01b03808516602483015283166044820152606481018290526116589085906323b872dd60e01b906084016118a5565b6001600160a01b03821661196a5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016106bd565b806002600082825461197c919061207a565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b600680546001600160a01b03191690556108df81611414565b600061173482846120ab565b6000611734828461207a565b6001600160a01b038316611a685760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016106bd565b6001600160a01b038216611aca5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016106bd565b6001600160a01b03831660009081526020819052604090205481811015611b425760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016106bd565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3611658565b6000611bfd826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611c7d9092919063ffffffff16565b9050805160001480611c1e575080806020019051810190611c1e919061223e565b6116ca5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016106bd565b6060611c8c8484600085611c94565b949350505050565b606082471015611cf55760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016106bd565b600080866001600160a01b03168587604051611d11919061225b565b60006040518083038185875af1925050503d8060008114611d4e576040519150601f19603f3d011682016040523d82523d6000602084013e611d53565b606091505b5091509150611d6487838387611d6f565b979650505050505050565b60608315611dde578251600003611dd7576001600160a01b0385163b611dd75760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016106bd565b5081611c8c565b611c8c8383815115611df35781518083602001fd5b8060405162461bcd60e51b81526004016106bd9190611e39565b60005b83811015611e28578181015183820152602001611e10565b838111156116585750506000910152565b6020815260008251806020840152611e58816040850160208701611e0d565b601f01601f19169190910160400192915050565b80356001600160a01b0381168114611e8357600080fd5b919050565b60008060408385031215611e9b57600080fd5b611ea483611e6c565b946020939093013593505050565b600060208284031215611ec457600080fd5b5035919050565b600080600060608486031215611ee057600080fd5b611ee984611e6c565b9250611ef760208501611e6c565b9150604084013590509250925092565b600060208284031215611f1957600080fd5b61173482611e6c565b80151581146108df57600080fd5b60008060408385031215611f4357600080fd5b611f4c83611e6c565b91506020830135611f5c81611f22565b809150509250929050565b60008060408385031215611f7a57600080fd5b82359150611f8a60208401611e6c565b90509250929050565b60008060008060808587031215611fa957600080fd5b611fb285611e6c565b935060208501359250604085013591506060850135611fd081611f22565b939692955090935050565b60008060408385031215611fee57600080fd5b611ff783611e6c565b9150611f8a60208401611e6c565b6000806040838503121561201857600080fd5b823591506020830135611f5c81611f22565b600181811c9082168061203e57607f821691505b60208210810361205e57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b6000821982111561208d5761208d612064565b500190565b6000602082840312156120a457600080fd5b5051919050565b6000828210156120bd576120bd612064565b500390565b6000602082840312156120d457600080fd5b815160ff8116811461173457600080fd5b600181815b8085111561212057816000190482111561210657612106612064565b8085161561211357918102915b93841c93908002906120ea565b509250929050565b60008261213757506001610601565b8161214457506000610601565b816001811461215a576002811461216457612180565b6001915050610601565b60ff84111561217557612175612064565b50506001821b610601565b5060208310610133831016604e8410600b84101617156121a3575081810a610601565b6121ad83836120e5565b80600019048211156121c1576121c1612064565b029392505050565b600061173460ff841683612128565b6020808252600b908201526a1393d517d0531313d5d15160aa1b604082015260600190565b600081600019048311821515161561221757612217612064565b500290565b60008261223957634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121561225057600080fd5b815161173481611f22565b6000825161226d818460208701611e0d565b919091019291505056fea2646970667358221220becf9323e37c80498bb954ecba8ae0bd2cbd628b3227828c10b9f8e50c5e9ce864736f6c634300080f0033000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000006efdbff2a14a7c8e15944d1f4a48f9f95f663a40000000000000000000000000000000000000000000000000000000000000003524c5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003524c500000000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106102325760003560e01c806379ba509711610130578063ce845d1d116100b8578063e30c39781161007c578063e30c397814610508578063ee17254614610519578063f2fde38b14610522578063f49a9b8a14610535578063fc2a5b1d1461054857600080fd5b8063ce845d1d146104a3578063ceb5caa5146104ac578063d63a8e11146104bf578063dd62ed3e146104e2578063dfa15f02146104f557600080fd5b806395d89b41116100ff57806395d89b411461044f5780639d1765f6146104575780639f0d5f271461046a578063a457c2d71461047d578063a9059cbb1461049057600080fd5b806379ba50971461041b578063853828b6146104235780638da5cb5b1461042b57806392da35f21461043c57600080fd5b806341200844116101be578063665714a911610182578063665714a9146103af5780636e553f65146103cf57806370a08231146103e2578063715018a61461040b57806377c7b8fc1461041357600080fd5b806341200844146103125780634697f05d146103355780634c7d7d3f146103485780634e71d92d146103875780635d1b0d381461038f57600080fd5b80631eefa740116102055780631eefa7401461029357806323b872dd146102a85780632e1a7d4d146102bb578063313ce567146102ce57806339509351146102ff57600080fd5b80630661c6ce1461023757806306fdde0314610253578063095ea7b31461026857806318160ddd1461028b575b600080fd5b61024060095481565b6040519081526020015b60405180910390f35b61025b61055b565b60405161024a9190611e39565b61027b610276366004611e88565b6105ed565b604051901515815260200161024a565b600254610240565b6102a66102a1366004611eb2565b610607565b005b61027b6102b6366004611ecb565b610642565b6102a66102c9366004611eb2565b610666565b60405160ff7f000000000000000000000000000000000000000000000000000000000000000616815260200161024a565b61027b61030d366004611e88565b6108e2565b61027b610320366004611f07565b600f6020526000908152604090205460ff1681565b6102a6610343366004611f30565b610904565b61036f7f00000000000000000000000006efdbff2a14a7c8e15944d1f4a48f9f95f663a481565b6040516001600160a01b03909116815260200161024a565b6102a661096c565b61024061039d366004611f07565b600d6020526000908152604090205481565b6102406103bd366004611f07565b600c6020526000908152604090205481565b6102a66103dd366004611f67565b610a96565b6102406103f0366004611f07565b6001600160a01b031660009081526020819052604090205490565b6102a6610ca0565b610240610cb4565b6102a6610d77565b6102a6610dee565b6005546001600160a01b031661036f565b6102a661044a366004611e88565b610e07565b61025b610f5b565b6102a6610465366004611f30565b610f6a565b6102a6610478366004611f07565b610fca565b61027b61048b366004611e88565b61105c565b61027b61049e366004611e88565b6110d7565b610240600a5481565b6102a66104ba366004611f93565b6110e5565b61027b6104cd366004611f07565b600e6020526000908152604090205460ff1681565b6102406104f0366004611fdb565b61119a565b6102a6610503366004612005565b6111c5565b6006546001600160a01b031661036f565b610240600b5481565b6102a6610530366004611f07565b61134d565b6102a6610543366004611f07565b6113be565b60085461036f906001600160a01b031681565b60606003805461056a9061202a565b80601f01602080910402602001604051908101604052809291908181526020018280546105969061202a565b80156105e35780601f106105b8576101008083540402835291602001916105e3565b820191906000526020600020905b8154815290600101906020018083116105c657829003601f168201915b5050505050905090565b6000336105fb818585611466565b60019150505b92915050565b61060f61158a565b600981905560405181907f06f87285860835b469490eb0f9b0e028d3565828b49497ebb80e736e6ca0514e90600090a250565b6000336106508582856115e4565b61065b85858561165e565b506001949350505050565b61066e6116cf565b336000908152602081905260409020548111156106c65760405162461bcd60e51b81526020600482015260116024820152704e6f7420456e6f7567682053686172657360781b60448201526064015b60405180910390fd5b600081116107015760405162461bcd60e51b81526020600482015260086024820152670414d4f554e545f360c41b60448201526064016106bd565b600061072261070f60025490565b600a5461071c9085611728565b9061173b565b600954336000908152600c60205260409020549192506107419161207a565b42101561077c5760405162461bcd60e51b8152602060048201526009602482015268544f4f5f4541524c5960b81b60448201526064016106bd565b60085460408051630380602760e21b815290516000926001600160a01b031691630e01809c9160048083019260209291908290030181865afa1580156107c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ea9190612092565b600a549091506107fa828461207a565b11156108335760405162461bcd60e51b81526020600482015260086024820152671bd8d8dd5c1a595960c21b60448201526064016106bd565b61083d3384611747565b81600a600082825461084f91906120ab565b9091555061088990506001600160a01b037f00000000000000000000000006efdbff2a14a7c8e15944d1f4a48f9f95f663a4163384611879565b600a5460408051338152602081018590528082019290925260608201859052517f75e161b3e824b114fc1a33274bd7091918dd4e639cede50b78b15a4eea956a219181900360800190a150506108df6001600755565b50565b6000336105fb8185856108f5838361119a565b6108ff919061207a565b611466565b61090c61158a565b6001600160a01b0382166000818152600e6020908152604091829020805460ff191685151590811790915591519182527fc5217903bd71390e046be1c1ee589f3af533c8fe5b67ee0a7dade2f8a853badd91015b60405180910390a25050565b336000908152600d6020526040902054806109bc5760405162461bcd60e51b815260206004820152601060248201526f4e4f5448494e475f544f5f434c41494d60801b60448201526064016106bd565b80600a54116109ff5760405162461bcd60e51b815260206004820152600f60248201526e42414c414e43455f544f4f5f4c4f5760881b60448201526064016106bd565b600a80548290039055336000818152600d6020526040812055610a4d907f00000000000000000000000006efdbff2a14a7c8e15944d1f4a48f9f95f663a46001600160a01b03169083611879565b600a546040805133815260208101849052908101919091527f987d620f307ff6b94d58743cb7a7509f24071586a77759b77c2d4e29f75a2f9a906060015b60405180910390a150565b610a9e6116cf565b60008211610ad95760405162461bcd60e51b81526020600482015260086024820152670414d4f554e545f360c41b60448201526064016106bd565b336000908152600e602052604081205460ff1615610af8575080610b0c565b50336000818152600c602052604090204290555b610b387f00000000000000000000000006efdbff2a14a7c8e15944d1f4a48f9f95f663a43330866118dc565b6000610b4360025490565b600003610bba576103e88411610b9b5760405162461bcd60e51b815260206004820181905260248201527f4e6f7420456e6f7567682053686172657320666f72206669727374206d696e7460448201526064016106bd565b610ba76103e8856120ab565b9050610bb5306103e8611914565b610bd6565b610bd3600a5461071c610bcc60025490565b8790611728565b90505b80600003610c1b5760405162461bcd60e51b815260206004820152601260248201527116995c9bc81cda185c995cc81b5a5b9d195960721b60448201526064016106bd565b83600a6000828254610c2d919061207a565b90915550610c3d90508282611914565b600a54604080516001600160a01b0385168152602081018790528082019290925260608201839052517f91ede45f04a37a7c170f5c1207df3b6bc748dc1e04ad5e917a241d0f52feada39181900360800190a15050610c9c6001600755565b5050565b610ca861158a565b610cb260006119d3565b565b6000610cbf60025490565b15610cea57610ce5610cd060025490565b600a5461071c90670de0b6b3a7640000611728565b905090565b7f00000000000000000000000006efdbff2a14a7c8e15944d1f4a48f9f95f663a46001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6c91906120c2565b610ce590600a6121c9565b60065433906001600160a01b03168114610de55760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084016106bd565b6108df816119d3565b33600090815260208190526040902054610cb290610666565b336000908152600f602052604090205460ff16610e365760405162461bcd60e51b81526004016106bd906121d8565b600a54811015610edd57600a54610e4d90826119ec565b600a55610e846001600160a01b037f00000000000000000000000006efdbff2a14a7c8e15944d1f4a48f9f95f663a4168383611879565b600a54604080513381526001600160a01b038516602082015290810183905260608101919091527f34355b4c5dff25f21b90975d65f648edf2c50bea228323bb74333bfe5f015f3c906080015b60405180910390a15050565b6001600160a01b0382166000908152600d602052604081208054839290610f0590849061207a565b9091555050600a54604080513381526001600160a01b038516602082015290810183905260608101919091527f5084298b6a649fa60b059555adae31e4f916067c54a48c56b76a106266f9136f90608001610ed1565b60606004805461056a9061202a565b610f7261158a565b6001600160a01b0382166000818152600f6020908152604091829020805460ff191685151590811790915591519182527f77711358779674597f238fdb43e9f28618347bc0e217ae42c982656c0b7f6be89101610960565b6040516370a0823160e01b81523360048201526108df907f00000000000000000000000006efdbff2a14a7c8e15944d1f4a48f9f95f663a46001600160a01b0316906370a0823190602401602060405180830381865afa158015611032573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110569190612092565b82610a96565b6000338161106a828661119a565b9050838110156110ca5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016106bd565b61065b8286868403611466565b6000336105fb81858561165e565b336000908152600f602052604090205460ff166111145760405162461bcd60e51b81526004016106bd906121d8565b82600a6000828254611126919061207a565b9091555050811561113b5761113b82826111c5565b600a54604080513381526001600160a01b0387166020820152808201869052606081018590526080810192909252517f6e22aa31121e8218696ecd7dc44c424a92f3d6f62814106f18b9311159fefcb29181900360a00190a150505050565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b336000908152600f602052604090205460ff166111f45760405162461bcd60e51b81526004016106bd906121d8565b600a5461120190836119f8565b600a8190555081600b6000828254611219919061207a565b90915550508015611259576112596001600160a01b037f00000000000000000000000006efdbff2a14a7c8e15944d1f4a48f9f95f663a4163330856118dc565b600a546040516370a0823160e01b81523060048201527f00000000000000000000000006efdbff2a14a7c8e15944d1f4a48f9f95f663a46001600160a01b0316906370a0823190602401602060405180830381865afa1580156112c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112e49190612092565b101561131d5760405162461bcd60e51b8152602060048201526008602482015267139bdd081cd95b9960c21b60448201526064016106bd565b6040518281527f231c2f80c902aff4c7d9f505b7c6d4e74f0dfa149d7cc269419632710952324a90602001610ed1565b61135561158a565b600680546001600160a01b0383166001600160a01b031990911681179091556113866005546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6113c661158a565b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527f498f61784682d2a34a04afb8c518b7d38e0e59907bd66601a0a41ed6fb79ff9e90602001610a8b565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b0383166114c85760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016106bd565b6001600160a01b0382166115295760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016106bd565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6005546001600160a01b03163314610cb25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016106bd565b60006115f0848461119a565b90506000198114611658578181101561164b5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016106bd565b6116588484848403611466565b50505050565b6009546001600160a01b0384166000908152600c6020526040902054611684919061207a565b4210156116bf5760405162461bcd60e51b8152602060048201526009602482015268544f4f5f4541524c5960b81b60448201526064016106bd565b6116ca838383611a04565b505050565b6002600754036117215760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016106bd565b6002600755565b600061173482846121fd565b9392505050565b6000611734828461221c565b6001600160a01b0382166117a75760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084016106bd565b6001600160a01b0382166000908152602081905260409020548181101561181b5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b60648201526084016106bd565b6001600160a01b0383166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b6040516001600160a01b0383166024820152604481018290526116ca90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611ba8565b6040516001600160a01b03808516602483015283166044820152606481018290526116589085906323b872dd60e01b906084016118a5565b6001600160a01b03821661196a5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016106bd565b806002600082825461197c919061207a565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b600680546001600160a01b03191690556108df81611414565b600061173482846120ab565b6000611734828461207a565b6001600160a01b038316611a685760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016106bd565b6001600160a01b038216611aca5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016106bd565b6001600160a01b03831660009081526020819052604090205481811015611b425760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016106bd565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3611658565b6000611bfd826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611c7d9092919063ffffffff16565b9050805160001480611c1e575080806020019051810190611c1e919061223e565b6116ca5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016106bd565b6060611c8c8484600085611c94565b949350505050565b606082471015611cf55760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016106bd565b600080866001600160a01b03168587604051611d11919061225b565b60006040518083038185875af1925050503d8060008114611d4e576040519150601f19603f3d011682016040523d82523d6000602084013e611d53565b606091505b5091509150611d6487838387611d6f565b979650505050505050565b60608315611dde578251600003611dd7576001600160a01b0385163b611dd75760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016106bd565b5081611c8c565b611c8c8383815115611df35781518083602001fd5b8060405162461bcd60e51b81526004016106bd9190611e39565b60005b83811015611e28578181015183820152602001611e10565b838111156116585750506000910152565b6020815260008251806020840152611e58816040850160208701611e0d565b601f01601f19169190910160400192915050565b80356001600160a01b0381168114611e8357600080fd5b919050565b60008060408385031215611e9b57600080fd5b611ea483611e6c565b946020939093013593505050565b600060208284031215611ec457600080fd5b5035919050565b600080600060608486031215611ee057600080fd5b611ee984611e6c565b9250611ef760208501611e6c565b9150604084013590509250925092565b600060208284031215611f1957600080fd5b61173482611e6c565b80151581146108df57600080fd5b60008060408385031215611f4357600080fd5b611f4c83611e6c565b91506020830135611f5c81611f22565b809150509250929050565b60008060408385031215611f7a57600080fd5b82359150611f8a60208401611e6c565b90509250929050565b60008060008060808587031215611fa957600080fd5b611fb285611e6c565b935060208501359250604085013591506060850135611fd081611f22565b939692955090935050565b60008060408385031215611fee57600080fd5b611ff783611e6c565b9150611f8a60208401611e6c565b6000806040838503121561201857600080fd5b823591506020830135611f5c81611f22565b600181811c9082168061203e57607f821691505b60208210810361205e57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b6000821982111561208d5761208d612064565b500190565b6000602082840312156120a457600080fd5b5051919050565b6000828210156120bd576120bd612064565b500390565b6000602082840312156120d457600080fd5b815160ff8116811461173457600080fd5b600181815b8085111561212057816000190482111561210657612106612064565b8085161561211357918102915b93841c93908002906120ea565b509250929050565b60008261213757506001610601565b8161214457506000610601565b816001811461215a576002811461216457612180565b6001915050610601565b60ff84111561217557612175612064565b50506001821b610601565b5060208310610133831016604e8410600b84101617156121a3575081810a610601565b6121ad83836120e5565b80600019048211156121c1576121c1612064565b029392505050565b600061173460ff841683612128565b6020808252600b908201526a1393d517d0531313d5d15160aa1b604082015260600190565b600081600019048311821515161561221757612217612064565b500290565b60008261223957634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121561225057600080fd5b815161173481611f22565b6000825161226d818460208701611e0d565b919091019291505056fea2646970667358221220becf9323e37c80498bb954ecba8ae0bd2cbd628b3227828c10b9f8e50c5e9ce864736f6c634300080f0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000006efdbff2a14a7c8e15944d1f4a48f9f95f663a40000000000000000000000000000000000000000000000000000000000000003524c5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003524c500000000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _name (string): RLP
Arg [1] : _symbol (string): RLP
Arg [2] : _standardToken (address): 0x06eFdBFf2a14a7c8E15944D1F4A48F9F95F663A4
-----Encoded View---------------
7 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000060
Arg [1] : 00000000000000000000000000000000000000000000000000000000000000a0
Arg [2] : 00000000000000000000000006efdbff2a14a7c8e15944d1f4a48f9f95f663a4
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [4] : 524c500000000000000000000000000000000000000000000000000000000000
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [6] : 524c500000000000000000000000000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$3,980.10
Net Worth in ETH
Token Allocations
USDC
100.00%
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|---|---|---|---|---|
| SCROLL | 100.00% | $0.999606 | 3,981.6702 | $3,980.1 |
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.