Source Code
Overview
ETH Balance
0 ETH
ETH Value
$0.00More Info
Private Name Tags
ContractCreator
| Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
Latest 25 internal transactions (View All)
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 72086658 | 972 days ago | 0 ETH | ||||
| 72086658 | 972 days ago | 0 ETH | ||||
| 72086658 | 972 days ago | 0 ETH | ||||
| 72086658 | 972 days ago | 0 ETH | ||||
| 72086658 | 972 days ago | 0 ETH | ||||
| 72086658 | 972 days ago | 0 ETH | ||||
| 72086627 | 972 days ago | 0 ETH | ||||
| 72086627 | 972 days ago | 0 ETH | ||||
| 72086627 | 972 days ago | 0 ETH | ||||
| 72086627 | 972 days ago | 0 ETH | ||||
| 72086627 | 972 days ago | 0 ETH | ||||
| 72086627 | 972 days ago | 0 ETH | ||||
| 72086612 | 972 days ago | 0 ETH | ||||
| 72086612 | 972 days ago | 0 ETH | ||||
| 72086612 | 972 days ago | 0 ETH | ||||
| 72086612 | 972 days ago | 0 ETH | ||||
| 72086612 | 972 days ago | 0 ETH | ||||
| 72086612 | 972 days ago | 0 ETH | ||||
| 72086596 | 972 days ago | 0 ETH | ||||
| 72086596 | 972 days ago | 0 ETH | ||||
| 72086596 | 972 days ago | 0 ETH | ||||
| 72086596 | 972 days ago | 0 ETH | ||||
| 72086596 | 972 days ago | 0 ETH | ||||
| 72086596 | 972 days ago | 0 ETH | ||||
| 72086586 | 972 days ago | 0 ETH |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
ExponentialPremiumPriceOracle
Compiler Version
v0.8.12+commit.f00d7308
Optimization Enabled:
Yes with 10000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
pragma solidity >=0.8.4;
import "./SidPriceOracle.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "../common/StringUtils.sol";
import "../giftcard/SidGiftCardLedger.sol";
import "./ISidPriceOracle.sol";
import "../giftcard/SidGiftCardVoucher.sol";
contract ExponentialPremiumPriceOracle is SidPriceOracle {
using StringUtils for *;
uint256 constant GRACE_PERIOD = 90 days;
uint256 immutable startPremium;
uint256 immutable endValue;
constructor(
AggregatorInterface _usdOracle,
SidGiftCardLedger _ledger,
SidGiftCardVoucher _voucher,
uint256 _startPremium,
uint256 totalDays
) SidPriceOracle(_usdOracle, _ledger, _voucher) {
startPremium = _startPremium;
endValue = _startPremium >> totalDays;
}
uint256 constant PRECISION = 1e18;
uint256 constant bit1 = 999989423469314432; // 0.5 ^ 1/65536 * (10 ** 18)
uint256 constant bit2 = 999978847050491904; // 0.5 ^ 2/65536 * (10 ** 18)
uint256 constant bit3 = 999957694548431104;
uint256 constant bit4 = 999915390886613504;
uint256 constant bit5 = 999830788931929088;
uint256 constant bit6 = 999661606496243712;
uint256 constant bit7 = 999323327502650752;
uint256 constant bit8 = 998647112890970240;
uint256 constant bit9 = 997296056085470080;
uint256 constant bit10 = 994599423483633152;
uint256 constant bit11 = 989228013193975424;
uint256 constant bit12 = 978572062087700096;
uint256 constant bit13 = 957603280698573696;
uint256 constant bit14 = 917004043204671232;
uint256 constant bit15 = 840896415253714560;
uint256 constant bit16 = 707106781186547584;
/**
* @dev Returns the pricing premium in internal base units.
*/
function _premium(
string memory,
uint256 expires,
uint256
) internal view override returns (uint256) {
expires = expires + GRACE_PERIOD;
if (expires > block.timestamp) {
return 0;
}
uint256 elapsed = block.timestamp - expires;
uint256 premium = decayedPremium(startPremium, elapsed);
if (premium >= endValue) {
return premium - endValue;
}
return 0;
}
/**
* @dev Returns the premium price at current time elapsed
* @param startPremium starting price
* @param elapsed time past since expiry
*/
function decayedPremium(uint256 startPremium, uint256 elapsed) public pure returns (uint256) {
uint256 daysPast = (elapsed * PRECISION) / 1 days;
uint256 intDays = daysPast / PRECISION;
uint256 premium = startPremium >> intDays;
uint256 partDay = (daysPast - intDays * PRECISION);
uint256 fraction = (partDay * (2**16)) / PRECISION;
uint256 totalPremium = addFractionalPremium(fraction, premium);
return totalPremium;
}
function addFractionalPremium(uint256 fraction, uint256 premium) internal pure returns (uint256) {
if (fraction & (1 << 0) != 0) {
premium = (premium * bit1) / PRECISION;
}
if (fraction & (1 << 1) != 0) {
premium = (premium * bit2) / PRECISION;
}
if (fraction & (1 << 2) != 0) {
premium = (premium * bit3) / PRECISION;
}
if (fraction & (1 << 3) != 0) {
premium = (premium * bit4) / PRECISION;
}
if (fraction & (1 << 4) != 0) {
premium = (premium * bit5) / PRECISION;
}
if (fraction & (1 << 5) != 0) {
premium = (premium * bit6) / PRECISION;
}
if (fraction & (1 << 6) != 0) {
premium = (premium * bit7) / PRECISION;
}
if (fraction & (1 << 7) != 0) {
premium = (premium * bit8) / PRECISION;
}
if (fraction & (1 << 8) != 0) {
premium = (premium * bit9) / PRECISION;
}
if (fraction & (1 << 9) != 0) {
premium = (premium * bit10) / PRECISION;
}
if (fraction & (1 << 10) != 0) {
premium = (premium * bit11) / PRECISION;
}
if (fraction & (1 << 11) != 0) {
premium = (premium * bit12) / PRECISION;
}
if (fraction & (1 << 12) != 0) {
premium = (premium * bit13) / PRECISION;
}
if (fraction & (1 << 13) != 0) {
premium = (premium * bit14) / PRECISION;
}
if (fraction & (1 << 14) != 0) {
premium = (premium * bit15) / PRECISION;
}
if (fraction & (1 << 15) != 0) {
premium = (premium * bit16) / PRECISION;
}
return premium;
}
}pragma solidity >=0.8.4;
import "@openzeppelin/contracts/access/Ownable.sol";
import "../common/StringUtils.sol";
import "../giftcard/SidGiftCardLedger.sol";
import "./ISidPriceOracle.sol";
import "../giftcard/SidGiftCardVoucher.sol";
interface AggregatorInterface {
function latestAnswer() external view returns (int256);
}
// StablePriceOracle sets a price in USD, based on an oracle.
contract SidPriceOracle is ISidPriceOracle, Ownable {
using StringUtils for *;
//price in USD per second
uint256 private constant price1Letter = 100000000000000;
uint256 private constant price2Letter = 50000000000000;
uint256 private constant price3Letter = 15844369253405;
uint256 private constant price4Letter = 3168873850681;
uint256 private constant price5Letter = 158443692534;
// Oracle address
AggregatorInterface public immutable usdOracle;
SidGiftCardLedger public immutable ledger;
SidGiftCardVoucher public immutable voucher;
constructor(
AggregatorInterface _usdOracle,
SidGiftCardLedger _ledger,
SidGiftCardVoucher _voucher
) {
usdOracle = _usdOracle;
ledger = _ledger;
voucher = _voucher;
}
/**
* @dev Returns the pricing premium in wei.
*/
function premium(
string calldata name,
uint256 expires,
uint256 duration
) external view returns (uint256) {
return attoUSDToWei(_premium(name, expires, duration));
}
/**
* @dev Returns the pricing premium in internal base units.
*/
function _premium(
string memory name,
uint256 expires,
uint256 duration
) internal view virtual returns (uint256) {
return 0;
}
function giftcard(uint256[] calldata ids, uint256[] calldata amounts) public view returns (ISidPriceOracle.Price memory) {
uint256 total = voucher.totalValue(ids, amounts);
return ISidPriceOracle.Price({base: attoUSDToWei(total), premium: 0, usedPoint: 0});
}
function domain(
string calldata name,
uint256 expires,
uint256 duration
) external view returns (ISidPriceOracle.Price memory) {
uint256 len = name.strlen();
uint256 basePrice;
if (len == 1) {
basePrice = price1Letter * duration;
} else if (len == 2) {
basePrice = price2Letter * duration;
} else if (len == 3) {
basePrice = price3Letter * duration;
} else if (len == 4) {
basePrice = price4Letter * duration;
} else {
basePrice = price5Letter * duration;
}
return ISidPriceOracle.Price({base: attoUSDToWei(basePrice), premium: attoUSDToWei(_premium(name, expires, duration)), usedPoint: 0});
}
function domainWithPoint(
string calldata name,
uint256 expires,
uint256 duration,
address owner
) external view returns (ISidPriceOracle.Price memory) {
uint256 len = name.strlen();
uint256 basePrice;
uint256 usedPoint;
uint256 premiumPrice = _premium(name, expires, duration);
if (len == 1) {
basePrice = price1Letter * duration;
} else if (len == 2) {
basePrice = price2Letter * duration;
} else if (len == 3) {
basePrice = price3Letter * duration;
} else if (len == 4) {
basePrice = price4Letter * duration;
} else {
basePrice = price5Letter * duration;
}
uint256 pointRedemption = ledger.balanceOf(owner);
//calculate base price with point redemption
if (pointRedemption > basePrice) {
usedPoint = basePrice;
basePrice = 0;
} else {
basePrice = basePrice - pointRedemption;
usedPoint = pointRedemption;
}
pointRedemption = pointRedemption - usedPoint;
//calculate premium price with point redemption
if (pointRedemption > 0) {
if (pointRedemption > premiumPrice) {
usedPoint = usedPoint + premiumPrice;
premiumPrice = 0;
} else {
premiumPrice = premiumPrice - pointRedemption;
usedPoint = usedPoint + pointRedemption;
}
}
return ISidPriceOracle.Price({base: attoUSDToWei(basePrice), premium: attoUSDToWei(premiumPrice), usedPoint: usedPoint});
}
function attoUSDToWei(uint256 amount) internal view returns (uint256) {
uint256 bnbPrice = uint256(usdOracle.latestAnswer());
return (amount * 1e8) / bnbPrice;
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;
import "./SidGiftCardRegistrar.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./SidGiftCardVoucher.sol";
contract SidGiftCardLedger is Ownable {
SidGiftCardRegistrar public registrar;
SidGiftCardVoucher public voucher;
mapping(address => uint256) public balances;
mapping(address => bool) public controllers;
event ControllerAdded(address indexed controller);
event ControllerRemoved(address indexed controller);
constructor(SidGiftCardRegistrar _registrar, SidGiftCardVoucher _voucher) {
registrar = _registrar;
voucher = _voucher;
}
modifier onlyController() {
require(controllers[msg.sender], "Not a authorized controller");
_;
}
function balanceOf(address account) public view returns (uint256) {
return balances[account];
}
function redeem(uint256[] calldata ids, uint256[] calldata amounts) external {
registrar.batchBurn(msg.sender, ids, amounts);
uint256 totalValue = voucher.totalValue(ids, amounts);
balances[msg.sender] += totalValue;
}
function deduct(address account, uint256 amount) public onlyController {
uint256 fromBalance = balances[account];
require(fromBalance >= amount, "Insufficient balance");
balances[account] = fromBalance - amount;
}
function addController(address controller) external onlyOwner {
require(controller != address(0), "address can not be zero!");
controllers[controller] = true;
emit ControllerAdded(controller);
}
function removeController(address controller) external onlyOwner {
require(controller != address(0), "address can not be zero!");
controllers[controller] = false;
emit ControllerRemoved(controller);
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;
import "@openzeppelin/contracts/access/Ownable.sol";
contract SidGiftCardVoucher is Ownable {
uint256 public constant THREE_DIGIT_VOUCHER = 0;
uint256 public constant FOUR_DIGIT_VOUCHER = 1;
uint256 public constant FIVE_DIGIT_VOUCHER = 2;
uint256 public constant THREE_DIGIT_VOUCHER_VALUE = 500 * (10**18);
uint256 public constant FOUR_DIGIT_VOUCHER_VALUE = 100 * (10**18);
uint256 public constant FIVE_DIGIT_VOUCHER_VALUE = 5 * (10**18);
mapping(uint256 => uint256) public voucherValues;
constructor() {
voucherValues[THREE_DIGIT_VOUCHER] = THREE_DIGIT_VOUCHER_VALUE;
voucherValues[FOUR_DIGIT_VOUCHER] = FOUR_DIGIT_VOUCHER_VALUE;
voucherValues[FIVE_DIGIT_VOUCHER] = FIVE_DIGIT_VOUCHER_VALUE;
}
function addCustomizedVoucher(uint256 tokenId, uint256 price) external onlyOwner {
require(voucherValues[tokenId] == 0, "voucher already exsits");
voucherValues[tokenId] = price;
}
function totalValue(uint256[] calldata ids, uint256[] calldata amounts) external view returns (uint256) {
uint256 total = 0;
for (uint256 i = 0; i < ids.length; i++) {
total += voucherValues[ids[i]] * amounts[i];
}
return total;
}
function isValidVoucherIds(uint256[] calldata id) external view returns (bool) {
for (uint256 i = 0; i < id.length; i++) {
if (voucherValues[id[i]] == 0) {
return false;
}
}
return true;
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;
interface ISidPriceOracle {
struct Price {
uint256 base;
uint256 premium;
uint256 usedPoint;
}
function giftcard(
uint256[] memory ids,
uint256[] memory amounts
) external view returns (Price calldata);
function domain(
string memory name,
uint256 expires,
uint256 duration
) external view returns (Price calldata);
function domainWithPoint(
string memory name,
uint256 expires,
uint256 duration,
address owner
) external view returns (Price calldata);
}pragma solidity >=0.8.4;
library StringUtils {
/**
* @dev Returns the length of a given string
*
* @param s The string to measure the length of
* @return The length of the input string
*/
function strlen(string memory s) internal pure returns (uint) {
uint len;
uint i = 0;
uint bytelength = bytes(s).length;
for(len = 0; i < bytelength; len++) {
bytes1 b = bytes(s)[i];
if(b < 0x80) {
i += 1;
} else if (b < 0xE0) {
i += 2;
} else if (b < 0xF0) {
i += 3;
} else if (b < 0xF8) {
i += 4;
} else if (b < 0xFC) {
i += 5;
} else {
i += 6;
}
}
return len;
}
}// 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
pragma solidity >=0.8.4;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./ISidGiftCardRegistrar.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
contract SidGiftCardRegistrar is ERC1155, ISidGiftCardRegistrar, Ownable, Pausable {
mapping(address => bool) public controllers;
constructor() ERC1155("") {}
modifier onlyController() {
require(controllers[msg.sender], "Not a authorized controller");
_;
}
function setURI(string calldata newURI) external onlyOwner {
_setURI(newURI);
}
function uri(uint256 _id) public view virtual override(ERC1155) returns (string memory) {
return string(abi.encodePacked(ERC1155.uri(_id), Strings.toString(_id)));
}
function name() public view virtual returns (string memory) {
return "SPACE ID Gift Card";
}
function symbol() public view virtual returns (string memory) {
return "SIDGC";
}
function register(
address to,
uint256 id,
uint256 amount
) external onlyController whenNotPaused returns (uint256, uint256) {
super._mint(to, id, amount, "");
return (id, amount);
}
function batchRegister(
address to,
uint256[] calldata ids,
uint256[] calldata amounts
) external onlyController whenNotPaused {
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
for (uint256 i = 0; i < ids.length; i++) {
if (amounts[i] > 0) {
super._mint(to, ids[i], amounts[i], "");
}
}
}
function batchBurn(
address account,
uint256[] calldata ids,
uint256[] calldata amounts
) external onlyController whenNotPaused {
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
for (uint256 i = 0; i < ids.length; i++) {
if (amounts[i] > 0) {
super._burn(account, ids[i], amounts[i]);
}
}
}
function addController(address controller) external override onlyOwner {
require(controller != address(0), "address can not be zero!");
controllers[controller] = true;
emit ControllerAdded(controller);
}
function removeController(address controller) external override onlyOwner {
require(controller != address(0), "address can not be zero!");
controllers[controller] = false;
emit ControllerRemoved(controller);
}
function pause() external onlyOwner {
_pause();
}
function unpause() external onlyOwner {
_unpause();
}
function safeBatchTransferFrom(
address from,
address to,
uint256[] calldata ids,
uint256[] calldata amounts,
bytes calldata data
) public virtual whenNotPaused override(ERC1155, IERC1155) {
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
for (uint256 i = 0; i < ids.length; i++) {
if (amounts[i] > 0) {
super.safeTransferFrom(from, to, ids[i], amounts[i], data);
}
}
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
interface ISidGiftCardRegistrar is IERC1155 {
event ControllerAdded(address indexed controller);
event ControllerRemoved(address indexed controller);
//Authorises a controller, who can issue a gift card.
function addController(address controller) external;
// Revoke controller permission for an address.
function removeController(address controller) external;
//Register new gift card voucher
function register(
address to,
uint256 id,
uint256 amount
) external returns (uint256, uint256);
//batch register new gift card voucher
function batchRegister(
address to,
uint256[] calldata ids,
uint256[] calldata amounts
) external;
}// 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 (security/Pausable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract Pausable is Context {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state.
*/
constructor() {
_paused = false;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
require(!paused(), "Pausable: paused");
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
require(paused(), "Pausable: not paused");
_;
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}// 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 (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/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 (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);
}// 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/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;
}
}{
"optimizer": {
"enabled": true,
"runs": 10000
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"metadata": {
"useLiteralContent": true
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"contract AggregatorInterface","name":"_usdOracle","type":"address"},{"internalType":"contract SidGiftCardLedger","name":"_ledger","type":"address"},{"internalType":"contract SidGiftCardVoucher","name":"_voucher","type":"address"},{"internalType":"uint256","name":"_startPremium","type":"uint256"},{"internalType":"uint256","name":"totalDays","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"uint256","name":"startPremium","type":"uint256"},{"internalType":"uint256","name":"elapsed","type":"uint256"}],"name":"decayedPremium","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"uint256","name":"expires","type":"uint256"},{"internalType":"uint256","name":"duration","type":"uint256"}],"name":"domain","outputs":[{"components":[{"internalType":"uint256","name":"base","type":"uint256"},{"internalType":"uint256","name":"premium","type":"uint256"},{"internalType":"uint256","name":"usedPoint","type":"uint256"}],"internalType":"struct ISidPriceOracle.Price","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"uint256","name":"expires","type":"uint256"},{"internalType":"uint256","name":"duration","type":"uint256"},{"internalType":"address","name":"owner","type":"address"}],"name":"domainWithPoint","outputs":[{"components":[{"internalType":"uint256","name":"base","type":"uint256"},{"internalType":"uint256","name":"premium","type":"uint256"},{"internalType":"uint256","name":"usedPoint","type":"uint256"}],"internalType":"struct ISidPriceOracle.Price","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"giftcard","outputs":[{"components":[{"internalType":"uint256","name":"base","type":"uint256"},{"internalType":"uint256","name":"premium","type":"uint256"},{"internalType":"uint256","name":"usedPoint","type":"uint256"}],"internalType":"struct ISidPriceOracle.Price","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ledger","outputs":[{"internalType":"contract SidGiftCardLedger","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"uint256","name":"expires","type":"uint256"},{"internalType":"uint256","name":"duration","type":"uint256"}],"name":"premium","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"usdOracle","outputs":[{"internalType":"contract AggregatorInterface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"voucher","outputs":[{"internalType":"contract SidGiftCardVoucher","name":"","type":"address"}],"stateMutability":"view","type":"function"}]Contract Creation Code
6101206040523480156200001257600080fd5b50604051620016b6380380620016b68339810160408190526200003591620000d8565b84848462000043336200006f565b6001600160a01b0392831660805290821660a0521660c05260e08290521c61010052506200013d915050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0381168114620000d557600080fd5b50565b600080600080600060a08688031215620000f157600080fd5b8551620000fe81620000bf565b60208701519095506200011181620000bf565b60408701519094506200012481620000bf565b6060870151608090970151959894975095949392505050565b60805160a05160c05160e051610100516115186200019e60003960008181610e870152610eb101526000610e5e0152600081816101ef015261029b01526000818161010d01526108cc0152600081816101c801526109e401526115186000f3fe608060405234801561001057600080fd5b50600436106100c95760003560e01c8063a34e359611610081578063cdda418c1161005b578063cdda418c146101ea578063f2fde38b14610211578063fb8bb3ab1461022457600080fd5b8063a34e35961461019d578063bbf2feec146101b0578063c8a4271f146101c357600080fd5b806359e1777c116100b257806359e1777c14610154578063715018a6146101755780638da5cb5b1461017f57600080fd5b80630e5fd76c146100ce57806356397c3514610108575b600080fd5b6100e16100dc36600461113e565b610237565b60408051825181526020808401519082015291810151908201526060015b60405180910390f35b61012f7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100ff565b6101676101623660046111aa565b610349565b6040519081526020016100ff565b61017d6103e4565b005b60005473ffffffffffffffffffffffffffffffffffffffff1661012f565b6101676101ab36600461120e565b610476565b6100e16101be36600461120e565b6104cc565b61012f7f000000000000000000000000000000000000000000000000000000000000000081565b61012f7f000000000000000000000000000000000000000000000000000000000000000081565b61017d61021f366004611288565b610626565b6100e16102323660046112a3565b610756565b61025b60405180606001604052806000815260200160008152602001600081525090565b6040517f992ba34600000000000000000000000000000000000000000000000000000000815260009073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063992ba346906102d6908990899089908990600401611359565b602060405180830381865afa1580156102f3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610317919061138b565b9050604051806060016040528061032d836109df565b8152602001600081526020016000815250915050949350505050565b60008062015180610362670de0b6b3a7640000856113d3565b61036c9190611410565b90506000610382670de0b6b3a764000083611410565b905084811c600061039b670de0b6b3a7640000846113d3565b6103a5908561144b565b90506000670de0b6b3a76400006103bf83620100006113d3565b6103c99190611410565b905060006103d78285610a93565b9998505050505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461046a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6104746000610db3565b565b60006104c36104be86868080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250889250879150610e289050565b6109df565b95945050505050565b6104f060405180606001604052806000815260200160008152602001600081525090565b600061053186868080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610eeb92505050565b9050600081600114156105555761054e84655af3107a40006113d3565b90506105b2565b816002141561056e5761054e84652d79883d20006113d3565b81600314156105875761054e84650e690e00441d6113d3565b81600414156105a05761054e846502e1cf99a7396113d3565b6105af846424e3fae1f66113d3565b90505b60405180606001604052806105c6836109df565b81526020016106116104be8a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c92508b9150610e289050565b81526000602090910152979650505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146106a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610461565b73ffffffffffffffffffffffffffffffffffffffff811661074a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610461565b61075381610db3565b50565b61077a60405180606001604052806000815260200160008152602001600081525090565b60006107bb87878080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610eeb92505050565b905060008060006108058a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c92508b9150610e289050565b905083600114156108275761082087655af3107a40006113d3565b9250610884565b83600214156108405761082087652d79883d20006113d3565b83600314156108595761082087650e690e00441d6113d3565b836004141561087257610820876502e1cf99a7396113d3565b610881876424e3fae1f66113d3565b92505b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff87811660048301526000917f0000000000000000000000000000000000000000000000000000000000000000909116906370a0823190602401602060405180830381865afa158015610915573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610939919061138b565b90508381111561094d57600093925061095d565b610957818561144b565b93508092505b610967838261144b565b905080156109a5578181111561098c576109818284611462565b9250600091506109a5565b610996818361144b565b91506109a28184611462565b92505b60405180606001604052806109b9866109df565b81526020016109c7846109df565b81526020019390935250909998505050505050505050565b6000807f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166350d25bcd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a71919061138b565b905080610a82846305f5e1006113d3565b610a8c9190611410565b9392505050565b60006001831615610ac657670de0b6b3a7640000610ab9670de0ad151d094180846113d3565b610ac39190611410565b91505b6002831615610af757670de0b6b3a7640000610aea670de0a37699596800846113d3565b610af49190611410565b91505b6004831615610b2857670de0b6b3a7640000610b1b670de09039a5fa5100846113d3565b610b259190611410565b91505b6008831615610b5957670de0b6b3a7640000610b4c670de069c00f3e1200846113d3565b610b569190611410565b91505b6010831615610b8a57670de0b6b3a7640000610b7d670de01cce21c94400846113d3565b610b879190611410565b91505b6020831615610bbb57670de0b6b3a7640000610bae670ddf82ef46ce1000846113d3565b610bb89190611410565b91505b6040831615610bec57670de0b6b3a7640000610bdf670dde4f458f8e8d80846113d3565b610be99190611410565b91505b6080831615610c1d57670de0b6b3a7640000610c10670ddbe84213d5f080846113d3565b610c1a9190611410565b91505b610100831615610c4f57670de0b6b3a7640000610c42670dd71b7aa6df5b80846113d3565b610c4c9190611410565b91505b610200831615610c8157670de0b6b3a7640000610c74670dcd86e7f28cde00846113d3565b610c7e9190611410565b91505b610400831615610cb357670de0b6b3a7640000610ca6670dba71a3084ad680846113d3565b610cb09190611410565b91505b610800831615610ce557670de0b6b3a7640000610cd8670d94961b13dbde80846113d3565b610ce29190611410565b91505b611000831615610d1757670de0b6b3a7640000610d0a670d4a171c35c98380846113d3565b610d149190611410565b91505b612000831615610d4957670de0b6b3a7640000610d3c670cb9da519ccfb700846113d3565b610d469190611410565b91505b614000831615610d7b57670de0b6b3a7640000610d6e670bab76d59c18d680846113d3565b610d789190611410565b91505b618000831615610dad57670de0b6b3a7640000610da06709d025defee4df80846113d3565b610daa9190611410565b91505b50919050565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000610e376276a70084611462565b925042831115610e4957506000610a8c565b6000610e55844261144b565b90506000610e837f000000000000000000000000000000000000000000000000000000000000000083610349565b90507f00000000000000000000000000000000000000000000000000000000000000008110610edf57610ed67f00000000000000000000000000000000000000000000000000000000000000008261144b565b92505050610a8c565b50600095945050505050565b8051600090819081905b808210156110e9576000858381518110610f1157610f1161147a565b01602001517fff000000000000000000000000000000000000000000000000000000000000001690507f8000000000000000000000000000000000000000000000000000000000000000811015610f7457610f6d600184611462565b92506110d6565b7fe0000000000000000000000000000000000000000000000000000000000000007fff0000000000000000000000000000000000000000000000000000000000000082161015610fc957610f6d600284611462565b7ff0000000000000000000000000000000000000000000000000000000000000007fff000000000000000000000000000000000000000000000000000000000000008216101561101e57610f6d600384611462565b7ff8000000000000000000000000000000000000000000000000000000000000007fff000000000000000000000000000000000000000000000000000000000000008216101561107357610f6d600484611462565b7ffc000000000000000000000000000000000000000000000000000000000000007fff00000000000000000000000000000000000000000000000000000000000000821610156110c857610f6d600584611462565b6110d3600684611462565b92505b50826110e1816114a9565b935050610ef5565b50909392505050565b60008083601f84011261110457600080fd5b50813567ffffffffffffffff81111561111c57600080fd5b6020830191508360208260051b850101111561113757600080fd5b9250929050565b6000806000806040858703121561115457600080fd5b843567ffffffffffffffff8082111561116c57600080fd5b611178888389016110f2565b9096509450602087013591508082111561119157600080fd5b5061119e878288016110f2565b95989497509550505050565b600080604083850312156111bd57600080fd5b50508035926020909101359150565b60008083601f8401126111de57600080fd5b50813567ffffffffffffffff8111156111f657600080fd5b60208301915083602082850101111561113757600080fd5b6000806000806060858703121561122457600080fd5b843567ffffffffffffffff81111561123b57600080fd5b611247878288016111cc565b90989097506020870135966040013595509350505050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461128357600080fd5b919050565b60006020828403121561129a57600080fd5b610a8c8261125f565b6000806000806000608086880312156112bb57600080fd5b853567ffffffffffffffff8111156112d257600080fd5b6112de888289016111cc565b90965094505060208601359250604086013591506112fe6060870161125f565b90509295509295909350565b81835260007f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83111561133c57600080fd5b8260051b8083602087013760009401602001938452509192915050565b60408152600061136d60408301868861130a565b828103602084015261138081858761130a565b979650505050505050565b60006020828403121561139d57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561140b5761140b6113a4565b500290565b600082611446577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b60008282101561145d5761145d6113a4565b500390565b60008219821115611475576114756113a4565b500190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156114db576114db6113a4565b506001019056fea2646970667358221220ec66baf202ce20c13bc26a6db4cebf6f6a05142b159add6acb0dea4047b12f1c64736f6c634300080c0033000000000000000000000000639fe6ab55c921f74e7fac1ee960c0b6293ba612000000000000000000000000c9eb5e16c10ad9845f49f280d46aef5899754897000000000000000000000000d99d0b5a302b66222cd36b0bc307ad2b11f21b3a00000000000000000000000000000000000000000052b7d2dcc80cd2e40000000000000000000000000000000000000000000000000000000000000000000015
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100c95760003560e01c8063a34e359611610081578063cdda418c1161005b578063cdda418c146101ea578063f2fde38b14610211578063fb8bb3ab1461022457600080fd5b8063a34e35961461019d578063bbf2feec146101b0578063c8a4271f146101c357600080fd5b806359e1777c116100b257806359e1777c14610154578063715018a6146101755780638da5cb5b1461017f57600080fd5b80630e5fd76c146100ce57806356397c3514610108575b600080fd5b6100e16100dc36600461113e565b610237565b60408051825181526020808401519082015291810151908201526060015b60405180910390f35b61012f7f000000000000000000000000c9eb5e16c10ad9845f49f280d46aef589975489781565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100ff565b6101676101623660046111aa565b610349565b6040519081526020016100ff565b61017d6103e4565b005b60005473ffffffffffffffffffffffffffffffffffffffff1661012f565b6101676101ab36600461120e565b610476565b6100e16101be36600461120e565b6104cc565b61012f7f000000000000000000000000639fe6ab55c921f74e7fac1ee960c0b6293ba61281565b61012f7f000000000000000000000000d99d0b5a302b66222cd36b0bc307ad2b11f21b3a81565b61017d61021f366004611288565b610626565b6100e16102323660046112a3565b610756565b61025b60405180606001604052806000815260200160008152602001600081525090565b6040517f992ba34600000000000000000000000000000000000000000000000000000000815260009073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000d99d0b5a302b66222cd36b0bc307ad2b11f21b3a169063992ba346906102d6908990899089908990600401611359565b602060405180830381865afa1580156102f3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610317919061138b565b9050604051806060016040528061032d836109df565b8152602001600081526020016000815250915050949350505050565b60008062015180610362670de0b6b3a7640000856113d3565b61036c9190611410565b90506000610382670de0b6b3a764000083611410565b905084811c600061039b670de0b6b3a7640000846113d3565b6103a5908561144b565b90506000670de0b6b3a76400006103bf83620100006113d3565b6103c99190611410565b905060006103d78285610a93565b9998505050505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461046a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6104746000610db3565b565b60006104c36104be86868080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250889250879150610e289050565b6109df565b95945050505050565b6104f060405180606001604052806000815260200160008152602001600081525090565b600061053186868080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610eeb92505050565b9050600081600114156105555761054e84655af3107a40006113d3565b90506105b2565b816002141561056e5761054e84652d79883d20006113d3565b81600314156105875761054e84650e690e00441d6113d3565b81600414156105a05761054e846502e1cf99a7396113d3565b6105af846424e3fae1f66113d3565b90505b60405180606001604052806105c6836109df565b81526020016106116104be8a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c92508b9150610e289050565b81526000602090910152979650505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146106a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610461565b73ffffffffffffffffffffffffffffffffffffffff811661074a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610461565b61075381610db3565b50565b61077a60405180606001604052806000815260200160008152602001600081525090565b60006107bb87878080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610eeb92505050565b905060008060006108058a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c92508b9150610e289050565b905083600114156108275761082087655af3107a40006113d3565b9250610884565b83600214156108405761082087652d79883d20006113d3565b83600314156108595761082087650e690e00441d6113d3565b836004141561087257610820876502e1cf99a7396113d3565b610881876424e3fae1f66113d3565b92505b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff87811660048301526000917f000000000000000000000000c9eb5e16c10ad9845f49f280d46aef5899754897909116906370a0823190602401602060405180830381865afa158015610915573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610939919061138b565b90508381111561094d57600093925061095d565b610957818561144b565b93508092505b610967838261144b565b905080156109a5578181111561098c576109818284611462565b9250600091506109a5565b610996818361144b565b91506109a28184611462565b92505b60405180606001604052806109b9866109df565b81526020016109c7846109df565b81526020019390935250909998505050505050505050565b6000807f000000000000000000000000639fe6ab55c921f74e7fac1ee960c0b6293ba61273ffffffffffffffffffffffffffffffffffffffff166350d25bcd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a71919061138b565b905080610a82846305f5e1006113d3565b610a8c9190611410565b9392505050565b60006001831615610ac657670de0b6b3a7640000610ab9670de0ad151d094180846113d3565b610ac39190611410565b91505b6002831615610af757670de0b6b3a7640000610aea670de0a37699596800846113d3565b610af49190611410565b91505b6004831615610b2857670de0b6b3a7640000610b1b670de09039a5fa5100846113d3565b610b259190611410565b91505b6008831615610b5957670de0b6b3a7640000610b4c670de069c00f3e1200846113d3565b610b569190611410565b91505b6010831615610b8a57670de0b6b3a7640000610b7d670de01cce21c94400846113d3565b610b879190611410565b91505b6020831615610bbb57670de0b6b3a7640000610bae670ddf82ef46ce1000846113d3565b610bb89190611410565b91505b6040831615610bec57670de0b6b3a7640000610bdf670dde4f458f8e8d80846113d3565b610be99190611410565b91505b6080831615610c1d57670de0b6b3a7640000610c10670ddbe84213d5f080846113d3565b610c1a9190611410565b91505b610100831615610c4f57670de0b6b3a7640000610c42670dd71b7aa6df5b80846113d3565b610c4c9190611410565b91505b610200831615610c8157670de0b6b3a7640000610c74670dcd86e7f28cde00846113d3565b610c7e9190611410565b91505b610400831615610cb357670de0b6b3a7640000610ca6670dba71a3084ad680846113d3565b610cb09190611410565b91505b610800831615610ce557670de0b6b3a7640000610cd8670d94961b13dbde80846113d3565b610ce29190611410565b91505b611000831615610d1757670de0b6b3a7640000610d0a670d4a171c35c98380846113d3565b610d149190611410565b91505b612000831615610d4957670de0b6b3a7640000610d3c670cb9da519ccfb700846113d3565b610d469190611410565b91505b614000831615610d7b57670de0b6b3a7640000610d6e670bab76d59c18d680846113d3565b610d789190611410565b91505b618000831615610dad57670de0b6b3a7640000610da06709d025defee4df80846113d3565b610daa9190611410565b91505b50919050565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000610e376276a70084611462565b925042831115610e4957506000610a8c565b6000610e55844261144b565b90506000610e837f00000000000000000000000000000000000000000052b7d2dcc80cd2e400000083610349565b90507f00000000000000000000000000000000000000000000000295be96e6406697208110610edf57610ed67f00000000000000000000000000000000000000000000000295be96e6406697208261144b565b92505050610a8c565b50600095945050505050565b8051600090819081905b808210156110e9576000858381518110610f1157610f1161147a565b01602001517fff000000000000000000000000000000000000000000000000000000000000001690507f8000000000000000000000000000000000000000000000000000000000000000811015610f7457610f6d600184611462565b92506110d6565b7fe0000000000000000000000000000000000000000000000000000000000000007fff0000000000000000000000000000000000000000000000000000000000000082161015610fc957610f6d600284611462565b7ff0000000000000000000000000000000000000000000000000000000000000007fff000000000000000000000000000000000000000000000000000000000000008216101561101e57610f6d600384611462565b7ff8000000000000000000000000000000000000000000000000000000000000007fff000000000000000000000000000000000000000000000000000000000000008216101561107357610f6d600484611462565b7ffc000000000000000000000000000000000000000000000000000000000000007fff00000000000000000000000000000000000000000000000000000000000000821610156110c857610f6d600584611462565b6110d3600684611462565b92505b50826110e1816114a9565b935050610ef5565b50909392505050565b60008083601f84011261110457600080fd5b50813567ffffffffffffffff81111561111c57600080fd5b6020830191508360208260051b850101111561113757600080fd5b9250929050565b6000806000806040858703121561115457600080fd5b843567ffffffffffffffff8082111561116c57600080fd5b611178888389016110f2565b9096509450602087013591508082111561119157600080fd5b5061119e878288016110f2565b95989497509550505050565b600080604083850312156111bd57600080fd5b50508035926020909101359150565b60008083601f8401126111de57600080fd5b50813567ffffffffffffffff8111156111f657600080fd5b60208301915083602082850101111561113757600080fd5b6000806000806060858703121561122457600080fd5b843567ffffffffffffffff81111561123b57600080fd5b611247878288016111cc565b90989097506020870135966040013595509350505050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461128357600080fd5b919050565b60006020828403121561129a57600080fd5b610a8c8261125f565b6000806000806000608086880312156112bb57600080fd5b853567ffffffffffffffff8111156112d257600080fd5b6112de888289016111cc565b90965094505060208601359250604086013591506112fe6060870161125f565b90509295509295909350565b81835260007f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83111561133c57600080fd5b8260051b8083602087013760009401602001938452509192915050565b60408152600061136d60408301868861130a565b828103602084015261138081858761130a565b979650505050505050565b60006020828403121561139d57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561140b5761140b6113a4565b500290565b600082611446577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b60008282101561145d5761145d6113a4565b500390565b60008219821115611475576114756113a4565b500190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156114db576114db6113a4565b506001019056fea2646970667358221220ec66baf202ce20c13bc26a6db4cebf6f6a05142b159add6acb0dea4047b12f1c64736f6c634300080c0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000639fe6ab55c921f74e7fac1ee960c0b6293ba612000000000000000000000000c9eb5e16c10ad9845f49f280d46aef5899754897000000000000000000000000d99d0b5a302b66222cd36b0bc307ad2b11f21b3a00000000000000000000000000000000000000000052b7d2dcc80cd2e40000000000000000000000000000000000000000000000000000000000000000000015
-----Decoded View---------------
Arg [0] : _usdOracle (address): 0x639Fe6ab55C921f74e7fac1ee960C0B6293ba612
Arg [1] : _ledger (address): 0xC9Eb5e16c10aD9845f49F280D46AEF5899754897
Arg [2] : _voucher (address): 0xD99d0b5a302b66222cD36b0bC307ad2B11F21b3a
Arg [3] : _startPremium (uint256): 100000000000000000000000000
Arg [4] : totalDays (uint256): 21
-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 000000000000000000000000639fe6ab55c921f74e7fac1ee960c0b6293ba612
Arg [1] : 000000000000000000000000c9eb5e16c10ad9845f49f280d46aef5899754897
Arg [2] : 000000000000000000000000d99d0b5a302b66222cd36b0bc307ad2b11f21b3a
Arg [3] : 00000000000000000000000000000000000000000052b7d2dcc80cd2e4000000
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000015
Loading...
Loading
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 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.