UNPKG

@etherisc/depeg-contracts

Version:

Etherisc's smart contracts for a depeg insurance for stable coins.

1,030 lines 32.4 kB
{ "abi": [ { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, { "indexed": true, "internalType": "address", "name": "approved", "type": "address" }, { "indexed": true, "internalType": "uint256", "name": "tokenId", "type": "uint256" } ], "name": "Approval", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, { "indexed": true, "internalType": "address", "name": "operator", "type": "address" }, { "indexed": false, "internalType": "bool", "name": "approved", "type": "bool" } ], "name": "ApprovalForAll", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "uint256", "name": "bundleId", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "tokenId", "type": "uint256" } ], "name": "LogBundleTokenBurned", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "uint256", "name": "bundleId", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "tokenId", "type": "uint256" }, { "indexed": false, "internalType": "address", "name": "tokenOwner", "type": "address" } ], "name": "LogBundleTokenMinted", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, { "indexed": true, "internalType": "uint256", "name": "tokenId", "type": "uint256" } ], "name": "Transfer", "type": "event" }, { "inputs": [ { "internalType": "address", "name": "to", "type": "address" }, { "internalType": "uint256", "name": "tokenId", "type": "uint256" } ], "name": "approve", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "owner", "type": "address" } ], "name": "balanceOf", "outputs": [ { "internalType": "uint256", "name": "balance", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "tokenId", "type": "uint256" } ], "name": "burned", "outputs": [ { "internalType": "bool", "name": "isBurned", "type": "bool" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "tokenId", "type": "uint256" } ], "name": "exists", "outputs": [ { "internalType": "bool", "name": "doesExist", "type": "bool" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "tokenId", "type": "uint256" } ], "name": "getApproved", "outputs": [ { "internalType": "address", "name": "operator", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "tokenId", "type": "uint256" } ], "name": "getBundleId", "outputs": [ { "internalType": "uint256", "name": "bundleId", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "owner", "type": "address" }, { "internalType": "address", "name": "operator", "type": "address" } ], "name": "isApprovedForAll", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "tokenId", "type": "uint256" } ], "name": "ownerOf", "outputs": [ { "internalType": "address", "name": "owner", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "from", "type": "address" }, { "internalType": "address", "name": "to", "type": "address" }, { "internalType": "uint256", "name": "tokenId", "type": "uint256" } ], "name": "safeTransferFrom", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "from", "type": "address" }, { "internalType": "address", "name": "to", "type": "address" }, { "internalType": "uint256", "name": "tokenId", "type": "uint256" }, { "internalType": "bytes", "name": "data", "type": "bytes" } ], "name": "safeTransferFrom", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "operator", "type": "address" }, { "internalType": "bool", "name": "_approved", "type": "bool" } ], "name": "setApprovalForAll", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "bytes4", "name": "interfaceId", "type": "bytes4" } ], "name": "supportsInterface", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "totalSupply", "outputs": [ { "internalType": "uint256", "name": "tokenCount", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "from", "type": "address" }, { "internalType": "address", "name": "to", "type": "address" }, { "internalType": "uint256", "name": "tokenId", "type": "uint256" } ], "name": "transferFrom", "outputs": [], "stateMutability": "nonpayable", "type": "function" } ], "allSourcePaths": { "15": "/home/vscode/.brownie/packages/OpenZeppelin/openzeppelin-contracts@4.7.3/contracts/utils/introspection/IERC165.sol", "46": "/home/vscode/.brownie/packages/etherisc/gif-interface@3b0002a/contracts/tokens/IBundleToken.sol", "7": "/home/vscode/.brownie/packages/OpenZeppelin/openzeppelin-contracts@4.7.3/contracts/token/ERC721/IERC721.sol" }, "ast": { "absolutePath": "/home/vscode/.brownie/packages/etherisc/gif-interface@3b0002a/contracts/tokens/IBundleToken.sol", "exportedSymbols": { "IBundleToken": [ 13428 ], "IERC165": [ 22864 ], "IERC721": [ 13932 ] }, "id": 13429, "license": "Apache-2.0", "nodeType": "SourceUnit", "nodes": [ { "id": 13384, "literals": [ "solidity", "0.8", ".2" ], "nodeType": "PragmaDirective", "src": "39:22:46" }, { "absolutePath": "/home/vscode/.brownie/packages/OpenZeppelin/openzeppelin-contracts@4.7.3/contracts/token/ERC721/IERC721.sol", "file": "@openzeppelin/contracts/token/ERC721/IERC721.sol", "id": 13385, "nameLocation": "-1:-1:-1", "nodeType": "ImportDirective", "scope": 13429, "sourceUnit": 13933, "src": "63:58:46", "symbolAliases": [], "unitAlias": "" }, { "abstract": false, "baseContracts": [ { "baseName": { "id": 13386, "name": "IERC721", "nodeType": "IdentifierPath", "referencedDeclaration": 13932, "src": "153:7:46" }, "id": 13387, "nodeType": "InheritanceSpecifier", "src": "153:7:46" } ], "contractDependencies": [ 13932, 22864 ], "contractKind": "interface", "fullyImplemented": false, "id": 13428, "linearizedBaseContracts": [ 13428, 13932, 22864 ], "name": "IBundleToken", "nameLocation": "133:12:46", "nodeType": "ContractDefinition", "nodes": [ { "anonymous": false, "id": 13395, "name": "LogBundleTokenMinted", "nameLocation": "173:20:46", "nodeType": "EventDefinition", "parameters": { "id": 13394, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 13389, "indexed": false, "mutability": "mutable", "name": "bundleId", "nameLocation": "202:8:46", "nodeType": "VariableDeclaration", "scope": 13395, "src": "194:16:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 13388, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "194:7:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" }, { "constant": false, "id": 13391, "indexed": false, "mutability": "mutable", "name": "tokenId", "nameLocation": "220:7:46", "nodeType": "VariableDeclaration", "scope": 13395, "src": "212:15:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 13390, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "212:7:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" }, { "constant": false, "id": 13393, "indexed": false, "mutability": "mutable", "name": "tokenOwner", "nameLocation": "237:10:46", "nodeType": "VariableDeclaration", "scope": 13395, "src": "229:18:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 13392, "name": "address", "nodeType": "ElementaryTypeName", "src": "229:7:46", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "visibility": "internal" } ], "src": "193:55:46" }, "src": "167:82:46" }, { "anonymous": false, "id": 13401, "name": "LogBundleTokenBurned", "nameLocation": "260:20:46", "nodeType": "EventDefinition", "parameters": { "id": 13400, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 13397, "indexed": false, "mutability": "mutable", "name": "bundleId", "nameLocation": "289:8:46", "nodeType": "VariableDeclaration", "scope": 13401, "src": "281:16:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 13396, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "281:7:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" }, { "constant": false, "id": 13399, "indexed": false, "mutability": "mutable", "name": "tokenId", "nameLocation": "307:7:46", "nodeType": "VariableDeclaration", "scope": 13401, "src": "299:15:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 13398, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "299:7:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" } ], "src": "280:35:46" }, "src": "254:62:46" }, { "functionSelector": "23250cae", "id": 13408, "implemented": false, "kind": "function", "modifiers": [], "name": "burned", "nameLocation": "334:6:46", "nodeType": "FunctionDefinition", "parameters": { "id": 13404, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 13403, "mutability": "mutable", "name": "tokenId", "nameLocation": "346:7:46", "nodeType": "VariableDeclaration", "scope": 13408, "src": "341:12:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 13402, "name": "uint", "nodeType": "ElementaryTypeName", "src": "341:4:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" } ], "src": "340:14:46" }, "returnParameters": { "id": 13407, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 13406, "mutability": "mutable", "name": "isBurned", "nameLocation": "382:8:46", "nodeType": "VariableDeclaration", "scope": 13408, "src": "377:13:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 13405, "name": "bool", "nodeType": "ElementaryTypeName", "src": "377:4:46", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "visibility": "internal" } ], "src": "376:15:46" }, "scope": 13428, "src": "325:67:46", "stateMutability": "view", "virtual": false, "visibility": "external" }, { "functionSelector": "4f558e79", "id": 13415, "implemented": false, "kind": "function", "modifiers": [], "name": "exists", "nameLocation": "406:6:46", "nodeType": "FunctionDefinition", "parameters": { "id": 13411, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 13410, "mutability": "mutable", "name": "tokenId", "nameLocation": "421:7:46", "nodeType": "VariableDeclaration", "scope": 13415, "src": "413:15:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 13409, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "413:7:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" } ], "src": "412:17:46" }, "returnParameters": { "id": 13414, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 13413, "mutability": "mutable", "name": "doesExist", "nameLocation": "457:9:46", "nodeType": "VariableDeclaration", "scope": 13415, "src": "452:14:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 13412, "name": "bool", "nodeType": "ElementaryTypeName", "src": "452:4:46", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "visibility": "internal" } ], "src": "451:16:46" }, "scope": 13428, "src": "397:71:46", "stateMutability": "view", "virtual": false, "visibility": "external" }, { "functionSelector": "29a63083", "id": 13422, "implemented": false, "kind": "function", "modifiers": [], "name": "getBundleId", "nameLocation": "482:11:46", "nodeType": "FunctionDefinition", "parameters": { "id": 13418, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 13417, "mutability": "mutable", "name": "tokenId", "nameLocation": "502:7:46", "nodeType": "VariableDeclaration", "scope": 13422, "src": "494:15:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 13416, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "494:7:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" } ], "src": "493:17:46" }, "returnParameters": { "id": 13421, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 13420, "mutability": "mutable", "name": "bundleId", "nameLocation": "541:8:46", "nodeType": "VariableDeclaration", "scope": 13422, "src": "533:16:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 13419, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "533:7:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" } ], "src": "532:18:46" }, "scope": 13428, "src": "473:78:46", "stateMutability": "view", "virtual": false, "visibility": "external" }, { "functionSelector": "18160ddd", "id": 13427, "implemented": false, "kind": "function", "modifiers": [], "name": "totalSupply", "nameLocation": "565:11:46", "nodeType": "FunctionDefinition", "parameters": { "id": 13423, "nodeType": "ParameterList", "parameters": [], "src": "576:2:46" }, "returnParameters": { "id": 13426, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 13425, "mutability": "mutable", "name": "tokenCount", "nameLocation": "609:10:46", "nodeType": "VariableDeclaration", "scope": 13427, "src": "601:18:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 13424, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "601:7:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" } ], "src": "600:20:46" }, "scope": 13428, "src": "556:65:46", "stateMutability": "view", "virtual": false, "visibility": "external" } ], "scope": 13429, "src": "123:500:46" } ], "src": "39:585:46" }, "bytecode": "", "bytecodeSha1": "da39a3ee5e6b4b0d3255bfef95601890afd80709", "compiler": { "evm_version": "istanbul", "optimizer": { "enabled": true, "runs": 200 }, "version": "0.8.2+commit.661d1103" }, "contractName": "IBundleToken", "coverageMap": { "branches": {}, "statements": {} }, "dependencies": [ "OpenZeppelin/openzeppelin-contracts@4.7.3/IERC165", "OpenZeppelin/openzeppelin-contracts@4.7.3/IERC721" ], "deployedBytecode": "", "deployedSourceMap": "", "language": "Solidity", "natspec": { "kind": "dev", "methods": { "approve(address,uint256)": { "details": "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." }, "balanceOf(address)": { "details": "Returns the number of tokens in ``owner``'s account." }, "getApproved(uint256)": { "details": "Returns the account approved for `tokenId` token. Requirements: - `tokenId` must exist." }, "isApprovedForAll(address,address)": { "details": "Returns if the `operator` is allowed to manage all of the assets of `owner`. See {setApprovalForAll}" }, "ownerOf(uint256)": { "details": "Returns the owner of the `tokenId` token. Requirements: - `tokenId` must exist." }, "safeTransferFrom(address,address,uint256)": { "details": "Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients are aware of the ERC721 protocol to prevent tokens from being forever locked. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `tokenId` token must exist and be owned by `from`. - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}. - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. Emits a {Transfer} event." }, "safeTransferFrom(address,address,uint256,bytes)": { "details": "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." }, "setApprovalForAll(address,bool)": { "details": "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." }, "supportsInterface(bytes4)": { "details": "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." }, "transferFrom(address,address,uint256)": { "details": "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." } }, "version": 1 }, "offset": [ 123, 623 ], "opcodes": "", "pcMap": {}, "sha1": "1af4a490e8fc4010a620039ae8fc1e86a9fc1d09", "source": "// SPDX-License-Identifier: Apache-2.0\npragma solidity 0.8.2;\n\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\ninterface IBundleToken is\n IERC721\n{\n event LogBundleTokenMinted(uint256 bundleId, uint256 tokenId, address tokenOwner);\n event LogBundleTokenBurned(uint256 bundleId, uint256 tokenId); \n\n function burned(uint tokenId) external view returns(bool isBurned);\n function exists(uint256 tokenId) external view returns(bool doesExist);\n function getBundleId(uint256 tokenId) external view returns(uint256 bundleId);\n function totalSupply() external view returns(uint256 tokenCount);\n}\n", "sourceMap": "", "sourcePath": "/home/vscode/.brownie/packages/etherisc/gif-interface@3b0002a/contracts/tokens/IBundleToken.sol", "type": "interface" }