Source Code
Latest 25 from a total of 5,678 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Get Reward | 408157690 | 57 days ago | IN | 0 ETH | 0.00000143 | ||||
| Get Reward | 408157553 | 57 days ago | IN | 0 ETH | 0.00000278 | ||||
| Withdraw NFT | 408156336 | 57 days ago | IN | 0 ETH | 0.00000754 | ||||
| Withdraw NFT | 408124187 | 57 days ago | IN | 0 ETH | 0.00000169 | ||||
| Get Reward | 408123949 | 57 days ago | IN | 0 ETH | 0.00000079 | ||||
| Get Reward | 408123728 | 57 days ago | IN | 0 ETH | 0.00000155 | ||||
| Withdraw Token | 407822638 | 58 days ago | IN | 0 ETH | 0.00000101 | ||||
| Get Reward | 407822489 | 58 days ago | IN | 0 ETH | 0.00000143 | ||||
| Withdraw NFT | 407479303 | 59 days ago | IN | 0 ETH | 0.00001504 | ||||
| Withdraw NFT | 407468976 | 59 days ago | IN | 0 ETH | 0.00001312 | ||||
| Deposit NFT | 407468913 | 59 days ago | IN | 0 ETH | 0.00002409 | ||||
| Withdraw NFT | 406797817 | 61 days ago | IN | 0 ETH | 0.00000242 | ||||
| Get Reward | 406797374 | 61 days ago | IN | 0 ETH | 0.00000205 | ||||
| Withdraw NFT | 406700226 | 61 days ago | IN | 0 ETH | 0.00000189 | ||||
| Get Reward | 406700092 | 61 days ago | IN | 0 ETH | 0.00000153 | ||||
| Withdraw Token | 406699316 | 61 days ago | IN | 0 ETH | 0.00000116 | ||||
| Withdraw NFT | 406698728 | 61 days ago | IN | 0 ETH | 0.00000169 | ||||
| Get Reward | 406698476 | 61 days ago | IN | 0 ETH | 0.00000161 | ||||
| Withdraw Token | 406584958 | 61 days ago | IN | 0 ETH | 0.00000098 | ||||
| Get Reward | 406584458 | 61 days ago | IN | 0 ETH | 0.00000192 | ||||
| Withdraw NFT | 406584132 | 61 days ago | IN | 0 ETH | 0.00000326 | ||||
| Get Reward | 406509403 | 61 days ago | IN | 0 ETH | 0.00000224 | ||||
| Withdraw NFT | 405235550 | 65 days ago | IN | 0 ETH | 0.0000022 | ||||
| Get Reward | 405235368 | 65 days ago | IN | 0 ETH | 0.00000155 | ||||
| Withdraw Token | 403824214 | 69 days ago | IN | 0 ETH | 0.00000105 |
Latest 25 internal transactions (View All)
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 71999050 | 1049 days ago | 0 ETH | ||||
| 71999050 | 1049 days ago | 0 ETH | ||||
| 71999050 | 1049 days ago | 0 ETH | ||||
| 71999013 | 1049 days ago | 0 ETH | ||||
| 71999013 | 1049 days ago | 0 ETH | ||||
| 71832472 | 1050 days ago | 0 ETH | ||||
| 71832472 | 1050 days ago | 0 ETH | ||||
| 71832355 | 1050 days ago | 0 ETH | ||||
| 71832355 | 1050 days ago | 0 ETH | ||||
| 71832355 | 1050 days ago | 0 ETH | ||||
| 71810168 | 1050 days ago | 0 ETH | ||||
| 71810168 | 1050 days ago | 0 ETH | ||||
| 71810168 | 1050 days ago | 0 ETH | ||||
| 71809883 | 1050 days ago | 0 ETH | ||||
| 71809883 | 1050 days ago | 0 ETH | ||||
| 71568606 | 1050 days ago | 0 ETH | ||||
| 71560940 | 1050 days ago | 0 ETH | ||||
| 71560940 | 1050 days ago | 0 ETH | ||||
| 71558465 | 1050 days ago | 0 ETH | ||||
| 71558465 | 1050 days ago | 0 ETH | ||||
| 71558465 | 1050 days ago | 0 ETH | ||||
| 71478188 | 1051 days ago | 0 ETH | ||||
| 71478188 | 1051 days ago | 0 ETH | ||||
| 71478188 | 1051 days ago | 0 ETH | ||||
| 71478188 | 1051 days ago | 0 ETH |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
XGBT
Compiler Version
v0.8.13+commit.abaa5c0e
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
interface IGBT {
function mustStayGBT(address account) external view returns (uint256);
}
contract XGBT is ReentrancyGuard {
using SafeERC20 for IERC20;
uint256 public constant DURATION = 7 days;
/* ========== STATE VARIABLES ========== */
struct Reward {
address rewardsDistributor;
uint256 periodFinish;
uint256 rewardRate;
uint256 lastUpdateTime;
uint256 rewardPerTokenStored;
}
IERC20 public immutable stakingToken;
IERC721 public immutable stakingNFT;
address public immutable factory;
mapping(address => Reward) public rewardData;
mapping(address => bool) public isRewardToken;
address[] public rewardTokens;
// user -> reward token -> amount
mapping(address => mapping(address => uint256)) public userRewardPerTokenPaid;
mapping(address => mapping(address => uint256)) public rewards;
uint256 private _totalSupply;
mapping(address => uint256) private _balances;
mapping(address => uint256) public balanceToken; // Accounts deposited GBTs
mapping(address => uint256[]) public balanceNFT; // Accounts deposited NFTs
uint256 private _totalToken;
uint256 private _totalNFT;
/* ========== CONSTRUCTOR ========== */
constructor(
address _factory,
address _stakingToken,
address _stakingNFT
) {
require(_factory != address(0), "!0");
factory = _factory;
stakingToken = IERC20(_stakingToken);
stakingNFT = IERC721(_stakingNFT);
}
function addReward(
address _rewardsToken,
address _rewardsDistributor
)
external OnlyFactory
{
require(!isRewardToken[_rewardsToken], "Reward token already exists");
rewardTokens.push(_rewardsToken);
rewardData[_rewardsToken].rewardsDistributor = _rewardsDistributor;
isRewardToken[_rewardsToken] = true;
emit RewardAdded(_rewardsToken, _rewardsDistributor);
}
/* ========== VIEWS ========== */
function balanceOfNFT(address user) external view returns (uint256 length, uint256[] memory arr) {
return (balanceNFT[user].length, balanceNFT[user]);
}
function totalSupply() external view returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) external view returns (uint256) {
return _balances[account];
}
function lastTimeRewardApplicable(address _rewardsToken) public view returns (uint256) {
return Math.min(block.timestamp, rewardData[_rewardsToken].periodFinish);
}
function rewardPerToken(address _rewardsToken) public view returns (uint256) {
if (_totalSupply == 0) {
return rewardData[_rewardsToken].rewardPerTokenStored;
}
return
rewardData[_rewardsToken].rewardPerTokenStored + ((lastTimeRewardApplicable(_rewardsToken) - rewardData[_rewardsToken].lastUpdateTime) * rewardData[_rewardsToken].rewardRate * 1e18 / _totalSupply);
}
function earned(address account, address _rewardsToken) public view returns (uint256) {
return (_balances[account] * (rewardPerToken(_rewardsToken) - userRewardPerTokenPaid[account][_rewardsToken]) / 1e18) + rewards[account][_rewardsToken];
}
function getRewardForDuration(address _rewardsToken) external view returns (uint256) {
return rewardData[_rewardsToken].rewardRate * DURATION;
}
/* ========== MUTATIVE FUNCTIONS ========== */
function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) public view returns (bytes4) {
return IERC721Receiver(address(this)).onERC721Received.selector;
}
function depositToken(uint256 amount) external nonReentrant updateReward(msg.sender) {
address account = msg.sender;
require(amount > 0, "Cannot deposit 0");
_totalToken += amount;
_totalSupply += amount;
balanceToken[account] = balanceToken[account] + amount;
_balances[account] = _balances[account] + amount;
stakingToken.safeTransferFrom(account, address(this), amount);
emit Deposited(account, amount);
}
function withdrawToken(uint256 amount) external nonReentrant updateReward(msg.sender) {
address account = msg.sender;
require(amount > 0, "Cannot withdraw 0");
require(amount <= balanceToken[account], "Insufficient balance");
_totalToken -= amount;
_totalSupply -= amount;
balanceToken[account] = balanceToken[account] - amount;
_balances[account] = _balances[account] - amount;
require(_balances[account] >= IGBT(address(stakingToken)).mustStayGBT(account), "Borrow debt");
stakingToken.safeTransfer(msg.sender, amount);
emit Withdrawn(account, amount);
}
/** @dev Stake Gumball(s) NFTs to receive rewards
* @param _id is an array of Gumballs desired for staking
*/
function depositNFT(uint256[] calldata _id) external nonReentrant updateReward(msg.sender) {
address account = msg.sender;
require(_id.length > 0, "Cannot deposit 0");
uint256 amount = _id.length * 1e18;
_totalNFT += amount;
_totalSupply += amount;
_balances[account] = _balances[account] + amount;
for (uint256 i = 0; i < _id.length; i++) {
balanceNFT[account].push(_id[i]);
IERC721(stakingNFT).transferFrom(account, address(this), _id[i]);
}
emit DepositNFT(msg.sender, address(stakingNFT), _id);
}
/** @dev Remove Gumball(s) from the contract and leave staking
* @param _id is an array of Gumballs desired for unstaking
*/
function withdrawNFT(uint256[] calldata _id) external nonReentrant updateReward(msg.sender) {
address account = msg.sender;
require(balanceNFT[account].length >= _id.length, "Withdrawal underflow");
uint256 amount = _id.length * 1e18;
for (uint256 i = 0; i < _id.length; i++) {
uint256 ind = findNFT(account, _id[i]);
_pop(account, ind);
}
_totalNFT -= amount;
_totalSupply -= amount;
_balances[account] = _balances[account] - amount;
require(_balances[account] >= IGBT(address(stakingToken)).mustStayGBT(account), "Borrow debt");
for (uint256 i = 0; i <_id.length; i++) {
IERC721(stakingNFT).transferFrom(address(this), account, _id[i]);
}
emit WithdrawNFT(msg.sender, address(stakingNFT), _id);
}
function getReward() external nonReentrant updateReward(msg.sender) {
for (uint i; i < rewardTokens.length; i++) {
address _rewardsToken = rewardTokens[i];
uint256 reward = rewards[msg.sender][_rewardsToken];
if (reward > 0) {
rewards[msg.sender][_rewardsToken] = 0;
IERC20(_rewardsToken).safeTransfer(msg.sender, reward);
emit RewardPaid(msg.sender, _rewardsToken, reward);
}
}
require(IERC20(stakingToken).balanceOf(address(this)) >= _totalToken);
}
/* ========== RESTRICTED FUNCTIONS ========== */
function notifyRewardAmount(address _rewardsToken, uint256 reward) external updateReward(address(0)) {
require(rewardData[_rewardsToken].rewardsDistributor == msg.sender);
require(reward > DURATION);
// handle the transfer of reward tokens via `transferFrom` to reduce the number
// of transactions required and ensure correctness of the reward amount
IERC20(_rewardsToken).safeTransferFrom(msg.sender, address(this), reward);
if (block.timestamp >= rewardData[_rewardsToken].periodFinish) {
rewardData[_rewardsToken].rewardRate = reward / DURATION;
} else {
uint256 remaining = rewardData[_rewardsToken].periodFinish - block.timestamp;
uint256 leftover = remaining * rewardData[_rewardsToken].rewardRate;
require(reward > leftover, "reward amount should be greater than leftover amount"); // to stop griefing attack
rewardData[_rewardsToken].rewardRate = (reward + leftover) / DURATION;
}
rewardData[_rewardsToken].lastUpdateTime = block.timestamp;
rewardData[_rewardsToken].periodFinish = block.timestamp + DURATION;
emit RewardNotified(reward);
}
function setRewardsDistributor(address _rewardsToken, address _rewardsDistributor) external OnlyFactory {
rewardData[_rewardsToken].rewardsDistributor = _rewardsDistributor;
emit DistributorSet(_rewardsToken, _rewardsDistributor);
}
/* ========== INTERNAL FUNCTIONS ========== */
/** @dev Locates gumball in an array */
function findNFT(address user, uint256 _id) internal view returns (uint256 _index) {
uint256 index;
bool found = false;
for (uint256 i = 0; i < balanceNFT[user].length; i++) {
if (balanceNFT[user][i] == _id) {
index = i;
found = true;
break;
}
}
if (!found) {
revert ("!Found");
} else {
return index;
}
}
/** @dev Removes an index from an array */
function _pop(address user, uint256 _index) internal {
uint256 tempID;
uint256 swapID;
tempID = balanceNFT[user][_index];
swapID = balanceNFT[user][balanceNFT[user].length - 1];
balanceNFT[user][_index] = swapID;
balanceNFT[user][balanceNFT[user].length - 1] = tempID;
balanceNFT[user].pop();
}
/* ========== MODIFIERS ========== */
modifier updateReward(address account) {
for (uint i; i < rewardTokens.length; i++) {
address token = rewardTokens[i];
rewardData[token].rewardPerTokenStored = rewardPerToken(token);
rewardData[token].lastUpdateTime = lastTimeRewardApplicable(token);
if (account != address(0)) {
rewards[account][token] = earned(account, token);
userRewardPerTokenPaid[account][token] = rewardData[token].rewardPerTokenStored;
}
}
_;
}
modifier OnlyFactory() {
require(msg.sender == factory, "!AUTH");
_;
}
/* ========== EVENTS ========== */
event RewardNotified(uint256 reward);
event Deposited(address indexed user, uint256 amount);
event Withdrawn(address indexed user, uint256 amount);
event DepositNFT(address indexed user, address colleciton, uint256[] id);
event WithdrawNFT(address indexed user, address collection, uint256[] id);
event RewardPaid(address indexed user, address indexed rewardsToken, uint256 reward);
event RewardAdded(address reward, address distributor);
event DistributorSet(address reward, address distributor);
}
contract XGBTFactory {
address public factory;
address public lastXGBT;
event FactorySet(address indexed _factory);
constructor() {
factory = msg.sender;
}
function setFactory(address _factory) external OnlyFactory {
factory = _factory;
emit FactorySet(_factory);
}
function createXGBT(
address _owner,
address _stakingToken,
address _stakingNFT
) external OnlyFactory returns (address) {
XGBT newXGBT = new XGBT(_owner, _stakingToken, _stakingNFT);
lastXGBT = address(newXGBT);
return lastXGBT;
}
modifier OnlyFactory() {
require(msg.sender == factory, "!AUTH");
_;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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].
*
* 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}.
*
* The default value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* 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 value {ERC20} uses, unless this function is
* 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 v4.4.1 (token/ERC20/extensions/draft-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 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.6.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 (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/draft-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;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
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));
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
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");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
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");
if (returndata.length > 0) {
// Return data is optional
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
* or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
* understand this adds an external call which potentially creates a reentrancy vulnerability.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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
* ====
*
* [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://diligence.consensys.net/posts/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.5.11/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 v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(
uint256 x,
uint256 y,
uint256 denominator
) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1);
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
// See https://cs.stackexchange.com/q/138556/92363.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
// in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(
uint256 x,
uint256 y,
uint256 denominator,
Rounding rounding
) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10**64) {
value /= 10**64;
result += 64;
}
if (value >= 10**32) {
value /= 10**32;
result += 32;
}
if (value >= 10**16) {
value /= 10**16;
result += 16;
}
if (value >= 10**8) {
value /= 10**8;
result += 8;
}
if (value >= 10**4) {
value /= 10**4;
result += 4;
}
if (value >= 10**2) {
value /= 10**2;
result += 2;
}
if (value >= 10**1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256, rounded down, of a positive value.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
}
}
}{
"optimizer": {
"enabled": true,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_factory","type":"address"},{"internalType":"address","name":"_stakingToken","type":"address"},{"internalType":"address","name":"_stakingNFT","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"address","name":"colleciton","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"id","type":"uint256[]"}],"name":"DepositNFT","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposited","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"reward","type":"address"},{"indexed":false,"internalType":"address","name":"distributor","type":"address"}],"name":"DistributorSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"reward","type":"address"},{"indexed":false,"internalType":"address","name":"distributor","type":"address"}],"name":"RewardAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"}],"name":"RewardNotified","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"rewardsToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"}],"name":"RewardPaid","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"address","name":"collection","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"id","type":"uint256[]"}],"name":"WithdrawNFT","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdrawn","type":"event"},{"inputs":[],"name":"DURATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_rewardsToken","type":"address"},{"internalType":"address","name":"_rewardsDistributor","type":"address"}],"name":"addReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"balanceNFT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"balanceOfNFT","outputs":[{"internalType":"uint256","name":"length","type":"uint256"},{"internalType":"uint256[]","name":"arr","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_id","type":"uint256[]"}],"name":"depositNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"depositToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"_rewardsToken","type":"address"}],"name":"earned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_rewardsToken","type":"address"}],"name":"getRewardForDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isRewardToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_rewardsToken","type":"address"}],"name":"lastTimeRewardApplicable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_rewardsToken","type":"address"},{"internalType":"uint256","name":"reward","type":"uint256"}],"name":"notifyRewardAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewardData","outputs":[{"internalType":"address","name":"rewardsDistributor","type":"address"},{"internalType":"uint256","name":"periodFinish","type":"uint256"},{"internalType":"uint256","name":"rewardRate","type":"uint256"},{"internalType":"uint256","name":"lastUpdateTime","type":"uint256"},{"internalType":"uint256","name":"rewardPerTokenStored","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_rewardsToken","type":"address"}],"name":"rewardPerToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"rewardTokens","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"rewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_rewardsToken","type":"address"},{"internalType":"address","name":"_rewardsDistributor","type":"address"}],"name":"setRewardsDistributor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakingNFT","outputs":[{"internalType":"contract IERC721","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakingToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"userRewardPerTokenPaid","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_id","type":"uint256[]"}],"name":"withdrawNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawToken","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60e06040523480156200001157600080fd5b50604051620027e9380380620027e98339810160408190526200003491620000b4565b60016000556001600160a01b038316620000795760405162461bcd60e51b8152602060048201526002602482015261021360f41b604482015260640160405180910390fd5b6001600160a01b0392831660c0529082166080521660a052620000fe565b80516001600160a01b0381168114620000af57600080fd5b919050565b600080600060608486031215620000ca57600080fd5b620000d58462000097565b9250620000e56020850162000097565b9150620000f56040850162000097565b90509250925092565b60805160a05160c05161266e6200017b6000396000818161048501528181610b910152610c5d0152600081816101fb0152818161072b0152818161081c015281816110df01526111d00152600081816103df01528181610afb015281816110120152818161145c01528181611529015261178c015261266e6000f3fe608060405234801561001057600080fd5b50600436106101a95760003560e01c80636215be77116100f9578063b66503cf11610097578063c45a015511610071578063c45a015514610480578063e70b9e27146104a7578063f1229777146104d2578063f5b100ea146104e557600080fd5b8063b66503cf14610447578063b8d3fc411461045a578063bcd110141461046d57600080fd5b806370a08231116100d357806370a08231146103b157806372f702f3146103da5780637bb7bed114610401578063b5fd73f81461041457600080fd5b80636215be7714610360578063638634ee146103735780637035ab981461038657600080fd5b8063211dc32d1161016657806340b47e1a1161014057806340b47e1a146102ad57806348e5d9f8146102c05780634b0b3dc71461033a57806350baa6221461034d57600080fd5b8063211dc32d1461027f5780633d18b912146102925780633f695b451461029a57600080fd5b806304599012146101ae5780630a72298e146101e15780630ce71e32146101f6578063150b7a021461023557806318160ddd1461026d5780631be0528914610275575b600080fd5b6101ce6101bc366004612274565b60086020526000908152604090205481565b6040519081526020015b60405180910390f35b6101f46101ef36600461228f565b610506565b005b61021d7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016101d8565b610254610243366004612304565b630a85bd0160e11b95945050505050565b6040516001600160e01b031990911681526020016101d8565b6006546101ce565b6101ce62093a8081565b6101ce61028d36600461239f565b610865565b6101f46108ff565b6101f46102a836600461239f565b610b86565b6101f46102bb36600461239f565b610c52565b6103086102ce366004612274565b6001602081905260009182526040909120805491810154600282015460038301546004909301546001600160a01b03909416939192909185565b604080516001600160a01b0390961686526020860194909452928401919091526060830152608082015260a0016101d8565b6101f461034836600461228f565b610dcc565b6101f461035b3660046123d2565b611200565b6101f461036e3660046123d2565b6115a2565b6101ce610381366004612274565b6117ef565b6101ce61039436600461239f565b600460209081526000928352604080842090915290825290205481565b6101ce6103bf366004612274565b6001600160a01b031660009081526007602052604090205490565b61021d7f000000000000000000000000000000000000000000000000000000000000000081565b61021d61040f3660046123d2565b611816565b610437610422366004612274565b60026020526000908152604090205460ff1681565b60405190151581526020016101d8565b6101f46104553660046123eb565b611840565b6101ce6104683660046123eb565b611b51565b6101ce61047b366004612274565b611b82565b61021d7f000000000000000000000000000000000000000000000000000000000000000081565b6101ce6104b536600461239f565b600560209081526000928352604080842090915290825290205481565b6101ce6104e0366004612274565b611bac565b6104f86104f3366004612274565b611c5c565b6040516101d8929190612415565b61050e611cd1565b3360005b6003548110156106075760006003828154811061053157610531612463565b6000918252602090912001546001600160a01b0316905061055181611bac565b6001600160a01b038216600090815260016020526040902060040155610576816117ef565b6001600160a01b038083166000908152600160205260409020600301919091558316156105f4576105a78382610865565b6001600160a01b0380851660008181526005602090815260408083209487168084529482528083209590955560018152848220600490810154938352815284822093825292909252919020555b50806105ff8161248f565b915050610512565b50338261064e5760405162461bcd60e51b815260206004820152601060248201526f043616e6e6f74206465706f73697420360841b60448201526064015b60405180910390fd5b600061066284670de0b6b3a76400006124a8565b905080600b600082825461067691906124c7565b92505081905550806006600082825461068f91906124c7565b90915550506001600160a01b0382166000908152600760205260409020546106b89082906124c7565b6001600160a01b0383166000908152600760205260408120919091555b848110156107ee576001600160a01b038316600090815260096020526040902086868381811061070757610707612463565b835460018101855560009485526020948590209190940292909201359190920155507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166323b872dd843089898681811061076c5761076c612463565b6040516001600160e01b031960e088901b1681526001600160a01b03958616600482015294909316602485015250602090910201356044820152606401600060405180830381600087803b1580156107c357600080fd5b505af11580156107d7573d6000803e3d6000fd5b5050505080806107e69061248f565b9150506106d5565b50336001600160a01b03167f66f123bb12c448858abe67013777a572dff5781ec2aab8cae00b90f1212e5dfd7f0000000000000000000000000000000000000000000000000000000000000000878760405161084c939291906124df565b60405180910390a25050506108616001600055565b5050565b6001600160a01b038083166000818152600560209081526040808320948616808452948252808320549383526004825280832094835293905291822054670de0b6b3a7640000906108b585611bac565b6108bf919061252c565b6001600160a01b0386166000908152600760205260409020546108e291906124a8565b6108ec9190612543565b6108f691906124c7565b90505b92915050565b610907611cd1565b3360005b600354811015610a005760006003828154811061092a5761092a612463565b6000918252602090912001546001600160a01b0316905061094a81611bac565b6001600160a01b03821660009081526001602052604090206004015561096f816117ef565b6001600160a01b038083166000908152600160205260409020600301919091558316156109ed576109a08382610865565b6001600160a01b0380851660008181526005602090815260408083209487168084529482528083209590955560018152848220600490810154938352815284822093825292909252919020555b50806109f88161248f565b91505061090b565b5060005b600354811015610ae257600060038281548110610a2357610a23612463565b60009182526020808320909101543383526005825260408084206001600160a01b03909216808552919092529120549091508015610acd573360008181526005602090815260408083206001600160a01b0387168085529252822091909155610a8c9183611d2a565b6040518181526001600160a01b0383169033907f540798df468d7b23d11f156fdb954cb19ad414d150722a7b6d55ba369dea792e9060200160405180910390a35b50508080610ada9061248f565b915050610a04565b50600a546040516370a0823160e01b81523060048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015610b4a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6e9190612565565b1015610b7957600080fd5b50610b846001600055565b565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610be65760405162461bcd60e51b815260206004820152600560248201526404282aaa8960db1b6044820152606401610645565b6001600160a01b0382811660008181526001602090815260409182902080546001600160a01b031916948616948517905581519283528201929092527f8c6eabd1db7fe5a1951a7c78767c0e3633c5352578d15d45f99aa4c4db01c55a91015b60405180910390a15050565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610cb25760405162461bcd60e51b815260206004820152600560248201526404282aaa8960db1b6044820152606401610645565b6001600160a01b03821660009081526002602052604090205460ff1615610d1b5760405162461bcd60e51b815260206004820152601b60248201527f52657761726420746f6b656e20616c72656164792065786973747300000000006044820152606401610645565b6003805460018082019092557fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180546001600160a01b038581166001600160a01b0319928316811790935560008381526020858152604080832080549489169490951684179094556002815290839020805460ff19169095179094558151928352928201929092527f766c9ea233f83f351d6be4cb95362682949d7699abd8698799beae0db83ad96e9101610c46565b610dd4611cd1565b3360005b600354811015610ecd57600060038281548110610df757610df7612463565b6000918252602090912001546001600160a01b03169050610e1781611bac565b6001600160a01b038216600090815260016020526040902060040155610e3c816117ef565b6001600160a01b03808316600090815260016020526040902060030191909155831615610eba57610e6d8382610865565b6001600160a01b0380851660008181526005602090815260408083209487168084529482528083209590955560018152848220600490810154938352815284822093825292909252919020555b5080610ec58161248f565b915050610dd8565b5033600081815260096020526040902054831115610f245760405162461bcd60e51b81526020600482015260146024820152735769746864726177616c20756e646572666c6f7760601b6044820152606401610645565b6000610f3884670de0b6b3a76400006124a8565b905060005b84811015610f88576000610f6984888885818110610f5d57610f5d612463565b90506020020135611d92565b9050610f758482611e53565b5080610f808161248f565b915050610f3d565b5080600b6000828254610f9b919061252c565b925050819055508060066000828254610fb4919061252c565b90915550506001600160a01b038216600090815260076020526040902054610fdd90829061252c565b6001600160a01b038381166000818152600760205260409081902093909355915163ce98fd6760e01b815260048101929092527f0000000000000000000000000000000000000000000000000000000000000000169063ce98fd6790602401602060405180830381865afa158015611059573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061107d9190612565565b6001600160a01b03831660009081526007602052604090205410156110d25760405162461bcd60e51b815260206004820152600b60248201526a109bdc9c9bddc81919589d60aa1b6044820152606401610645565b60005b848110156111a2577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166323b872dd308589898681811061112057611120612463565b6040516001600160e01b031960e088901b1681526001600160a01b03958616600482015294909316602485015250602090910201356044820152606401600060405180830381600087803b15801561117757600080fd5b505af115801561118b573d6000803e3d6000fd5b50505050808061119a9061248f565b9150506110d5565b50336001600160a01b03167f18e9b1b89c8ef058568b1f6c17ae88e5ccb891480d0a58fe7b7775ed42fcf4547f0000000000000000000000000000000000000000000000000000000000000000878760405161084c939291906124df565b611208611cd1565b3360005b6003548110156113015760006003828154811061122b5761122b612463565b6000918252602090912001546001600160a01b0316905061124b81611bac565b6001600160a01b038216600090815260016020526040902060040155611270816117ef565b6001600160a01b038083166000908152600160205260409020600301919091558316156112ee576112a18382610865565b6001600160a01b0380851660008181526005602090815260408083209487168084529482528083209590955560018152848220600490810154938352815284822093825292909252919020555b50806112f98161248f565b91505061120c565b5033826113445760405162461bcd60e51b8152602060048201526011602482015270043616e6e6f74207769746864726177203607c1b6044820152606401610645565b6001600160a01b0381166000908152600860205260409020548311156113a35760405162461bcd60e51b8152602060048201526014602482015273496e73756666696369656e742062616c616e636560601b6044820152606401610645565b82600a60008282546113b5919061252c565b9250508190555082600660008282546113ce919061252c565b90915550506001600160a01b0381166000908152600860205260409020546113f790849061252c565b6001600160a01b03821660009081526008602090815260408083209390935560079052205461142790849061252c565b6001600160a01b038281166000818152600760205260409081902093909355915163ce98fd6760e01b815260048101929092527f0000000000000000000000000000000000000000000000000000000000000000169063ce98fd6790602401602060405180830381865afa1580156114a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114c79190612565565b6001600160a01b038216600090815260076020526040902054101561151c5760405162461bcd60e51b815260206004820152600b60248201526a109bdc9c9bddc81919589d60aa1b6044820152606401610645565b6115506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163385611d2a565b806001600160a01b03167f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d58460405161158b91815260200190565b60405180910390a2505061159f6001600055565b50565b6115aa611cd1565b3360005b6003548110156116a3576000600382815481106115cd576115cd612463565b6000918252602090912001546001600160a01b031690506115ed81611bac565b6001600160a01b038216600090815260016020526040902060040155611612816117ef565b6001600160a01b03808316600090815260016020526040902060030191909155831615611690576116438382610865565b6001600160a01b0380851660008181526005602090815260408083209487168084529482528083209590955560018152848220600490810154938352815284822093825292909252919020555b508061169b8161248f565b9150506115ae565b5033826116e55760405162461bcd60e51b815260206004820152601060248201526f043616e6e6f74206465706f73697420360841b6044820152606401610645565b82600a60008282546116f791906124c7565b92505081905550826006600082825461171091906124c7565b90915550506001600160a01b0381166000908152600860205260409020546117399084906124c7565b6001600160a01b0382166000908152600860209081526040808320939093556007905220546117699084906124c7565b6001600160a01b038083166000908152600760205260409020919091556117b4907f000000000000000000000000000000000000000000000000000000000000000016823086611fa2565b806001600160a01b03167f2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c48460405161158b91815260200190565b6001600160a01b0381166000908152600160208190526040822001546108f9904290611fe0565b6003818154811061182657600080fd5b6000918252602090912001546001600160a01b0316905081565b6000805b6003548110156119395760006003828154811061186357611863612463565b6000918252602090912001546001600160a01b0316905061188381611bac565b6001600160a01b0382166000908152600160205260409020600401556118a8816117ef565b6001600160a01b03808316600090815260016020526040902060030191909155831615611926576118d98382610865565b6001600160a01b0380851660008181526005602090815260408083209487168084529482528083209590955560018152848220600490810154938352815284822093825292909252919020555b50806119318161248f565b915050611844565b506001600160a01b0383811660009081526001602052604090205416331461196057600080fd5b62093a80821161196f57600080fd5b6119846001600160a01b038416333085611fa2565b6001600160a01b0383166000908152600160208190526040909120015442106119d5576119b462093a8083612543565b6001600160a01b038416600090815260016020526040902060020155611acb565b6001600160a01b0383166000908152600160208190526040822001546119fc90429061252c565b6001600160a01b03851660009081526001602052604081206002015491925090611a2690836124a8565b9050808411611a945760405162461bcd60e51b815260206004820152603460248201527f72657761726420616d6f756e742073686f756c642062652067726561746572206044820152731d1a185b881b19599d1bdd995c88185b5bdd5b9d60621b6064820152608401610645565b62093a80611aa282866124c7565b611aac9190612543565b6001600160a01b03861660009081526001602052604090206002015550505b6001600160a01b0383166000908152600160205260409020426003909101819055611afa9062093a80906124c7565b6001600160a01b03841660009081526001602081815260409283902090910192909255518381527ff9a5da3a173eca8cd77c02ece3ff1467b8aa461ed3822201817f2d72fbc54283910160405180910390a1505050565b60096020528160005260406000208181548110611b6d57600080fd5b90600052602060002001600091509150505481565b6001600160a01b0381166000908152600160205260408120600201546108f99062093a80906124a8565b6000600654600003611bd757506001600160a01b031660009081526001602052604090206004015490565b6006546001600160a01b03831660009081526001602052604090206002810154600390910154611c06856117ef565b611c10919061252c565b611c1a91906124a8565b611c2c90670de0b6b3a76400006124a8565b611c369190612543565b6001600160a01b0383166000908152600160205260409020600401546108f991906124c7565b6001600160a01b0381166000908152600960209081526040808320805482518185028101850190935280835260609390929082908490830182828015611cc157602002820191906000526020600020905b815481526020019060010190808311611cad575b5050505050905091509150915091565b600260005403611d235760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610645565b6002600055565b6040516001600160a01b038316602482015260448101829052611d8d90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611ff6565b505050565b6000806000805b6001600160a01b038616600090815260096020526040902054811015611e14576001600160a01b0386166000908152600960205260409020805486919083908110611de657611de6612463565b906000526020600020015403611e025780925060019150611e14565b80611e0c8161248f565b915050611d99565b5080611e4b5760405162461bcd60e51b815260206004820152600660248201526508519bdd5b9960d21b6044820152606401610645565b5090506108f9565b6001600160a01b0382166000908152600960205260408120805482919084908110611e8057611e80612463565b60009182526020808320909101546001600160a01b038716835260099091526040909120805491935090611eb69060019061252c565b81548110611ec657611ec6612463565b906000526020600020015490508060096000866001600160a01b03166001600160a01b031681526020019081526020016000208481548110611f0a57611f0a612463565b60009182526020808320909101929092556001600160a01b03861681526009909152604090208054839190611f419060019061252c565b81548110611f5157611f51612463565b60009182526020808320909101929092556001600160a01b0386168152600990915260409020805480611f8657611f8661257e565b6001900381819060005260206000200160009055905550505050565b6040516001600160a01b0380851660248301528316604482015260648101829052611fda9085906323b872dd60e01b90608401611d56565b50505050565b6000818310611fef57816108f6565b5090919050565b600061204b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166120c89092919063ffffffff16565b805190915015611d8d57808060200190518101906120699190612594565b611d8d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610645565b60606120d784846000856120df565b949350505050565b6060824710156121405760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610645565b600080866001600160a01b0316858760405161215c91906125e9565b60006040518083038185875af1925050503d8060008114612199576040519150601f19603f3d011682016040523d82523d6000602084013e61219e565b606091505b50915091506121af878383876121ba565b979650505050505050565b60608315612229578251600003612222576001600160a01b0385163b6122225760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610645565b50816120d7565b6120d7838381511561223e5781518083602001fd5b8060405162461bcd60e51b81526004016106459190612605565b80356001600160a01b038116811461226f57600080fd5b919050565b60006020828403121561228657600080fd5b6108f682612258565b600080602083850312156122a257600080fd5b823567ffffffffffffffff808211156122ba57600080fd5b818501915085601f8301126122ce57600080fd5b8135818111156122dd57600080fd5b8660208260051b85010111156122f257600080fd5b60209290920196919550909350505050565b60008060008060006080868803121561231c57600080fd5b61232586612258565b945061233360208701612258565b935060408601359250606086013567ffffffffffffffff8082111561235757600080fd5b818801915088601f83011261236b57600080fd5b81358181111561237a57600080fd5b89602082850101111561238c57600080fd5b9699959850939650602001949392505050565b600080604083850312156123b257600080fd5b6123bb83612258565b91506123c960208401612258565b90509250929050565b6000602082840312156123e457600080fd5b5035919050565b600080604083850312156123fe57600080fd5b61240783612258565b946020939093013593505050565b6000604082018483526020604081850152818551808452606086019150828701935060005b818110156124565784518352938301939183019160010161243a565b5090979650505050505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016124a1576124a1612479565b5060010190565b60008160001904831182151516156124c2576124c2612479565b500290565b600082198211156124da576124da612479565b500190565b6001600160a01b0384168152604060208201819052810182905260006001600160fb1b0383111561250f57600080fd5b8260051b8085606085013760009201606001918252509392505050565b60008282101561253e5761253e612479565b500390565b60008261256057634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121561257757600080fd5b5051919050565b634e487b7160e01b600052603160045260246000fd5b6000602082840312156125a657600080fd5b815180151581146125b657600080fd5b9392505050565b60005b838110156125d85781810151838201526020016125c0565b83811115611fda5750506000910152565b600082516125fb8184602087016125bd565b9190910192915050565b60208152600082518060208401526126248160408501602087016125bd565b601f01601f1916919091016040019291505056fea2646970667358221220597e11f30293f20be91b2bda3a6218e1dc88b6f0a74dde9094500a8517088ec664736f6c634300080d0033000000000000000000000000f5cfbaf55036264b902d9ae55a114d9a22c42750000000000000000000000000fb1f65955e168e0ef500b170eed4a4efeb99ae320000000000000000000000006a0959cd80fc9e2c1be958df1f8207c5b03f2a84
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101a95760003560e01c80636215be77116100f9578063b66503cf11610097578063c45a015511610071578063c45a015514610480578063e70b9e27146104a7578063f1229777146104d2578063f5b100ea146104e557600080fd5b8063b66503cf14610447578063b8d3fc411461045a578063bcd110141461046d57600080fd5b806370a08231116100d357806370a08231146103b157806372f702f3146103da5780637bb7bed114610401578063b5fd73f81461041457600080fd5b80636215be7714610360578063638634ee146103735780637035ab981461038657600080fd5b8063211dc32d1161016657806340b47e1a1161014057806340b47e1a146102ad57806348e5d9f8146102c05780634b0b3dc71461033a57806350baa6221461034d57600080fd5b8063211dc32d1461027f5780633d18b912146102925780633f695b451461029a57600080fd5b806304599012146101ae5780630a72298e146101e15780630ce71e32146101f6578063150b7a021461023557806318160ddd1461026d5780631be0528914610275575b600080fd5b6101ce6101bc366004612274565b60086020526000908152604090205481565b6040519081526020015b60405180910390f35b6101f46101ef36600461228f565b610506565b005b61021d7f0000000000000000000000006a0959cd80fc9e2c1be958df1f8207c5b03f2a8481565b6040516001600160a01b0390911681526020016101d8565b610254610243366004612304565b630a85bd0160e11b95945050505050565b6040516001600160e01b031990911681526020016101d8565b6006546101ce565b6101ce62093a8081565b6101ce61028d36600461239f565b610865565b6101f46108ff565b6101f46102a836600461239f565b610b86565b6101f46102bb36600461239f565b610c52565b6103086102ce366004612274565b6001602081905260009182526040909120805491810154600282015460038301546004909301546001600160a01b03909416939192909185565b604080516001600160a01b0390961686526020860194909452928401919091526060830152608082015260a0016101d8565b6101f461034836600461228f565b610dcc565b6101f461035b3660046123d2565b611200565b6101f461036e3660046123d2565b6115a2565b6101ce610381366004612274565b6117ef565b6101ce61039436600461239f565b600460209081526000928352604080842090915290825290205481565b6101ce6103bf366004612274565b6001600160a01b031660009081526007602052604090205490565b61021d7f000000000000000000000000fb1f65955e168e0ef500b170eed4a4efeb99ae3281565b61021d61040f3660046123d2565b611816565b610437610422366004612274565b60026020526000908152604090205460ff1681565b60405190151581526020016101d8565b6101f46104553660046123eb565b611840565b6101ce6104683660046123eb565b611b51565b6101ce61047b366004612274565b611b82565b61021d7f000000000000000000000000f5cfbaf55036264b902d9ae55a114d9a22c4275081565b6101ce6104b536600461239f565b600560209081526000928352604080842090915290825290205481565b6101ce6104e0366004612274565b611bac565b6104f86104f3366004612274565b611c5c565b6040516101d8929190612415565b61050e611cd1565b3360005b6003548110156106075760006003828154811061053157610531612463565b6000918252602090912001546001600160a01b0316905061055181611bac565b6001600160a01b038216600090815260016020526040902060040155610576816117ef565b6001600160a01b038083166000908152600160205260409020600301919091558316156105f4576105a78382610865565b6001600160a01b0380851660008181526005602090815260408083209487168084529482528083209590955560018152848220600490810154938352815284822093825292909252919020555b50806105ff8161248f565b915050610512565b50338261064e5760405162461bcd60e51b815260206004820152601060248201526f043616e6e6f74206465706f73697420360841b60448201526064015b60405180910390fd5b600061066284670de0b6b3a76400006124a8565b905080600b600082825461067691906124c7565b92505081905550806006600082825461068f91906124c7565b90915550506001600160a01b0382166000908152600760205260409020546106b89082906124c7565b6001600160a01b0383166000908152600760205260408120919091555b848110156107ee576001600160a01b038316600090815260096020526040902086868381811061070757610707612463565b835460018101855560009485526020948590209190940292909201359190920155507f0000000000000000000000006a0959cd80fc9e2c1be958df1f8207c5b03f2a846001600160a01b03166323b872dd843089898681811061076c5761076c612463565b6040516001600160e01b031960e088901b1681526001600160a01b03958616600482015294909316602485015250602090910201356044820152606401600060405180830381600087803b1580156107c357600080fd5b505af11580156107d7573d6000803e3d6000fd5b5050505080806107e69061248f565b9150506106d5565b50336001600160a01b03167f66f123bb12c448858abe67013777a572dff5781ec2aab8cae00b90f1212e5dfd7f0000000000000000000000006a0959cd80fc9e2c1be958df1f8207c5b03f2a84878760405161084c939291906124df565b60405180910390a25050506108616001600055565b5050565b6001600160a01b038083166000818152600560209081526040808320948616808452948252808320549383526004825280832094835293905291822054670de0b6b3a7640000906108b585611bac565b6108bf919061252c565b6001600160a01b0386166000908152600760205260409020546108e291906124a8565b6108ec9190612543565b6108f691906124c7565b90505b92915050565b610907611cd1565b3360005b600354811015610a005760006003828154811061092a5761092a612463565b6000918252602090912001546001600160a01b0316905061094a81611bac565b6001600160a01b03821660009081526001602052604090206004015561096f816117ef565b6001600160a01b038083166000908152600160205260409020600301919091558316156109ed576109a08382610865565b6001600160a01b0380851660008181526005602090815260408083209487168084529482528083209590955560018152848220600490810154938352815284822093825292909252919020555b50806109f88161248f565b91505061090b565b5060005b600354811015610ae257600060038281548110610a2357610a23612463565b60009182526020808320909101543383526005825260408084206001600160a01b03909216808552919092529120549091508015610acd573360008181526005602090815260408083206001600160a01b0387168085529252822091909155610a8c9183611d2a565b6040518181526001600160a01b0383169033907f540798df468d7b23d11f156fdb954cb19ad414d150722a7b6d55ba369dea792e9060200160405180910390a35b50508080610ada9061248f565b915050610a04565b50600a546040516370a0823160e01b81523060048201527f000000000000000000000000fb1f65955e168e0ef500b170eed4a4efeb99ae326001600160a01b0316906370a0823190602401602060405180830381865afa158015610b4a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6e9190612565565b1015610b7957600080fd5b50610b846001600055565b565b336001600160a01b037f000000000000000000000000f5cfbaf55036264b902d9ae55a114d9a22c427501614610be65760405162461bcd60e51b815260206004820152600560248201526404282aaa8960db1b6044820152606401610645565b6001600160a01b0382811660008181526001602090815260409182902080546001600160a01b031916948616948517905581519283528201929092527f8c6eabd1db7fe5a1951a7c78767c0e3633c5352578d15d45f99aa4c4db01c55a91015b60405180910390a15050565b336001600160a01b037f000000000000000000000000f5cfbaf55036264b902d9ae55a114d9a22c427501614610cb25760405162461bcd60e51b815260206004820152600560248201526404282aaa8960db1b6044820152606401610645565b6001600160a01b03821660009081526002602052604090205460ff1615610d1b5760405162461bcd60e51b815260206004820152601b60248201527f52657761726420746f6b656e20616c72656164792065786973747300000000006044820152606401610645565b6003805460018082019092557fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180546001600160a01b038581166001600160a01b0319928316811790935560008381526020858152604080832080549489169490951684179094556002815290839020805460ff19169095179094558151928352928201929092527f766c9ea233f83f351d6be4cb95362682949d7699abd8698799beae0db83ad96e9101610c46565b610dd4611cd1565b3360005b600354811015610ecd57600060038281548110610df757610df7612463565b6000918252602090912001546001600160a01b03169050610e1781611bac565b6001600160a01b038216600090815260016020526040902060040155610e3c816117ef565b6001600160a01b03808316600090815260016020526040902060030191909155831615610eba57610e6d8382610865565b6001600160a01b0380851660008181526005602090815260408083209487168084529482528083209590955560018152848220600490810154938352815284822093825292909252919020555b5080610ec58161248f565b915050610dd8565b5033600081815260096020526040902054831115610f245760405162461bcd60e51b81526020600482015260146024820152735769746864726177616c20756e646572666c6f7760601b6044820152606401610645565b6000610f3884670de0b6b3a76400006124a8565b905060005b84811015610f88576000610f6984888885818110610f5d57610f5d612463565b90506020020135611d92565b9050610f758482611e53565b5080610f808161248f565b915050610f3d565b5080600b6000828254610f9b919061252c565b925050819055508060066000828254610fb4919061252c565b90915550506001600160a01b038216600090815260076020526040902054610fdd90829061252c565b6001600160a01b038381166000818152600760205260409081902093909355915163ce98fd6760e01b815260048101929092527f000000000000000000000000fb1f65955e168e0ef500b170eed4a4efeb99ae32169063ce98fd6790602401602060405180830381865afa158015611059573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061107d9190612565565b6001600160a01b03831660009081526007602052604090205410156110d25760405162461bcd60e51b815260206004820152600b60248201526a109bdc9c9bddc81919589d60aa1b6044820152606401610645565b60005b848110156111a2577f0000000000000000000000006a0959cd80fc9e2c1be958df1f8207c5b03f2a846001600160a01b03166323b872dd308589898681811061112057611120612463565b6040516001600160e01b031960e088901b1681526001600160a01b03958616600482015294909316602485015250602090910201356044820152606401600060405180830381600087803b15801561117757600080fd5b505af115801561118b573d6000803e3d6000fd5b50505050808061119a9061248f565b9150506110d5565b50336001600160a01b03167f18e9b1b89c8ef058568b1f6c17ae88e5ccb891480d0a58fe7b7775ed42fcf4547f0000000000000000000000006a0959cd80fc9e2c1be958df1f8207c5b03f2a84878760405161084c939291906124df565b611208611cd1565b3360005b6003548110156113015760006003828154811061122b5761122b612463565b6000918252602090912001546001600160a01b0316905061124b81611bac565b6001600160a01b038216600090815260016020526040902060040155611270816117ef565b6001600160a01b038083166000908152600160205260409020600301919091558316156112ee576112a18382610865565b6001600160a01b0380851660008181526005602090815260408083209487168084529482528083209590955560018152848220600490810154938352815284822093825292909252919020555b50806112f98161248f565b91505061120c565b5033826113445760405162461bcd60e51b8152602060048201526011602482015270043616e6e6f74207769746864726177203607c1b6044820152606401610645565b6001600160a01b0381166000908152600860205260409020548311156113a35760405162461bcd60e51b8152602060048201526014602482015273496e73756666696369656e742062616c616e636560601b6044820152606401610645565b82600a60008282546113b5919061252c565b9250508190555082600660008282546113ce919061252c565b90915550506001600160a01b0381166000908152600860205260409020546113f790849061252c565b6001600160a01b03821660009081526008602090815260408083209390935560079052205461142790849061252c565b6001600160a01b038281166000818152600760205260409081902093909355915163ce98fd6760e01b815260048101929092527f000000000000000000000000fb1f65955e168e0ef500b170eed4a4efeb99ae32169063ce98fd6790602401602060405180830381865afa1580156114a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114c79190612565565b6001600160a01b038216600090815260076020526040902054101561151c5760405162461bcd60e51b815260206004820152600b60248201526a109bdc9c9bddc81919589d60aa1b6044820152606401610645565b6115506001600160a01b037f000000000000000000000000fb1f65955e168e0ef500b170eed4a4efeb99ae32163385611d2a565b806001600160a01b03167f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d58460405161158b91815260200190565b60405180910390a2505061159f6001600055565b50565b6115aa611cd1565b3360005b6003548110156116a3576000600382815481106115cd576115cd612463565b6000918252602090912001546001600160a01b031690506115ed81611bac565b6001600160a01b038216600090815260016020526040902060040155611612816117ef565b6001600160a01b03808316600090815260016020526040902060030191909155831615611690576116438382610865565b6001600160a01b0380851660008181526005602090815260408083209487168084529482528083209590955560018152848220600490810154938352815284822093825292909252919020555b508061169b8161248f565b9150506115ae565b5033826116e55760405162461bcd60e51b815260206004820152601060248201526f043616e6e6f74206465706f73697420360841b6044820152606401610645565b82600a60008282546116f791906124c7565b92505081905550826006600082825461171091906124c7565b90915550506001600160a01b0381166000908152600860205260409020546117399084906124c7565b6001600160a01b0382166000908152600860209081526040808320939093556007905220546117699084906124c7565b6001600160a01b038083166000908152600760205260409020919091556117b4907f000000000000000000000000fb1f65955e168e0ef500b170eed4a4efeb99ae3216823086611fa2565b806001600160a01b03167f2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c48460405161158b91815260200190565b6001600160a01b0381166000908152600160208190526040822001546108f9904290611fe0565b6003818154811061182657600080fd5b6000918252602090912001546001600160a01b0316905081565b6000805b6003548110156119395760006003828154811061186357611863612463565b6000918252602090912001546001600160a01b0316905061188381611bac565b6001600160a01b0382166000908152600160205260409020600401556118a8816117ef565b6001600160a01b03808316600090815260016020526040902060030191909155831615611926576118d98382610865565b6001600160a01b0380851660008181526005602090815260408083209487168084529482528083209590955560018152848220600490810154938352815284822093825292909252919020555b50806119318161248f565b915050611844565b506001600160a01b0383811660009081526001602052604090205416331461196057600080fd5b62093a80821161196f57600080fd5b6119846001600160a01b038416333085611fa2565b6001600160a01b0383166000908152600160208190526040909120015442106119d5576119b462093a8083612543565b6001600160a01b038416600090815260016020526040902060020155611acb565b6001600160a01b0383166000908152600160208190526040822001546119fc90429061252c565b6001600160a01b03851660009081526001602052604081206002015491925090611a2690836124a8565b9050808411611a945760405162461bcd60e51b815260206004820152603460248201527f72657761726420616d6f756e742073686f756c642062652067726561746572206044820152731d1a185b881b19599d1bdd995c88185b5bdd5b9d60621b6064820152608401610645565b62093a80611aa282866124c7565b611aac9190612543565b6001600160a01b03861660009081526001602052604090206002015550505b6001600160a01b0383166000908152600160205260409020426003909101819055611afa9062093a80906124c7565b6001600160a01b03841660009081526001602081815260409283902090910192909255518381527ff9a5da3a173eca8cd77c02ece3ff1467b8aa461ed3822201817f2d72fbc54283910160405180910390a1505050565b60096020528160005260406000208181548110611b6d57600080fd5b90600052602060002001600091509150505481565b6001600160a01b0381166000908152600160205260408120600201546108f99062093a80906124a8565b6000600654600003611bd757506001600160a01b031660009081526001602052604090206004015490565b6006546001600160a01b03831660009081526001602052604090206002810154600390910154611c06856117ef565b611c10919061252c565b611c1a91906124a8565b611c2c90670de0b6b3a76400006124a8565b611c369190612543565b6001600160a01b0383166000908152600160205260409020600401546108f991906124c7565b6001600160a01b0381166000908152600960209081526040808320805482518185028101850190935280835260609390929082908490830182828015611cc157602002820191906000526020600020905b815481526020019060010190808311611cad575b5050505050905091509150915091565b600260005403611d235760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610645565b6002600055565b6040516001600160a01b038316602482015260448101829052611d8d90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611ff6565b505050565b6000806000805b6001600160a01b038616600090815260096020526040902054811015611e14576001600160a01b0386166000908152600960205260409020805486919083908110611de657611de6612463565b906000526020600020015403611e025780925060019150611e14565b80611e0c8161248f565b915050611d99565b5080611e4b5760405162461bcd60e51b815260206004820152600660248201526508519bdd5b9960d21b6044820152606401610645565b5090506108f9565b6001600160a01b0382166000908152600960205260408120805482919084908110611e8057611e80612463565b60009182526020808320909101546001600160a01b038716835260099091526040909120805491935090611eb69060019061252c565b81548110611ec657611ec6612463565b906000526020600020015490508060096000866001600160a01b03166001600160a01b031681526020019081526020016000208481548110611f0a57611f0a612463565b60009182526020808320909101929092556001600160a01b03861681526009909152604090208054839190611f419060019061252c565b81548110611f5157611f51612463565b60009182526020808320909101929092556001600160a01b0386168152600990915260409020805480611f8657611f8661257e565b6001900381819060005260206000200160009055905550505050565b6040516001600160a01b0380851660248301528316604482015260648101829052611fda9085906323b872dd60e01b90608401611d56565b50505050565b6000818310611fef57816108f6565b5090919050565b600061204b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166120c89092919063ffffffff16565b805190915015611d8d57808060200190518101906120699190612594565b611d8d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610645565b60606120d784846000856120df565b949350505050565b6060824710156121405760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610645565b600080866001600160a01b0316858760405161215c91906125e9565b60006040518083038185875af1925050503d8060008114612199576040519150601f19603f3d011682016040523d82523d6000602084013e61219e565b606091505b50915091506121af878383876121ba565b979650505050505050565b60608315612229578251600003612222576001600160a01b0385163b6122225760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610645565b50816120d7565b6120d7838381511561223e5781518083602001fd5b8060405162461bcd60e51b81526004016106459190612605565b80356001600160a01b038116811461226f57600080fd5b919050565b60006020828403121561228657600080fd5b6108f682612258565b600080602083850312156122a257600080fd5b823567ffffffffffffffff808211156122ba57600080fd5b818501915085601f8301126122ce57600080fd5b8135818111156122dd57600080fd5b8660208260051b85010111156122f257600080fd5b60209290920196919550909350505050565b60008060008060006080868803121561231c57600080fd5b61232586612258565b945061233360208701612258565b935060408601359250606086013567ffffffffffffffff8082111561235757600080fd5b818801915088601f83011261236b57600080fd5b81358181111561237a57600080fd5b89602082850101111561238c57600080fd5b9699959850939650602001949392505050565b600080604083850312156123b257600080fd5b6123bb83612258565b91506123c960208401612258565b90509250929050565b6000602082840312156123e457600080fd5b5035919050565b600080604083850312156123fe57600080fd5b61240783612258565b946020939093013593505050565b6000604082018483526020604081850152818551808452606086019150828701935060005b818110156124565784518352938301939183019160010161243a565b5090979650505050505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016124a1576124a1612479565b5060010190565b60008160001904831182151516156124c2576124c2612479565b500290565b600082198211156124da576124da612479565b500190565b6001600160a01b0384168152604060208201819052810182905260006001600160fb1b0383111561250f57600080fd5b8260051b8085606085013760009201606001918252509392505050565b60008282101561253e5761253e612479565b500390565b60008261256057634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121561257757600080fd5b5051919050565b634e487b7160e01b600052603160045260246000fd5b6000602082840312156125a657600080fd5b815180151581146125b657600080fd5b9392505050565b60005b838110156125d85781810151838201526020016125c0565b83811115611fda5750506000910152565b600082516125fb8184602087016125bd565b9190910192915050565b60208152600082518060208401526126248160408501602087016125bd565b601f01601f1916919091016040019291505056fea2646970667358221220597e11f30293f20be91b2bda3a6218e1dc88b6f0a74dde9094500a8517088ec664736f6c634300080d0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000f5cfbaf55036264b902d9ae55a114d9a22c42750000000000000000000000000fb1f65955e168e0ef500b170eed4a4efeb99ae320000000000000000000000006a0959cd80fc9e2c1be958df1f8207c5b03f2a84
-----Decoded View---------------
Arg [0] : _factory (address): 0xf5cfBaF55036264B902D9ae55A114d9A22c42750
Arg [1] : _stakingToken (address): 0xfb1f65955E168e0eF500b170EEd4A4EFEB99ae32
Arg [2] : _stakingNFT (address): 0x6a0959Cd80FC9E2C1bE958dF1F8207C5b03f2A84
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000f5cfbaf55036264b902d9ae55a114d9a22c42750
Arg [1] : 000000000000000000000000fb1f65955e168e0ef500b170eed4a4efeb99ae32
Arg [2] : 0000000000000000000000006a0959cd80fc9e2c1be958df1f8207c5b03f2a84
Loading...
Loading
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ 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.