More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 531 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
Value | ||||
---|---|---|---|---|---|---|---|---|---|
Claim | 14453123 | 829 days ago | IN | 0 ETH | 0.00686798 | ||||
Claim | 14446525 | 830 days ago | IN | 0 ETH | 0.00646915 | ||||
Claim | 14443111 | 831 days ago | IN | 0 ETH | 0.00609995 | ||||
Claim | 14443043 | 831 days ago | IN | 0 ETH | 0.00507593 | ||||
Claim | 14442738 | 831 days ago | IN | 0 ETH | 0.00297426 | ||||
Claim | 14441920 | 831 days ago | IN | 0 ETH | 0.00351358 | ||||
Claim | 14439672 | 831 days ago | IN | 0 ETH | 0.00391941 | ||||
Claim | 14438586 | 831 days ago | IN | 0 ETH | 0.00487878 | ||||
Claim | 14438444 | 831 days ago | IN | 0 ETH | 0.00773151 | ||||
Claim | 14438236 | 831 days ago | IN | 0 ETH | 0.0056407 | ||||
Claim | 14434848 | 832 days ago | IN | 0 ETH | 0.00270558 | ||||
Claim | 14434073 | 832 days ago | IN | 0 ETH | 0.00386292 | ||||
Claim | 14432278 | 832 days ago | IN | 0 ETH | 0.00688373 | ||||
Claim | 14431461 | 832 days ago | IN | 0 ETH | 0.00579926 | ||||
Claim | 14431361 | 832 days ago | IN | 0 ETH | 0.00590521 | ||||
Claim | 14431190 | 832 days ago | IN | 0 ETH | 0.00620467 | ||||
Claim | 14431177 | 832 days ago | IN | 0 ETH | 0.00622986 | ||||
Claim | 14429898 | 833 days ago | IN | 0 ETH | 0.00405108 | ||||
Claim | 14428377 | 833 days ago | IN | 0 ETH | 0.00166166 | ||||
Claim | 14428155 | 833 days ago | IN | 0 ETH | 0.00234697 | ||||
Claim | 14428142 | 833 days ago | IN | 0 ETH | 0.00252577 | ||||
Claim | 14427990 | 833 days ago | IN | 0 ETH | 0.0025126 | ||||
Claim | 14427851 | 833 days ago | IN | 0 ETH | 0.0020238 | ||||
Claim | 14427351 | 833 days ago | IN | 0 ETH | 0.00333438 | ||||
Claim | 14427235 | 833 days ago | IN | 0 ETH | 0.00324001 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
FraktalAirdrop
Compiler Version
v0.8.4+commit.c7e474f2
Optimization Enabled:
Yes with 1000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /*** * _______ ______ _______ _ _ _______ _______ * |______ |_____/ |_____| |____/ | |_____| | * | | \_ | | | \_ | | | |_____ * */ import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; import {Pausable} from "@openzeppelin/contracts/security/Pausable.sol"; import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import {MerkleProof} from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; import {IERC20, SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import {IERC1155} from "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; import {FraktalMarket} from "./FraktalMarket.sol"; contract FraktalAirdrop is Pausable, ReentrancyGuard, Ownable { using SafeERC20 for IERC20; //for referencing auction listing struct AuctionListing { address tokenAddress; uint256 reservePrice; uint256 numberOfShares; uint256 auctionEndTime; } IERC20 public immutable fraktalToken; uint256 public immutable MAXIMUM_AMOUNT_TO_CLAIM; bool public isMerkleRootSet; bytes32 public merkleRoot; uint256 public endTimestamp; uint256 public startTimestamp; mapping(address => bool) public hasClaimed; address public fraktalMarket; event AirdropRewardsClaim(address indexed user, uint256 amount); event MerkleRootSet(bytes32 merkleRoot); event NewEndTimestamp(uint256 endTimestamp); event TokensWithdrawn(uint256 amount); constructor( uint256 _startTimestamp,//1647518400 uint256 _endTimestamp,//1648382400 uint256 _maximumAmountToClaim,//10000*10**18 address _fraktalToken, address _market, bytes32 _merkleRoot//0x8dfab5f1445c86bab8ddecc22981110b60bb14aa0e326226e3974785643a4e57 ) { startTimestamp = _startTimestamp; endTimestamp = _endTimestamp; MAXIMUM_AMOUNT_TO_CLAIM = _maximumAmountToClaim; fraktalToken = IERC20(_fraktalToken); fraktalMarket = _market; merkleRoot = _merkleRoot; isMerkleRootSet = true; } function claim( uint256 amount, bytes32[] calldata merkleProof, address listedToken ) external whenNotPaused nonReentrant { require(isMerkleRootSet, "Airdrop: Merkle root not set"); require(amount <= MAXIMUM_AMOUNT_TO_CLAIM, "Airdrop: Amount too high"); require(block.timestamp >= startTimestamp, "Airdrop: Too early to claim"); require(block.timestamp <= endTimestamp, "Airdrop: Too late to claim"); // Verify the user has claimed require(!hasClaimed[msg.sender], "Airdrop: Already claimed"); uint256 listedAmount = FraktalMarket(payable(fraktalMarket)).getListingAmount(msg.sender,listedToken); (,,uint256 listedAuctionAmount,,) = FraktalMarket(payable(fraktalMarket)).auctionListings(listedToken,msg.sender,0); //check if any listing available bool isListed = listedAmount > 0 || listedAuctionAmount > 0; require(isListed,"No NFT listed"); // Compute the node and verify the merkle proof bytes32 node = keccak256(abi.encodePacked(msg.sender, amount)); require(MerkleProof.verify(merkleProof, merkleRoot, node), "Airdrop: Invalid proof"); // Set as claimed hasClaimed[msg.sender] = true; // parse to Fraktal distribution amount = this.parseTier(amount); // Transfer tokens fraktalToken.safeTransfer(msg.sender, amount); emit AirdropRewardsClaim(msg.sender, amount); } function canClaim( address user, uint256 amount, bytes32[] calldata merkleProof ) external view returns (bool) { if (block.timestamp <= endTimestamp) { // Compute the node and verify the merkle proof bytes32 node = keccak256(abi.encodePacked(user, amount)); return MerkleProof.verify(merkleProof, merkleRoot, node); } else { return false; } } function pauseAirdrop() external onlyOwner whenNotPaused { _pause(); } function unpauseAirdrop() external onlyOwner whenPaused { _unpause(); } function updateEndTimestamp(uint256 newEndTimestamp) external onlyOwner { require(block.timestamp + 30 days > newEndTimestamp, "Owner: New timestamp too far"); endTimestamp = newEndTimestamp; emit NewEndTimestamp(newEndTimestamp); } function withdrawTokenRewards() external onlyOwner { require(block.timestamp > (endTimestamp + 1 days), "Owner: Too early to remove rewards"); uint256 balanceToWithdraw = fraktalToken.balanceOf(address(this)); fraktalToken.safeTransfer(msg.sender, balanceToWithdraw); emit TokensWithdrawn(balanceToWithdraw); } //refer https://docs.fraktal.io/fraktal-governance-token-frak/airdrop function parseTier(uint256 amount) public pure returns (uint256 parsed){ if(amount == 10000 ether){ return 7900 ether; } if(amount == 4540 ether){ return 3160 ether; } if(amount == 2450 ether){ return 2370 ether; } if(amount == 1500 ether){ return 1580 ether; } if(amount == 1200 ether){ return 790 ether; } if(amount == 800 ether){ return 474 ether; } if(amount == 400 ether){ return 316 ether; } if(amount == 200 ether){ return 252 ether; } if(amount == 125 ether){ return 126 ether; } return 0; } function setFraktalMarket(address _market) external{ fraktalMarket = _market; } }
// SPDX-License-Identifier: MIT 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() { _setOwner(_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 { _setOwner(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"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT 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 pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and make it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev These functions deal with verification of Merkle Trees proofs. * * The proofs can be generated using the JavaScript library * https://github.com/miguelmota/merkletreejs[merkletreejs]. * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled. * * See `test/utils/cryptography/MerkleProof.test.js` for some examples. */ library MerkleProof { /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. */ function verify( bytes32[] memory proof, bytes32 root, bytes32 leaf ) internal pure returns (bool) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { bytes32 proofElement = proof[i]; if (computedHash <= proofElement) { // Hash(current computed hash + current element of the proof) computedHash = keccak256(abi.encodePacked(computedHash, proofElement)); } else { // Hash(current element of the proof + current computed hash) computedHash = keccak256(abi.encodePacked(proofElement, computedHash)); } } // Check if the computed hash (root) is equal to the provided root return computedHash == root; } }
// SPDX-License-Identifier: MIT 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 pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT 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 pragma solidity ^0.8.0; import "./FraktalNFT.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/ClonesUpgradeable.sol"; import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol"; import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol"; // import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; contract FraktalMarket is Initializable, OwnableUpgradeable, ReentrancyGuardUpgradeable, ERC1155Holder { uint16 public fee; uint256 public listingFee; uint256 private feesAccrued; struct Proposal { uint256 value; bool winner; } struct Listing { address tokenAddress; uint256 price; uint256 numberOfShares; string name; } struct AuctionListing { address tokenAddress; uint256 reservePrice; uint256 numberOfShares; uint256 auctionEndTime; string name; } mapping(address => mapping(address => Listing)) listings; mapping(address => mapping(address => mapping(uint256 => AuctionListing))) public auctionListings; mapping(address => uint256) public auctionNonce; mapping(address => mapping(uint256 => uint256)) public auctionReserve; mapping(address => mapping(uint256 => bool)) public auctionSellerRedeemed; //use below mapping as like this: participantContribution[auctioneer][sellerNonce][participant] mapping(address => mapping(uint256 => mapping(address => uint256))) public participantContribution; mapping(address => mapping(address => Proposal)) public offers; mapping(address => uint256) public sellersBalance; mapping(address => uint256) public maxPriceRegistered; event Bought( address buyer, address seller, address tokenAddress, uint256 numberOfShares ); event FeeUpdated(uint16 newFee); event ListingFeeUpdated(uint256 newFee); event ItemListed( address owner, address tokenAddress, uint256 price, uint256 amountOfShares, string name ); event AuctionItemListed( address owner, address tokenAddress, uint256 reservePrice, uint256 amountOfShares, uint256 endTime, uint256 nonce, string name ); event AuctionContribute( address participant, address tokenAddress, address seller, uint256 sellerNonce, uint256 value ); event FraktalClaimed(address owner, address tokenAddress); event SellerPaymentPull(address seller, uint256 balance); event AdminWithdrawFees(uint256 feesAccrued); event OfferMade(address offerer, address tokenAddress, uint256 value); event OfferVoted(address voter, address offerer, address tokenAddress, bool sold); event Volume(address user, uint256 volume); function initialize() public initializer { __Ownable_init(); fee = 500; //5% } // Admin Functions ////////////////////////////////// function setFee(uint16 _newFee) external onlyOwner { require(_newFee >= 0); require(_newFee < 10000); fee = _newFee; emit FeeUpdated(_newFee); } function setListingFee(uint256 _newListingFee) external onlyOwner { require(_newListingFee >= 0); require(_newListingFee < 10000); listingFee = _newListingFee; emit ListingFeeUpdated(_newListingFee); } function withdrawAccruedFees() external onlyOwner nonReentrant returns (bool) { address payable wallet = payable(_msgSender()); uint256 bufferedFees = feesAccrued; feesAccrued = 0; AddressUpgradeable.sendValue(wallet, bufferedFees); emit AdminWithdrawFees(bufferedFees); return true; } // Users Functions ////////////////////////////////// function rescueEth() external nonReentrant { require(sellersBalance[_msgSender()] > 0, "No claimed ETH"); address payable seller = payable(_msgSender()); uint256 balance = sellersBalance[_msgSender()]; sellersBalance[_msgSender()] = 0; AddressUpgradeable.sendValue(seller, balance); emit SellerPaymentPull(_msgSender(), balance); } function redeemAuctionSeller( address _tokenAddress, address _seller, uint256 _sellerNonce ) external nonReentrant { require(_seller == _msgSender()); require(!auctionSellerRedeemed[_seller][_sellerNonce]);//is seller already claim? AuctionListing storage auctionListed = auctionListings[_tokenAddress][_msgSender()][_sellerNonce]; require(block.timestamp >= auctionListed.auctionEndTime);//is auction ended? uint256 _auctionReserve = auctionReserve[_seller][_sellerNonce]; //auction successful //give eth minus fee to seller if(_auctionReserve>=auctionListed.reservePrice){ uint256 totalForSeller = _auctionReserve - ((_auctionReserve * fee) / 10000); feesAccrued += _auctionReserve - totalForSeller; (bool sent,) = _msgSender().call{value: totalForSeller}(""); auctionSellerRedeemed[_seller][_sellerNonce] = true; emit Volume(_msgSender(),totalForSeller); require(sent);//check if ether failed to send } //auction failed else{ auctionSellerRedeemed[_seller][_sellerNonce] = true; FraktalNFT(_tokenAddress).safeTransferFrom( address(this), _msgSender(), FraktalNFT(_tokenAddress).fraktionsIndex(), auctionListed.numberOfShares, "" ); } } function redeemAuctionParticipant( address _tokenAddress, address _seller, uint256 _sellerNonce ) external nonReentrant { AuctionListing storage auctionListing = auctionListings[_tokenAddress][_seller][_sellerNonce]; require(block.timestamp >= auctionListing.auctionEndTime);//is auction ended? require(auctionListing.auctionEndTime>0);//is auction exist? uint256 _auctionReserve = auctionReserve[_seller][_sellerNonce]; uint256 fraktionsIndex = FraktalNFT(_tokenAddress).fraktionsIndex(); //auction successful //give participant fraktions according to their contribution if(_auctionReserve>=auctionListing.reservePrice){ uint256 auctionFraks = auctionListing.numberOfShares; uint256 _participantContribution = participantContribution[_seller][_sellerNonce][_msgSender()]; uint256 eligibleFrak = (_participantContribution * auctionFraks) / _auctionReserve; participantContribution[_seller][_sellerNonce][_msgSender()] = 0; emit Volume(_msgSender(),_participantContribution); FraktalNFT(_tokenAddress).safeTransferFrom( address(this), _msgSender(), fraktionsIndex, eligibleFrak, "" ); } //auction failed //give back contributed eth to participant else{ uint256 _contributed = participantContribution[_seller][_sellerNonce][_msgSender()]; participantContribution[_seller][_sellerNonce][_msgSender()] = 0; (bool sent,) = _msgSender().call{value: _contributed}(""); require(sent);//check if ether failed to send } } function importFraktal(address tokenAddress, uint256 fraktionsIndex) external { FraktalNFT(tokenAddress).safeTransferFrom( _msgSender(), address(this), 0, 1, "" ); FraktalNFT(tokenAddress).fraktionalize(_msgSender(), fraktionsIndex); FraktalNFT(tokenAddress).lockSharesTransfer( _msgSender(), 10000*10**18, address(this) ); FraktalNFT(tokenAddress).unlockSharesTransfer(_msgSender(), address(this)); } function buyFraktions( address from, address tokenAddress, uint256 _numberOfShares ) external payable nonReentrant { Listing storage listing = listings[tokenAddress][from]; require(!FraktalNFT(tokenAddress).sold(), "item sold"); require( listing.numberOfShares >= _numberOfShares );//"Not enough Fraktions on sale" uint256 buyPrice = (listing.price * _numberOfShares)/(10**18); require(buyPrice!=0); uint256 totalFees = (buyPrice * fee) / 10000; uint256 totalForSeller = buyPrice - totalFees; uint256 fraktionsIndex = FraktalNFT(tokenAddress).fraktionsIndex(); require(msg.value >= buyPrice);//"FraktalMarket: insufficient funds" listing.numberOfShares = listing.numberOfShares - _numberOfShares; if (listing.price * 10000 > maxPriceRegistered[tokenAddress]) { maxPriceRegistered[tokenAddress] = listing.price * 10000; } feesAccrued += msg.value - totalForSeller; sellersBalance[from] += totalForSeller; FraktalNFT(tokenAddress).safeTransferFrom( from, _msgSender(), fraktionsIndex, _numberOfShares, "" ); emit Bought(_msgSender(), from, tokenAddress, _numberOfShares); emit Volume(_msgSender(),msg.value); emit Volume(from,msg.value); } function participateAuction( address tokenAddress, address seller, uint256 sellerNonce ) external payable nonReentrant { AuctionListing storage auctionListing = auctionListings[tokenAddress][seller][sellerNonce]; require(block.timestamp < auctionListing.auctionEndTime);//is auction still ongoing? require(auctionListing.auctionEndTime>0);//is auction exist? uint256 contribution = msg.value; require(contribution>0);//need eth to participate //note of Eth contribution to auction reserve and participant auctionReserve[seller][sellerNonce] += msg.value; participantContribution[seller][sellerNonce][_msgSender()] += contribution; emit AuctionContribute(_msgSender(), tokenAddress, seller, sellerNonce, contribution); } function listItem( address _tokenAddress, uint256 _price,//wei per frak uint256 _numberOfShares, string memory _name ) payable external returns (bool) { require(msg.value >= listingFee); require(_price>0); uint256 fraktionsIndex = FraktalNFT(_tokenAddress).fraktionsIndex(); require( FraktalNFT(_tokenAddress).balanceOf(address(this), 0) == 1 );// "nft not in market" require(!FraktalNFT(_tokenAddress).sold());//"item sold" require( FraktalNFT(_tokenAddress).balanceOf(_msgSender(), fraktionsIndex) >= _numberOfShares );//"no valid Fraktions" Listing memory listed = listings[_tokenAddress][_msgSender()]; require(listed.numberOfShares == 0);//"unlist first" Listing memory listing = Listing({ tokenAddress: _tokenAddress, price: _price, numberOfShares: _numberOfShares, name: _name }); listings[_tokenAddress][_msgSender()] = listing; emit ItemListed(_msgSender(), _tokenAddress, _price, _numberOfShares, _name); return true; } function listItemAuction( address _tokenAddress, uint256 _reservePrice, uint256 _numberOfShares, string memory _name ) payable external returns (uint256) { require(msg.value >= listingFee); uint256 fraktionsIndex = FraktalNFT(_tokenAddress).fraktionsIndex(); require( FraktalNFT(_tokenAddress).balanceOf(address(this), 0) == 1 );//"nft not in market" require(!FraktalNFT(_tokenAddress).sold());// "item sold" require( FraktalNFT(_tokenAddress).balanceOf(_msgSender(), fraktionsIndex) >= _numberOfShares );//"no valid Fraktions" require(_reservePrice>0); uint256 sellerNonce = auctionNonce[_msgSender()]++; uint256 _endTime = block.timestamp + (10 days); auctionListings[_tokenAddress][_msgSender()][sellerNonce] = AuctionListing({ tokenAddress: _tokenAddress, reservePrice: _reservePrice, numberOfShares: _numberOfShares, auctionEndTime: _endTime, name: _name }); FraktalNFT(_tokenAddress).safeTransferFrom( _msgSender(), address(this), fraktionsIndex, _numberOfShares, "" ); emit AuctionItemListed(_msgSender(), _tokenAddress, _reservePrice, _numberOfShares, _endTime, sellerNonce, _name); return auctionNonce[_msgSender()]; } function exportFraktal(address tokenAddress) public { uint256 fraktionsIndex = FraktalNFT(tokenAddress).fraktionsIndex(); FraktalNFT(tokenAddress).safeTransferFrom(_msgSender(), address(this), fraktionsIndex, 10000*10**18, ''); FraktalNFT(tokenAddress).defraktionalize(); FraktalNFT(tokenAddress).safeTransferFrom(address(this), _msgSender(), 0, 1, ''); } function makeOffer(address tokenAddress, uint256 _value) public payable { require(msg.value >= _value);//"No pay" Proposal storage prop = offers[_msgSender()][tokenAddress]; address payable offerer = payable(_msgSender()); require(!prop.winner);// "offer accepted" if (_value >= prop.value) { require(_value >= maxPriceRegistered[tokenAddress], "Min offer"); require(msg.value >= _value - prop.value); } else { uint256 bufferedValue = prop.value; prop.value = 0; AddressUpgradeable.sendValue(offerer, bufferedValue); } offers[_msgSender()][tokenAddress] = Proposal({ value: _value, winner: false }); emit OfferMade(_msgSender(), tokenAddress, _value); } function rejectOffer(address from, address to, address tokenAddress) external { FraktalNFT(tokenAddress).unlockSharesTransfer( from, to ); } function voteOffer(address offerer, address tokenAddress) external { uint256 fraktionsIndex = FraktalNFT(tokenAddress).fraktionsIndex(); Proposal storage offer = offers[offerer][tokenAddress]; uint256 lockedShares = FraktalNFT(tokenAddress).lockedShares(fraktionsIndex,_msgSender()); uint256 votesAvailable = FraktalNFT(tokenAddress).balanceOf( _msgSender(), fraktionsIndex ) - lockedShares; FraktalNFT(tokenAddress).lockSharesTransfer( _msgSender(), votesAvailable, offerer ); uint256 lockedToOfferer = FraktalNFT(tokenAddress).lockedToTotal(fraktionsIndex,offerer); bool sold = false; if (lockedToOfferer > FraktalNFT(tokenAddress).majority()) { FraktalNFT(tokenAddress).sellItem(); offer.winner = true; sold = true; } emit OfferVoted(_msgSender(), offerer, tokenAddress, sold); } function claimFraktal(address tokenAddress) external { uint256 fraktionsIndex = FraktalNFT(tokenAddress).fraktionsIndex(); if (FraktalNFT(tokenAddress).sold()) { Proposal memory offer = offers[_msgSender()][tokenAddress]; require( FraktalNFT(tokenAddress).lockedToTotal(fraktionsIndex,_msgSender()) > FraktalNFT(tokenAddress).majority(), "not buyer" ); FraktalNFT(tokenAddress).createRevenuePayment{ value: offer.value }(address(this)); maxPriceRegistered[tokenAddress] = 0; } FraktalNFT(tokenAddress).safeTransferFrom( address(this), _msgSender(), 0, 1, "" ); emit FraktalClaimed(_msgSender(), tokenAddress); } function unlistItem(address tokenAddress) external { delete listings[tokenAddress][_msgSender()]; emit ItemListed(_msgSender(), tokenAddress, 0, 0, ""); } function unlistAuctionItem(address tokenAddress,uint256 sellerNonce) external { AuctionListing storage auctionListed = auctionListings[tokenAddress][_msgSender()][sellerNonce]; require(auctionListed.auctionEndTime>0); auctionListed.auctionEndTime = block.timestamp; emit AuctionItemListed(_msgSender(), tokenAddress, 0, 0, auctionListed.auctionEndTime,sellerNonce, ""); } // GETTERS ////////////////////////////////// function getFee() external view returns (uint256) { return (fee); } function getListingPrice(address _listOwner, address tokenAddress) external view returns (uint256) { return listings[tokenAddress][_listOwner].price; } function getListingAmount(address _listOwner, address tokenAddress) external view returns (uint256) { return listings[tokenAddress][_listOwner].numberOfShares; } function getSellerBalance(address _who) external view returns (uint256) { return (sellersBalance[_who]); } function getOffer(address offerer, address tokenAddress) external view returns (uint256) { return (offers[offerer][tokenAddress].value); } fallback() external payable { feesAccrued += msg.value; } receive() external payable { feesAccrued += msg.value; } }
// SPDX-License-Identifier: MIT 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 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 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 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 pragma solidity ^0.8.0; import "@openzeppelin/contracts-upgradeable/proxy/ClonesUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol"; import "./PaymentSplitterUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol"; import "@openzeppelin/contracts/utils/structs/EnumerableMap.sol"; import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC1155/utils/ERC1155HolderUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC721/utils/ERC721HolderUpgradeable.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; contract FraktalNFT is ERC1155Upgradeable,ERC721HolderUpgradeable,ERC1155HolderUpgradeable{ using EnumerableSet for EnumerableSet.AddressSet; using EnumerableMap for EnumerableMap.UintToAddressMap; address revenueChannelImplementation; bool fraktionalized; bool public sold; uint256 public fraktionsIndex; uint16 public majority; mapping(uint256 => bool) public indexUsed; mapping(uint256 => mapping(address => uint256)) public lockedShares; mapping(uint256 => mapping(address => uint256)) public lockedToTotal; EnumerableSet.AddressSet private holders; EnumerableMap.UintToAddressMap private revenues; string public name = "FraktalNFT"; string public symbol = "FRAK"; address public factory; address collateral; event LockedSharesForTransfer( address shareOwner, address to, uint256 numShares ); event unLockedSharesForTransfer( address shareOwner, address to, uint256 numShares ); event ItemSold(address buyer, uint256 indexUsed); event NewRevenueAdded( address payer, address revenueChannel, uint256 amount, bool sold ); event Fraktionalized(address holder, address minter, uint256 index); event Defraktionalized(address holder, uint256 index); event MajorityValueChanged(uint16 newValue); // constructor() initializer {} function init( address _creator, address _revenueChannelImplementation, string calldata uri, uint16 _majority, string memory _name, string memory _symbol ) external initializer { __ERC1155_init(uri); _mint(_creator, 0, 1, ""); fraktionalized = false; sold = false; majority = _majority; revenueChannelImplementation = _revenueChannelImplementation; holders.add(_creator); if(keccak256(abi.encodePacked(_name)) != keccak256(abi.encodePacked("")) && keccak256(abi.encodePacked(_symbol)) != keccak256(abi.encodePacked("")) ){ name = _name; symbol = _symbol; } factory = msg.sender;//factory as msg.sender } // User Functions /////////////////////////// function fraktionalize(address _to, uint256 _tokenId) external { require((_tokenId != 0) && (this.balanceOf(_msgSender(), 0) == 1) && !fraktionalized && (indexUsed[_tokenId] == false) ); // require(this.balanceOf(_msgSender(), 0) == 1); // require(fraktionalized == false); // require(indexUsed[_tokenId] == false); fraktionalized = true; sold = false; fraktionsIndex = _tokenId; _mint(_to, _tokenId, 10000*10**18, ""); emit Fraktionalized(_msgSender(), _to, _tokenId); } function defraktionalize() external { fraktionalized = false; _burn(_msgSender(), fraktionsIndex, 10000*10**18); emit Defraktionalized(_msgSender(), fraktionsIndex); } function setMajority(uint16 newValue) external { require((this.balanceOf(_msgSender(), 0) == 1)&& (newValue <= 10000*10**18) ); // require(newValue <= 10000*10**18); // require(newValue > 0); majority = newValue; emit MajorityValueChanged(newValue); } function soldBurn( address owner, uint256 _tokenId, uint256 bal ) external { if (_msgSender() != owner) { require(isApprovedForAll(owner, _msgSender())); } _burn(owner, _tokenId, bal); } function lockSharesTransfer( address from, uint256 numShares, address _to ) external { if (from != _msgSender()) { require(isApprovedForAll(from, _msgSender())); } require( balanceOf(from, fraktionsIndex) - lockedShares[fraktionsIndex][from] >= numShares ); lockedShares[fraktionsIndex][from] += numShares; lockedToTotal[fraktionsIndex][_to] += numShares; emit LockedSharesForTransfer(from, _to, numShares); } function unlockSharesTransfer(address from, address _to) external { require(!sold); if (from != _msgSender()) { require(isApprovedForAll(from, _msgSender())); } uint256 balance = lockedShares[fraktionsIndex][from]; lockedShares[fraktionsIndex][from] -= balance; lockedToTotal[fraktionsIndex][_to] -= balance; emit unLockedSharesForTransfer(from, _to, 0); } function createRevenuePayment(address _marketAddress) external payable returns (address _clone) { cleanUpHolders(); address[] memory owners = holders.values(); uint256 listLength = holders.length(); uint256[] memory fraktions = new uint256[](listLength); for (uint256 i = 0; i < listLength; i++) { fraktions[i] = this.balanceOf(owners[i], fraktionsIndex); } _clone = ClonesUpgradeable.clone(revenueChannelImplementation); address payable revenueContract = payable(_clone); PaymentSplitterUpgradeable(revenueContract).init(owners, fraktions, _marketAddress); uint256 bufferedValue = msg.value; AddressUpgradeable.sendValue(revenueContract, bufferedValue); uint256 index = revenues.length(); revenues.set(index, _clone); emit NewRevenueAdded(_msgSender(), revenueContract, msg.value, sold); } function sellItem() external payable { require(this.balanceOf(_msgSender(), 0) == 1); sold = true; fraktionalized = false; indexUsed[fraktionsIndex] = true; emit ItemSold(_msgSender(), fraktionsIndex); } function cleanUpHolders() internal { uint16 cur = 0; while(cur < holders.length()){ if (this.balanceOf(holders.at(cur), fraktionsIndex) < 1) { holders.remove(holders.at(cur)); cur=0; } cur++; } } // Overrided functions //////////////////////////////// function _beforeTokenTransfer( address operator, address from, address to, uint256[] memory tokenId, uint256[] memory amount, bytes memory data ) internal virtual override { super._beforeTokenTransfer(operator, from, to, tokenId, amount, data); if (from != address(0) && to != address(0)) { if (tokenId[0] == 0) { if (fraktionalized == true && sold == false) { require((lockedToTotal[fraktionsIndex][to] > 9999)); } } else { require(sold != true); require( (balanceOf(from, tokenId[0]) - lockedShares[fraktionsIndex][from] >= amount[0]) ); } holders.add(to); } } // Getters /////////////////////////// // function getRevenue(uint256 index) external view returns (address) { // return revenues.get(index); // } // function getFraktions(address who) external view returns (uint256) { // return this.balanceOf(who, fraktionsIndex); // } // function getLockedShares(uint256 index, address who) // external // view // returns (uint256) // { // return lockedShares[index][who]; // } // function getLockedToTotal(uint256 index, address who) // external // view // returns (uint256) // { // return lockedToTotal[index][who]; // } /** *@notice transfer contained ERC721 to the Fraktal owner with given address and index *@param contractAddress address of ERC721 contained *@param index index of the ERC721 */ //todo: Should block if collateral is being claimed function claimContainedERC721(address contractAddress, uint256 index) external{ if(msg.sender != factory){ require(contractAddress != collateral); } require((this.balanceOf(msg.sender, 0) == 1) && !fraktionalized && (IERC721(contractAddress).ownerOf(index) == address(this))); // require(fraktionalized==false); // require(IERC721(contractAddress).ownerOf(index) == address(this)); IERC721(contractAddress).safeTransferFrom(address(this), msg.sender, index); } /** *@notice transfer contained ERC1155 to the Fraktal owner with given address and index *@param contractAddress address of ERC1155 contained *@param index index of the ERC1155 */ //todo: Should block if collateral is being claimed function claimContainedERC1155(address contractAddress, uint256 index, uint256 amount) external{ if(msg.sender != factory){ require(contractAddress != collateral); } require((this.balanceOf(msg.sender, 0) == 1) && !fraktionalized); IERC1155(contractAddress).safeTransferFrom(address(this), msg.sender, index, amount,""); } function supportsInterface(bytes4 interfaceId) public view virtual override(ERC1155Upgradeable, ERC1155ReceiverUpgradeable) returns (bool) { return ERC1155Upgradeable.supportsInterface(interfaceId) || ERC1155ReceiverUpgradeable.supportsInterface(interfaceId); } function setCollateral(address _collateral ) external{ require(msg.sender == factory); collateral = _collateral; } // function getStatus() external view returns (bool) { // return sold; // } // function getFraktionsIndex() external view returns (uint256) { // return fraktionsIndex; // } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC1155/ERC1155.sol) pragma solidity ^0.8.0; import "./IERC1155Upgradeable.sol"; import "./IERC1155ReceiverUpgradeable.sol"; import "./extensions/IERC1155MetadataURIUpgradeable.sol"; import "../../utils/AddressUpgradeable.sol"; import "../../utils/ContextUpgradeable.sol"; import "../../utils/introspection/ERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.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 ERC1155Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC1155Upgradeable, IERC1155MetadataURIUpgradeable { using AddressUpgradeable 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}. */ function __ERC1155_init(string memory uri_) internal onlyInitializing { __Context_init_unchained(); __ERC165_init_unchained(); __ERC1155_init_unchained(uri_); } function __ERC1155_init_unchained(string memory uri_) internal onlyInitializing { _setURI(uri_); } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) { return interfaceId == type(IERC1155Upgradeable).interfaceId || interfaceId == type(IERC1155MetadataURIUpgradeable).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 IERC1155ReceiverUpgradeable(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) { if (response != IERC1155ReceiverUpgradeable.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 IERC1155ReceiverUpgradeable(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns ( bytes4 response ) { if (response != IERC1155ReceiverUpgradeable.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; } uint256[47] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/Clones.sol) pragma solidity ^0.8.0; /** * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for * deploying minimal proxy contracts, also known as "clones". * * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies * > a minimal bytecode implementation that delegates all calls to a known, fixed address. * * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2` * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the * deterministic method. * * _Available since v3.4._ */ library ClonesUpgradeable { /** * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`. * * This function uses the create opcode, which should never revert. */ function clone(address implementation) internal returns (address instance) { assembly { let ptr := mload(0x40) mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000) mstore(add(ptr, 0x14), shl(0x60, implementation)) mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000) instance := create(0, ptr, 0x37) } require(instance != address(0), "ERC1167: create failed"); } /** * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`. * * This function uses the create2 opcode and a `salt` to deterministically deploy * the clone. Using the same `implementation` and `salt` multiple time will revert, since * the clones cannot be deployed twice at the same address. */ function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) { assembly { let ptr := mload(0x40) mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000) mstore(add(ptr, 0x14), shl(0x60, implementation)) mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000) instance := create2(0, ptr, 0x37, salt) } require(instance != address(0), "ERC1167: create2 failed"); } /** * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}. */ function predictDeterministicAddress( address implementation, bytes32 salt, address deployer ) internal pure returns (address predicted) { assembly { let ptr := mload(0x40) mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000) mstore(add(ptr, 0x14), shl(0x60, implementation)) mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf3ff00000000000000000000000000000000) mstore(add(ptr, 0x38), shl(0x60, deployer)) mstore(add(ptr, 0x4c), salt) mstore(add(ptr, 0x6c), keccak256(ptr, 0x37)) predicted := keccak256(add(ptr, 0x37), 0x55) } } /** * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}. */ function predictDeterministicAddress(address implementation, bytes32 salt) internal view returns (address predicted) { return predictDeterministicAddress(implementation, salt, address(this)); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./ERC1155Receiver.sol"; /** * @dev _Available since v3.1._ */ contract ERC1155Holder is ERC1155Receiver { function onERC1155Received( address, address, uint256, uint256, bytes memory ) public virtual override returns (bytes4) { return this.onERC1155Received.selector; } function onERC1155BatchReceived( address, address, uint256[] memory, uint256[] memory, bytes memory ) public virtual override returns (bytes4) { return this.onERC1155BatchReceived.selector; } }
// 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 AddressUpgradeable { /** * @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 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 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuardUpgradeable is Initializable { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; function __ReentrancyGuard_init() internal onlyInitializing { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal onlyInitializing { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.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 OwnableUpgradeable is Initializable, ContextUpgradeable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function __Ownable_init() internal onlyInitializing { __Context_init_unchained(); __Ownable_init_unchained(); } function __Ownable_init_unchained() internal onlyInitializing { _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); } uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/utils/Initializable.sol) pragma solidity ^0.8.0; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() initializer {} * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { // If the contract is initializing we ignore whether _initialized is set in order to support multiple // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the // contract may have been reentered. require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} modifier, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } function _isConstructor() private view returns (bool) { return !AddressUpgradeable.isContract(address(this)); } }
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IFraktalNFT.sol"; import "./FraktalNFT.sol"; import "./FraktalMarket.sol"; import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; /** * @title PaymentSplitter * @dev This contract allows to split Ether payments among a group of accounts. The sender does not need to be aware * that the Ether will be split in this way, since it is handled transparently by the contract. * * The split can be in equal parts or in any other arbitrary proportion. The way this is specified is by assigning each * account to a number of shares. Of all the Ether that this contract receives, each account will then be able to claim * an amount proportional to the percentage of total shares they were assigned. * * `PaymentSplitter` follows a _pull payment_ model. This means that payments are not automatically forwarded to the * accounts but kept in this contract, and the actual transfer is triggered as a separate step by calling the {release} * function. */ contract PaymentSplitterUpgradeable is Initializable, ContextUpgradeable { event PayeeAdded(address account, uint256 shares); event PaymentReleased(address to, uint256 amount); event PaymentReceived(address from, uint256 amount); uint256 private _totalShares; uint256 private _totalReleased; mapping(address => uint256) private _shares; mapping(address => uint256) private _released; address[] private _payees; address tokenParent; uint256 fraktionsIndex; bool public buyout; address marketContract; /** * @dev Creates an instance of `PaymentSplitter` where each account in `payees` is assigned the number of shares at * the matching position in the `shares` array. * * All addresses in `payees` must be non-zero. Both arrays must have the same non-zero length, and there must be no * duplicates in `payees`. */ function init(address[] memory payees, uint256[] memory shares_, address _marketContract) external initializer { __PaymentSplitter_init(payees, shares_); tokenParent = _msgSender(); fraktionsIndex = FraktalNFT(_msgSender()).fraktionsIndex(); buyout = FraktalNFT(_msgSender()).sold(); marketContract = _marketContract; } function __PaymentSplitter_init( address[] memory payees, uint256[] memory shares_ ) internal { __Context_init_unchained(); __PaymentSplitter_init_unchained(payees, shares_); } function __PaymentSplitter_init_unchained( address[] memory payees, uint256[] memory shares_ ) internal { require( payees.length == shares_.length, "PaymentSplitter: payees and shares length mismatch" ); require(payees.length > 0, "PaymentSplitter: no payees"); for (uint256 i = 0; i < payees.length; i++) { _addPayee(payees[i], shares_[i]); } } /** * @dev The Ether received will be logged with {PaymentReceived} events. Note that these events are not fully * reliable: it's possible for a contract to receive Ether without triggering this function. This only affects the * reliability of the events, and not the actual splitting of Ether. * * To learn more about this see the Solidity documentation for * https://solidity.readthedocs.io/en/latest/contracts.html#fallback-function[fallback * functions]. */ receive() external payable virtual { emit PaymentReceived(_msgSender(), msg.value); } /** * @dev Getter for the total shares held by payees. */ function totalShares() external view returns (uint256) { return _totalShares; } /** * @dev Getter for the total amount of Ether already released. */ function totalReleased() external view returns (uint256) { return _totalReleased; } /** * @dev Getter for the amount of shares held by an account. */ function shares(address account) external view returns (uint256) { return _shares[account]; } /** * @dev Getter for the amount of Ether already released to a payee. */ function released(address account) external view returns (uint256) { return _released[account]; } /** * @dev Getter for the address of the payee number `index`. */ function payee(uint256 index) external view returns (address) { return _payees[index]; } /** * @dev Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the * total shares and their previous withdrawals. */ function release() external virtual { address payable operator = payable(_msgSender()); require(_shares[operator] > 0, "PaymentSplitter: account has no shares"); if (buyout) { // uint256 bal = IFraktalNFT(tokenParent).getFraktions(_msgSender()); uint256 bal = FraktalNFT(tokenParent).balanceOf(_msgSender(),FraktalNFT(tokenParent).fraktionsIndex()); IFraktalNFT(tokenParent).soldBurn(_msgSender(), fraktionsIndex, bal); } uint256 totalReceived = address(this).balance + _totalReleased; uint256 payment = (totalReceived * _shares[operator]) / _totalShares - _released[operator]; require(payment != 0, "PaymentSplitter: operator is not due payment"); _released[operator] = _released[operator] + payment; _totalReleased = _totalReleased + payment; address payable marketPayable = payable(marketContract); uint16 marketFee = FraktalMarket(marketPayable).fee(); uint256 forMarket = (payment * marketFee )/ 10000; uint256 forOperator = payment - forMarket; AddressUpgradeable.sendValue(operator, forOperator); AddressUpgradeable.sendValue(marketPayable, forMarket); emit PaymentReleased(operator, payment); } /** * @dev Add a new payee to the contract. * @param account The address of the payee to add. * @param shares_ The number of shares owned by the payee. */ function _addPayee(address account, uint256 shares_) private { require( account != address(0), "PaymentSplitter: account is the zero address" ); require(shares_ > 0, "PaymentSplitter: shares are 0"); require( _shares[account] == 0, "PaymentSplitter: account already has shares" ); _payees.push(account); _shares[account] = shares_; _totalShares = _totalShares + shares_; emit PayeeAdded(account, shares_); } uint256[45] private __gap; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./EnumerableSet.sol"; /** * @dev Library for managing an enumerable variant of Solidity's * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`] * type. * * Maps have the following properties: * * - Entries are added, removed, and checked for existence in constant time * (O(1)). * - Entries are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableMap for EnumerableMap.UintToAddressMap; * * // Declare a set state variable * EnumerableMap.UintToAddressMap private myMap; * } * ``` * * As of v3.0.0, only maps of type `uint256 -> address` (`UintToAddressMap`) are * supported. */ library EnumerableMap { using EnumerableSet for EnumerableSet.Bytes32Set; // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Map type with // bytes32 keys and values. // The Map implementation uses private functions, and user-facing // implementations (such as Uint256ToAddressMap) are just wrappers around // the underlying Map. // This means that we can only create new EnumerableMaps for types that fit // in bytes32. struct Map { // Storage of keys EnumerableSet.Bytes32Set _keys; mapping(bytes32 => bytes32) _values; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function _set( Map storage map, bytes32 key, bytes32 value ) private returns (bool) { map._values[key] = value; return map._keys.add(key); } /** * @dev Removes a key-value pair from a map. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function _remove(Map storage map, bytes32 key) private returns (bool) { delete map._values[key]; return map._keys.remove(key); } /** * @dev Returns true if the key is in the map. O(1). */ function _contains(Map storage map, bytes32 key) private view returns (bool) { return map._keys.contains(key); } /** * @dev Returns the number of key-value pairs in the map. O(1). */ function _length(Map storage map) private view returns (uint256) { return map._keys.length(); } /** * @dev Returns the key-value pair stored at position `index` in the map. O(1). * * Note that there are no guarantees on the ordering of entries inside the * array, and it may change when more entries are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Map storage map, uint256 index) private view returns (bytes32, bytes32) { bytes32 key = map._keys.at(index); return (key, map._values[key]); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. */ function _tryGet(Map storage map, bytes32 key) private view returns (bool, bytes32) { bytes32 value = map._values[key]; if (value == bytes32(0)) { return (_contains(map, key), bytes32(0)); } else { return (true, value); } } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function _get(Map storage map, bytes32 key) private view returns (bytes32) { bytes32 value = map._values[key]; require(value != 0 || _contains(map, key), "EnumerableMap: nonexistent key"); return value; } /** * @dev Same as {_get}, with a custom error message when `key` is not in the map. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {_tryGet}. */ function _get( Map storage map, bytes32 key, string memory errorMessage ) private view returns (bytes32) { bytes32 value = map._values[key]; require(value != 0 || _contains(map, key), errorMessage); return value; } // UintToAddressMap struct UintToAddressMap { Map _inner; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set( UintToAddressMap storage map, uint256 key, address value ) internal returns (bool) { return _set(map._inner, bytes32(key), bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) { return _remove(map._inner, bytes32(key)); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(UintToAddressMap storage map, uint256 key) internal view returns (bool) { return _contains(map._inner, bytes32(key)); } /** * @dev Returns the number of elements in the map. O(1). */ function length(UintToAddressMap storage map) internal view returns (uint256) { return _length(map._inner); } /** * @dev Returns the element stored at position `index` in the set. O(1). * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) { (bytes32 key, bytes32 value) = _at(map._inner, index); return (uint256(key), address(uint160(uint256(value)))); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. * * _Available since v3.4._ */ function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool, address) { (bool success, bytes32 value) = _tryGet(map._inner, bytes32(key)); return (success, address(uint160(uint256(value)))); } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(UintToAddressMap storage map, uint256 key) internal view returns (address) { return address(uint160(uint256(_get(map._inner, bytes32(key))))); } /** * @dev Same as {get}, with a custom error message when `key` is not in the map. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryGet}. */ function get( UintToAddressMap storage map, uint256 key, string memory errorMessage ) internal view returns (address) { return address(uint160(uint256(_get(map._inner, bytes32(key), errorMessage)))); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { return _values(set._inner); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Holder.sol) pragma solidity ^0.8.0; import "./ERC1155ReceiverUpgradeable.sol"; import "../../../proxy/utils/Initializable.sol"; /** * @dev _Available since v3.1._ */ contract ERC1155HolderUpgradeable is Initializable, ERC1155ReceiverUpgradeable { function __ERC1155Holder_init() internal onlyInitializing { __ERC165_init_unchained(); __ERC1155Receiver_init_unchained(); __ERC1155Holder_init_unchained(); } function __ERC1155Holder_init_unchained() internal onlyInitializing { } function onERC1155Received( address, address, uint256, uint256, bytes memory ) public virtual override returns (bytes4) { return this.onERC1155Received.selector; } function onERC1155BatchReceived( address, address, uint256[] memory, uint256[] memory, bytes memory ) public virtual override returns (bytes4) { return this.onERC1155BatchReceived.selector; } uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/utils/ERC721Holder.sol) pragma solidity ^0.8.0; import "../IERC721ReceiverUpgradeable.sol"; import "../../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the {IERC721Receiver} interface. * * Accepts all token transfers. * Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or {IERC721-setApprovalForAll}. */ contract ERC721HolderUpgradeable is Initializable, IERC721ReceiverUpgradeable { function __ERC721Holder_init() internal onlyInitializing { __ERC721Holder_init_unchained(); } function __ERC721Holder_init_unchained() internal onlyInitializing { } /** * @dev See {IERC721Receiver-onERC721Received}. * * Always returns `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received( address, address, uint256, bytes memory ) public virtual override returns (bytes4) { return this.onERC721Received.selector; } uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165Upgradeable.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 IERC1155Upgradeable is IERC165Upgradeable { /** * @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/IERC1155Receiver.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165Upgradeable.sol"; /** * @dev _Available since v3.1._ */ interface IERC1155ReceiverUpgradeable is IERC165Upgradeable { /** @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 (token/ERC1155/extensions/IERC1155MetadataURI.sol) pragma solidity ^0.8.0; import "../IERC1155Upgradeable.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 IERC1155MetadataURIUpgradeable is IERC1155Upgradeable { /** * @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; import "../proxy/utils/Initializable.sol"; /** * @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 ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { __Context_init_unchained(); } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165Upgradeable { function __ERC165_init() internal onlyInitializing { __ERC165_init_unchained(); } function __ERC165_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165Upgradeable).interfaceId; } uint256[50] private __gap; }
// 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 IERC165Upgradeable { /** * @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 pragma solidity ^0.8.0; interface IFraktalNFT { function fraktionalize(address _to, uint _tokenId) external; function setMajority(uint16 newValue) external; function defraktionalize() external; function soldBurn(address owner, uint256 _tokenId, uint256 bal) external; function lockSharesTransfer(address from, uint numShares, address _to) external; function unlockSharesTransfer(address from, address _to) external; function createRevenuePayment() external returns (address _clone); function sellItem() external; function cleanUpHolders() external; function getRevenue(uint256 index) external view returns(address); function getFraktions(address who) external view returns(uint); function getLockedShares(uint256 index, address who) external view returns(uint); function getLockedToTotal(uint256 index, address who) external view returns(uint); function getStatus() external view returns (bool); function getFraktionsIndex() external view returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol) pragma solidity ^0.8.0; import "../IERC1155ReceiverUpgradeable.sol"; import "../../../utils/introspection/ERC165Upgradeable.sol"; import "../../../proxy/utils/Initializable.sol"; /** * @dev _Available since v3.1._ */ abstract contract ERC1155ReceiverUpgradeable is Initializable, ERC165Upgradeable, IERC1155ReceiverUpgradeable { function __ERC1155Receiver_init() internal onlyInitializing { __ERC165_init_unchained(); __ERC1155Receiver_init_unchained(); } function __ERC1155Receiver_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) { return interfaceId == type(IERC1155ReceiverUpgradeable).interfaceId || super.supportsInterface(interfaceId); } uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721ReceiverUpgradeable { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT 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 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 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": 1000 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"uint256","name":"_startTimestamp","type":"uint256"},{"internalType":"uint256","name":"_endTimestamp","type":"uint256"},{"internalType":"uint256","name":"_maximumAmountToClaim","type":"uint256"},{"internalType":"address","name":"_fraktalToken","type":"address"},{"internalType":"address","name":"_market","type":"address"},{"internalType":"bytes32","name":"_merkleRoot","type":"bytes32"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"AirdropRewardsClaim","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"merkleRoot","type":"bytes32"}],"name":"MerkleRootSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"endTimestamp","type":"uint256"}],"name":"NewEndTimestamp","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TokensWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"MAXIMUM_AMOUNT_TO_CLAIM","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes32[]","name":"merkleProof","type":"bytes32[]"}],"name":"canClaim","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes32[]","name":"merkleProof","type":"bytes32[]"},{"internalType":"address","name":"listedToken","type":"address"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"endTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fraktalMarket","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fraktalToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"hasClaimed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isMerkleRootSet","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"merkleRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"parseTier","outputs":[{"internalType":"uint256","name":"parsed","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"pauseAirdrop","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_market","type":"address"}],"name":"setFraktalMarket","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpauseAirdrop","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newEndTimestamp","type":"uint256"}],"name":"updateEndTimestamp","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawTokenRewards","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60c06040523480156200001157600080fd5b5060405162001a7a38038062001a7a83398101604081905262000034916200011b565b6000805460ff19169055600180556200004d33620000ac565b60059590955560049390935560a09190915260601b6001600160601b031916608052600780546001600160a01b0319166001600160a01b0390921691909117905560035560028054600160a01b60ff60a01b1990911617905562000177565b600280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b80516001600160a01b03811681146200011657600080fd5b919050565b60008060008060008060c0878903121562000134578182fd5b8651955060208701519450604087015193506200015460608801620000fe565b92506200016460808801620000fe565b915060a087015190509295509295509295565b60805160601c60a0516118be620001bc600039600081816102d401526106310152600081816102a401528181610449015281816104da0152610acf01526118be6000f3fe608060405234801561001057600080fd5b506004361061016c5760003560e01c8063810e6853116100cd578063c6afd5bb11610081578063e6fd48bc11610066578063e6fd48bc14610311578063e96ad3ad1461031a578063f2fde38b1461032257600080fd5b8063c6afd5bb146102f6578063dc38bdb5146102fe57600080fd5b806392cedabd116100b257806392cedabd1461029f578063a85adeab146102c6578063bd69ba50146102cf57600080fd5b8063810e68531461027b5780638da5cb5b1461028e57600080fd5b806369c6afc611610124578063715018a611610109578063715018a61461022557806373b2e80e1461022d5780637ad94ac11461025057600080fd5b806369c6afc6146101d55780636e1613fb1461021257600080fd5b806350bca4ca1161015557806350bca4ca146101975780635c975abb146101aa5780635ff10e39146101c157600080fd5b806315618acd146101715780632eb4a7ab1461017b575b600080fd5b610179610335565b005b61018460035481565b6040519081526020015b60405180910390f35b6101796101a5366004611738565b610538565b60005460ff165b604051901515815260200161018e565b6002546101b190600160a01b900460ff1681565b6101796101e3366004611595565b6007805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b610179610220366004611708565b610b39565b610179610c23565b6101b161023b366004611595565b60066020526000908152604090205460ff1681565b600754610263906001600160a01b031681565b6040516001600160a01b03909116815260200161018e565b610184610289366004611708565b610c89565b6002546001600160a01b0316610263565b6102637f000000000000000000000000000000000000000000000000000000000000000081565b61018460045481565b6101847f000000000000000000000000000000000000000000000000000000000000000081565b610179610dbe565b6101b161030c3660046115b1565b610e66565b61018460055481565b610179610f07565b610179610330366004611595565b610fbb565b6002546001600160a01b031633146103945760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6004546103a490620151806117e4565b42116104185760405162461bcd60e51b815260206004820152602260248201527f4f776e65723a20546f6f206561726c7920746f2072656d6f766520726577617260448201527f6473000000000000000000000000000000000000000000000000000000000000606482015260840161038b565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a082319060240160206040518083038186803b15801561049357600080fd5b505afa1580156104a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104cb9190611720565b90506105016001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016338361109d565b6040518181527f9c6393f251205f9e03559951cab4c9ae71767b6174f77944a5b0c2fa51fbda9f906020015b60405180910390a150565b60005460ff161561057e5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161038b565b600260015414156105d15760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161038b565b6002600181905554600160a01b900460ff1661062f5760405162461bcd60e51b815260206004820152601c60248201527f41697264726f703a204d65726b6c6520726f6f74206e6f742073657400000000604482015260640161038b565b7f000000000000000000000000000000000000000000000000000000000000000084111561069f5760405162461bcd60e51b815260206004820152601860248201527f41697264726f703a20416d6f756e7420746f6f20686967680000000000000000604482015260640161038b565b6005544210156106f15760405162461bcd60e51b815260206004820152601b60248201527f41697264726f703a20546f6f206561726c7920746f20636c61696d0000000000604482015260640161038b565b6004544211156107435760405162461bcd60e51b815260206004820152601a60248201527f41697264726f703a20546f6f206c61746520746f20636c61696d000000000000604482015260640161038b565b3360009081526006602052604090205460ff16156107a35760405162461bcd60e51b815260206004820152601860248201527f41697264726f703a20416c726561647920636c61696d65640000000000000000604482015260640161038b565b6007546040517f3af3eff10000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b0383811660248301526000921690633af3eff19060440160206040518083038186803b15801561080857600080fd5b505afa15801561081c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108409190611720565b6007546040517f4e9ceecb0000000000000000000000000000000000000000000000000000000081526001600160a01b03858116600483015233602483015260006044830181905293945090911690634e9ceecb9060640160006040518083038186803b1580156108b057600080fd5b505afa1580156108c4573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108ec919081019061160b565b5050925050506000808311806109025750600082115b9050806109515760405162461bcd60e51b815260206004820152600d60248201527f4e6f204e4654206c697374656400000000000000000000000000000000000000604482015260640161038b565b6040516bffffffffffffffffffffffff193360601b166020820152603481018890526000906054016040516020818303038152906040528051906020012090506109d2878780806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250506003549150849050611122565b610a1e5760405162461bcd60e51b815260206004820152601660248201527f41697264726f703a20496e76616c69642070726f6f6600000000000000000000604482015260640161038b565b3360009081526006602052604090819020805460ff19166001179055517f810e685300000000000000000000000000000000000000000000000000000000815260048101899052309063810e68539060240160206040518083038186803b158015610a8857600080fd5b505afa158015610a9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ac09190611720565b9750610af66001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016338a61109d565b60405188815233907f19552fadade1a47d8fa44f6487230cfff67275de6e68fbfba65171532768fd7d9060200160405180910390a2505060018055505050505050565b6002546001600160a01b03163314610b935760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161038b565b80610ba14262278d006117e4565b11610bee5760405162461bcd60e51b815260206004820152601c60248201527f4f776e65723a204e65772074696d657374616d7020746f6f2066617200000000604482015260640161038b565b60048190556040518181527fac7d83845fcc6871010ded05a8cb9bddee5cc49fdb8f2d24b96141d401b6bfed9060200161052d565b6002546001600160a01b03163314610c7d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161038b565b610c8760006111e1565b565b60008169021e19e0c9bab24000001415610cae57506901ac4286100191f00000919050565b8168f61d281a0c917000001415610ccf575068ab4dcf399a3a600000919050565b816884d0948357fb0800001415610cf0575068807a5b6b33abc80000919050565b81685150ae84a8cdf000001415610d1157506855a6e79ccd1d300000919050565b8168410d586a20a4c000001415610d325750682ad373ce668e980000919050565b81682b5e3af16b188000001415610d5357506819b21248a3ef280000919050565b816815af1d78b58c4000001415610d7457506811216185c29f700000919050565b81680ad78ebc5ac62000001415610d955750680da933d8d8c6700000919050565b816806c6b935b8bbd400001415610db657506806d499ec6c63380000919050565b506000919050565b6002546001600160a01b03163314610e185760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161038b565b60005460ff1615610e5e5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161038b565b610c87611240565b60006004544211610efb576040516bffffffffffffffffffffffff19606087901b16602082015260348101859052600090605401604051602081830303815290604052805190602001209050610ef3848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250506003549150849050611122565b915050610eff565b5060005b949350505050565b6002546001600160a01b03163314610f615760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161038b565b60005460ff16610fb35760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f7420706175736564000000000000000000000000604482015260640161038b565b610c876112d8565b6002546001600160a01b031633146110155760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161038b565b6001600160a01b0381166110915760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161038b565b61109a816111e1565b50565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb0000000000000000000000000000000000000000000000000000000017905261111d90849061135b565b505050565b600081815b85518110156111d457600086828151811061115257634e487b7160e01b600052603260045260246000fd5b602002602001015190508083116111945760408051602081018590529081018290526060016040516020818303038152906040528051906020012092506111c1565b60408051602081018390529081018490526060016040516020818303038152906040528051906020012092505b50806111cc8161182c565b915050611127565b50831490505b9392505050565b600280546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60005460ff16156112865760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161038b565b6000805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586112bb3390565b6040516001600160a01b03909116815260200160405180910390a1565b60005460ff1661132a5760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f7420706175736564000000000000000000000000604482015260640161038b565b6000805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa336112bb565b60006113b0826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166114409092919063ffffffff16565b80519091501561111d57808060200190518101906113ce91906116e8565b61111d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161038b565b6060610eff848460008585843b6114995760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161038b565b600080866001600160a01b031685876040516114b59190611795565b60006040518083038185875af1925050503d80600081146114f2576040519150601f19603f3d011682016040523d82523d6000602084013e6114f7565b606091505b5091509150611507828286611512565b979650505050505050565b606083156115215750816111da565b8251156115315782518084602001fd5b8160405162461bcd60e51b815260040161038b91906117b1565b60008083601f84011261155c578081fd5b50813567ffffffffffffffff811115611573578182fd5b6020830191508360208260051b850101111561158e57600080fd5b9250929050565b6000602082840312156115a6578081fd5b81356111da81611873565b600080600080606085870312156115c6578283fd5b84356115d181611873565b935060208501359250604085013567ffffffffffffffff8111156115f3578283fd5b6115ff8782880161154b565b95989497509550505050565b600080600080600060a08688031215611622578081fd5b855161162d81611873565b80955050602086015193506040860151925060608601519150608086015167ffffffffffffffff80821115611660578283fd5b818801915088601f830112611673578283fd5b8151818111156116855761168561185d565b604051601f8201601f19908116603f011681019083821181831017156116ad576116ad61185d565b816040528281528b60208487010111156116c5578586fd5b6116d68360208301602088016117fc565b80955050505050509295509295909350565b6000602082840312156116f9578081fd5b815180151581146111da578182fd5b600060208284031215611719578081fd5b5035919050565b600060208284031215611731578081fd5b5051919050565b6000806000806060858703121561174d578384fd5b84359350602085013567ffffffffffffffff81111561176a578384fd5b6117768782880161154b565b909450925050604085013561178a81611873565b939692955090935050565b600082516117a78184602087016117fc565b9190910192915050565b60208152600082518060208401526117d08160408501602087016117fc565b601f01601f19169190910160400192915050565b600082198211156117f7576117f7611847565b500190565b60005b838110156118175781810151838201526020016117ff565b83811115611826576000848401525b50505050565b600060001982141561184057611840611847565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461109a57600080fdfea2646970667358221220f58cbffdab90225e94c41e4cfbc5c6bec05c68bb8f0be51a2ee7081c28baacec64736f6c6343000804003300000000000000000000000000000000000000000000000000000000623322c000000000000000000000000000000000000000000000000000000000624051c000000000000000000000000000000000000000000000021e19e0c9bab24000000000000000000000000000001f81f8f262714cc932141c7c79495b481ef27258000000000000000000000000244763ea2039d880b62d2ba427d8919eba6ee50b8dfab5f1445c86bab8ddecc22981110b60bb14aa0e326226e3974785643a4e57
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061016c5760003560e01c8063810e6853116100cd578063c6afd5bb11610081578063e6fd48bc11610066578063e6fd48bc14610311578063e96ad3ad1461031a578063f2fde38b1461032257600080fd5b8063c6afd5bb146102f6578063dc38bdb5146102fe57600080fd5b806392cedabd116100b257806392cedabd1461029f578063a85adeab146102c6578063bd69ba50146102cf57600080fd5b8063810e68531461027b5780638da5cb5b1461028e57600080fd5b806369c6afc611610124578063715018a611610109578063715018a61461022557806373b2e80e1461022d5780637ad94ac11461025057600080fd5b806369c6afc6146101d55780636e1613fb1461021257600080fd5b806350bca4ca1161015557806350bca4ca146101975780635c975abb146101aa5780635ff10e39146101c157600080fd5b806315618acd146101715780632eb4a7ab1461017b575b600080fd5b610179610335565b005b61018460035481565b6040519081526020015b60405180910390f35b6101796101a5366004611738565b610538565b60005460ff165b604051901515815260200161018e565b6002546101b190600160a01b900460ff1681565b6101796101e3366004611595565b6007805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b610179610220366004611708565b610b39565b610179610c23565b6101b161023b366004611595565b60066020526000908152604090205460ff1681565b600754610263906001600160a01b031681565b6040516001600160a01b03909116815260200161018e565b610184610289366004611708565b610c89565b6002546001600160a01b0316610263565b6102637f0000000000000000000000001f81f8f262714cc932141c7c79495b481ef2725881565b61018460045481565b6101847f00000000000000000000000000000000000000000000021e19e0c9bab240000081565b610179610dbe565b6101b161030c3660046115b1565b610e66565b61018460055481565b610179610f07565b610179610330366004611595565b610fbb565b6002546001600160a01b031633146103945760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6004546103a490620151806117e4565b42116104185760405162461bcd60e51b815260206004820152602260248201527f4f776e65723a20546f6f206561726c7920746f2072656d6f766520726577617260448201527f6473000000000000000000000000000000000000000000000000000000000000606482015260840161038b565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000907f0000000000000000000000001f81f8f262714cc932141c7c79495b481ef272586001600160a01b0316906370a082319060240160206040518083038186803b15801561049357600080fd5b505afa1580156104a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104cb9190611720565b90506105016001600160a01b037f0000000000000000000000001f81f8f262714cc932141c7c79495b481ef2725816338361109d565b6040518181527f9c6393f251205f9e03559951cab4c9ae71767b6174f77944a5b0c2fa51fbda9f906020015b60405180910390a150565b60005460ff161561057e5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161038b565b600260015414156105d15760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161038b565b6002600181905554600160a01b900460ff1661062f5760405162461bcd60e51b815260206004820152601c60248201527f41697264726f703a204d65726b6c6520726f6f74206e6f742073657400000000604482015260640161038b565b7f00000000000000000000000000000000000000000000021e19e0c9bab240000084111561069f5760405162461bcd60e51b815260206004820152601860248201527f41697264726f703a20416d6f756e7420746f6f20686967680000000000000000604482015260640161038b565b6005544210156106f15760405162461bcd60e51b815260206004820152601b60248201527f41697264726f703a20546f6f206561726c7920746f20636c61696d0000000000604482015260640161038b565b6004544211156107435760405162461bcd60e51b815260206004820152601a60248201527f41697264726f703a20546f6f206c61746520746f20636c61696d000000000000604482015260640161038b565b3360009081526006602052604090205460ff16156107a35760405162461bcd60e51b815260206004820152601860248201527f41697264726f703a20416c726561647920636c61696d65640000000000000000604482015260640161038b565b6007546040517f3af3eff10000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b0383811660248301526000921690633af3eff19060440160206040518083038186803b15801561080857600080fd5b505afa15801561081c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108409190611720565b6007546040517f4e9ceecb0000000000000000000000000000000000000000000000000000000081526001600160a01b03858116600483015233602483015260006044830181905293945090911690634e9ceecb9060640160006040518083038186803b1580156108b057600080fd5b505afa1580156108c4573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108ec919081019061160b565b5050925050506000808311806109025750600082115b9050806109515760405162461bcd60e51b815260206004820152600d60248201527f4e6f204e4654206c697374656400000000000000000000000000000000000000604482015260640161038b565b6040516bffffffffffffffffffffffff193360601b166020820152603481018890526000906054016040516020818303038152906040528051906020012090506109d2878780806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250506003549150849050611122565b610a1e5760405162461bcd60e51b815260206004820152601660248201527f41697264726f703a20496e76616c69642070726f6f6600000000000000000000604482015260640161038b565b3360009081526006602052604090819020805460ff19166001179055517f810e685300000000000000000000000000000000000000000000000000000000815260048101899052309063810e68539060240160206040518083038186803b158015610a8857600080fd5b505afa158015610a9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ac09190611720565b9750610af66001600160a01b037f0000000000000000000000001f81f8f262714cc932141c7c79495b481ef2725816338a61109d565b60405188815233907f19552fadade1a47d8fa44f6487230cfff67275de6e68fbfba65171532768fd7d9060200160405180910390a2505060018055505050505050565b6002546001600160a01b03163314610b935760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161038b565b80610ba14262278d006117e4565b11610bee5760405162461bcd60e51b815260206004820152601c60248201527f4f776e65723a204e65772074696d657374616d7020746f6f2066617200000000604482015260640161038b565b60048190556040518181527fac7d83845fcc6871010ded05a8cb9bddee5cc49fdb8f2d24b96141d401b6bfed9060200161052d565b6002546001600160a01b03163314610c7d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161038b565b610c8760006111e1565b565b60008169021e19e0c9bab24000001415610cae57506901ac4286100191f00000919050565b8168f61d281a0c917000001415610ccf575068ab4dcf399a3a600000919050565b816884d0948357fb0800001415610cf0575068807a5b6b33abc80000919050565b81685150ae84a8cdf000001415610d1157506855a6e79ccd1d300000919050565b8168410d586a20a4c000001415610d325750682ad373ce668e980000919050565b81682b5e3af16b188000001415610d5357506819b21248a3ef280000919050565b816815af1d78b58c4000001415610d7457506811216185c29f700000919050565b81680ad78ebc5ac62000001415610d955750680da933d8d8c6700000919050565b816806c6b935b8bbd400001415610db657506806d499ec6c63380000919050565b506000919050565b6002546001600160a01b03163314610e185760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161038b565b60005460ff1615610e5e5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161038b565b610c87611240565b60006004544211610efb576040516bffffffffffffffffffffffff19606087901b16602082015260348101859052600090605401604051602081830303815290604052805190602001209050610ef3848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250506003549150849050611122565b915050610eff565b5060005b949350505050565b6002546001600160a01b03163314610f615760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161038b565b60005460ff16610fb35760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f7420706175736564000000000000000000000000604482015260640161038b565b610c876112d8565b6002546001600160a01b031633146110155760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161038b565b6001600160a01b0381166110915760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161038b565b61109a816111e1565b50565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb0000000000000000000000000000000000000000000000000000000017905261111d90849061135b565b505050565b600081815b85518110156111d457600086828151811061115257634e487b7160e01b600052603260045260246000fd5b602002602001015190508083116111945760408051602081018590529081018290526060016040516020818303038152906040528051906020012092506111c1565b60408051602081018390529081018490526060016040516020818303038152906040528051906020012092505b50806111cc8161182c565b915050611127565b50831490505b9392505050565b600280546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60005460ff16156112865760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161038b565b6000805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586112bb3390565b6040516001600160a01b03909116815260200160405180910390a1565b60005460ff1661132a5760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f7420706175736564000000000000000000000000604482015260640161038b565b6000805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa336112bb565b60006113b0826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166114409092919063ffffffff16565b80519091501561111d57808060200190518101906113ce91906116e8565b61111d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161038b565b6060610eff848460008585843b6114995760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161038b565b600080866001600160a01b031685876040516114b59190611795565b60006040518083038185875af1925050503d80600081146114f2576040519150601f19603f3d011682016040523d82523d6000602084013e6114f7565b606091505b5091509150611507828286611512565b979650505050505050565b606083156115215750816111da565b8251156115315782518084602001fd5b8160405162461bcd60e51b815260040161038b91906117b1565b60008083601f84011261155c578081fd5b50813567ffffffffffffffff811115611573578182fd5b6020830191508360208260051b850101111561158e57600080fd5b9250929050565b6000602082840312156115a6578081fd5b81356111da81611873565b600080600080606085870312156115c6578283fd5b84356115d181611873565b935060208501359250604085013567ffffffffffffffff8111156115f3578283fd5b6115ff8782880161154b565b95989497509550505050565b600080600080600060a08688031215611622578081fd5b855161162d81611873565b80955050602086015193506040860151925060608601519150608086015167ffffffffffffffff80821115611660578283fd5b818801915088601f830112611673578283fd5b8151818111156116855761168561185d565b604051601f8201601f19908116603f011681019083821181831017156116ad576116ad61185d565b816040528281528b60208487010111156116c5578586fd5b6116d68360208301602088016117fc565b80955050505050509295509295909350565b6000602082840312156116f9578081fd5b815180151581146111da578182fd5b600060208284031215611719578081fd5b5035919050565b600060208284031215611731578081fd5b5051919050565b6000806000806060858703121561174d578384fd5b84359350602085013567ffffffffffffffff81111561176a578384fd5b6117768782880161154b565b909450925050604085013561178a81611873565b939692955090935050565b600082516117a78184602087016117fc565b9190910192915050565b60208152600082518060208401526117d08160408501602087016117fc565b601f01601f19169190910160400192915050565b600082198211156117f7576117f7611847565b500190565b60005b838110156118175781810151838201526020016117ff565b83811115611826576000848401525b50505050565b600060001982141561184057611840611847565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461109a57600080fdfea2646970667358221220f58cbffdab90225e94c41e4cfbc5c6bec05c68bb8f0be51a2ee7081c28baacec64736f6c63430008040033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000000000000000000000000000000000000623322c000000000000000000000000000000000000000000000000000000000624051c000000000000000000000000000000000000000000000021e19e0c9bab24000000000000000000000000000001f81f8f262714cc932141c7c79495b481ef27258000000000000000000000000244763ea2039d880b62d2ba427d8919eba6ee50b8dfab5f1445c86bab8ddecc22981110b60bb14aa0e326226e3974785643a4e57
-----Decoded View---------------
Arg [0] : _startTimestamp (uint256): 1647518400
Arg [1] : _endTimestamp (uint256): 1648382400
Arg [2] : _maximumAmountToClaim (uint256): 10000000000000000000000
Arg [3] : _fraktalToken (address): 0x1f81f8f262714cc932141c7C79495B481eF27258
Arg [4] : _market (address): 0x244763Ea2039D880B62D2BA427d8919Eba6ee50B
Arg [5] : _merkleRoot (bytes32): 0x8dfab5f1445c86bab8ddecc22981110b60bb14aa0e326226e3974785643a4e57
-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000000000000000000000000623322c0
Arg [1] : 00000000000000000000000000000000000000000000000000000000624051c0
Arg [2] : 00000000000000000000000000000000000000000000021e19e0c9bab2400000
Arg [3] : 0000000000000000000000001f81f8f262714cc932141c7c79495b481ef27258
Arg [4] : 000000000000000000000000244763ea2039d880b62d2ba427d8919eba6ee50b
Arg [5] : 8dfab5f1445c86bab8ddecc22981110b60bb14aa0e326226e3974785643a4e57
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 26 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.