becrypto/build/contracts/IMarketPlace.json
2021-12-27 18:57:12 +08:00

2236 lines
86 KiB
JSON

{
"contractName": "IMarketPlace",
"abi": [
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "string",
"name": "TxType",
"type": "string"
},
{
"indexed": false,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "MarketTransaction",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "string",
"name": "message",
"type": "string"
},
{
"indexed": false,
"internalType": "address",
"name": "recipient",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "MonetaryTransaction",
"type": "event"
},
{
"inputs": [
{
"internalType": "address",
"name": "_contractAddress",
"type": "address"
}
],
"name": "setContract",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "pause",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "resume",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_tokenId",
"type": "uint256"
}
],
"name": "getOffer",
"outputs": [
{
"internalType": "address",
"name": "seller",
"type": "address"
},
{
"internalType": "uint256",
"name": "price",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "index",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"internalType": "bool",
"name": "active",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getAllTokensOnSale",
"outputs": [
{
"internalType": "uint256[]",
"name": "listOfOffers",
"type": "uint256[]"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_price",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_tokenId",
"type": "uint256"
}
],
"name": "setOffer",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_tokenId",
"type": "uint256"
}
],
"name": "removeOffer",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_tokenId",
"type": "uint256"
}
],
"name": "buyHero",
"outputs": [],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [],
"name": "getBalance",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "withdrawFunds",
"outputs": [],
"stateMutability": "payable",
"type": "function"
}
],
"metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"TxType\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"MarketTransaction\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"message\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"MonetaryTransaction\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_tokenId\",\"type\":\"uint256\"}],\"name\":\"buyHero\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAllTokensOnSale\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"listOfOffers\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_tokenId\",\"type\":\"uint256\"}],\"name\":\"getOffer\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"seller\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"price\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"active\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_tokenId\",\"type\":\"uint256\"}],\"name\":\"removeOffer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"resume\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_contractAddress\",\"type\":\"address\"}],\"name\":\"setContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_price\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_tokenId\",\"type\":\"uint256\"}],\"name\":\"setOffer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"withdrawFunds\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"buyHero(uint256)\":{\"notice\":\"Executes the purchase of _tokenId. Transfers the token using transferFrom in CryptoHero. Transfers funds to the _fundsToBeCollected mapping. Removes the offer from the mapping. Sets the offer in the array to inactive. Emits the MarketTransaction event with txType \\\"Buy\\\". Requirement: The msg.value needs to equal the price of _tokenId Requirement: There must be an active offer for _tokenId\"},\"getAllTokensOnSale()\":{\"notice\":\"Get all tokenId's that are currently for sale. Returns an empty array if no offer exists.\"},\"getBalance()\":{\"notice\":\"Returns current balance of msg.sender\"},\"getOffer(uint256)\":{\"notice\":\"Get the details about a offer for _tokenId. Throws an error if there is no active offer for _tokenId.\"},\"pause()\":{\"notice\":\"Sets status of _paused to true which affects all functions that have whenNotPaused modifiers.\"},\"removeOffer(uint256)\":{\"notice\":\"Removes an existing offer. Emits the MarketTransaction event with txType \\\"Remove offer\\\" Requirement: Only the seller of _tokenId can remove an offer.\"},\"resume()\":{\"notice\":\"Sets status of _paused to false which affects all functions that have whenNotPaused modifiers.\"},\"setContract(address)\":{\"notice\":\"Set the current contract address and initialize the instance of the contract. Requirement: Only the contract owner can call.\"},\"setOffer(uint256,uint256)\":{\"notice\":\"Creates a new offer for _tokenId for the price _price. Emits the MarketTransaction event with txType \\\"Create offer\\\" Requirement: Only the owner of _tokenId can create an offer. Requirement: There can only be one active offer for a token at a time. Requirement: Marketplace contract (this) needs to be an approved operator when the offer is created.\"},\"withdrawFunds()\":{\"notice\":\"Send funds to msg.sender. Emits a MonetaryTransaction event \\\"Successful Transfer\\\". Requirement: msg.sender must have funds in the mapping.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"project:/contracts/IMarketplace.sol\":\"IMarketPlace\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"keccak256\":\"0x24e0364e503a9bbde94c715d26573a76f14cd2a202d45f96f52134ab806b67b9\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e12cbaa7378fd9b62280e4e1d164bedcb4399ce238f5f98fc0eefb7e50577981\",\"dweb:/ipfs/QmXRoFGUgfsaRkoPT5bxNMtSayKTQ8GZATLPXf69HcRA51\"]},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"keccak256\":\"0x516a22876c1fab47f49b1bc22b4614491cd05338af8bd2e7b382da090a079990\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a439187f7126d31add4557f82d8aed6be0162007cd7182c48fd934dbab8f3849\",\"dweb:/ipfs/QmRPLguRFvrRJS7r6F1bcLvsx6q1VrgjEpZafyeL8D7xZh\"]},\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\":{\"keccak256\":\"0xd5fa74b4fb323776fa4a8158800fec9d5ac0fec0d6dd046dd93798632ada265f\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://33017a30a99cc5411a9e376622c31fc4a55cfc6a335e2f57f00cbf24a817ff3f\",\"dweb:/ipfs/QmWNQtWTPhA7Lo8nbxbc8KFMvZwbFYB8fSeEQ3vuapSV4a\"]},\"@openzeppelin/contracts/utils/Context.sol\":{\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6df0ddf21ce9f58271bdfaa85cde98b200ef242a05a3f85c2bc10a8294800a92\",\"dweb:/ipfs/QmRK2Y5Yc6BK7tGKkgsgn3aJEQGi5aakeSPZvS65PV8Xp3\"]},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://be161e54f24e5c6fae81a12db1a8ae87bc5ae1b0ddc805d82a1440a68455088f\",\"dweb:/ipfs/QmP7C3CHdY9urF4dEMb9wmsp1wMxHF6nhA2yQE5SKiPAdy\"]},\"@openzeppelin/contracts/utils/math/SafeMath.sol\":{\"keccak256\":\"0xa2f576be637946f767aa56601c26d717f48a0aff44f82e46f13807eea1009a21\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://973868f808e88e21a1a0a01d4839314515ee337ad096286c88e41b74dcc11fc2\",\"dweb:/ipfs/QmfYuZxRfx2J2xdk4EXN7jKg4bUYEMTaYk9BAw9Bqn4o2Y\"]},\"project:/contracts/CryptoHero.sol\":{\"keccak256\":\"0x64f1ab87d777461c757bad508c6863eb2901814d381e598b20d1140d0e521c3d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c4714ac384d4489583831a09612d2fcb424a28092bd08275af43ef05f8c700d5\",\"dweb:/ipfs/Qma9TjsYDxg1GrLVmbjtXMmK7aMgj57nCnZTETS3BZ8spm\"]},\"project:/contracts/IMarketplace.sol\":{\"keccak256\":\"0x6eb0f9d80ae4b8620775c9cda93606a8d158e6eaa3f4728a64559825f9b1efe1\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://070c11e95226d0319d4beb12b58ccf1496d2646dc54bcff834f33c9ec5bdb230\",\"dweb:/ipfs/QmedRXVZaxepHuhBfUb1so1dcMCje564BczkkgKHxRdryc\"]}},\"version\":1}",
"bytecode": "0x",
"deployedBytecode": "0x",
"immutableReferences": {},
"generatedSources": [],
"deployedGeneratedSources": [],
"sourceMap": "",
"deployedSourceMap": "",
"source": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./CryptoHero.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\n/*\n * Market place to trade heros (should **in theory** be used for any ERC721 token)\n * It needs an existing hero contract to interact with\n * Note: it does not inherit from the contract\n * Note: It takes ownership of the hero for the duration that is is on the marketplace.\n */\ninterface IMarketPlace {\n\n event MarketTransaction(string TxType, address owner, uint256 tokenId);\n event MonetaryTransaction(string message, address recipient, uint256 amount);\n\n /**\n * Set the current contract address and initialize the instance of the contract.\n * Requirement: Only the contract owner can call.\n */\n function setContract(address _contractAddress) external;\n\n /**\n * Sets status of _paused to true which affects all functions that have whenNotPaused modifiers.\n */\n function pause() external;\n\n /**\n * Sets status of _paused to false which affects all functions that have whenNotPaused modifiers.\n */\n function resume() external;\n\n /**\n * Get the details about a offer for _tokenId. Throws an error if there is no active offer for _tokenId.\n */\n function getOffer(uint256 _tokenId) external view returns (address seller, uint256 price, uint256 index, uint256 tokenId, bool active);\n\n /**\n * Get all tokenId's that are currently for sale. Returns an empty array if no offer exists.\n */\n function getAllTokensOnSale() external view returns (uint256[] memory listOfOffers);\n\n /**\n * Creates a new offer for _tokenId for the price _price.\n * Emits the MarketTransaction event with txType \"Create offer\"\n * Requirement: Only the owner of _tokenId can create an offer.\n * Requirement: There can only be one active offer for a token at a time.\n * Requirement: Marketplace contract (this) needs to be an approved operator when the offer is created.\n */\n function setOffer(uint256 _price, uint256 _tokenId) external;\n\n /**\n * Removes an existing offer.\n * Emits the MarketTransaction event with txType \"Remove offer\"\n * Requirement: Only the seller of _tokenId can remove an offer.\n */\n function removeOffer(uint256 _tokenId) external;\n\n /**\n * Executes the purchase of _tokenId.\n * Transfers the token using transferFrom in CryptoHero.\n * Transfers funds to the _fundsToBeCollected mapping.\n * Removes the offer from the mapping.\n * Sets the offer in the array to inactive.\n * Emits the MarketTransaction event with txType \"Buy\".\n * Requirement: The msg.value needs to equal the price of _tokenId\n * Requirement: There must be an active offer for _tokenId\n */\n function buyHero(uint256 _tokenId) external payable;\n\n /**\n * Returns current balance of msg.sender\n */\n function getBalance() external view returns (uint256);\n\n /**\n * Send funds to msg.sender.\n * Emits a MonetaryTransaction event \"Successful Transfer\".\n * Requirement: msg.sender must have funds in the mapping.\n */\n function withdrawFunds() external payable;\n}",
"sourcePath": "/Users/zhl/Documents/workspace/game/becrypto/contracts/IMarketplace.sol",
"ast": {
"absolutePath": "project:/contracts/IMarketplace.sol",
"exportedSymbols": {
"Context": [
260
],
"CryptoHero": [
1741
],
"IERC165": [
272
],
"IERC721": [
220
],
"IERC721Receiver": [
238
],
"IMarketPlace": [
1829
],
"Ownable": [
104
],
"SafeMath": [
584
]
},
"id": 1830,
"license": "MIT",
"nodeType": "SourceUnit",
"nodes": [
{
"id": 1743,
"literals": [
"solidity",
"^",
"0.8",
".0"
],
"nodeType": "PragmaDirective",
"src": "32:23:7"
},
{
"absolutePath": "project:/contracts/CryptoHero.sol",
"file": "./CryptoHero.sol",
"id": 1744,
"nameLocation": "-1:-1:-1",
"nodeType": "ImportDirective",
"scope": 1830,
"sourceUnit": 1742,
"src": "57:26:7",
"symbolAliases": [],
"unitAlias": ""
},
{
"absolutePath": "@openzeppelin/contracts/access/Ownable.sol",
"file": "@openzeppelin/contracts/access/Ownable.sol",
"id": 1745,
"nameLocation": "-1:-1:-1",
"nodeType": "ImportDirective",
"scope": 1830,
"sourceUnit": 105,
"src": "84:52:7",
"symbolAliases": [],
"unitAlias": ""
},
{
"abstract": false,
"baseContracts": [],
"canonicalName": "IMarketPlace",
"contractDependencies": [],
"contractKind": "interface",
"fullyImplemented": false,
"id": 1829,
"linearizedBaseContracts": [
1829
],
"name": "IMarketPlace",
"nameLocation": "428:12:7",
"nodeType": "ContractDefinition",
"nodes": [
{
"anonymous": false,
"id": 1753,
"name": "MarketTransaction",
"nameLocation": "454:17:7",
"nodeType": "EventDefinition",
"parameters": {
"id": 1752,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1747,
"indexed": false,
"mutability": "mutable",
"name": "TxType",
"nameLocation": "479:6:7",
"nodeType": "VariableDeclaration",
"scope": 1753,
"src": "472:13:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_string_memory_ptr",
"typeString": "string"
},
"typeName": {
"id": 1746,
"name": "string",
"nodeType": "ElementaryTypeName",
"src": "472:6:7",
"typeDescriptions": {
"typeIdentifier": "t_string_storage_ptr",
"typeString": "string"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 1749,
"indexed": false,
"mutability": "mutable",
"name": "owner",
"nameLocation": "495:5:7",
"nodeType": "VariableDeclaration",
"scope": 1753,
"src": "487:13:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 1748,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "487:7:7",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 1751,
"indexed": false,
"mutability": "mutable",
"name": "tokenId",
"nameLocation": "510:7:7",
"nodeType": "VariableDeclaration",
"scope": 1753,
"src": "502:15:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 1750,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "502:7:7",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "471:47:7"
},
"src": "448:71:7"
},
{
"anonymous": false,
"id": 1761,
"name": "MonetaryTransaction",
"nameLocation": "530:19:7",
"nodeType": "EventDefinition",
"parameters": {
"id": 1760,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1755,
"indexed": false,
"mutability": "mutable",
"name": "message",
"nameLocation": "557:7:7",
"nodeType": "VariableDeclaration",
"scope": 1761,
"src": "550:14:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_string_memory_ptr",
"typeString": "string"
},
"typeName": {
"id": 1754,
"name": "string",
"nodeType": "ElementaryTypeName",
"src": "550:6:7",
"typeDescriptions": {
"typeIdentifier": "t_string_storage_ptr",
"typeString": "string"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 1757,
"indexed": false,
"mutability": "mutable",
"name": "recipient",
"nameLocation": "574:9:7",
"nodeType": "VariableDeclaration",
"scope": 1761,
"src": "566:17:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 1756,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "566:7:7",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 1759,
"indexed": false,
"mutability": "mutable",
"name": "amount",
"nameLocation": "593:6:7",
"nodeType": "VariableDeclaration",
"scope": 1761,
"src": "585:14:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 1758,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "585:7:7",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "549:51:7"
},
"src": "524:77:7"
},
{
"documentation": {
"id": 1762,
"nodeType": "StructuredDocumentation",
"src": "607:148:7",
"text": " Set the current contract address and initialize the instance of the contract.\n Requirement: Only the contract owner can call."
},
"functionSelector": "75f890ab",
"id": 1767,
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "setContract",
"nameLocation": "769:11:7",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 1765,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1764,
"mutability": "mutable",
"name": "_contractAddress",
"nameLocation": "789:16:7",
"nodeType": "VariableDeclaration",
"scope": 1767,
"src": "781:24:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 1763,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "781:7:7",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
}
],
"src": "780:26:7"
},
"returnParameters": {
"id": 1766,
"nodeType": "ParameterList",
"parameters": [],
"src": "815:0:7"
},
"scope": 1829,
"src": "760:56:7",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "external"
},
{
"documentation": {
"id": 1768,
"nodeType": "StructuredDocumentation",
"src": "822:111:7",
"text": " Sets status of _paused to true which affects all functions that have whenNotPaused modifiers."
},
"functionSelector": "8456cb59",
"id": 1771,
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "pause",
"nameLocation": "947:5:7",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 1769,
"nodeType": "ParameterList",
"parameters": [],
"src": "952:2:7"
},
"returnParameters": {
"id": 1770,
"nodeType": "ParameterList",
"parameters": [],
"src": "963:0:7"
},
"scope": 1829,
"src": "938:26:7",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "external"
},
{
"documentation": {
"id": 1772,
"nodeType": "StructuredDocumentation",
"src": "970:112:7",
"text": " Sets status of _paused to false which affects all functions that have whenNotPaused modifiers."
},
"functionSelector": "046f7da2",
"id": 1775,
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "resume",
"nameLocation": "1096:6:7",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 1773,
"nodeType": "ParameterList",
"parameters": [],
"src": "1102:2:7"
},
"returnParameters": {
"id": 1774,
"nodeType": "ParameterList",
"parameters": [],
"src": "1113:0:7"
},
"scope": 1829,
"src": "1087:27:7",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "external"
},
{
"documentation": {
"id": 1776,
"nodeType": "StructuredDocumentation",
"src": "1120:119:7",
"text": " Get the details about a offer for _tokenId. Throws an error if there is no active offer for _tokenId."
},
"functionSelector": "4579268a",
"id": 1791,
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "getOffer",
"nameLocation": "1253:8:7",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 1779,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1778,
"mutability": "mutable",
"name": "_tokenId",
"nameLocation": "1270:8:7",
"nodeType": "VariableDeclaration",
"scope": 1791,
"src": "1262:16:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 1777,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1262:7:7",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "1261:18:7"
},
"returnParameters": {
"id": 1790,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1781,
"mutability": "mutable",
"name": "seller",
"nameLocation": "1311:6:7",
"nodeType": "VariableDeclaration",
"scope": 1791,
"src": "1303:14:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 1780,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1303:7:7",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 1783,
"mutability": "mutable",
"name": "price",
"nameLocation": "1327:5:7",
"nodeType": "VariableDeclaration",
"scope": 1791,
"src": "1319:13:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 1782,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1319:7:7",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 1785,
"mutability": "mutable",
"name": "index",
"nameLocation": "1342:5:7",
"nodeType": "VariableDeclaration",
"scope": 1791,
"src": "1334:13:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 1784,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1334:7:7",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 1787,
"mutability": "mutable",
"name": "tokenId",
"nameLocation": "1357:7:7",
"nodeType": "VariableDeclaration",
"scope": 1791,
"src": "1349:15:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 1786,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1349:7:7",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 1789,
"mutability": "mutable",
"name": "active",
"nameLocation": "1371:6:7",
"nodeType": "VariableDeclaration",
"scope": 1791,
"src": "1366:11:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 1788,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "1366:4:7",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"visibility": "internal"
}
],
"src": "1302:76:7"
},
"scope": 1829,
"src": "1244:135:7",
"stateMutability": "view",
"virtual": false,
"visibility": "external"
},
{
"documentation": {
"id": 1792,
"nodeType": "StructuredDocumentation",
"src": "1385:107:7",
"text": " Get all tokenId's that are currently for sale. Returns an empty array if no offer exists."
},
"functionSelector": "ae6b016c",
"id": 1798,
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "getAllTokensOnSale",
"nameLocation": "1506:18:7",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 1793,
"nodeType": "ParameterList",
"parameters": [],
"src": "1524:2:7"
},
"returnParameters": {
"id": 1797,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1796,
"mutability": "mutable",
"name": "listOfOffers",
"nameLocation": "1567:12:7",
"nodeType": "VariableDeclaration",
"scope": 1798,
"src": "1550:29:7",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr",
"typeString": "uint256[]"
},
"typeName": {
"baseType": {
"id": 1794,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1550:7:7",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 1795,
"nodeType": "ArrayTypeName",
"src": "1550:9:7",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr",
"typeString": "uint256[]"
}
},
"visibility": "internal"
}
],
"src": "1549:31:7"
},
"scope": 1829,
"src": "1497:84:7",
"stateMutability": "view",
"virtual": false,
"visibility": "external"
},
{
"documentation": {
"id": 1799,
"nodeType": "StructuredDocumentation",
"src": "1587:390:7",
"text": " Creates a new offer for _tokenId for the price _price.\n Emits the MarketTransaction event with txType \"Create offer\"\n Requirement: Only the owner of _tokenId can create an offer.\n Requirement: There can only be one active offer for a token at a time.\n Requirement: Marketplace contract (this) needs to be an approved operator when the offer is created."
},
"functionSelector": "941b055b",
"id": 1806,
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "setOffer",
"nameLocation": "1991:8:7",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 1804,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1801,
"mutability": "mutable",
"name": "_price",
"nameLocation": "2008:6:7",
"nodeType": "VariableDeclaration",
"scope": 1806,
"src": "2000:14:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 1800,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2000:7:7",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 1803,
"mutability": "mutable",
"name": "_tokenId",
"nameLocation": "2024:8:7",
"nodeType": "VariableDeclaration",
"scope": 1806,
"src": "2016:16:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 1802,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2016:7:7",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "1999:34:7"
},
"returnParameters": {
"id": 1805,
"nodeType": "ParameterList",
"parameters": [],
"src": "2042:0:7"
},
"scope": 1829,
"src": "1982:61:7",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "external"
},
{
"documentation": {
"id": 1807,
"nodeType": "StructuredDocumentation",
"src": "2049:179:7",
"text": " Removes an existing offer.\n Emits the MarketTransaction event with txType \"Remove offer\"\n Requirement: Only the seller of _tokenId can remove an offer."
},
"functionSelector": "95a0f9c7",
"id": 1812,
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "removeOffer",
"nameLocation": "2242:11:7",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 1810,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1809,
"mutability": "mutable",
"name": "_tokenId",
"nameLocation": "2262:8:7",
"nodeType": "VariableDeclaration",
"scope": 1812,
"src": "2254:16:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 1808,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2254:7:7",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "2253:18:7"
},
"returnParameters": {
"id": 1811,
"nodeType": "ParameterList",
"parameters": [],
"src": "2280:0:7"
},
"scope": 1829,
"src": "2233:48:7",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "external"
},
{
"documentation": {
"id": 1813,
"nodeType": "StructuredDocumentation",
"src": "2287:450:7",
"text": " Executes the purchase of _tokenId.\n Transfers the token using transferFrom in CryptoHero.\n Transfers funds to the _fundsToBeCollected mapping.\n Removes the offer from the mapping.\n Sets the offer in the array to inactive.\n Emits the MarketTransaction event with txType \"Buy\".\n Requirement: The msg.value needs to equal the price of _tokenId\n Requirement: There must be an active offer for _tokenId"
},
"functionSelector": "024edd75",
"id": 1818,
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "buyHero",
"nameLocation": "2751:7:7",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 1816,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1815,
"mutability": "mutable",
"name": "_tokenId",
"nameLocation": "2767:8:7",
"nodeType": "VariableDeclaration",
"scope": 1818,
"src": "2759:16:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 1814,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2759:7:7",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "2758:18:7"
},
"returnParameters": {
"id": 1817,
"nodeType": "ParameterList",
"parameters": [],
"src": "2793:0:7"
},
"scope": 1829,
"src": "2742:52:7",
"stateMutability": "payable",
"virtual": false,
"visibility": "external"
},
{
"documentation": {
"id": 1819,
"nodeType": "StructuredDocumentation",
"src": "2800:55:7",
"text": " Returns current balance of msg.sender"
},
"functionSelector": "12065fe0",
"id": 1824,
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "getBalance",
"nameLocation": "2869:10:7",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 1820,
"nodeType": "ParameterList",
"parameters": [],
"src": "2879:2:7"
},
"returnParameters": {
"id": 1823,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1822,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 1824,
"src": "2905:7:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 1821,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2905:7:7",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "2904:9:7"
},
"scope": 1829,
"src": "2860:54:7",
"stateMutability": "view",
"virtual": false,
"visibility": "external"
},
{
"documentation": {
"id": 1825,
"nodeType": "StructuredDocumentation",
"src": "2920:168:7",
"text": " Send funds to msg.sender.\n Emits a MonetaryTransaction event \"Successful Transfer\".\n Requirement: msg.sender must have funds in the mapping."
},
"functionSelector": "24600fc3",
"id": 1828,
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "withdrawFunds",
"nameLocation": "3102:13:7",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 1826,
"nodeType": "ParameterList",
"parameters": [],
"src": "3115:2:7"
},
"returnParameters": {
"id": 1827,
"nodeType": "ParameterList",
"parameters": [],
"src": "3134:0:7"
},
"scope": 1829,
"src": "3093:42:7",
"stateMutability": "payable",
"virtual": false,
"visibility": "external"
}
],
"scope": 1830,
"src": "418:2719:7",
"usedErrors": []
}
],
"src": "32:3105:7"
},
"legacyAST": {
"absolutePath": "project:/contracts/IMarketplace.sol",
"exportedSymbols": {
"Context": [
260
],
"CryptoHero": [
1741
],
"IERC165": [
272
],
"IERC721": [
220
],
"IERC721Receiver": [
238
],
"IMarketPlace": [
1829
],
"Ownable": [
104
],
"SafeMath": [
584
]
},
"id": 1830,
"license": "MIT",
"nodeType": "SourceUnit",
"nodes": [
{
"id": 1743,
"literals": [
"solidity",
"^",
"0.8",
".0"
],
"nodeType": "PragmaDirective",
"src": "32:23:7"
},
{
"absolutePath": "project:/contracts/CryptoHero.sol",
"file": "./CryptoHero.sol",
"id": 1744,
"nameLocation": "-1:-1:-1",
"nodeType": "ImportDirective",
"scope": 1830,
"sourceUnit": 1742,
"src": "57:26:7",
"symbolAliases": [],
"unitAlias": ""
},
{
"absolutePath": "@openzeppelin/contracts/access/Ownable.sol",
"file": "@openzeppelin/contracts/access/Ownable.sol",
"id": 1745,
"nameLocation": "-1:-1:-1",
"nodeType": "ImportDirective",
"scope": 1830,
"sourceUnit": 105,
"src": "84:52:7",
"symbolAliases": [],
"unitAlias": ""
},
{
"abstract": false,
"baseContracts": [],
"canonicalName": "IMarketPlace",
"contractDependencies": [],
"contractKind": "interface",
"fullyImplemented": false,
"id": 1829,
"linearizedBaseContracts": [
1829
],
"name": "IMarketPlace",
"nameLocation": "428:12:7",
"nodeType": "ContractDefinition",
"nodes": [
{
"anonymous": false,
"id": 1753,
"name": "MarketTransaction",
"nameLocation": "454:17:7",
"nodeType": "EventDefinition",
"parameters": {
"id": 1752,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1747,
"indexed": false,
"mutability": "mutable",
"name": "TxType",
"nameLocation": "479:6:7",
"nodeType": "VariableDeclaration",
"scope": 1753,
"src": "472:13:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_string_memory_ptr",
"typeString": "string"
},
"typeName": {
"id": 1746,
"name": "string",
"nodeType": "ElementaryTypeName",
"src": "472:6:7",
"typeDescriptions": {
"typeIdentifier": "t_string_storage_ptr",
"typeString": "string"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 1749,
"indexed": false,
"mutability": "mutable",
"name": "owner",
"nameLocation": "495:5:7",
"nodeType": "VariableDeclaration",
"scope": 1753,
"src": "487:13:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 1748,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "487:7:7",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 1751,
"indexed": false,
"mutability": "mutable",
"name": "tokenId",
"nameLocation": "510:7:7",
"nodeType": "VariableDeclaration",
"scope": 1753,
"src": "502:15:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 1750,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "502:7:7",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "471:47:7"
},
"src": "448:71:7"
},
{
"anonymous": false,
"id": 1761,
"name": "MonetaryTransaction",
"nameLocation": "530:19:7",
"nodeType": "EventDefinition",
"parameters": {
"id": 1760,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1755,
"indexed": false,
"mutability": "mutable",
"name": "message",
"nameLocation": "557:7:7",
"nodeType": "VariableDeclaration",
"scope": 1761,
"src": "550:14:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_string_memory_ptr",
"typeString": "string"
},
"typeName": {
"id": 1754,
"name": "string",
"nodeType": "ElementaryTypeName",
"src": "550:6:7",
"typeDescriptions": {
"typeIdentifier": "t_string_storage_ptr",
"typeString": "string"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 1757,
"indexed": false,
"mutability": "mutable",
"name": "recipient",
"nameLocation": "574:9:7",
"nodeType": "VariableDeclaration",
"scope": 1761,
"src": "566:17:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 1756,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "566:7:7",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 1759,
"indexed": false,
"mutability": "mutable",
"name": "amount",
"nameLocation": "593:6:7",
"nodeType": "VariableDeclaration",
"scope": 1761,
"src": "585:14:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 1758,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "585:7:7",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "549:51:7"
},
"src": "524:77:7"
},
{
"documentation": {
"id": 1762,
"nodeType": "StructuredDocumentation",
"src": "607:148:7",
"text": " Set the current contract address and initialize the instance of the contract.\n Requirement: Only the contract owner can call."
},
"functionSelector": "75f890ab",
"id": 1767,
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "setContract",
"nameLocation": "769:11:7",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 1765,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1764,
"mutability": "mutable",
"name": "_contractAddress",
"nameLocation": "789:16:7",
"nodeType": "VariableDeclaration",
"scope": 1767,
"src": "781:24:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 1763,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "781:7:7",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
}
],
"src": "780:26:7"
},
"returnParameters": {
"id": 1766,
"nodeType": "ParameterList",
"parameters": [],
"src": "815:0:7"
},
"scope": 1829,
"src": "760:56:7",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "external"
},
{
"documentation": {
"id": 1768,
"nodeType": "StructuredDocumentation",
"src": "822:111:7",
"text": " Sets status of _paused to true which affects all functions that have whenNotPaused modifiers."
},
"functionSelector": "8456cb59",
"id": 1771,
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "pause",
"nameLocation": "947:5:7",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 1769,
"nodeType": "ParameterList",
"parameters": [],
"src": "952:2:7"
},
"returnParameters": {
"id": 1770,
"nodeType": "ParameterList",
"parameters": [],
"src": "963:0:7"
},
"scope": 1829,
"src": "938:26:7",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "external"
},
{
"documentation": {
"id": 1772,
"nodeType": "StructuredDocumentation",
"src": "970:112:7",
"text": " Sets status of _paused to false which affects all functions that have whenNotPaused modifiers."
},
"functionSelector": "046f7da2",
"id": 1775,
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "resume",
"nameLocation": "1096:6:7",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 1773,
"nodeType": "ParameterList",
"parameters": [],
"src": "1102:2:7"
},
"returnParameters": {
"id": 1774,
"nodeType": "ParameterList",
"parameters": [],
"src": "1113:0:7"
},
"scope": 1829,
"src": "1087:27:7",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "external"
},
{
"documentation": {
"id": 1776,
"nodeType": "StructuredDocumentation",
"src": "1120:119:7",
"text": " Get the details about a offer for _tokenId. Throws an error if there is no active offer for _tokenId."
},
"functionSelector": "4579268a",
"id": 1791,
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "getOffer",
"nameLocation": "1253:8:7",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 1779,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1778,
"mutability": "mutable",
"name": "_tokenId",
"nameLocation": "1270:8:7",
"nodeType": "VariableDeclaration",
"scope": 1791,
"src": "1262:16:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 1777,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1262:7:7",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "1261:18:7"
},
"returnParameters": {
"id": 1790,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1781,
"mutability": "mutable",
"name": "seller",
"nameLocation": "1311:6:7",
"nodeType": "VariableDeclaration",
"scope": 1791,
"src": "1303:14:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 1780,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1303:7:7",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 1783,
"mutability": "mutable",
"name": "price",
"nameLocation": "1327:5:7",
"nodeType": "VariableDeclaration",
"scope": 1791,
"src": "1319:13:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 1782,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1319:7:7",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 1785,
"mutability": "mutable",
"name": "index",
"nameLocation": "1342:5:7",
"nodeType": "VariableDeclaration",
"scope": 1791,
"src": "1334:13:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 1784,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1334:7:7",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 1787,
"mutability": "mutable",
"name": "tokenId",
"nameLocation": "1357:7:7",
"nodeType": "VariableDeclaration",
"scope": 1791,
"src": "1349:15:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 1786,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1349:7:7",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 1789,
"mutability": "mutable",
"name": "active",
"nameLocation": "1371:6:7",
"nodeType": "VariableDeclaration",
"scope": 1791,
"src": "1366:11:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 1788,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "1366:4:7",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"visibility": "internal"
}
],
"src": "1302:76:7"
},
"scope": 1829,
"src": "1244:135:7",
"stateMutability": "view",
"virtual": false,
"visibility": "external"
},
{
"documentation": {
"id": 1792,
"nodeType": "StructuredDocumentation",
"src": "1385:107:7",
"text": " Get all tokenId's that are currently for sale. Returns an empty array if no offer exists."
},
"functionSelector": "ae6b016c",
"id": 1798,
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "getAllTokensOnSale",
"nameLocation": "1506:18:7",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 1793,
"nodeType": "ParameterList",
"parameters": [],
"src": "1524:2:7"
},
"returnParameters": {
"id": 1797,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1796,
"mutability": "mutable",
"name": "listOfOffers",
"nameLocation": "1567:12:7",
"nodeType": "VariableDeclaration",
"scope": 1798,
"src": "1550:29:7",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr",
"typeString": "uint256[]"
},
"typeName": {
"baseType": {
"id": 1794,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1550:7:7",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 1795,
"nodeType": "ArrayTypeName",
"src": "1550:9:7",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr",
"typeString": "uint256[]"
}
},
"visibility": "internal"
}
],
"src": "1549:31:7"
},
"scope": 1829,
"src": "1497:84:7",
"stateMutability": "view",
"virtual": false,
"visibility": "external"
},
{
"documentation": {
"id": 1799,
"nodeType": "StructuredDocumentation",
"src": "1587:390:7",
"text": " Creates a new offer for _tokenId for the price _price.\n Emits the MarketTransaction event with txType \"Create offer\"\n Requirement: Only the owner of _tokenId can create an offer.\n Requirement: There can only be one active offer for a token at a time.\n Requirement: Marketplace contract (this) needs to be an approved operator when the offer is created."
},
"functionSelector": "941b055b",
"id": 1806,
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "setOffer",
"nameLocation": "1991:8:7",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 1804,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1801,
"mutability": "mutable",
"name": "_price",
"nameLocation": "2008:6:7",
"nodeType": "VariableDeclaration",
"scope": 1806,
"src": "2000:14:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 1800,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2000:7:7",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 1803,
"mutability": "mutable",
"name": "_tokenId",
"nameLocation": "2024:8:7",
"nodeType": "VariableDeclaration",
"scope": 1806,
"src": "2016:16:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 1802,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2016:7:7",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "1999:34:7"
},
"returnParameters": {
"id": 1805,
"nodeType": "ParameterList",
"parameters": [],
"src": "2042:0:7"
},
"scope": 1829,
"src": "1982:61:7",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "external"
},
{
"documentation": {
"id": 1807,
"nodeType": "StructuredDocumentation",
"src": "2049:179:7",
"text": " Removes an existing offer.\n Emits the MarketTransaction event with txType \"Remove offer\"\n Requirement: Only the seller of _tokenId can remove an offer."
},
"functionSelector": "95a0f9c7",
"id": 1812,
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "removeOffer",
"nameLocation": "2242:11:7",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 1810,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1809,
"mutability": "mutable",
"name": "_tokenId",
"nameLocation": "2262:8:7",
"nodeType": "VariableDeclaration",
"scope": 1812,
"src": "2254:16:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 1808,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2254:7:7",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "2253:18:7"
},
"returnParameters": {
"id": 1811,
"nodeType": "ParameterList",
"parameters": [],
"src": "2280:0:7"
},
"scope": 1829,
"src": "2233:48:7",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "external"
},
{
"documentation": {
"id": 1813,
"nodeType": "StructuredDocumentation",
"src": "2287:450:7",
"text": " Executes the purchase of _tokenId.\n Transfers the token using transferFrom in CryptoHero.\n Transfers funds to the _fundsToBeCollected mapping.\n Removes the offer from the mapping.\n Sets the offer in the array to inactive.\n Emits the MarketTransaction event with txType \"Buy\".\n Requirement: The msg.value needs to equal the price of _tokenId\n Requirement: There must be an active offer for _tokenId"
},
"functionSelector": "024edd75",
"id": 1818,
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "buyHero",
"nameLocation": "2751:7:7",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 1816,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1815,
"mutability": "mutable",
"name": "_tokenId",
"nameLocation": "2767:8:7",
"nodeType": "VariableDeclaration",
"scope": 1818,
"src": "2759:16:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 1814,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2759:7:7",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "2758:18:7"
},
"returnParameters": {
"id": 1817,
"nodeType": "ParameterList",
"parameters": [],
"src": "2793:0:7"
},
"scope": 1829,
"src": "2742:52:7",
"stateMutability": "payable",
"virtual": false,
"visibility": "external"
},
{
"documentation": {
"id": 1819,
"nodeType": "StructuredDocumentation",
"src": "2800:55:7",
"text": " Returns current balance of msg.sender"
},
"functionSelector": "12065fe0",
"id": 1824,
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "getBalance",
"nameLocation": "2869:10:7",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 1820,
"nodeType": "ParameterList",
"parameters": [],
"src": "2879:2:7"
},
"returnParameters": {
"id": 1823,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1822,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 1824,
"src": "2905:7:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 1821,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2905:7:7",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "2904:9:7"
},
"scope": 1829,
"src": "2860:54:7",
"stateMutability": "view",
"virtual": false,
"visibility": "external"
},
{
"documentation": {
"id": 1825,
"nodeType": "StructuredDocumentation",
"src": "2920:168:7",
"text": " Send funds to msg.sender.\n Emits a MonetaryTransaction event \"Successful Transfer\".\n Requirement: msg.sender must have funds in the mapping."
},
"functionSelector": "24600fc3",
"id": 1828,
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "withdrawFunds",
"nameLocation": "3102:13:7",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 1826,
"nodeType": "ParameterList",
"parameters": [],
"src": "3115:2:7"
},
"returnParameters": {
"id": 1827,
"nodeType": "ParameterList",
"parameters": [],
"src": "3134:0:7"
},
"scope": 1829,
"src": "3093:42:7",
"stateMutability": "payable",
"virtual": false,
"visibility": "external"
}
],
"scope": 1830,
"src": "418:2719:7",
"usedErrors": []
}
],
"src": "32:3105:7"
},
"compiler": {
"name": "solc",
"version": "0.8.10+commit.fc410830.Emscripten.clang"
},
"networks": {},
"schemaVersion": "3.4.4",
"updatedAt": "2021-12-27T10:56:40.631Z",
"devdoc": {
"kind": "dev",
"methods": {},
"version": 1
},
"userdoc": {
"kind": "user",
"methods": {
"buyHero(uint256)": {
"notice": "Executes the purchase of _tokenId. Transfers the token using transferFrom in CryptoHero. Transfers funds to the _fundsToBeCollected mapping. Removes the offer from the mapping. Sets the offer in the array to inactive. Emits the MarketTransaction event with txType \"Buy\". Requirement: The msg.value needs to equal the price of _tokenId Requirement: There must be an active offer for _tokenId"
},
"getAllTokensOnSale()": {
"notice": "Get all tokenId's that are currently for sale. Returns an empty array if no offer exists."
},
"getBalance()": {
"notice": "Returns current balance of msg.sender"
},
"getOffer(uint256)": {
"notice": "Get the details about a offer for _tokenId. Throws an error if there is no active offer for _tokenId."
},
"pause()": {
"notice": "Sets status of _paused to true which affects all functions that have whenNotPaused modifiers."
},
"removeOffer(uint256)": {
"notice": "Removes an existing offer. Emits the MarketTransaction event with txType \"Remove offer\" Requirement: Only the seller of _tokenId can remove an offer."
},
"resume()": {
"notice": "Sets status of _paused to false which affects all functions that have whenNotPaused modifiers."
},
"setContract(address)": {
"notice": "Set the current contract address and initialize the instance of the contract. Requirement: Only the contract owner can call."
},
"setOffer(uint256,uint256)": {
"notice": "Creates a new offer for _tokenId for the price _price. Emits the MarketTransaction event with txType \"Create offer\" Requirement: Only the owner of _tokenId can create an offer. Requirement: There can only be one active offer for a token at a time. Requirement: Marketplace contract (this) needs to be an approved operator when the offer is created."
},
"withdrawFunds()": {
"notice": "Send funds to msg.sender. Emits a MonetaryTransaction event \"Successful Transfer\". Requirement: msg.sender must have funds in the mapping."
}
},
"version": 1
}
}