Feature Tip: Add private address tag to any address under My Name Tag !
Source Code
Latest 15 from a total of 15 transactions
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Change Rate | 14617261 | 1442 days ago | IN | 0 ETH | 0.00320252 | ||||
| Change Rate | 14617260 | 1442 days ago | IN | 0 ETH | 0.00308831 | ||||
| Change Rate | 14617260 | 1442 days ago | IN | 0 ETH | 0.00308831 | ||||
| Change Rate | 14617254 | 1442 days ago | IN | 0 ETH | 0.00291704 | ||||
| Change Rate | 14616880 | 1442 days ago | IN | 0 ETH | 0.00114495 | ||||
| Withdraw | 14616878 | 1442 days ago | IN | 0 ETH | 0.01691051 | ||||
| Change Royalty C... | 14616857 | 1442 days ago | IN | 0 ETH | 0.00121095 | ||||
| Change Reward To... | 14616857 | 1442 days ago | IN | 0 ETH | 0.00131449 | ||||
| Change Rate | 14616830 | 1442 days ago | IN | 0 ETH | 0.00110128 | ||||
| Change Royalty P... | 14616821 | 1442 days ago | IN | 0 ETH | 0.00097856 | ||||
| Change Royalty C... | 14616801 | 1442 days ago | IN | 0 ETH | 0.00148888 | ||||
| Deposit | 14616795 | 1442 days ago | IN | 0 ETH | 0.00488717 | ||||
| Change Rate | 14616789 | 1442 days ago | IN | 0 ETH | 0.00197365 | ||||
| Change Reward To... | 14616784 | 1442 days ago | IN | 0 ETH | 0.00210834 | ||||
| Set Expiration | 14616779 | 1442 days ago | IN | 0 ETH | 0.00250311 |
Advanced mode: Intended for advanced users or developers and will display all Internal Transactions including zero value transfers.
Latest 5 internal transactions
Advanced mode:
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
ChainsawInuStaking
Compiler Version
v0.8.0+commit.c7dfd78e
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.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Receiver.sol";
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
struct UserInfo {
uint256 amount;
uint256 depositTime;
uint256 previousUnClaimedRewardAmount;
}
contract ChainsawInuStaking is Ownable, ERC1155Receiver {
using SafeMath for uint256;
using SafeERC20 for IERC20;
event ChangeExpiration(
uint256 oldExpirationTime,
uint256 newExpirationTime
);
event ChangeRewardAddress(IERC20 oldRewardAddress, IERC20 newOldAddress);
event ChangeChainftAddress(IERC1155 oldChainftAddress, IERC1155 newChainftAddress);
event ChangeRoyaltyClaimer(
address oldRoyaltyClaimer,
address newRoyaltyClaimer
);
event Deposited(
address depositer,
uint256 collectionId,
uint256 amount,
uint256 depositedTime
);
event WithDraw(
uint256[] collectionIds,
uint256[] totalRewardsAmounts,
uint256 claimedAmount
);
event ChangedRoyaltyPercentage(
uint256 indexed oldRoyaltyPercentage,
uint256 indexed newRoyaltyPercentage
);
IERC1155 ChainftAddress;
// expiration time of reward providing
uint256 public expiration;
address royaltyClaimer = 0x89cC8F045033CF767BbB93A01e55F83288E061BA;
mapping(uint256 => uint256) public rates;
mapping(address => mapping(uint256 => UserInfo)) public _userInfo;
IERC20 public rewardToken;
uint256 public royaltyPercentage = 20;
constructor(IERC1155 _ChainftAddress) {
ChainftAddress = _ChainftAddress;
}
function setExpiration(uint256 _expiration) public onlyOwner {
uint256 oldExpirationTime = expiration;
expiration = _expiration;
emit ChangeExpiration(oldExpirationTime, expiration);
}
function changeRewardToken(IERC20 _rewardTokenAddress) public onlyOwner {
IERC20 oldRewardAddress = rewardToken;
rewardToken = _rewardTokenAddress;
emit ChangeRewardAddress(oldRewardAddress, _rewardTokenAddress);
}
function changeChainftAddress(IERC1155 _ChainftAddress) public onlyOwner {
IERC1155 oldChainftAddress = ChainftAddress;
ChainftAddress = _ChainftAddress;
emit ChangeChainftAddress(oldChainftAddress, ChainftAddress);
}
function changeRate(uint256 collectionId, uint256 newRate)
public
onlyOwner
{
rates[collectionId] = newRate;
}
function changeRoyaltyPercentage(uint256 _royaltyPercentage)
public
onlyOwner
{
uint256 oldRoyaltyPercentage = royaltyPercentage;
royaltyPercentage = _royaltyPercentage;
emit ChangedRoyaltyPercentage(oldRoyaltyPercentage, royaltyPercentage);
}
function changeRoyaltyClaimer(address newRoyaltyClaimer) public {
address oldRoyaltyClaimer = royaltyClaimer;
royaltyClaimer = newRoyaltyClaimer;
emit ChangeRoyaltyClaimer(oldRoyaltyClaimer, royaltyClaimer);
}
function deposit(uint256 _amount, uint256 collectionId) external {
require(expiration > block.timestamp, "Invalid time stamp");
ChainftAddress.safeTransferFrom(
msg.sender,
address(this),
collectionId,
_amount,
""
);
uint256 previousDeposit = _userInfo[msg.sender][collectionId].amount;
uint256 rewardAmount = calculateReward(collectionId, msg.sender);
if (previousDeposit > 0) {
_userInfo[msg.sender][collectionId]
.previousUnClaimedRewardAmount = rewardAmount;
_userInfo[msg.sender][collectionId].depositTime = block.timestamp;
_userInfo[msg.sender][collectionId].amount =
previousDeposit +
_amount;
} else {
_userInfo[msg.sender][collectionId] = UserInfo(
_amount,
block.timestamp,
0
);
}
emit Deposited(msg.sender, collectionId, _amount, block.timestamp);
}
function calculateReward(uint256 collectionId, address account)
public
view
returns (uint256)
{
return
_userInfo[account][collectionId].previousUnClaimedRewardAmount +
rates[collectionId] *
(Math.min(block.timestamp, expiration) -
_userInfo[account][collectionId].depositTime) *
_userInfo[account][collectionId].amount;
}
function claimRewards(uint256[] memory collectionIds) public {
claimRewards(collectionIds, msg.sender);
}
function distributeRewards(uint256[] memory collectionIds, address account)
public
onlyOwner
{
claimRewards(collectionIds, account);
}
function claimRewards(uint256[] memory collectionIds, address account)
internal
{
uint256 totalClaimableAmount;
uint256[] memory amounts = new uint256[](collectionIds.length);
for (uint256 i = 0; i < collectionIds.length; i++) {
amounts[i] = _userInfo[account][collectionIds[i]].amount;
require(amounts[i] > 0, "Amount must be more than or equal to 1");
totalClaimableAmount =
totalClaimableAmount +
calculateReward(collectionIds[i], account);
_userInfo[account][collectionIds[i]]
.previousUnClaimedRewardAmount = 0;
_userInfo[account][collectionIds[i]].depositTime = block.timestamp;
}
uint256 rewardAmount = totalClaimableAmount
.mul(100 - royaltyPercentage)
.div(100);
uint256 royaltyAmount = totalClaimableAmount.mul(royaltyPercentage).div(
100
);
rewardToken.transfer(account, rewardAmount);
rewardToken.transfer(royaltyClaimer, royaltyAmount);
}
function calculateClaimableRewards(
uint256[] memory collectionIds,
address account
)
public
view
returns (
uint256[] memory,
uint256[] memory,
uint256[] memory
)
{
uint256 totalRewardAmount;
uint256[] memory amounts = new uint256[](collectionIds.length);
uint256[] memory rewardAmounts = new uint256[](collectionIds.length);
uint256[] memory royaltyAmounts = new uint256[](collectionIds.length);
for (uint256 i = 0; i < collectionIds.length; i++) {
amounts[i] = _userInfo[account][collectionIds[i]].amount;
uint256 reward = calculateReward(collectionIds[i], account);
totalRewardAmount += reward;
}
return (amounts, rewardAmounts, royaltyAmounts);
}
function withdraw(uint256[] memory collectionIds) public {
uint256 totalClaimableAmount;
uint256[] memory amounts = new uint256[](collectionIds.length);
for (uint256 i = 0; i < collectionIds.length; i++) {
amounts[i] = _userInfo[msg.sender][collectionIds[i]].amount;
totalClaimableAmount =
totalClaimableAmount +
calculateReward(collectionIds[i], msg.sender);
delete _userInfo[msg.sender][collectionIds[i]];
}
uint256 rewardAmount = totalClaimableAmount
.mul(100 - royaltyPercentage)
.div(100);
uint256 royaltyAmount = totalClaimableAmount.mul(royaltyPercentage).div(
100
);
rewardToken.transfer(msg.sender, rewardAmount);
rewardToken.transfer(royaltyClaimer, royaltyAmount);
ChainftAddress.safeBatchTransferFrom(
address(this),
msg.sender,
collectionIds,
amounts,
""
);
emit WithDraw(collectionIds, amounts, rewardAmount);
}
function onERC1155Received(
address operator,
address from,
uint256 id,
uint256 value,
bytes calldata data
) external override returns (bytes4) {
return IERC1155Receiver.onERC1155Received.selector;
}
function onERC1155BatchReceived(
address operator,
address from,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external override returns (bytes4) {
return IERC1155Receiver.onERC1155BatchReceived.selector;
}
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(ERC1155Receiver)
returns (bool)
{
return
interfaceId == type(IERC1155).interfaceId ||
interfaceId == type(IERC1155Receiver).interfaceId;
}
function emergencyExit(IERC20 token) public onlyOwner {
rewardToken.transfer(msg.sender, token.balanceOf(address(this)));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/math/SafeMath.sol)
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
* now has built in overflow checking.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
/**
* @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 / b + (a % b == 0 ? 0 : 1);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.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));
}
}
/**
* @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 v4.4.1 (token/ERC1155/IERC1155.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC1155 compliant contract, as defined in the
* https://eips.ethereum.org/EIPS/eip-1155[EIP].
*
* _Available since v3.1._
*/
interface IERC1155 is IERC165 {
/**
* @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
*/
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
/**
* @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
* transfers.
*/
event TransferBatch(
address indexed operator,
address indexed from,
address indexed to,
uint256[] ids,
uint256[] values
);
/**
* @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
* `approved`.
*/
event ApprovalForAll(address indexed account, address indexed operator, bool approved);
/**
* @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
*
* If an {URI} event was emitted for `id`, the standard
* https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
* returned by {IERC1155MetadataURI-uri}.
*/
event URI(string value, uint256 indexed id);
/**
* @dev Returns the amount of tokens of token type `id` owned by `account`.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function balanceOf(address account, uint256 id) external view returns (uint256);
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
external
view
returns (uint256[] memory);
/**
* @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
*
* Emits an {ApprovalForAll} event.
*
* Requirements:
*
* - `operator` cannot be the caller.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(address account, address operator) external view returns (bool);
/**
* @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.
* - `from` must have a balance of tokens of type `id` of at least `amount`.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes calldata data
) external;
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function safeBatchTransferFrom(
address from,
address to,
uint256[] calldata ids,
uint256[] calldata amounts,
bytes calldata data
) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol)
pragma solidity ^0.8.0;
import "../IERC1155Receiver.sol";
import "../../../utils/introspection/ERC165.sol";
/**
* @dev _Available since v3.1._
*/
abstract contract ERC1155Receiver is ERC165, IERC1155Receiver {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/ERC1155.sol)
pragma solidity ^0.8.0;
import "./IERC1155.sol";
import "./IERC1155Receiver.sol";
import "./extensions/IERC1155MetadataURI.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/introspection/ERC165.sol";
/**
* @dev Implementation of the basic standard multi-token.
* See https://eips.ethereum.org/EIPS/eip-1155
* Originally based on code by Enjin: https://github.com/enjin/erc-1155
*
* _Available since v3.1._
*/
contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
using Address for address;
// Mapping from token ID to account balances
mapping(uint256 => mapping(address => uint256)) private _balances;
// Mapping from account to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
// Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json
string private _uri;
/**
* @dev See {_setURI}.
*/
constructor(string memory uri_) {
_setURI(uri_);
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC1155).interfaceId ||
interfaceId == type(IERC1155MetadataURI).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC1155MetadataURI-uri}.
*
* This implementation returns the same URI for *all* token types. It relies
* on the token type ID substitution mechanism
* https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
*
* Clients calling this function must replace the `\{id\}` substring with the
* actual token type ID.
*/
function uri(uint256) public view virtual override returns (string memory) {
return _uri;
}
/**
* @dev See {IERC1155-balanceOf}.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {
require(account != address(0), "ERC1155: balance query for the zero address");
return _balances[id][account];
}
/**
* @dev See {IERC1155-balanceOfBatch}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(address[] memory accounts, uint256[] memory ids)
public
view
virtual
override
returns (uint256[] memory)
{
require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch");
uint256[] memory batchBalances = new uint256[](accounts.length);
for (uint256 i = 0; i < accounts.length; ++i) {
batchBalances[i] = balanceOf(accounts[i], ids[i]);
}
return batchBalances;
}
/**
* @dev See {IERC1155-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
_setApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC1155-isApprovedForAll}.
*/
function isApprovedForAll(address account, address operator) public view virtual override returns (bool) {
return _operatorApprovals[account][operator];
}
/**
* @dev See {IERC1155-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) public virtual override {
require(
from == _msgSender() || isApprovedForAll(from, _msgSender()),
"ERC1155: caller is not owner nor approved"
);
_safeTransferFrom(from, to, id, amount, data);
}
/**
* @dev See {IERC1155-safeBatchTransferFrom}.
*/
function safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) public virtual override {
require(
from == _msgSender() || isApprovedForAll(from, _msgSender()),
"ERC1155: transfer caller is not owner nor approved"
);
_safeBatchTransferFrom(from, to, ids, amounts, data);
}
/**
* @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `from` must have a balance of tokens of type `id` of at least `amount`.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function _safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: transfer to the zero address");
address operator = _msgSender();
_beforeTokenTransfer(operator, from, to, _asSingletonArray(id), _asSingletonArray(amount), data);
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
unchecked {
_balances[id][from] = fromBalance - amount;
}
_balances[id][to] += amount;
emit TransferSingle(operator, from, to, id, amount);
_doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function _safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
require(to != address(0), "ERC1155: transfer to the zero address");
address operator = _msgSender();
_beforeTokenTransfer(operator, from, to, ids, amounts, data);
for (uint256 i = 0; i < ids.length; ++i) {
uint256 id = ids[i];
uint256 amount = amounts[i];
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
unchecked {
_balances[id][from] = fromBalance - amount;
}
_balances[id][to] += amount;
}
emit TransferBatch(operator, from, to, ids, amounts);
_doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);
}
/**
* @dev Sets a new URI for all token types, by relying on the token type ID
* substitution mechanism
* https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
*
* By this mechanism, any occurrence of the `\{id\}` substring in either the
* URI or any of the amounts in the JSON file at said URI will be replaced by
* clients with the token type ID.
*
* For example, the `https://token-cdn-domain/\{id\}.json` URI would be
* interpreted by clients as
* `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`
* for token type ID 0x4cce0.
*
* See {uri}.
*
* Because these URIs cannot be meaningfully represented by the {URI} event,
* this function emits no events.
*/
function _setURI(string memory newuri) internal virtual {
_uri = newuri;
}
/**
* @dev Creates `amount` tokens of token type `id`, and assigns them to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function _mint(
address to,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
address operator = _msgSender();
_beforeTokenTransfer(operator, address(0), to, _asSingletonArray(id), _asSingletonArray(amount), data);
_balances[id][to] += amount;
emit TransferSingle(operator, address(0), to, id, amount);
_doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function _mintBatch(
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
address operator = _msgSender();
_beforeTokenTransfer(operator, address(0), to, ids, amounts, data);
for (uint256 i = 0; i < ids.length; i++) {
_balances[ids[i]][to] += amounts[i];
}
emit TransferBatch(operator, address(0), to, ids, amounts);
_doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);
}
/**
* @dev Destroys `amount` tokens of token type `id` from `from`
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `from` must have at least `amount` tokens of token type `id`.
*/
function _burn(
address from,
uint256 id,
uint256 amount
) internal virtual {
require(from != address(0), "ERC1155: burn from the zero address");
address operator = _msgSender();
_beforeTokenTransfer(operator, from, address(0), _asSingletonArray(id), _asSingletonArray(amount), "");
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
unchecked {
_balances[id][from] = fromBalance - amount;
}
emit TransferSingle(operator, from, address(0), id, amount);
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
*/
function _burnBatch(
address from,
uint256[] memory ids,
uint256[] memory amounts
) internal virtual {
require(from != address(0), "ERC1155: burn from the zero address");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
address operator = _msgSender();
_beforeTokenTransfer(operator, from, address(0), ids, amounts, "");
for (uint256 i = 0; i < ids.length; i++) {
uint256 id = ids[i];
uint256 amount = amounts[i];
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
unchecked {
_balances[id][from] = fromBalance - amount;
}
}
emit TransferBatch(operator, from, address(0), ids, amounts);
}
/**
* @dev Approve `operator` to operate on all of `owner` tokens
*
* Emits a {ApprovalForAll} event.
*/
function _setApprovalForAll(
address owner,
address operator,
bool approved
) internal virtual {
require(owner != operator, "ERC1155: setting approval status for self");
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning, as well as batched variants.
*
* The same hook is called on both single and batched variants. For single
* transfers, the length of the `id` and `amount` arrays will be 1.
*
* Calling conditions (for each `id` and `amount` pair):
*
* - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* of token type `id` will be transferred to `to`.
* - When `from` is zero, `amount` tokens of token type `id` will be minted
* for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
* will be burned.
* - `from` and `to` are never both zero.
* - `ids` and `amounts` have the same, non-zero length.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {}
function _doSafeTransferAcceptanceCheck(
address operator,
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) private {
if (to.isContract()) {
try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {
if (response != IERC1155Receiver.onERC1155Received.selector) {
revert("ERC1155: ERC1155Receiver rejected tokens");
}
} catch Error(string memory reason) {
revert(reason);
} catch {
revert("ERC1155: transfer to non ERC1155Receiver implementer");
}
}
}
function _doSafeBatchTransferAcceptanceCheck(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) private {
if (to.isContract()) {
try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (
bytes4 response
) {
if (response != IERC1155Receiver.onERC1155BatchReceived.selector) {
revert("ERC1155: ERC1155Receiver rejected tokens");
}
} catch Error(string memory reason) {
revert(reason);
} catch {
revert("ERC1155: transfer to non ERC1155Receiver implementer");
}
}
}
function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {
uint256[] memory array = new uint256[](1);
array[0] = element;
return array;
}
}// 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 (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @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 `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, 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 `sender` to `recipient` 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 sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @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);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)
pragma solidity ^0.8.0;
/**
* @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
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 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 functionCall(target, data, "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");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(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) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(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) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason 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 {
// 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
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/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 v4.4.1 (token/ERC1155/IERC1155Receiver.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev _Available since v3.1._
*/
interface IERC1155Receiver is IERC165 {
/**
@dev Handles the receipt of a single ERC1155 token type. This function is
called at the end of a `safeTransferFrom` after the balance has been updated.
To accept the transfer, this must return
`bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
(i.e. 0xf23a6e61, or its own function selector).
@param operator The address which initiated the transfer (i.e. msg.sender)
@param from The address which previously owned the token
@param id The ID of the token being transferred
@param value The amount of tokens being transferred
@param data Additional data with no specified format
@return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
*/
function onERC1155Received(
address operator,
address from,
uint256 id,
uint256 value,
bytes calldata data
) external returns (bytes4);
/**
@dev Handles the receipt of a multiple ERC1155 token types. This function
is called at the end of a `safeBatchTransferFrom` after the balances have
been updated. To accept the transfer(s), this must return
`bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
(i.e. 0xbc197c81, or its own function selector).
@param operator The address which initiated the batch transfer (i.e. msg.sender)
@param from The address which previously owned the token
@param ids An array containing ids of each token being transferred (order and length must match values array)
@param values An array containing amounts of each token being transferred (order and length must match ids array)
@param data Additional data with no specified format
@return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
*/
function onERC1155BatchReceived(
address operator,
address from,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external returns (bytes4);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)
pragma solidity ^0.8.0;
import "../IERC1155.sol";
/**
* @dev Interface of the optional ERC1155MetadataExtension interface, as defined
* in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].
*
* _Available since v3.1._
*/
interface IERC1155MetadataURI is IERC1155 {
/**
* @dev Returns the URI for token type `id`.
*
* If the `\{id\}` substring is present in the URI, it must be replaced by
* clients with the actual token type ID.
*/
function uri(uint256 id) external view returns (string memory);
}{
"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":"contract IERC1155","name":"_ChainftAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IERC1155","name":"oldChainftAddress","type":"address"},{"indexed":false,"internalType":"contract IERC1155","name":"newChainftAddress","type":"address"}],"name":"ChangeChainftAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldExpirationTime","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newExpirationTime","type":"uint256"}],"name":"ChangeExpiration","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IERC20","name":"oldRewardAddress","type":"address"},{"indexed":false,"internalType":"contract IERC20","name":"newOldAddress","type":"address"}],"name":"ChangeRewardAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldRoyaltyClaimer","type":"address"},{"indexed":false,"internalType":"address","name":"newRoyaltyClaimer","type":"address"}],"name":"ChangeRoyaltyClaimer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"oldRoyaltyPercentage","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"newRoyaltyPercentage","type":"uint256"}],"name":"ChangedRoyaltyPercentage","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"depositer","type":"address"},{"indexed":false,"internalType":"uint256","name":"collectionId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"depositedTime","type":"uint256"}],"name":"Deposited","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256[]","name":"collectionIds","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"totalRewardsAmounts","type":"uint256[]"},{"indexed":false,"internalType":"uint256","name":"claimedAmount","type":"uint256"}],"name":"WithDraw","type":"event"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"_userInfo","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"depositTime","type":"uint256"},{"internalType":"uint256","name":"previousUnClaimedRewardAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"collectionIds","type":"uint256[]"},{"internalType":"address","name":"account","type":"address"}],"name":"calculateClaimableRewards","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"collectionId","type":"uint256"},{"internalType":"address","name":"account","type":"address"}],"name":"calculateReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC1155","name":"_ChainftAddress","type":"address"}],"name":"changeChainftAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"collectionId","type":"uint256"},{"internalType":"uint256","name":"newRate","type":"uint256"}],"name":"changeRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_rewardTokenAddress","type":"address"}],"name":"changeRewardToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newRoyaltyClaimer","type":"address"}],"name":"changeRoyaltyClaimer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_royaltyPercentage","type":"uint256"}],"name":"changeRoyaltyPercentage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"collectionIds","type":"uint256[]"}],"name":"claimRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"collectionId","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"collectionIds","type":"uint256[]"},{"internalType":"address","name":"account","type":"address"}],"name":"distributeRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"}],"name":"emergencyExit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"expiration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onERC1155BatchReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"rates","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"royaltyPercentage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_expiration","type":"uint256"}],"name":"setExpiration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"collectionIds","type":"uint256[]"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
6080604052600380546001600160a01b0319167389cc8f045033cf767bbb93a01e55f83288e061ba17905560146007553480156200003c57600080fd5b5060405162001df738038062001df78339810160408190526200005f91620000ed565b620000736200006d62000099565b6200009d565b600180546001600160a01b0319166001600160a01b03929092169190911790556200011d565b3390565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600060208284031215620000ff578081fd5b81516001600160a01b038116811462000116578182fd5b9392505050565b611cca806200012d6000396000f3fe608060405234801561001057600080fd5b50600436106101585760003560e01c8063983d95ce116100c3578063dd418ae21161007c578063dd418ae2146102d5578063e2bbb158146102e8578063e6f0e63a146102fb578063f23a6e611461031d578063f2fde38b14610330578063f7c618c11461034357610158565b8063983d95ce146102475780639f79f66a1461025a578063a18f07a01461027c578063a441d0671461028f578063a883b0c4146102a2578063bc197c81146102b557610158565b8063515a20ba11610115578063515a20ba146101e95780635eac6239146101fc57806364a3e0c61461020f578063715018a6146102225780638a71bb2d1461022a5780638da5cb5b1461023257610158565b806301ffc9a71461015d578063088ab8ce146101865780632885978b1461019b5780632d1c652e146101ae5780634665096d146101c15780634bd0d89c146101d6575b600080fd5b61017061016b366004611843565b61034b565b60405161017d9190611a90565b60405180910390f35b61019961019436600461161c565b610382565b005b6101996101a936600461161c565b610429565b6101996101bc36600461161c565b6104bd565b6101c9610512565b60405161017d9190611b9d565b6101996101e436600461186b565b610518565b6101996101f736600461186b565b610590565b61019961020a366004611798565b610609565b61019961021d3660046117d3565b610616565b610199610663565b6101c96106ae565b61023a6106b4565b60405161017d919061191a565b610199610255366004611798565b6106c3565b61026d61026836600461176d565b610a4a565b60405161017d93929190611bb4565b6101c961028a36600461189b565b610a76565b61019961029d36600461161c565b610b14565b6101996102b03660046118bf565b610c4d565b6102c86102c3366004611638565b610c9e565b60405161017d9190611a9b565b6101c96102e336600461186b565b610cb2565b6101996102f63660046118bf565b610cc4565b61030e6103093660046117d3565b610e57565b60405161017d93929190611a17565b6102c861032b3660046116f3565b611053565b61019961033e36600461161c565b611065565b61023a6110d3565b60006001600160e01b03198216636cdb3d1360e11b148061037c57506001600160e01b03198216630271189760e51b145b92915050565b61038a6110e2565b6001600160a01b031661039b6106b4565b6001600160a01b0316146103ca5760405162461bcd60e51b81526004016103c190611b22565b60405180910390fd5b600680546001600160a01b038381166001600160a01b03198316179092556040519116907f0bbf50c070088acad59f59185185066c85e24a9972f0e2d18976de5d2fc7a27f9061041d908390859061192e565b60405180910390a15050565b6104316110e2565b6001600160a01b03166104426106b4565b6001600160a01b0316146104685760405162461bcd60e51b81526004016103c190611b22565b600180546001600160a01b038381166001600160a01b031983161792839055604051918116927fd00a8f7babf051591646c0d29f14ce3c4cc74bafe3accc93ce80c9adca8cae919261041d928592169061192e565b600380546001600160a01b038381166001600160a01b031983161792839055604051918116927fca7fd09e65c3245e4714e02ceca06f1aeb4db0b5d9f1c8488fb5b5849b22945d9261041d928592169061192e565b60025481565b6105206110e2565b6001600160a01b03166105316106b4565b6001600160a01b0316146105575760405162461bcd60e51b81526004016103c190611b22565b6007805490829055604051829082907f4c434265718b3bf9496b91524760d18e4320d64a7e37e586a21987ee90f4404690600090a35050565b6105986110e2565b6001600160a01b03166105a96106b4565b6001600160a01b0316146105cf5760405162461bcd60e51b81526004016103c190611b22565b60028054908290556040517f135e40ec91466ed3813f68ce139b94ee618dd3b27f7dbf53a3b284f21eb90f599061041d9083908590611ba6565b61061381336110e6565b50565b61061e6110e2565b6001600160a01b031661062f6106b4565b6001600160a01b0316146106555760405162461bcd60e51b81526004016103c190611b22565b61065f82826110e6565b5050565b61066b6110e2565b6001600160a01b031661067c6106b4565b6001600160a01b0316146106a25760405162461bcd60e51b81526004016103c190611b22565b6106ac600061147d565b565b60075481565b6000546001600160a01b031690565b600080825167ffffffffffffffff8111156106ee57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610717578160200160208202803683370190505b50905060005b835181101561084c57336000908152600560205260408120855190919086908490811061075a57634e487b7160e01b600052603260045260246000fd5b602002602001015181526020019081526020016000206000015482828151811061079457634e487b7160e01b600052603260045260246000fd5b6020026020010181815250506107d18482815181106107c357634e487b7160e01b600052603260045260246000fd5b602002602001015133610a76565b6107db9084611bca565b33600090815260056020526040812086519295509186908490811061081057634e487b7160e01b600052603260045260246000fd5b6020908102919091018101518252810191909152604001600090812081815560018101829055600201558061084481611c38565b91505061071d565b506000610873606461086d60075460646108669190611c21565b86906114cd565b906114d9565b90506000610891606461086d600754876114cd90919063ffffffff16565b60065460405163a9059cbb60e01b81529192506001600160a01b03169063a9059cbb906108c490339086906004016119d8565b602060405180830381600087803b1580156108de57600080fd5b505af11580156108f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109169190611823565b5060065460035460405163a9059cbb60e01b81526001600160a01b039283169263a9059cbb9261094d9291169085906004016119d8565b602060405180830381600087803b15801561096757600080fd5b505af115801561097b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061099f9190611823565b50600154604051631759616b60e11b81526001600160a01b0390911690632eb2c2d6906109d690309033908a908990600401611948565b600060405180830381600087803b1580156109f057600080fd5b505af1158015610a04573d6000803e3d6000fd5b505050507f33426c144059dfa891c736d6d3133f64f8e356fdad3039be2499e78cdaa823d3858484604051610a3b93929190611a5a565b60405180910390a15050505050565b600560209081526000928352604080842090915290825290208054600182015460029092015490919083565b6001600160a01b038116600090815260056020908152604080832085845290915281208054600190910154600254610aaf9042906114e5565b610ab99190611c21565b600085815260046020526040902054610ad29190611c02565b610adc9190611c02565b6001600160a01b0383166000908152600560209081526040808320878452909152902060020154610b0d9190611bca565b9392505050565b610b1c6110e2565b6001600160a01b0316610b2d6106b4565b6001600160a01b031614610b535760405162461bcd60e51b81526004016103c190611b22565b6006546040516370a0823160e01b81526001600160a01b039182169163a9059cbb9133918516906370a0823190610b8e90309060040161191a565b60206040518083038186803b158015610ba657600080fd5b505afa158015610bba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bde9190611883565b6040518363ffffffff1660e01b8152600401610bfb9291906119d8565b602060405180830381600087803b158015610c1557600080fd5b505af1158015610c29573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061065f9190611823565b610c556110e2565b6001600160a01b0316610c666106b4565b6001600160a01b031614610c8c5760405162461bcd60e51b81526004016103c190611b22565b60009182526004602052604090912055565b63bc197c8160e01b98975050505050505050565b60046020526000908152604090205481565b4260025411610ce55760405162461bcd60e51b81526004016103c190611af6565b600154604051637921219560e11b81526001600160a01b039091169063f242432a90610d1b9033903090869088906004016119a0565b600060405180830381600087803b158015610d3557600080fd5b505af1158015610d49573d6000803e3d6000fd5b505033600081815260056020908152604080832087845290915281205493509150610d75908490610a76565b90508115610dcf5733600090815260056020908152604080832086845290915290206002810182905542600190910155610daf8483611bca565b336000908152600560209081526040808320878452909152902055610e14565b60408051606081018252858152426020808301918252600083850181815233825260058352858220898352909252939093209151825551600182015590516002909101555b7f91ede45f04a37a7c170f5c1207df3b6bc748dc1e04ad5e917a241d0f52feada333848642604051610e4994939291906119f1565b60405180910390a150505050565b6060806060600080865167ffffffffffffffff811115610e8757634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610eb0578160200160208202803683370190505b5090506000875167ffffffffffffffff811115610edd57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610f06578160200160208202803683370190505b5090506000885167ffffffffffffffff811115610f3357634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610f5c578160200160208202803683370190505b50905060005b8951811015611043576001600160a01b03891660009081526005602052604081208b519091908c9084908110610fa857634e487b7160e01b600052603260045260246000fd5b6020026020010151815260200190815260200160002060000154848281518110610fe257634e487b7160e01b600052603260045260246000fd5b60200260200101818152505060006110218b838151811061101357634e487b7160e01b600052603260045260246000fd5b60200260200101518b610a76565b905061102d8187611bca565b955050808061103b90611c38565b915050610f62565b5091955093509150509250925092565b63f23a6e6160e01b9695505050505050565b61106d6110e2565b6001600160a01b031661107e6106b4565b6001600160a01b0316146110a45760405162461bcd60e51b81526004016103c190611b22565b6001600160a01b0381166110ca5760405162461bcd60e51b81526004016103c190611ab0565b6106138161147d565b6006546001600160a01b031681565b3390565b600080835167ffffffffffffffff81111561111157634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561113a578160200160208202803683370190505b50905060005b845181101561132e576001600160a01b0384166000908152600560205260408120865190919087908490811061118657634e487b7160e01b600052603260045260246000fd5b60200260200101518152602001908152602001600020600001548282815181106111c057634e487b7160e01b600052603260045260246000fd5b60200260200101818152505060008282815181106111ee57634e487b7160e01b600052603260045260246000fd5b6020026020010151116112135760405162461bcd60e51b81526004016103c190611b57565b61124485828151811061123657634e487b7160e01b600052603260045260246000fd5b602002602001015185610a76565b61124e9084611bca565b9250600060056000866001600160a01b03166001600160a01b03168152602001908152602001600020600087848151811061129957634e487b7160e01b600052603260045260246000fd5b60200260200101518152602001908152602001600020600201819055504260056000866001600160a01b03166001600160a01b0316815260200190815260200160002060008784815181106112fe57634e487b7160e01b600052603260045260246000fd5b6020026020010151815260200190815260200160002060010181905550808061132690611c38565b915050611140565b506000611348606461086d60075460646108669190611c21565b90506000611366606461086d600754876114cd90919063ffffffff16565b60065460405163a9059cbb60e01b81529192506001600160a01b03169063a9059cbb9061139990889086906004016119d8565b602060405180830381600087803b1580156113b357600080fd5b505af11580156113c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113eb9190611823565b5060065460035460405163a9059cbb60e01b81526001600160a01b039283169263a9059cbb926114229291169085906004016119d8565b602060405180830381600087803b15801561143c57600080fd5b505af1158015611450573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114749190611823565b50505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000610b0d8284611c02565b6000610b0d8284611be2565b60008183106114f45781610b0d565b5090919050565b60008083601f84011261150c578081fd5b50813567ffffffffffffffff811115611523578182fd5b602083019150836020808302850101111561153d57600080fd5b9250929050565b600082601f830112611554578081fd5b8135602067ffffffffffffffff8083111561157157611571611c69565b8183026040518382820101818110848211171561159057611590611c69565b604052848152838101925086840182880185018910156115ae578687fd5b8692505b858310156115d05780358452928401926001929092019184016115b2565b50979650505050505050565b60008083601f8401126115ed578182fd5b50813567ffffffffffffffff811115611604578182fd5b60208301915083602082850101111561153d57600080fd5b60006020828403121561162d578081fd5b8135610b0d81611c7f565b60008060008060008060008060a0898b031215611653578384fd5b883561165e81611c7f565b9750602089013561166e81611c7f565b9650604089013567ffffffffffffffff8082111561168a578586fd5b6116968c838d016114fb565b909850965060608b01359150808211156116ae578586fd5b6116ba8c838d016114fb565b909650945060808b01359150808211156116d2578384fd5b506116df8b828c016115dc565b999c989b5096995094979396929594505050565b60008060008060008060a0878903121561170b578182fd5b863561171681611c7f565b9550602087013561172681611c7f565b94506040870135935060608701359250608087013567ffffffffffffffff81111561174f578283fd5b61175b89828a016115dc565b979a9699509497509295939492505050565b6000806040838503121561177f578182fd5b823561178a81611c7f565b946020939093013593505050565b6000602082840312156117a9578081fd5b813567ffffffffffffffff8111156117bf578182fd5b6117cb84828501611544565b949350505050565b600080604083850312156117e5578182fd5b823567ffffffffffffffff8111156117fb578283fd5b61180785828601611544565b925050602083013561181881611c7f565b809150509250929050565b600060208284031215611834578081fd5b81518015158114610b0d578182fd5b600060208284031215611854578081fd5b81356001600160e01b031981168114610b0d578182fd5b60006020828403121561187c578081fd5b5035919050565b600060208284031215611894578081fd5b5051919050565b600080604083850312156118ad578182fd5b82359150602083013561181881611c7f565b600080604083850312156118d1578182fd5b50508035926020909101359150565b6000815180845260208085019450808401835b8381101561190f578151875295820195908201906001016118f3565b509495945050505050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b0385811682528416602082015260a060408201819052600090611974908301856118e0565b828103606084015261198681856118e0565b838103608090940193909352508152602001949350505050565b6001600160a01b0394851681529290931660208301526040820152606081019190915260a06080820181905260009082015260c00190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b0394909416845260208401929092526040830152606082015260800190565b600060608252611a2a60608301866118e0565b8281036020840152611a3c81866118e0565b90508281036040840152611a5081856118e0565b9695505050505050565b600060608252611a6d60608301866118e0565b8281036020840152611a7f81866118e0565b915050826040830152949350505050565b901515815260200190565b6001600160e01b031991909116815260200190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b6020808252601290820152710496e76616c69642074696d65207374616d760741b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526026908201527f416d6f756e74206d757374206265206d6f7265207468616e206f7220657175616040820152656c20746f203160d01b606082015260800190565b90815260200190565b918252602082015260400190565b9283526020830191909152604082015260600190565b60008219821115611bdd57611bdd611c53565b500190565b600082611bfd57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611c1c57611c1c611c53565b500290565b600082821015611c3357611c33611c53565b500390565b6000600019821415611c4c57611c4c611c53565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461061357600080fdfea2646970667358221220d2ad046bc14b216b41b894fb16e476161371827e631de5aa50174920c590a8a864736f6c63430008000033000000000000000000000000c6f4f8c67d96f1d29bc76df03f114d106b1d9172
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101585760003560e01c8063983d95ce116100c3578063dd418ae21161007c578063dd418ae2146102d5578063e2bbb158146102e8578063e6f0e63a146102fb578063f23a6e611461031d578063f2fde38b14610330578063f7c618c11461034357610158565b8063983d95ce146102475780639f79f66a1461025a578063a18f07a01461027c578063a441d0671461028f578063a883b0c4146102a2578063bc197c81146102b557610158565b8063515a20ba11610115578063515a20ba146101e95780635eac6239146101fc57806364a3e0c61461020f578063715018a6146102225780638a71bb2d1461022a5780638da5cb5b1461023257610158565b806301ffc9a71461015d578063088ab8ce146101865780632885978b1461019b5780632d1c652e146101ae5780634665096d146101c15780634bd0d89c146101d6575b600080fd5b61017061016b366004611843565b61034b565b60405161017d9190611a90565b60405180910390f35b61019961019436600461161c565b610382565b005b6101996101a936600461161c565b610429565b6101996101bc36600461161c565b6104bd565b6101c9610512565b60405161017d9190611b9d565b6101996101e436600461186b565b610518565b6101996101f736600461186b565b610590565b61019961020a366004611798565b610609565b61019961021d3660046117d3565b610616565b610199610663565b6101c96106ae565b61023a6106b4565b60405161017d919061191a565b610199610255366004611798565b6106c3565b61026d61026836600461176d565b610a4a565b60405161017d93929190611bb4565b6101c961028a36600461189b565b610a76565b61019961029d36600461161c565b610b14565b6101996102b03660046118bf565b610c4d565b6102c86102c3366004611638565b610c9e565b60405161017d9190611a9b565b6101c96102e336600461186b565b610cb2565b6101996102f63660046118bf565b610cc4565b61030e6103093660046117d3565b610e57565b60405161017d93929190611a17565b6102c861032b3660046116f3565b611053565b61019961033e36600461161c565b611065565b61023a6110d3565b60006001600160e01b03198216636cdb3d1360e11b148061037c57506001600160e01b03198216630271189760e51b145b92915050565b61038a6110e2565b6001600160a01b031661039b6106b4565b6001600160a01b0316146103ca5760405162461bcd60e51b81526004016103c190611b22565b60405180910390fd5b600680546001600160a01b038381166001600160a01b03198316179092556040519116907f0bbf50c070088acad59f59185185066c85e24a9972f0e2d18976de5d2fc7a27f9061041d908390859061192e565b60405180910390a15050565b6104316110e2565b6001600160a01b03166104426106b4565b6001600160a01b0316146104685760405162461bcd60e51b81526004016103c190611b22565b600180546001600160a01b038381166001600160a01b031983161792839055604051918116927fd00a8f7babf051591646c0d29f14ce3c4cc74bafe3accc93ce80c9adca8cae919261041d928592169061192e565b600380546001600160a01b038381166001600160a01b031983161792839055604051918116927fca7fd09e65c3245e4714e02ceca06f1aeb4db0b5d9f1c8488fb5b5849b22945d9261041d928592169061192e565b60025481565b6105206110e2565b6001600160a01b03166105316106b4565b6001600160a01b0316146105575760405162461bcd60e51b81526004016103c190611b22565b6007805490829055604051829082907f4c434265718b3bf9496b91524760d18e4320d64a7e37e586a21987ee90f4404690600090a35050565b6105986110e2565b6001600160a01b03166105a96106b4565b6001600160a01b0316146105cf5760405162461bcd60e51b81526004016103c190611b22565b60028054908290556040517f135e40ec91466ed3813f68ce139b94ee618dd3b27f7dbf53a3b284f21eb90f599061041d9083908590611ba6565b61061381336110e6565b50565b61061e6110e2565b6001600160a01b031661062f6106b4565b6001600160a01b0316146106555760405162461bcd60e51b81526004016103c190611b22565b61065f82826110e6565b5050565b61066b6110e2565b6001600160a01b031661067c6106b4565b6001600160a01b0316146106a25760405162461bcd60e51b81526004016103c190611b22565b6106ac600061147d565b565b60075481565b6000546001600160a01b031690565b600080825167ffffffffffffffff8111156106ee57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610717578160200160208202803683370190505b50905060005b835181101561084c57336000908152600560205260408120855190919086908490811061075a57634e487b7160e01b600052603260045260246000fd5b602002602001015181526020019081526020016000206000015482828151811061079457634e487b7160e01b600052603260045260246000fd5b6020026020010181815250506107d18482815181106107c357634e487b7160e01b600052603260045260246000fd5b602002602001015133610a76565b6107db9084611bca565b33600090815260056020526040812086519295509186908490811061081057634e487b7160e01b600052603260045260246000fd5b6020908102919091018101518252810191909152604001600090812081815560018101829055600201558061084481611c38565b91505061071d565b506000610873606461086d60075460646108669190611c21565b86906114cd565b906114d9565b90506000610891606461086d600754876114cd90919063ffffffff16565b60065460405163a9059cbb60e01b81529192506001600160a01b03169063a9059cbb906108c490339086906004016119d8565b602060405180830381600087803b1580156108de57600080fd5b505af11580156108f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109169190611823565b5060065460035460405163a9059cbb60e01b81526001600160a01b039283169263a9059cbb9261094d9291169085906004016119d8565b602060405180830381600087803b15801561096757600080fd5b505af115801561097b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061099f9190611823565b50600154604051631759616b60e11b81526001600160a01b0390911690632eb2c2d6906109d690309033908a908990600401611948565b600060405180830381600087803b1580156109f057600080fd5b505af1158015610a04573d6000803e3d6000fd5b505050507f33426c144059dfa891c736d6d3133f64f8e356fdad3039be2499e78cdaa823d3858484604051610a3b93929190611a5a565b60405180910390a15050505050565b600560209081526000928352604080842090915290825290208054600182015460029092015490919083565b6001600160a01b038116600090815260056020908152604080832085845290915281208054600190910154600254610aaf9042906114e5565b610ab99190611c21565b600085815260046020526040902054610ad29190611c02565b610adc9190611c02565b6001600160a01b0383166000908152600560209081526040808320878452909152902060020154610b0d9190611bca565b9392505050565b610b1c6110e2565b6001600160a01b0316610b2d6106b4565b6001600160a01b031614610b535760405162461bcd60e51b81526004016103c190611b22565b6006546040516370a0823160e01b81526001600160a01b039182169163a9059cbb9133918516906370a0823190610b8e90309060040161191a565b60206040518083038186803b158015610ba657600080fd5b505afa158015610bba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bde9190611883565b6040518363ffffffff1660e01b8152600401610bfb9291906119d8565b602060405180830381600087803b158015610c1557600080fd5b505af1158015610c29573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061065f9190611823565b610c556110e2565b6001600160a01b0316610c666106b4565b6001600160a01b031614610c8c5760405162461bcd60e51b81526004016103c190611b22565b60009182526004602052604090912055565b63bc197c8160e01b98975050505050505050565b60046020526000908152604090205481565b4260025411610ce55760405162461bcd60e51b81526004016103c190611af6565b600154604051637921219560e11b81526001600160a01b039091169063f242432a90610d1b9033903090869088906004016119a0565b600060405180830381600087803b158015610d3557600080fd5b505af1158015610d49573d6000803e3d6000fd5b505033600081815260056020908152604080832087845290915281205493509150610d75908490610a76565b90508115610dcf5733600090815260056020908152604080832086845290915290206002810182905542600190910155610daf8483611bca565b336000908152600560209081526040808320878452909152902055610e14565b60408051606081018252858152426020808301918252600083850181815233825260058352858220898352909252939093209151825551600182015590516002909101555b7f91ede45f04a37a7c170f5c1207df3b6bc748dc1e04ad5e917a241d0f52feada333848642604051610e4994939291906119f1565b60405180910390a150505050565b6060806060600080865167ffffffffffffffff811115610e8757634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610eb0578160200160208202803683370190505b5090506000875167ffffffffffffffff811115610edd57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610f06578160200160208202803683370190505b5090506000885167ffffffffffffffff811115610f3357634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610f5c578160200160208202803683370190505b50905060005b8951811015611043576001600160a01b03891660009081526005602052604081208b519091908c9084908110610fa857634e487b7160e01b600052603260045260246000fd5b6020026020010151815260200190815260200160002060000154848281518110610fe257634e487b7160e01b600052603260045260246000fd5b60200260200101818152505060006110218b838151811061101357634e487b7160e01b600052603260045260246000fd5b60200260200101518b610a76565b905061102d8187611bca565b955050808061103b90611c38565b915050610f62565b5091955093509150509250925092565b63f23a6e6160e01b9695505050505050565b61106d6110e2565b6001600160a01b031661107e6106b4565b6001600160a01b0316146110a45760405162461bcd60e51b81526004016103c190611b22565b6001600160a01b0381166110ca5760405162461bcd60e51b81526004016103c190611ab0565b6106138161147d565b6006546001600160a01b031681565b3390565b600080835167ffffffffffffffff81111561111157634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561113a578160200160208202803683370190505b50905060005b845181101561132e576001600160a01b0384166000908152600560205260408120865190919087908490811061118657634e487b7160e01b600052603260045260246000fd5b60200260200101518152602001908152602001600020600001548282815181106111c057634e487b7160e01b600052603260045260246000fd5b60200260200101818152505060008282815181106111ee57634e487b7160e01b600052603260045260246000fd5b6020026020010151116112135760405162461bcd60e51b81526004016103c190611b57565b61124485828151811061123657634e487b7160e01b600052603260045260246000fd5b602002602001015185610a76565b61124e9084611bca565b9250600060056000866001600160a01b03166001600160a01b03168152602001908152602001600020600087848151811061129957634e487b7160e01b600052603260045260246000fd5b60200260200101518152602001908152602001600020600201819055504260056000866001600160a01b03166001600160a01b0316815260200190815260200160002060008784815181106112fe57634e487b7160e01b600052603260045260246000fd5b6020026020010151815260200190815260200160002060010181905550808061132690611c38565b915050611140565b506000611348606461086d60075460646108669190611c21565b90506000611366606461086d600754876114cd90919063ffffffff16565b60065460405163a9059cbb60e01b81529192506001600160a01b03169063a9059cbb9061139990889086906004016119d8565b602060405180830381600087803b1580156113b357600080fd5b505af11580156113c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113eb9190611823565b5060065460035460405163a9059cbb60e01b81526001600160a01b039283169263a9059cbb926114229291169085906004016119d8565b602060405180830381600087803b15801561143c57600080fd5b505af1158015611450573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114749190611823565b50505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000610b0d8284611c02565b6000610b0d8284611be2565b60008183106114f45781610b0d565b5090919050565b60008083601f84011261150c578081fd5b50813567ffffffffffffffff811115611523578182fd5b602083019150836020808302850101111561153d57600080fd5b9250929050565b600082601f830112611554578081fd5b8135602067ffffffffffffffff8083111561157157611571611c69565b8183026040518382820101818110848211171561159057611590611c69565b604052848152838101925086840182880185018910156115ae578687fd5b8692505b858310156115d05780358452928401926001929092019184016115b2565b50979650505050505050565b60008083601f8401126115ed578182fd5b50813567ffffffffffffffff811115611604578182fd5b60208301915083602082850101111561153d57600080fd5b60006020828403121561162d578081fd5b8135610b0d81611c7f565b60008060008060008060008060a0898b031215611653578384fd5b883561165e81611c7f565b9750602089013561166e81611c7f565b9650604089013567ffffffffffffffff8082111561168a578586fd5b6116968c838d016114fb565b909850965060608b01359150808211156116ae578586fd5b6116ba8c838d016114fb565b909650945060808b01359150808211156116d2578384fd5b506116df8b828c016115dc565b999c989b5096995094979396929594505050565b60008060008060008060a0878903121561170b578182fd5b863561171681611c7f565b9550602087013561172681611c7f565b94506040870135935060608701359250608087013567ffffffffffffffff81111561174f578283fd5b61175b89828a016115dc565b979a9699509497509295939492505050565b6000806040838503121561177f578182fd5b823561178a81611c7f565b946020939093013593505050565b6000602082840312156117a9578081fd5b813567ffffffffffffffff8111156117bf578182fd5b6117cb84828501611544565b949350505050565b600080604083850312156117e5578182fd5b823567ffffffffffffffff8111156117fb578283fd5b61180785828601611544565b925050602083013561181881611c7f565b809150509250929050565b600060208284031215611834578081fd5b81518015158114610b0d578182fd5b600060208284031215611854578081fd5b81356001600160e01b031981168114610b0d578182fd5b60006020828403121561187c578081fd5b5035919050565b600060208284031215611894578081fd5b5051919050565b600080604083850312156118ad578182fd5b82359150602083013561181881611c7f565b600080604083850312156118d1578182fd5b50508035926020909101359150565b6000815180845260208085019450808401835b8381101561190f578151875295820195908201906001016118f3565b509495945050505050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b0385811682528416602082015260a060408201819052600090611974908301856118e0565b828103606084015261198681856118e0565b838103608090940193909352508152602001949350505050565b6001600160a01b0394851681529290931660208301526040820152606081019190915260a06080820181905260009082015260c00190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b0394909416845260208401929092526040830152606082015260800190565b600060608252611a2a60608301866118e0565b8281036020840152611a3c81866118e0565b90508281036040840152611a5081856118e0565b9695505050505050565b600060608252611a6d60608301866118e0565b8281036020840152611a7f81866118e0565b915050826040830152949350505050565b901515815260200190565b6001600160e01b031991909116815260200190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b6020808252601290820152710496e76616c69642074696d65207374616d760741b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526026908201527f416d6f756e74206d757374206265206d6f7265207468616e206f7220657175616040820152656c20746f203160d01b606082015260800190565b90815260200190565b918252602082015260400190565b9283526020830191909152604082015260600190565b60008219821115611bdd57611bdd611c53565b500190565b600082611bfd57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611c1c57611c1c611c53565b500290565b600082821015611c3357611c33611c53565b500390565b6000600019821415611c4c57611c4c611c53565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461061357600080fdfea2646970667358221220d2ad046bc14b216b41b894fb16e476161371827e631de5aa50174920c590a8a864736f6c63430008000033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000c6f4f8c67d96f1d29bc76df03f114d106b1d9172
-----Decoded View---------------
Arg [0] : _ChainftAddress (address): 0xC6f4F8C67D96F1d29bc76df03F114d106b1D9172
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000c6f4f8c67d96f1d29bc76df03f114d106b1d9172
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 33 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.