Contract 0x1B7C65f2daCe6932D9375E6BA24aB4EE3F54D03b

Txn Hash Method
Block
From
To
Value [Txn Fee]
0x025c6b1f13d39cd26678c5ca4a1e004ec3a561630eaca2e082f3fff37042a9480x608060408338552021-11-01 20:01:36204 days 7 hrs agoMoonBeans: Developer Wallet IN  Create: TokenOwnershipWrapper0 MOVR0.000467092
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
TokenOwnershipWrapper

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, MIT license
/**
 *Submitted for verification at moonriver.moonscan.io on 2021-11-01
*/

//Custom contract wrapping the IERC721-enumerable tokensOfOwnerByIndex function, with the ability to get an array of owned NFTs.

pragma solidity ^0.8.0;
// SPDX-License-Identifier: MIT

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);
}

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;
}

interface IERC721Enumerable is IERC721 {
    /**
     * @dev Returns the total amount of tokens stored by the contract.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns a token ID owned by `owner` at a given `index` of its token list.
     * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);

    /**
     * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
     * Use along with {totalSupply} to enumerate all tokens.
     */
    function tokenByIndex(uint256 index) external view returns (uint256);
}

contract TokenOwnershipWrapper {

  function tokensOfOwner(address _owner, address _contract) external view returns (uint256[] memory) {
    IERC721Enumerable nft = IERC721Enumerable(_contract);
    uint256 tokenCount = nft.balanceOf(_owner);
    if (tokenCount == 0) {
      // Return an empty array
      return new uint256[](0);
    } else {
      uint256[] memory result = new uint256[](tokenCount);
      uint256 index;
      for (index = 0; index < tokenCount; index++) {
        result[index] = nft.tokenOfOwnerByIndex(_owner, index);
      }
      return result;
    }
  }

}

Contract ABI

[{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_contract","type":"address"}],"name":"tokensOfOwner","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b50610343806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063cfe8f48714610030575b600080fd5b61004361003e366004610228565b610059565b604051610050919061025b565b60405180910390f35b6040516370a0823160e01b81526001600160a01b0383811660048301526060918391600091908316906370a082319060240160206040518083038186803b1580156100a357600080fd5b505afa1580156100b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100db919061029f565b9050806100fa5750506040805160008152602081019091529050610206565b60008167ffffffffffffffff811115610115576101156102b8565b60405190808252806020026020018201604052801561013e578160200160208202803683370190505b50905060005b828110156101fb57604051632f745c5960e01b81526001600160a01b03888116600483015260248201839052851690632f745c599060440160206040518083038186803b15801561019457600080fd5b505afa1580156101a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101cc919061029f565b8282815181106101de576101de6102ce565b6020908102919091010152806101f3816102e4565b915050610144565b509250610206915050565b92915050565b80356001600160a01b038116811461022357600080fd5b919050565b6000806040838503121561023b57600080fd5b6102448361020c565b91506102526020840161020c565b90509250929050565b6020808252825182820181905260009190848201906040850190845b8181101561029357835183529284019291840191600101610277565b50909695505050505050565b6000602082840312156102b157600080fd5b5051919050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b600060001982141561030657634e487b7160e01b600052601160045260246000fd5b506001019056fea2646970667358221220bc1b3ab535e42ce6a003edff1569824c32088b069cabec49ec0e6e41437d88f264736f6c63430008090033

Deployed ByteCode Sourcemap

6024:601:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6062:558;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;;6248:21;;-1:-1:-1;;;6248:21:0;;-1:-1:-1;;;;;1258:32:1;;;6248:21:0;;;1240:51:1;6143:16:0;;6210:9;;6168:21;;6248:13;;;;;;1213:18:1;;6248:21:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;6227:42;-1:-1:-1;6280:15:0;6276:339;;-1:-1:-1;;6345:16:0;;;6359:1;6345:16;;;;;;;;;-1:-1:-1;6338:23:0;;6276:339;6384:23;6424:10;6410:25;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;6410:25:0;;6384:51;;6444:13;6466:120;6490:10;6482:5;:18;6466:120;;;6538:38;;-1:-1:-1;;;6538:38:0;;-1:-1:-1;;;;;1815:32:1;;;6538:38:0;;;1797:51:1;1864:18;;;1857:34;;;6538:23:0;;;;;1770:18:1;;6538:38:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;6522:6;6529:5;6522:13;;;;;;;;:::i;:::-;;;;;;;;;;:54;6502:7;;;;:::i;:::-;;;;6466:120;;;-1:-1:-1;6601:6:0;-1:-1:-1;6594:13:0;;-1:-1:-1;;6594:13:0;6062:558;;;;;:::o;14:173:1:-;82:20;;-1:-1:-1;;;;;131:31:1;;121:42;;111:70;;177:1;174;167:12;111:70;14:173;;;:::o;192:260::-;260:6;268;321:2;309:9;300:7;296:23;292:32;289:52;;;337:1;334;327:12;289:52;360:29;379:9;360:29;:::i;:::-;350:39;;408:38;442:2;431:9;427:18;408:38;:::i;:::-;398:48;;192:260;;;;;:::o;457:632::-;628:2;680:21;;;750:13;;653:18;;;772:22;;;599:4;;628:2;851:15;;;;825:2;810:18;;;599:4;894:169;908:6;905:1;902:13;894:169;;;969:13;;957:26;;1038:15;;;;1003:12;;;;930:1;923:9;894:169;;;-1:-1:-1;1080:3:1;;457:632;-1:-1:-1;;;;;;457:632:1:o;1302:184::-;1372:6;1425:2;1413:9;1404:7;1400:23;1396:32;1393:52;;;1441:1;1438;1431:12;1393:52;-1:-1:-1;1464:16:1;;1302:184;-1:-1:-1;1302:184:1:o;1491:127::-;1552:10;1547:3;1543:20;1540:1;1533:31;1583:4;1580:1;1573:15;1607:4;1604:1;1597:15;1902:127;1963:10;1958:3;1954:20;1951:1;1944:31;1994:4;1991:1;1984:15;2018:4;2015:1;2008:15;2034:232;2073:3;-1:-1:-1;;2094:17:1;;2091:140;;;2153:10;2148:3;2144:20;2141:1;2134:31;2188:4;2185:1;2178:15;2216:4;2213:1;2206:15;2091:140;-1:-1:-1;2258:1:1;2247:13;;2034:232::o

Swarm Source

ipfs://bc1b3ab535e42ce6a003edff1569824c32088b069cabec49ec0e6e41437d88f2
Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.