rename nftbapp

This commit is contained in:
elegant651
2020-03-25 13:49:36 +09:00
parent 5ad3b5d2de
commit 8072a65374
51 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1 @@
{ "presets": ["babel-preset-es2015"] }

2
nftbapp/backend-nftbapp/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
node_modules
.env

View File

@@ -0,0 +1,511 @@
{
"contractName": "AddressUtils",
"abi": [],
"bytecode": "0x604c602c600b82828239805160001a60731460008114601c57601e565bfe5b5030600052607381538281f30073000000000000000000000000000000000000000030146080604052600080fd00a165627a7a72305820a33fcaee8adec8f4f199d47c1b3eb0309f78890ba1f229616f27f0a5aedbe8450029",
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fd00a165627a7a72305820a33fcaee8adec8f4f199d47c1b3eb0309f78890ba1f229616f27f0a5aedbe8450029",
"sourceMap": "87:932:3:-;;132:2:-1;166:7;155:9;146:7;137:37;252:7;246:14;243:1;238:23;232:4;229:33;270:1;265:20;;;;222:63;;265:20;274:9;222:63;;298:9;295:1;288:20;328:4;319:7;311:22;352:7;343;336:24",
"deployedSourceMap": "87:932:3:-;;;;;;;;",
"source": "pragma solidity ^0.4.24;\n\n\n/**\n * Utility library of inline functions on addresses\n */\nlibrary AddressUtils {\n\n /**\n * Returns whether the target address is a contract\n * @dev This function will return false if invoked during the constructor of a contract,\n * as the code is not actually created until after the constructor finishes.\n * @param _addr address to check\n * @return whether the target address is a contract\n */\n function isContract(address _addr) internal view returns (bool) {\n uint256 size;\n // XXX Currently there is no better way to check if there is a contract in an address\n // than to check the size of the code at that address.\n // See https://ethereum.stackexchange.com/a/14016/36603\n // for more details about how this works.\n // TODO Check this again before the Serenity release, because all addresses will be\n // contracts then.\n // solium-disable-next-line security/no-inline-assembly\n assembly { size := extcodesize(_addr) }\n return size > 0;\n }\n\n}\n",
"sourcePath": "/Users/willpark/Desktop/bookwork-klaytn/project_codes/nftbapp/backend-nftdapp/node_modules/zeppelin-solidity/contracts/AddressUtils.sol",
"ast": {
"absolutePath": "/Users/willpark/Desktop/bookwork-klaytn/project_codes/nftbapp/backend-nftdapp/node_modules/zeppelin-solidity/contracts/AddressUtils.sol",
"exportedSymbols": {
"AddressUtils": [
470
]
},
"id": 471,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 453,
"literals": [
"solidity",
"^",
"0.4",
".24"
],
"nodeType": "PragmaDirective",
"src": "0:24:3"
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "library",
"documentation": "Utility library of inline functions on addresses",
"fullyImplemented": true,
"id": 470,
"linearizedBaseContracts": [
470
],
"name": "AddressUtils",
"nodeType": "ContractDefinition",
"nodes": [
{
"body": {
"id": 468,
"nodeType": "Block",
"src": "502:514:3",
"statements": [
{
"assignments": [],
"declarations": [
{
"constant": false,
"id": 461,
"name": "size",
"nodeType": "VariableDeclaration",
"scope": 469,
"src": "508:12:3",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 460,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "508:7:3",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 462,
"initialValue": null,
"nodeType": "VariableDeclarationStatement",
"src": "508:12:3"
},
{
"externalReferences": [
{
"size": {
"declaration": 461,
"isOffset": false,
"isSlot": false,
"src": "963:4:3",
"valueSize": 1
}
},
{
"_addr": {
"declaration": 455,
"isOffset": false,
"isSlot": false,
"src": "983:5:3",
"valueSize": 1
}
}
],
"id": 463,
"nodeType": "InlineAssembly",
"operations": "{\n size := extcodesize(_addr)\n}",
"src": "952:50:3"
},
{
"expression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 466,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 464,
"name": "size",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 461,
"src": "1003:4:3",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": ">",
"rightExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 465,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1010:1:3",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "1003:8:3",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"functionReturnParameters": 459,
"id": 467,
"nodeType": "Return",
"src": "996:15:3"
}
]
},
"documentation": "Returns whether the target address is a contract\n@dev This function will return false if invoked during the constructor of a contract,\nas the code is not actually created until after the constructor finishes.\n@param _addr address to check\n@return whether the target address is a contract",
"id": 469,
"implemented": true,
"isConstructor": false,
"isDeclaredConst": true,
"modifiers": [],
"name": "isContract",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 456,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 455,
"name": "_addr",
"nodeType": "VariableDeclaration",
"scope": 469,
"src": "458:13:3",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 454,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "458:7:3",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "457:15:3"
},
"payable": false,
"returnParameters": {
"id": 459,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 458,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 469,
"src": "496:4:3",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 457,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "496:4:3",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "495:6:3"
},
"scope": 470,
"src": "438:578:3",
"stateMutability": "view",
"superFunction": null,
"visibility": "internal"
}
],
"scope": 471,
"src": "87:932:3"
}
],
"src": "0:1020:3"
},
"legacyAST": {
"absolutePath": "/Users/willpark/Desktop/bookwork-klaytn/project_codes/nftbapp/backend-nftdapp/node_modules/zeppelin-solidity/contracts/AddressUtils.sol",
"exportedSymbols": {
"AddressUtils": [
470
]
},
"id": 471,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 453,
"literals": [
"solidity",
"^",
"0.4",
".24"
],
"nodeType": "PragmaDirective",
"src": "0:24:3"
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "library",
"documentation": "Utility library of inline functions on addresses",
"fullyImplemented": true,
"id": 470,
"linearizedBaseContracts": [
470
],
"name": "AddressUtils",
"nodeType": "ContractDefinition",
"nodes": [
{
"body": {
"id": 468,
"nodeType": "Block",
"src": "502:514:3",
"statements": [
{
"assignments": [],
"declarations": [
{
"constant": false,
"id": 461,
"name": "size",
"nodeType": "VariableDeclaration",
"scope": 469,
"src": "508:12:3",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 460,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "508:7:3",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 462,
"initialValue": null,
"nodeType": "VariableDeclarationStatement",
"src": "508:12:3"
},
{
"externalReferences": [
{
"size": {
"declaration": 461,
"isOffset": false,
"isSlot": false,
"src": "963:4:3",
"valueSize": 1
}
},
{
"_addr": {
"declaration": 455,
"isOffset": false,
"isSlot": false,
"src": "983:5:3",
"valueSize": 1
}
}
],
"id": 463,
"nodeType": "InlineAssembly",
"operations": "{\n size := extcodesize(_addr)\n}",
"src": "952:50:3"
},
{
"expression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 466,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 464,
"name": "size",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 461,
"src": "1003:4:3",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": ">",
"rightExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 465,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1010:1:3",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "1003:8:3",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"functionReturnParameters": 459,
"id": 467,
"nodeType": "Return",
"src": "996:15:3"
}
]
},
"documentation": "Returns whether the target address is a contract\n@dev This function will return false if invoked during the constructor of a contract,\nas the code is not actually created until after the constructor finishes.\n@param _addr address to check\n@return whether the target address is a contract",
"id": 469,
"implemented": true,
"isConstructor": false,
"isDeclaredConst": true,
"modifiers": [],
"name": "isContract",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 456,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 455,
"name": "_addr",
"nodeType": "VariableDeclaration",
"scope": 469,
"src": "458:13:3",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 454,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "458:7:3",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "457:15:3"
},
"payable": false,
"returnParameters": {
"id": 459,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 458,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 469,
"src": "496:4:3",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 457,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "496:4:3",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "495:6:3"
},
"scope": 470,
"src": "438:578:3",
"stateMutability": "view",
"superFunction": null,
"visibility": "internal"
}
],
"scope": 471,
"src": "87:932:3"
}
],
"src": "0:1020:3"
},
"compiler": {
"name": "solc",
"version": "0.4.25+commit.59dbf8f1.Emscripten.clang"
},
"networks": {},
"schemaVersion": "2.0.2",
"updatedAt": "2020-03-25T02:14:16.713Z"
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,285 @@
{
"contractName": "ERC165",
"abi": [
{
"constant": true,
"inputs": [
{
"name": "_interfaceId",
"type": "bytes4"
}
],
"name": "supportsInterface",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
}
],
"bytecode": "0x",
"deployedBytecode": "0x",
"sourceMap": "",
"deployedSourceMap": "",
"source": "pragma solidity ^0.4.24;\n\n\n/**\n * @title ERC165\n * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md\n */\ninterface ERC165 {\n\n /**\n * @notice Query if a contract implements an interface\n * @param _interfaceId The interface identifier, as specified in ERC-165\n * @dev Interface identification is specified in ERC-165. This function\n * uses less than 30,000 gas.\n */\n function supportsInterface(bytes4 _interfaceId)\n external\n view\n returns (bool);\n}\n",
"sourcePath": "/Users/willpark/Desktop/bookwork-klaytn/project_codes/nftbapp/backend-nftdapp/node_modules/zeppelin-solidity/contracts/introspection/ERC165.sol",
"ast": {
"absolutePath": "/Users/willpark/Desktop/bookwork-klaytn/project_codes/nftbapp/backend-nftdapp/node_modules/zeppelin-solidity/contracts/introspection/ERC165.sol",
"exportedSymbols": {
"ERC165": [
480
]
},
"id": 481,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 472,
"literals": [
"solidity",
"^",
"0.4",
".24"
],
"nodeType": "PragmaDirective",
"src": "0:24:4"
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "interface",
"documentation": "@title ERC165\n@dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md",
"fullyImplemented": false,
"id": 480,
"linearizedBaseContracts": [
480
],
"name": "ERC165",
"nodeType": "ContractDefinition",
"nodes": [
{
"body": null,
"documentation": "@notice Query if a contract implements an interface\n@param _interfaceId The interface identifier, as specified in ERC-165\n@dev Interface identification is specified in ERC-165. This function\nuses less than 30,000 gas.",
"id": 479,
"implemented": false,
"isConstructor": false,
"isDeclaredConst": true,
"modifiers": [],
"name": "supportsInterface",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 475,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 474,
"name": "_interfaceId",
"nodeType": "VariableDeclaration",
"scope": 479,
"src": "420:19:4",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
},
"typeName": {
"id": 473,
"name": "bytes4",
"nodeType": "ElementaryTypeName",
"src": "420:6:4",
"typeDescriptions": {
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "419:21:4"
},
"payable": false,
"returnParameters": {
"id": 478,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 477,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 479,
"src": "476:4:4",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 476,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "476:4:4",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "475:6:4"
},
"scope": 480,
"src": "393:89:4",
"stateMutability": "view",
"superFunction": null,
"visibility": "external"
}
],
"scope": 481,
"src": "121:363:4"
}
],
"src": "0:485:4"
},
"legacyAST": {
"absolutePath": "/Users/willpark/Desktop/bookwork-klaytn/project_codes/nftbapp/backend-nftdapp/node_modules/zeppelin-solidity/contracts/introspection/ERC165.sol",
"exportedSymbols": {
"ERC165": [
480
]
},
"id": 481,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 472,
"literals": [
"solidity",
"^",
"0.4",
".24"
],
"nodeType": "PragmaDirective",
"src": "0:24:4"
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "interface",
"documentation": "@title ERC165\n@dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md",
"fullyImplemented": false,
"id": 480,
"linearizedBaseContracts": [
480
],
"name": "ERC165",
"nodeType": "ContractDefinition",
"nodes": [
{
"body": null,
"documentation": "@notice Query if a contract implements an interface\n@param _interfaceId The interface identifier, as specified in ERC-165\n@dev Interface identification is specified in ERC-165. This function\nuses less than 30,000 gas.",
"id": 479,
"implemented": false,
"isConstructor": false,
"isDeclaredConst": true,
"modifiers": [],
"name": "supportsInterface",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 475,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 474,
"name": "_interfaceId",
"nodeType": "VariableDeclaration",
"scope": 479,
"src": "420:19:4",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
},
"typeName": {
"id": 473,
"name": "bytes4",
"nodeType": "ElementaryTypeName",
"src": "420:6:4",
"typeDescriptions": {
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "419:21:4"
},
"payable": false,
"returnParameters": {
"id": 478,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 477,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 479,
"src": "476:4:4",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 476,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "476:4:4",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "475:6:4"
},
"scope": 480,
"src": "393:89:4",
"stateMutability": "view",
"superFunction": null,
"visibility": "external"
}
],
"scope": 481,
"src": "121:363:4"
}
],
"src": "0:485:4"
},
"compiler": {
"name": "solc",
"version": "0.4.25+commit.59dbf8f1.Emscripten.clang"
},
"networks": {},
"schemaVersion": "2.0.2",
"updatedAt": "2020-03-25T02:14:16.711Z"
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,539 @@
{
"contractName": "ERC721Receiver",
"abi": [
{
"constant": false,
"inputs": [
{
"name": "_operator",
"type": "address"
},
{
"name": "_from",
"type": "address"
},
{
"name": "_tokenId",
"type": "uint256"
},
{
"name": "_data",
"type": "bytes"
}
],
"name": "onERC721Received",
"outputs": [
{
"name": "",
"type": "bytes4"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}
],
"bytecode": "0x",
"deployedBytecode": "0x",
"sourceMap": "",
"deployedSourceMap": "",
"source": "pragma solidity ^0.4.24;\n\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ncontract ERC721Receiver {\n /**\n * @dev Magic value to be returned upon successful reception of an NFT\n * Equals to `bytes4(keccak256(\"onERC721Received(address,address,uint256,bytes)\"))`,\n * which can be also obtained as `ERC721Receiver(0).onERC721Received.selector`\n */\n bytes4 internal constant ERC721_RECEIVED = 0x150b7a02;\n\n /**\n * @notice Handle the receipt of an NFT\n * @dev The ERC721 smart contract calls this function on the recipient\n * after a `safetransfer`. This function MAY throw to revert and reject the\n * transfer. Return of other than the magic value MUST result in the\n * transaction being reverted.\n * Note: the contract address is always the message sender.\n * @param _operator The address which called `safeTransferFrom` function\n * @param _from The address which previously owned the token\n * @param _tokenId The NFT identifier which is being transferred\n * @param _data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC721Received(address,address,uint256,bytes)\"))`\n */\n function onERC721Received(\n address _operator,\n address _from,\n uint256 _tokenId,\n bytes _data\n )\n public\n returns(bytes4);\n}\n",
"sourcePath": "/Users/willpark/Desktop/bookwork-klaytn/project_codes/nftbapp/backend-nftdapp/node_modules/zeppelin-solidity/contracts/token/ERC721/ERC721Receiver.sol",
"ast": {
"absolutePath": "/Users/willpark/Desktop/bookwork-klaytn/project_codes/nftbapp/backend-nftdapp/node_modules/zeppelin-solidity/contracts/token/ERC721/ERC721Receiver.sol",
"exportedSymbols": {
"ERC721Receiver": [
1368
]
},
"id": 1369,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 1351,
"literals": [
"solidity",
"^",
"0.4",
".24"
],
"nodeType": "PragmaDirective",
"src": "0:24:10"
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"documentation": "@title ERC721 token receiver interface\n@dev Interface for any contract that wants to support safeTransfers\nfrom ERC721 asset contracts.",
"fullyImplemented": false,
"id": 1368,
"linearizedBaseContracts": [
1368
],
"name": "ERC721Receiver",
"nodeType": "ContractDefinition",
"nodes": [
{
"constant": true,
"id": 1354,
"name": "ERC721_RECEIVED",
"nodeType": "VariableDeclaration",
"scope": 1368,
"src": "463:53:10",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
},
"typeName": {
"id": 1352,
"name": "bytes4",
"nodeType": "ElementaryTypeName",
"src": "463:6:10",
"typeDescriptions": {
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
}
},
"value": {
"argumentTypes": null,
"hexValue": "30783135306237613032",
"id": 1353,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "506:10:10",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_353073666_by_1",
"typeString": "int_const 353073666"
},
"value": "0x150b7a02"
},
"visibility": "internal"
},
{
"body": null,
"documentation": "@notice Handle the receipt of an NFT\n@dev The ERC721 smart contract calls this function on the recipient\nafter a `safetransfer`. This function MAY throw to revert and reject the\ntransfer. Return of other than the magic value MUST result in the\ntransaction being reverted.\nNote: the contract address is always the message sender.\n@param _operator The address which called `safeTransferFrom` function\n@param _from The address which previously owned the token\n@param _tokenId The NFT identifier which is being transferred\n@param _data Additional data with no specified format\n@return `bytes4(keccak256(\"onERC721Received(address,address,uint256,bytes)\"))`",
"id": 1367,
"implemented": false,
"isConstructor": false,
"isDeclaredConst": false,
"modifiers": [],
"name": "onERC721Received",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 1363,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1356,
"name": "_operator",
"nodeType": "VariableDeclaration",
"scope": 1367,
"src": "1271:17:10",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 1355,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1271:7:10",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 1358,
"name": "_from",
"nodeType": "VariableDeclaration",
"scope": 1367,
"src": "1294:13:10",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 1357,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1294:7:10",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 1360,
"name": "_tokenId",
"nodeType": "VariableDeclaration",
"scope": 1367,
"src": "1313:16:10",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 1359,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1313:7:10",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 1362,
"name": "_data",
"nodeType": "VariableDeclaration",
"scope": 1367,
"src": "1335:11:10",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 1361,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "1335:5:10",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1265:85:10"
},
"payable": false,
"returnParameters": {
"id": 1366,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1365,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 1367,
"src": "1374:6:10",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
},
"typeName": {
"id": 1364,
"name": "bytes4",
"nodeType": "ElementaryTypeName",
"src": "1374:6:10",
"typeDescriptions": {
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1373:8:10"
},
"scope": 1368,
"src": "1240:142:10",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
}
],
"scope": 1369,
"src": "180:1204:10"
}
],
"src": "0:1385:10"
},
"legacyAST": {
"absolutePath": "/Users/willpark/Desktop/bookwork-klaytn/project_codes/nftbapp/backend-nftdapp/node_modules/zeppelin-solidity/contracts/token/ERC721/ERC721Receiver.sol",
"exportedSymbols": {
"ERC721Receiver": [
1368
]
},
"id": 1369,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 1351,
"literals": [
"solidity",
"^",
"0.4",
".24"
],
"nodeType": "PragmaDirective",
"src": "0:24:10"
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"documentation": "@title ERC721 token receiver interface\n@dev Interface for any contract that wants to support safeTransfers\nfrom ERC721 asset contracts.",
"fullyImplemented": false,
"id": 1368,
"linearizedBaseContracts": [
1368
],
"name": "ERC721Receiver",
"nodeType": "ContractDefinition",
"nodes": [
{
"constant": true,
"id": 1354,
"name": "ERC721_RECEIVED",
"nodeType": "VariableDeclaration",
"scope": 1368,
"src": "463:53:10",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
},
"typeName": {
"id": 1352,
"name": "bytes4",
"nodeType": "ElementaryTypeName",
"src": "463:6:10",
"typeDescriptions": {
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
}
},
"value": {
"argumentTypes": null,
"hexValue": "30783135306237613032",
"id": 1353,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "506:10:10",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_353073666_by_1",
"typeString": "int_const 353073666"
},
"value": "0x150b7a02"
},
"visibility": "internal"
},
{
"body": null,
"documentation": "@notice Handle the receipt of an NFT\n@dev The ERC721 smart contract calls this function on the recipient\nafter a `safetransfer`. This function MAY throw to revert and reject the\ntransfer. Return of other than the magic value MUST result in the\ntransaction being reverted.\nNote: the contract address is always the message sender.\n@param _operator The address which called `safeTransferFrom` function\n@param _from The address which previously owned the token\n@param _tokenId The NFT identifier which is being transferred\n@param _data Additional data with no specified format\n@return `bytes4(keccak256(\"onERC721Received(address,address,uint256,bytes)\"))`",
"id": 1367,
"implemented": false,
"isConstructor": false,
"isDeclaredConst": false,
"modifiers": [],
"name": "onERC721Received",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 1363,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1356,
"name": "_operator",
"nodeType": "VariableDeclaration",
"scope": 1367,
"src": "1271:17:10",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 1355,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1271:7:10",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 1358,
"name": "_from",
"nodeType": "VariableDeclaration",
"scope": 1367,
"src": "1294:13:10",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 1357,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1294:7:10",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 1360,
"name": "_tokenId",
"nodeType": "VariableDeclaration",
"scope": 1367,
"src": "1313:16:10",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 1359,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1313:7:10",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 1362,
"name": "_data",
"nodeType": "VariableDeclaration",
"scope": 1367,
"src": "1335:11:10",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 1361,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "1335:5:10",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1265:85:10"
},
"payable": false,
"returnParameters": {
"id": 1366,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1365,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 1367,
"src": "1374:6:10",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
},
"typeName": {
"id": 1364,
"name": "bytes4",
"nodeType": "ElementaryTypeName",
"src": "1374:6:10",
"typeDescriptions": {
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1373:8:10"
},
"scope": 1368,
"src": "1240:142:10",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
}
],
"scope": 1369,
"src": "180:1204:10"
}
],
"src": "0:1385:10"
},
"compiler": {
"name": "solc",
"version": "0.4.25+commit.59dbf8f1.Emscripten.clang"
},
"networks": {},
"schemaVersion": "2.0.2",
"updatedAt": "2020-03-25T02:14:16.714Z"
}

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,101 @@
pragma solidity ^0.4.24;
import "./MyNFT.sol";
contract Auctions {
Auction[] public auctions;
mapping(address => uint[]) public auctionOwner;
struct Auction {
string name; // 제목
uint256 price; // 가격
string metadata; // 메타데이터 : ipfs hash
uint256 tokenId; // 토큰 아이디
address repoAddress; // nft 컨트랙트 어드레스
address owner; // 소유자
bool active; //활성화 여부
bool finalized; //판매 종료여부
}
function() public {
revert();
}
modifier contractIsNFTOwner(address _repoAddress, uint256 _tokenId) {
address nftOwner = MyNFT(_repoAddress).ownerOf(_tokenId);
require(nftOwner == address(this));
_;
}
function createAuction(address _repoAddress, uint256 _tokenId, string _auctionTitle, string _metadata, uint256 _price) public contractIsNFTOwner(_repoAddress, _tokenId) returns(bool) {
uint auctionId = auctions.length;
Auction memory newAuction;
newAuction.name = _auctionTitle;
newAuction.price = _price;
newAuction.metadata = _metadata;
newAuction.tokenId = _tokenId;
newAuction.repoAddress = _repoAddress;
newAuction.owner = msg.sender;
newAuction.active = true;
newAuction.finalized = false;
auctions.push(newAuction);
auctionOwner[msg.sender].push(auctionId);
emit AuctionCreated(msg.sender, auctionId);
return true;
}
function finalizeAuction(uint _auctionId, address _to) public {
Auction memory myAuction = auctions[_auctionId];
if(approveAndTransfer(address(this), _to, myAuction.repoAddress, myAuction.tokenId)){
auctions[_auctionId].active = false;
auctions[_auctionId].finalized = true;
emit AuctionFinalized(msg.sender, _auctionId);
}
}
function approveAndTransfer(address _from, address _to, address _repoAddress, uint256 _tokenId) internal returns(bool) {
MyNFT remoteContract = MyNFT(_repoAddress);
remoteContract.approve(_to, _tokenId);
remoteContract.transferFrom(_from, _to, _tokenId);
return true;
}
function getCount() public constant returns(uint) {
return auctions.length;
}
function getAuctionsOf(address _owner) public constant returns(uint[]) {
uint[] memory ownedAuctions = auctionOwner[_owner];
return ownedAuctions;
}
function getAuctionsCountOfOwner(address _owner) public constant returns(uint) {
return auctionOwner[_owner].length;
}
function getAuctionById(uint _auctionId) public constant returns(
string name,
uint256 price,
string metadata,
uint256 tokenId,
address repoAddress,
address owner,
bool active,
bool finalized) {
Auction memory auc = auctions[_auctionId];
return (
auc.name,
auc.price,
auc.metadata,
auc.tokenId,
auc.repoAddress,
auc.owner,
auc.active,
auc.finalized);
}
event AuctionCreated(address _owner, uint _auctionId);
event AuctionFinalized(address _owner, uint _auctionId);
}

View File

@@ -0,0 +1,23 @@
pragma solidity >=0.4.21 <0.7.0;
contract Migrations {
address public owner;
uint public last_completed_migration;
constructor() public {
owner = msg.sender;
}
modifier restricted() {
if (msg.sender == owner) _;
}
function setCompleted(uint completed) public restricted {
last_completed_migration = completed;
}
function upgrade(address new_address) public restricted {
Migrations upgraded = Migrations(new_address);
upgraded.setCompleted(last_completed_migration);
}
}

View File

@@ -0,0 +1,21 @@
pragma solidity ^0.4.24;
import "../node_modules/zeppelin-solidity/contracts/token/ERC721/ERC721Token.sol";
contract MyNFT is ERC721Token {
constructor (string _name, string _symbol) public
ERC721Token(_name, _symbol) {}
function registerUniqueToken(
address _to,
uint256 _tokenId,
string _tokenURI
) public
{
super._mint(_to, _tokenId);
super._setTokenURI(_tokenId, _tokenURI);
emit TokenRegistered(_to, _tokenId);
}
event TokenRegistered(address _by, uint256 _tokenId);
}

View File

@@ -0,0 +1,5 @@
var Migrations = artifacts.require("Migrations");
module.exports = function(deployer) {
deployer.deploy(Migrations);
};

View File

@@ -0,0 +1,7 @@
const MyNFT = artifacts.require("./MyNFT.sol");
const Auctions = artifacts.require("./Auctions.sol");
module.exports = async function(deployer) {
deployer.deploy(MyNFT, "MyKlay", "MKlay")
deployer.deploy(Auctions)
};

3508
nftbapp/backend-nftbapp/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,61 @@
import chai from 'chai'
import chaiAsPromised from 'chai-as-promised'
chai.use(chaiAsPromised)
const { expect, assert } = chai
const MyNFT = artifacts.require("MyNFT");
contract('Test MyNFT contract', function(accounts) {
let token;
const name = "MyKlay"
const symbol = "MKlay"
const account1 = accounts[1]
const tokenId1 = 1111;
const tokenUri1 = "This is data for the token 1"; // Does not have to be unique
const account2 = accounts[2]
const tokenId2 = 2222;
const tokenUri2 = "This is data for the token 2"; // Does not have to be unique
const account3 = accounts[3]
it(' deploy and mint ERC721 token', async () => {
token = await MyNFT.new(name, symbol)
await token.registerUniqueToken(account1, tokenId1, tokenUri1, {from: accounts[0]})
expect(await token.symbol()).to.equal(symbol)
expect(await token.name()).to.equal(name)
})
it(' check unique id', async () => {
const duplicateTokenID = token.registerUniqueToken(account2, tokenId1, tokenUri2, {from: accounts[0]}) //tokenId
expect(duplicateTokenID).to.be.rejectedWith(/VM Exception while processing transaction: revert/)
})
it(' create multiple unique tokens and manage ownership', async () => {
const additionalToken = await token.registerUniqueToken(account2, tokenId2, tokenUri2, {from: accounts[0]})
expect(Number(await token.totalSupply())).to.equal(2)
expect(await token.exists(tokenId1)).to.be.true
expect(await token.exists(tokenId2)).to.be.true
expect(await token.ownerOf(tokenId1)).to.equal(account1)
expect(await token.ownerOf(tokenId2)).to.equal(account2)
})
it(' safe transfer', async () => {
const unownedTokenId = token.safeTransferFrom(account2, account3, tokenId1, {from: accounts[2]}) // tokenId
expect(unownedTokenId).to.be.rejectedWith(/VM Exception while processing transaction: revert/)
const wrongOwner = token.safeTransferFrom(account1, account3, tokenId2, {from: accounts[1]}) // wrong owner
expect(wrongOwner).to.be.rejectedWith(/VM Exception while processing transaction: revert/)
const wrongFromGas = token.safeTransferFrom(account2, account3, tokenId2, {from: accounts[1]}) // wrong owner
expect(wrongFromGas).to.be.rejectedWith(/VM Exception while processing transaction: revert/)
await token.safeTransferFrom(account2, account3, tokenId2, {from: accounts[2]})
expect(await token.ownerOf(tokenId2)).to.equal(account3)
})
})

View File

@@ -0,0 +1,115 @@
/**
* Use this file to configure your truffle project. It's seeded with some
* common settings for different networks and features like migrations,
* compilation and testing. Uncomment the ones you need or modify
* them to suit your project as necessary.
*
* More information about configuration can be found at:
*
* truffleframework.com/docs/advanced/configuration
*
* To deploy via Infura you'll need a wallet provider (like truffle-hdwallet-provider)
* to sign your transactions before they're sent to a remote public node. Infura API
* keys are available for free at: infura.io/register
*
* You'll also need a mnemonic - the twelve word phrase the wallet uses to generate
* public/private key pairs. If you're publishing your code to GitHub make sure you load this
* phrase from a file you've .gitignored so it doesn't accidentally become public.
*
*/
// const HDWalletProvider = require('truffle-hdwallet-provider');
// const infuraKey = "fj4jll3k.....";
//
// const fs = require('fs');
// const mnemonic = fs.readFileSync(".secret").toString().trim();
require('babel-register')
require('babel-polyfill')
const HDWalletProvider = require("truffle-hdwallet-provider-klaytn");
const NETWORK_ID = '1001'
const URL = 'https://api.baobab.klaytn.net:8651' // testnet
const PRIVATE_KEY = '0x9452f902e6c2751c123db6480cff2d83597b077059be7cb3ab9b47fb555e7da5' //testnet
module.exports = {
/**
* Networks define how you connect to your ethereum client and let you set the
* defaults web3 uses to send transactions. If you don't specify one truffle
* will spin up a development blockchain for you on port 9545 when you
* run `develop` or `test`. You can ask a truffle command to use a specific
* network from the command line, e.g
*
* $ truffle test --network <network-name>
*/
networks: {
// Useful for testing. The `development` name is special - truffle uses it by default
// if it's defined here and no other network is specified at the command line.
// You should run a client (like ganache-cli, geth or parity) in a separate terminal
// tab if you use this network and you must also set the `host`, `port` and `network_id`
// options below to some value.
//
// development: {
// host: "127.0.0.1", // Localhost (default: none)
// port: 8545, // Standard Ethereum port (default: none)
// network_id: "*", // Any network (default: none)
// },
klaytn: {
provider: () => new HDWalletProvider(PRIVATE_KEY, URL),
network_id: NETWORK_ID,
gas: '8500000',
gasPrice: null,
},
// Another network with more advanced options...
// advanced: {
// port: 8777, // Custom port
// network_id: 1342, // Custom network
// gas: 8500000, // Gas sent with each transaction (default: ~6700000)
// gasPrice: 20000000000, // 20 gwei (in wei) (default: 100 gwei)
// from: <address>, // Account to send txs from (default: accounts[0])
// websockets: true // Enable EventEmitter interface for web3 (default: false)
// },
// Useful for deploying to a public network.
// NB: It's important to wrap the provider as a function.
// ropsten: {
// provider: () => new HDWalletProvider(mnemonic, `https://ropsten.infura.io/${infuraKey}`),
// network_id: 3, // Ropsten's id
// gas: 5500000, // Ropsten has a lower block limit than mainnet
// confirmations: 2, // # of confs to wait between deployments. (default: 0)
// timeoutBlocks: 200, // # of blocks before a deployment times out (minimum/default: 50)
// skipDryRun: true // Skip dry run before migrations? (default: false for public nets )
// },
// Useful for private networks
// private: {
// provider: () => new HDWalletProvider(mnemonic, `https://network.io`),
// network_id: 2111, // This network is yours, in the cloud.
// production: true // Treats this network as if it was a public net. (default: false)
// }
},
// Set default mocha options here, use special reporters etc.
mocha: {
// timeout: 100000
},
// Configure your compilers
compilers: {
solc: {
// version: "0.5.1", // Fetch exact version from solc-bin (default: truffle's version)
// docker: true, // Use "0.5.1" you've installed locally with docker (default: false)
// settings: { // See the solidity docs for advice about optimization and evmVersion
// optimizer: {
// enabled: false,
// runs: 200
// },
// evmVersion: "byzantium"
// }
}
}
}