This commit is contained in:
elegant651
2020-03-24 14:39:38 +09:00
commit 6e0388b653
83 changed files with 92480 additions and 0 deletions

2
.gitignore vendored Normal file
View File

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

View File

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

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

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

View File

@@ -0,0 +1,511 @@
{
"contractName": "AddressUtils",
"abi": [],
"bytecode": "0x604c602c600b82828239805160001a60731460008114601c57601e565bfe5b5030600052607381538281f30073000000000000000000000000000000000000000030146080604052600080fd00a165627a7a7230582057055433fd49bcd62bd59af54c3a75f9b5c81d9c70f5bb908838e055d5c8ece90029",
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fd00a165627a7a7230582057055433fd49bcd62bd59af54c3a75f9b5c81d9c70f5bb908838e055d5c8ece90029",
"sourceMap": "87:932:2:-;;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:2:-;;;;;;;;",
"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-blockchain/testcodes/9nftdapp-new/backend-nftdapp/node_modules/zeppelin-solidity/contracts/AddressUtils.sol",
"ast": {
"absolutePath": "/Users/willpark/Desktop/bookwork-blockchain/testcodes/9nftdapp-new/backend-nftdapp/node_modules/zeppelin-solidity/contracts/AddressUtils.sol",
"exportedSymbols": {
"AddressUtils": [
413
]
},
"id": 414,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 396,
"literals": [
"solidity",
"^",
"0.4",
".24"
],
"nodeType": "PragmaDirective",
"src": "0:24:2"
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "library",
"documentation": "Utility library of inline functions on addresses",
"fullyImplemented": true,
"id": 413,
"linearizedBaseContracts": [
413
],
"name": "AddressUtils",
"nodeType": "ContractDefinition",
"nodes": [
{
"body": {
"id": 411,
"nodeType": "Block",
"src": "502:514:2",
"statements": [
{
"assignments": [],
"declarations": [
{
"constant": false,
"id": 404,
"name": "size",
"nodeType": "VariableDeclaration",
"scope": 412,
"src": "508:12:2",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 403,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "508:7:2",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 405,
"initialValue": null,
"nodeType": "VariableDeclarationStatement",
"src": "508:12:2"
},
{
"externalReferences": [
{
"size": {
"declaration": 404,
"isOffset": false,
"isSlot": false,
"src": "963:4:2",
"valueSize": 1
}
},
{
"_addr": {
"declaration": 398,
"isOffset": false,
"isSlot": false,
"src": "983:5:2",
"valueSize": 1
}
}
],
"id": 406,
"nodeType": "InlineAssembly",
"operations": "{\n size := extcodesize(_addr)\n}",
"src": "952:50:2"
},
{
"expression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 409,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 407,
"name": "size",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 404,
"src": "1003:4:2",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": ">",
"rightExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 408,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1010:1:2",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "1003:8:2",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"functionReturnParameters": 402,
"id": 410,
"nodeType": "Return",
"src": "996:15:2"
}
]
},
"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": 412,
"implemented": true,
"isConstructor": false,
"isDeclaredConst": true,
"modifiers": [],
"name": "isContract",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 399,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 398,
"name": "_addr",
"nodeType": "VariableDeclaration",
"scope": 412,
"src": "458:13:2",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 397,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "458:7:2",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "457:15:2"
},
"payable": false,
"returnParameters": {
"id": 402,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 401,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 412,
"src": "496:4:2",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 400,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "496:4:2",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "495:6:2"
},
"scope": 413,
"src": "438:578:2",
"stateMutability": "view",
"superFunction": null,
"visibility": "internal"
}
],
"scope": 414,
"src": "87:932:2"
}
],
"src": "0:1020:2"
},
"legacyAST": {
"absolutePath": "/Users/willpark/Desktop/bookwork-blockchain/testcodes/9nftdapp-new/backend-nftdapp/node_modules/zeppelin-solidity/contracts/AddressUtils.sol",
"exportedSymbols": {
"AddressUtils": [
413
]
},
"id": 414,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 396,
"literals": [
"solidity",
"^",
"0.4",
".24"
],
"nodeType": "PragmaDirective",
"src": "0:24:2"
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "library",
"documentation": "Utility library of inline functions on addresses",
"fullyImplemented": true,
"id": 413,
"linearizedBaseContracts": [
413
],
"name": "AddressUtils",
"nodeType": "ContractDefinition",
"nodes": [
{
"body": {
"id": 411,
"nodeType": "Block",
"src": "502:514:2",
"statements": [
{
"assignments": [],
"declarations": [
{
"constant": false,
"id": 404,
"name": "size",
"nodeType": "VariableDeclaration",
"scope": 412,
"src": "508:12:2",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 403,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "508:7:2",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 405,
"initialValue": null,
"nodeType": "VariableDeclarationStatement",
"src": "508:12:2"
},
{
"externalReferences": [
{
"size": {
"declaration": 404,
"isOffset": false,
"isSlot": false,
"src": "963:4:2",
"valueSize": 1
}
},
{
"_addr": {
"declaration": 398,
"isOffset": false,
"isSlot": false,
"src": "983:5:2",
"valueSize": 1
}
}
],
"id": 406,
"nodeType": "InlineAssembly",
"operations": "{\n size := extcodesize(_addr)\n}",
"src": "952:50:2"
},
{
"expression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 409,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 407,
"name": "size",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 404,
"src": "1003:4:2",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": ">",
"rightExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 408,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1010:1:2",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "1003:8:2",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"functionReturnParameters": 402,
"id": 410,
"nodeType": "Return",
"src": "996:15:2"
}
]
},
"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": 412,
"implemented": true,
"isConstructor": false,
"isDeclaredConst": true,
"modifiers": [],
"name": "isContract",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 399,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 398,
"name": "_addr",
"nodeType": "VariableDeclaration",
"scope": 412,
"src": "458:13:2",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 397,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "458:7:2",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "457:15:2"
},
"payable": false,
"returnParameters": {
"id": 402,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 401,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 412,
"src": "496:4:2",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 400,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "496:4:2",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "495:6:2"
},
"scope": 413,
"src": "438:578:2",
"stateMutability": "view",
"superFunction": null,
"visibility": "internal"
}
],
"scope": 414,
"src": "87:932:2"
}
],
"src": "0:1020:2"
},
"compiler": {
"name": "solc",
"version": "0.4.25+commit.59dbf8f1.Emscripten.clang"
},
"networks": {},
"schemaVersion": "2.0.2",
"updatedAt": "2019-01-10T18:16:54.178Z"
}

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-blockchain/testcodes/9nftdapp-new/backend-nftdapp/node_modules/zeppelin-solidity/contracts/introspection/ERC165.sol",
"ast": {
"absolutePath": "/Users/willpark/Desktop/bookwork-blockchain/testcodes/9nftdapp-new/backend-nftdapp/node_modules/zeppelin-solidity/contracts/introspection/ERC165.sol",
"exportedSymbols": {
"ERC165": [
423
]
},
"id": 424,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 415,
"literals": [
"solidity",
"^",
"0.4",
".24"
],
"nodeType": "PragmaDirective",
"src": "0:24:3"
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "interface",
"documentation": "@title ERC165\n@dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md",
"fullyImplemented": false,
"id": 423,
"linearizedBaseContracts": [
423
],
"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": 422,
"implemented": false,
"isConstructor": false,
"isDeclaredConst": true,
"modifiers": [],
"name": "supportsInterface",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 418,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 417,
"name": "_interfaceId",
"nodeType": "VariableDeclaration",
"scope": 422,
"src": "420:19:3",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
},
"typeName": {
"id": 416,
"name": "bytes4",
"nodeType": "ElementaryTypeName",
"src": "420:6:3",
"typeDescriptions": {
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "419:21:3"
},
"payable": false,
"returnParameters": {
"id": 421,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 420,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 422,
"src": "476:4:3",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 419,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "476:4:3",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "475:6:3"
},
"scope": 423,
"src": "393:89:3",
"stateMutability": "view",
"superFunction": null,
"visibility": "external"
}
],
"scope": 424,
"src": "121:363:3"
}
],
"src": "0:485:3"
},
"legacyAST": {
"absolutePath": "/Users/willpark/Desktop/bookwork-blockchain/testcodes/9nftdapp-new/backend-nftdapp/node_modules/zeppelin-solidity/contracts/introspection/ERC165.sol",
"exportedSymbols": {
"ERC165": [
423
]
},
"id": 424,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 415,
"literals": [
"solidity",
"^",
"0.4",
".24"
],
"nodeType": "PragmaDirective",
"src": "0:24:3"
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "interface",
"documentation": "@title ERC165\n@dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md",
"fullyImplemented": false,
"id": 423,
"linearizedBaseContracts": [
423
],
"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": 422,
"implemented": false,
"isConstructor": false,
"isDeclaredConst": true,
"modifiers": [],
"name": "supportsInterface",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 418,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 417,
"name": "_interfaceId",
"nodeType": "VariableDeclaration",
"scope": 422,
"src": "420:19:3",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
},
"typeName": {
"id": 416,
"name": "bytes4",
"nodeType": "ElementaryTypeName",
"src": "420:6:3",
"typeDescriptions": {
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "419:21:3"
},
"payable": false,
"returnParameters": {
"id": 421,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 420,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 422,
"src": "476:4:3",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 419,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "476:4:3",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "475:6:3"
},
"scope": 423,
"src": "393:89:3",
"stateMutability": "view",
"superFunction": null,
"visibility": "external"
}
],
"scope": 424,
"src": "121:363:3"
}
],
"src": "0:485:3"
},
"compiler": {
"name": "solc",
"version": "0.4.25+commit.59dbf8f1.Emscripten.clang"
},
"networks": {},
"schemaVersion": "2.0.2",
"updatedAt": "2019-01-10T18:16:54.178Z"
}

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-blockchain/testcodes/9nftdapp-new/backend-nftdapp/node_modules/zeppelin-solidity/contracts/token/ERC721/ERC721Receiver.sol",
"ast": {
"absolutePath": "/Users/willpark/Desktop/bookwork-blockchain/testcodes/9nftdapp-new/backend-nftdapp/node_modules/zeppelin-solidity/contracts/token/ERC721/ERC721Receiver.sol",
"exportedSymbols": {
"ERC721Receiver": [
1311
]
},
"id": 1312,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 1294,
"literals": [
"solidity",
"^",
"0.4",
".24"
],
"nodeType": "PragmaDirective",
"src": "0:24:9"
},
{
"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": 1311,
"linearizedBaseContracts": [
1311
],
"name": "ERC721Receiver",
"nodeType": "ContractDefinition",
"nodes": [
{
"constant": true,
"id": 1297,
"name": "ERC721_RECEIVED",
"nodeType": "VariableDeclaration",
"scope": 1311,
"src": "463:53:9",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
},
"typeName": {
"id": 1295,
"name": "bytes4",
"nodeType": "ElementaryTypeName",
"src": "463:6:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
}
},
"value": {
"argumentTypes": null,
"hexValue": "30783135306237613032",
"id": 1296,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "506:10:9",
"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": 1310,
"implemented": false,
"isConstructor": false,
"isDeclaredConst": false,
"modifiers": [],
"name": "onERC721Received",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 1306,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1299,
"name": "_operator",
"nodeType": "VariableDeclaration",
"scope": 1310,
"src": "1271:17:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 1298,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1271:7:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 1301,
"name": "_from",
"nodeType": "VariableDeclaration",
"scope": 1310,
"src": "1294:13:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 1300,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1294:7:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 1303,
"name": "_tokenId",
"nodeType": "VariableDeclaration",
"scope": 1310,
"src": "1313:16:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 1302,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1313:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 1305,
"name": "_data",
"nodeType": "VariableDeclaration",
"scope": 1310,
"src": "1335:11:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 1304,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "1335:5:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1265:85:9"
},
"payable": false,
"returnParameters": {
"id": 1309,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1308,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 1310,
"src": "1374:6:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
},
"typeName": {
"id": 1307,
"name": "bytes4",
"nodeType": "ElementaryTypeName",
"src": "1374:6:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1373:8:9"
},
"scope": 1311,
"src": "1240:142:9",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
}
],
"scope": 1312,
"src": "180:1204:9"
}
],
"src": "0:1385:9"
},
"legacyAST": {
"absolutePath": "/Users/willpark/Desktop/bookwork-blockchain/testcodes/9nftdapp-new/backend-nftdapp/node_modules/zeppelin-solidity/contracts/token/ERC721/ERC721Receiver.sol",
"exportedSymbols": {
"ERC721Receiver": [
1311
]
},
"id": 1312,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 1294,
"literals": [
"solidity",
"^",
"0.4",
".24"
],
"nodeType": "PragmaDirective",
"src": "0:24:9"
},
{
"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": 1311,
"linearizedBaseContracts": [
1311
],
"name": "ERC721Receiver",
"nodeType": "ContractDefinition",
"nodes": [
{
"constant": true,
"id": 1297,
"name": "ERC721_RECEIVED",
"nodeType": "VariableDeclaration",
"scope": 1311,
"src": "463:53:9",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
},
"typeName": {
"id": 1295,
"name": "bytes4",
"nodeType": "ElementaryTypeName",
"src": "463:6:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
}
},
"value": {
"argumentTypes": null,
"hexValue": "30783135306237613032",
"id": 1296,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "506:10:9",
"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": 1310,
"implemented": false,
"isConstructor": false,
"isDeclaredConst": false,
"modifiers": [],
"name": "onERC721Received",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 1306,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1299,
"name": "_operator",
"nodeType": "VariableDeclaration",
"scope": 1310,
"src": "1271:17:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 1298,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1271:7:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 1301,
"name": "_from",
"nodeType": "VariableDeclaration",
"scope": 1310,
"src": "1294:13:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 1300,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1294:7:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 1303,
"name": "_tokenId",
"nodeType": "VariableDeclaration",
"scope": 1310,
"src": "1313:16:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 1302,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1313:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 1305,
"name": "_data",
"nodeType": "VariableDeclaration",
"scope": 1310,
"src": "1335:11:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 1304,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "1335:5:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1265:85:9"
},
"payable": false,
"returnParameters": {
"id": 1309,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1308,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 1310,
"src": "1374:6:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
},
"typeName": {
"id": 1307,
"name": "bytes4",
"nodeType": "ElementaryTypeName",
"src": "1374:6:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1373:8:9"
},
"scope": 1311,
"src": "1240:142:9",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
}
],
"scope": 1312,
"src": "180:1204:9"
}
],
"src": "0:1385:9"
},
"compiler": {
"name": "solc",
"version": "0.4.25+commit.59dbf8f1.Emscripten.clang"
},
"networks": {},
"schemaVersion": "2.0.2",
"updatedAt": "2019-01-10T18:16:54.179Z"
}

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.23;
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.6.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.sol");
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, "AvarCat", "ACat")
deployer.deploy(Auctions)
};

972
nftbapp/backend-nftdapp/package-lock.json generated Normal file
View File

@@ -0,0 +1,972 @@
{
"requires": true,
"lockfileVersion": 1,
"dependencies": {
"ansi-regex": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
"dev": true
},
"ansi-styles": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz",
"integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=",
"dev": true
},
"assertion-error": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz",
"integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==",
"dev": true
},
"babel-code-frame": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz",
"integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=",
"dev": true,
"requires": {
"chalk": "^1.1.3",
"esutils": "^2.0.2",
"js-tokens": "^3.0.2"
}
},
"babel-core": {
"version": "6.26.3",
"resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.26.3.tgz",
"integrity": "sha512-6jyFLuDmeidKmUEb3NM+/yawG0M2bDZ9Z1qbZP59cyHLz8kYGKYwpJP0UwUKKUiTRNvxfLesJnTedqczP7cTDA==",
"dev": true,
"requires": {
"babel-code-frame": "^6.26.0",
"babel-generator": "^6.26.0",
"babel-helpers": "^6.24.1",
"babel-messages": "^6.23.0",
"babel-register": "^6.26.0",
"babel-runtime": "^6.26.0",
"babel-template": "^6.26.0",
"babel-traverse": "^6.26.0",
"babel-types": "^6.26.0",
"babylon": "^6.18.0",
"convert-source-map": "^1.5.1",
"debug": "^2.6.9",
"json5": "^0.5.1",
"lodash": "^4.17.4",
"minimatch": "^3.0.4",
"path-is-absolute": "^1.0.1",
"private": "^0.1.8",
"slash": "^1.0.0",
"source-map": "^0.5.7"
}
},
"babel-generator": {
"version": "6.26.1",
"resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.1.tgz",
"integrity": "sha512-HyfwY6ApZj7BYTcJURpM5tznulaBvyio7/0d4zFOeMPUmfxkCjHocCuoLa2SAGzBI8AREcH3eP3758F672DppA==",
"dev": true,
"requires": {
"babel-messages": "^6.23.0",
"babel-runtime": "^6.26.0",
"babel-types": "^6.26.0",
"detect-indent": "^4.0.0",
"jsesc": "^1.3.0",
"lodash": "^4.17.4",
"source-map": "^0.5.7",
"trim-right": "^1.0.1"
},
"dependencies": {
"jsesc": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz",
"integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=",
"dev": true
}
}
},
"babel-helper-call-delegate": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-helper-call-delegate/-/babel-helper-call-delegate-6.24.1.tgz",
"integrity": "sha1-7Oaqzdx25Bw0YfiL/Fdb0Nqi340=",
"dev": true,
"requires": {
"babel-helper-hoist-variables": "^6.24.1",
"babel-runtime": "^6.22.0",
"babel-traverse": "^6.24.1",
"babel-types": "^6.24.1"
}
},
"babel-helper-define-map": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-helper-define-map/-/babel-helper-define-map-6.26.0.tgz",
"integrity": "sha1-pfVtq0GiX5fstJjH66ypgZ+Vvl8=",
"dev": true,
"requires": {
"babel-helper-function-name": "^6.24.1",
"babel-runtime": "^6.26.0",
"babel-types": "^6.26.0",
"lodash": "^4.17.4"
}
},
"babel-helper-function-name": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-helper-function-name/-/babel-helper-function-name-6.24.1.tgz",
"integrity": "sha1-00dbjAPtmCQqJbSDUasYOZ01gKk=",
"dev": true,
"requires": {
"babel-helper-get-function-arity": "^6.24.1",
"babel-runtime": "^6.22.0",
"babel-template": "^6.24.1",
"babel-traverse": "^6.24.1",
"babel-types": "^6.24.1"
}
},
"babel-helper-get-function-arity": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-helper-get-function-arity/-/babel-helper-get-function-arity-6.24.1.tgz",
"integrity": "sha1-j3eCqpNAfEHTqlCQj4mwMbG2hT0=",
"dev": true,
"requires": {
"babel-runtime": "^6.22.0",
"babel-types": "^6.24.1"
}
},
"babel-helper-hoist-variables": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-helper-hoist-variables/-/babel-helper-hoist-variables-6.24.1.tgz",
"integrity": "sha1-HssnaJydJVE+rbyZFKc/VAi+enY=",
"dev": true,
"requires": {
"babel-runtime": "^6.22.0",
"babel-types": "^6.24.1"
}
},
"babel-helper-optimise-call-expression": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-helper-optimise-call-expression/-/babel-helper-optimise-call-expression-6.24.1.tgz",
"integrity": "sha1-96E0J7qfc/j0+pk8VKl4gtEkQlc=",
"dev": true,
"requires": {
"babel-runtime": "^6.22.0",
"babel-types": "^6.24.1"
}
},
"babel-helper-regex": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-helper-regex/-/babel-helper-regex-6.26.0.tgz",
"integrity": "sha1-MlxZ+QL4LyS3T6zu0DY5VPZJXnI=",
"dev": true,
"requires": {
"babel-runtime": "^6.26.0",
"babel-types": "^6.26.0",
"lodash": "^4.17.4"
}
},
"babel-helper-replace-supers": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-helper-replace-supers/-/babel-helper-replace-supers-6.24.1.tgz",
"integrity": "sha1-v22/5Dk40XNpohPKiov3S2qQqxo=",
"dev": true,
"requires": {
"babel-helper-optimise-call-expression": "^6.24.1",
"babel-messages": "^6.23.0",
"babel-runtime": "^6.22.0",
"babel-template": "^6.24.1",
"babel-traverse": "^6.24.1",
"babel-types": "^6.24.1"
}
},
"babel-helpers": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-helpers/-/babel-helpers-6.24.1.tgz",
"integrity": "sha1-NHHenK7DiOXIUOWX5Yom3fN2ArI=",
"dev": true,
"requires": {
"babel-runtime": "^6.22.0",
"babel-template": "^6.24.1"
}
},
"babel-messages": {
"version": "6.23.0",
"resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz",
"integrity": "sha1-8830cDhYA1sqKVHG7F7fbGLyYw4=",
"dev": true,
"requires": {
"babel-runtime": "^6.22.0"
}
},
"babel-plugin-check-es2015-constants": {
"version": "6.22.0",
"resolved": "https://registry.npmjs.org/babel-plugin-check-es2015-constants/-/babel-plugin-check-es2015-constants-6.22.0.tgz",
"integrity": "sha1-NRV7EBQm/S/9PaP3XH0ekYNbv4o=",
"dev": true,
"requires": {
"babel-runtime": "^6.22.0"
}
},
"babel-plugin-transform-es2015-arrow-functions": {
"version": "6.22.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-6.22.0.tgz",
"integrity": "sha1-RSaSy3EdX3ncf4XkQM5BufJE0iE=",
"dev": true,
"requires": {
"babel-runtime": "^6.22.0"
}
},
"babel-plugin-transform-es2015-block-scoped-functions": {
"version": "6.22.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoped-functions/-/babel-plugin-transform-es2015-block-scoped-functions-6.22.0.tgz",
"integrity": "sha1-u8UbSflk1wy42OC5ToICRs46YUE=",
"dev": true,
"requires": {
"babel-runtime": "^6.22.0"
}
},
"babel-plugin-transform-es2015-block-scoping": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoping/-/babel-plugin-transform-es2015-block-scoping-6.26.0.tgz",
"integrity": "sha1-1w9SmcEwjQXBL0Y4E7CgnnOxiV8=",
"dev": true,
"requires": {
"babel-runtime": "^6.26.0",
"babel-template": "^6.26.0",
"babel-traverse": "^6.26.0",
"babel-types": "^6.26.0",
"lodash": "^4.17.4"
}
},
"babel-plugin-transform-es2015-classes": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-classes/-/babel-plugin-transform-es2015-classes-6.24.1.tgz",
"integrity": "sha1-WkxYpQyclGHlZLSyo7+ryXolhNs=",
"dev": true,
"requires": {
"babel-helper-define-map": "^6.24.1",
"babel-helper-function-name": "^6.24.1",
"babel-helper-optimise-call-expression": "^6.24.1",
"babel-helper-replace-supers": "^6.24.1",
"babel-messages": "^6.23.0",
"babel-runtime": "^6.22.0",
"babel-template": "^6.24.1",
"babel-traverse": "^6.24.1",
"babel-types": "^6.24.1"
}
},
"babel-plugin-transform-es2015-computed-properties": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-computed-properties/-/babel-plugin-transform-es2015-computed-properties-6.24.1.tgz",
"integrity": "sha1-b+Ko0WiV1WNPTNmZttNICjCBWbM=",
"dev": true,
"requires": {
"babel-runtime": "^6.22.0",
"babel-template": "^6.24.1"
}
},
"babel-plugin-transform-es2015-destructuring": {
"version": "6.23.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-destructuring/-/babel-plugin-transform-es2015-destructuring-6.23.0.tgz",
"integrity": "sha1-mXux8auWf2gtKwh2/jWNYOdlxW0=",
"dev": true,
"requires": {
"babel-runtime": "^6.22.0"
}
},
"babel-plugin-transform-es2015-duplicate-keys": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-duplicate-keys/-/babel-plugin-transform-es2015-duplicate-keys-6.24.1.tgz",
"integrity": "sha1-c+s9MQypaePvnskcU3QabxV2Qj4=",
"dev": true,
"requires": {
"babel-runtime": "^6.22.0",
"babel-types": "^6.24.1"
}
},
"babel-plugin-transform-es2015-for-of": {
"version": "6.23.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-for-of/-/babel-plugin-transform-es2015-for-of-6.23.0.tgz",
"integrity": "sha1-9HyVsrYT3x0+zC/bdXNiPHUkhpE=",
"dev": true,
"requires": {
"babel-runtime": "^6.22.0"
}
},
"babel-plugin-transform-es2015-function-name": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-function-name/-/babel-plugin-transform-es2015-function-name-6.24.1.tgz",
"integrity": "sha1-g0yJhTvDaxrw86TF26qU/Y6sqos=",
"dev": true,
"requires": {
"babel-helper-function-name": "^6.24.1",
"babel-runtime": "^6.22.0",
"babel-types": "^6.24.1"
}
},
"babel-plugin-transform-es2015-literals": {
"version": "6.22.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-literals/-/babel-plugin-transform-es2015-literals-6.22.0.tgz",
"integrity": "sha1-T1SgLWzWbPkVKAAZox0xklN3yi4=",
"dev": true,
"requires": {
"babel-runtime": "^6.22.0"
}
},
"babel-plugin-transform-es2015-modules-amd": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-amd/-/babel-plugin-transform-es2015-modules-amd-6.24.1.tgz",
"integrity": "sha1-Oz5UAXI5hC1tGcMBHEvS8AoA0VQ=",
"dev": true,
"requires": {
"babel-plugin-transform-es2015-modules-commonjs": "^6.24.1",
"babel-runtime": "^6.22.0",
"babel-template": "^6.24.1"
}
},
"babel-plugin-transform-es2015-modules-commonjs": {
"version": "6.26.2",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.26.2.tgz",
"integrity": "sha512-CV9ROOHEdrjcwhIaJNBGMBCodN+1cfkwtM1SbUHmvyy35KGT7fohbpOxkE2uLz1o6odKK2Ck/tz47z+VqQfi9Q==",
"dev": true,
"requires": {
"babel-plugin-transform-strict-mode": "^6.24.1",
"babel-runtime": "^6.26.0",
"babel-template": "^6.26.0",
"babel-types": "^6.26.0"
}
},
"babel-plugin-transform-es2015-modules-systemjs": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-systemjs/-/babel-plugin-transform-es2015-modules-systemjs-6.24.1.tgz",
"integrity": "sha1-/4mhQrkRmpBhlfXxBuzzBdlAfSM=",
"dev": true,
"requires": {
"babel-helper-hoist-variables": "^6.24.1",
"babel-runtime": "^6.22.0",
"babel-template": "^6.24.1"
}
},
"babel-plugin-transform-es2015-modules-umd": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-umd/-/babel-plugin-transform-es2015-modules-umd-6.24.1.tgz",
"integrity": "sha1-rJl+YoXNGO1hdq22B9YCNErThGg=",
"dev": true,
"requires": {
"babel-plugin-transform-es2015-modules-amd": "^6.24.1",
"babel-runtime": "^6.22.0",
"babel-template": "^6.24.1"
}
},
"babel-plugin-transform-es2015-object-super": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-object-super/-/babel-plugin-transform-es2015-object-super-6.24.1.tgz",
"integrity": "sha1-JM72muIcuDp/hgPa0CH1cusnj40=",
"dev": true,
"requires": {
"babel-helper-replace-supers": "^6.24.1",
"babel-runtime": "^6.22.0"
}
},
"babel-plugin-transform-es2015-parameters": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-parameters/-/babel-plugin-transform-es2015-parameters-6.24.1.tgz",
"integrity": "sha1-V6w1GrScrxSpfNE7CfZv3wpiXys=",
"dev": true,
"requires": {
"babel-helper-call-delegate": "^6.24.1",
"babel-helper-get-function-arity": "^6.24.1",
"babel-runtime": "^6.22.0",
"babel-template": "^6.24.1",
"babel-traverse": "^6.24.1",
"babel-types": "^6.24.1"
}
},
"babel-plugin-transform-es2015-shorthand-properties": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-shorthand-properties/-/babel-plugin-transform-es2015-shorthand-properties-6.24.1.tgz",
"integrity": "sha1-JPh11nIch2YbvZmkYi5R8U3jiqA=",
"dev": true,
"requires": {
"babel-runtime": "^6.22.0",
"babel-types": "^6.24.1"
}
},
"babel-plugin-transform-es2015-spread": {
"version": "6.22.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-spread/-/babel-plugin-transform-es2015-spread-6.22.0.tgz",
"integrity": "sha1-1taKmfia7cRTbIGlQujdnxdG+NE=",
"dev": true,
"requires": {
"babel-runtime": "^6.22.0"
}
},
"babel-plugin-transform-es2015-sticky-regex": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-sticky-regex/-/babel-plugin-transform-es2015-sticky-regex-6.24.1.tgz",
"integrity": "sha1-AMHNsaynERLN8M9hJsLta0V8zbw=",
"dev": true,
"requires": {
"babel-helper-regex": "^6.24.1",
"babel-runtime": "^6.22.0",
"babel-types": "^6.24.1"
}
},
"babel-plugin-transform-es2015-template-literals": {
"version": "6.22.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-template-literals/-/babel-plugin-transform-es2015-template-literals-6.22.0.tgz",
"integrity": "sha1-qEs0UPfp+PH2g51taH2oS7EjbY0=",
"dev": true,
"requires": {
"babel-runtime": "^6.22.0"
}
},
"babel-plugin-transform-es2015-typeof-symbol": {
"version": "6.23.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-typeof-symbol/-/babel-plugin-transform-es2015-typeof-symbol-6.23.0.tgz",
"integrity": "sha1-3sCfHN3/lLUqxz1QXITfWdzOs3I=",
"dev": true,
"requires": {
"babel-runtime": "^6.22.0"
}
},
"babel-plugin-transform-es2015-unicode-regex": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-unicode-regex/-/babel-plugin-transform-es2015-unicode-regex-6.24.1.tgz",
"integrity": "sha1-04sS9C6nMj9yk4fxinxa4frrNek=",
"dev": true,
"requires": {
"babel-helper-regex": "^6.24.1",
"babel-runtime": "^6.22.0",
"regexpu-core": "^2.0.0"
}
},
"babel-plugin-transform-regenerator": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.26.0.tgz",
"integrity": "sha1-4HA2lvveJ/Cj78rPi03KL3s6jy8=",
"dev": true,
"requires": {
"regenerator-transform": "^0.10.0"
}
},
"babel-plugin-transform-strict-mode": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.24.1.tgz",
"integrity": "sha1-1fr3qleKZbvlkc9e2uBKDGcCB1g=",
"dev": true,
"requires": {
"babel-runtime": "^6.22.0",
"babel-types": "^6.24.1"
}
},
"babel-polyfill": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-polyfill/-/babel-polyfill-6.26.0.tgz",
"integrity": "sha1-N5k3q8Z9eJWXCtxiHyhM2WbPIVM=",
"dev": true,
"requires": {
"babel-runtime": "^6.26.0",
"core-js": "^2.5.0",
"regenerator-runtime": "^0.10.5"
}
},
"babel-preset-es2015": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-preset-es2015/-/babel-preset-es2015-6.24.1.tgz",
"integrity": "sha1-1EBQ1rwsn+6nAqrzjXJ6AhBTiTk=",
"dev": true,
"requires": {
"babel-plugin-check-es2015-constants": "^6.22.0",
"babel-plugin-transform-es2015-arrow-functions": "^6.22.0",
"babel-plugin-transform-es2015-block-scoped-functions": "^6.22.0",
"babel-plugin-transform-es2015-block-scoping": "^6.24.1",
"babel-plugin-transform-es2015-classes": "^6.24.1",
"babel-plugin-transform-es2015-computed-properties": "^6.24.1",
"babel-plugin-transform-es2015-destructuring": "^6.22.0",
"babel-plugin-transform-es2015-duplicate-keys": "^6.24.1",
"babel-plugin-transform-es2015-for-of": "^6.22.0",
"babel-plugin-transform-es2015-function-name": "^6.24.1",
"babel-plugin-transform-es2015-literals": "^6.22.0",
"babel-plugin-transform-es2015-modules-amd": "^6.24.1",
"babel-plugin-transform-es2015-modules-commonjs": "^6.24.1",
"babel-plugin-transform-es2015-modules-systemjs": "^6.24.1",
"babel-plugin-transform-es2015-modules-umd": "^6.24.1",
"babel-plugin-transform-es2015-object-super": "^6.24.1",
"babel-plugin-transform-es2015-parameters": "^6.24.1",
"babel-plugin-transform-es2015-shorthand-properties": "^6.24.1",
"babel-plugin-transform-es2015-spread": "^6.22.0",
"babel-plugin-transform-es2015-sticky-regex": "^6.24.1",
"babel-plugin-transform-es2015-template-literals": "^6.22.0",
"babel-plugin-transform-es2015-typeof-symbol": "^6.22.0",
"babel-plugin-transform-es2015-unicode-regex": "^6.24.1",
"babel-plugin-transform-regenerator": "^6.24.1"
}
},
"babel-register": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.26.0.tgz",
"integrity": "sha1-btAhFz4vy0htestFxgCahW9kcHE=",
"dev": true,
"requires": {
"babel-core": "^6.26.0",
"babel-runtime": "^6.26.0",
"core-js": "^2.5.0",
"home-or-tmp": "^2.0.0",
"lodash": "^4.17.4",
"mkdirp": "^0.5.1",
"source-map-support": "^0.4.15"
}
},
"babel-runtime": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz",
"integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=",
"dev": true,
"requires": {
"core-js": "^2.4.0",
"regenerator-runtime": "^0.11.0"
},
"dependencies": {
"regenerator-runtime": {
"version": "0.11.1",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz",
"integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==",
"dev": true
}
}
},
"babel-template": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.26.0.tgz",
"integrity": "sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI=",
"dev": true,
"requires": {
"babel-runtime": "^6.26.0",
"babel-traverse": "^6.26.0",
"babel-types": "^6.26.0",
"babylon": "^6.18.0",
"lodash": "^4.17.4"
}
},
"babel-traverse": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.26.0.tgz",
"integrity": "sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4=",
"dev": true,
"requires": {
"babel-code-frame": "^6.26.0",
"babel-messages": "^6.23.0",
"babel-runtime": "^6.26.0",
"babel-types": "^6.26.0",
"babylon": "^6.18.0",
"debug": "^2.6.8",
"globals": "^9.18.0",
"invariant": "^2.2.2",
"lodash": "^4.17.4"
}
},
"babel-types": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz",
"integrity": "sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc=",
"dev": true,
"requires": {
"babel-runtime": "^6.26.0",
"esutils": "^2.0.2",
"lodash": "^4.17.4",
"to-fast-properties": "^1.0.3"
}
},
"babylon": {
"version": "6.18.0",
"resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz",
"integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==",
"dev": true
},
"balanced-match": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
"dev": true
},
"brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"dev": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
}
},
"chai": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/chai/-/chai-4.2.0.tgz",
"integrity": "sha512-XQU3bhBukrOsQCuwZndwGcCVQHyZi53fQ6Ys1Fym7E4olpIqqZZhhoFJoaKVvV17lWQoXYwgWN2nF5crA8J2jw==",
"dev": true,
"requires": {
"assertion-error": "^1.1.0",
"check-error": "^1.0.2",
"deep-eql": "^3.0.1",
"get-func-name": "^2.0.0",
"pathval": "^1.1.0",
"type-detect": "^4.0.5"
}
},
"chai-as-promised": {
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/chai-as-promised/-/chai-as-promised-7.1.1.tgz",
"integrity": "sha512-azL6xMoi+uxu6z4rhWQ1jbdUhOMhis2PvscD/xjLqNMkv3BPPp2JyyuTHOrf9BOosGpNQ11v6BKv/g57RXbiaA==",
"dev": true,
"requires": {
"check-error": "^1.0.2"
}
},
"chalk": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
"integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
"dev": true,
"requires": {
"ansi-styles": "^2.2.1",
"escape-string-regexp": "^1.0.2",
"has-ansi": "^2.0.0",
"strip-ansi": "^3.0.0",
"supports-color": "^2.0.0"
}
},
"check-error": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz",
"integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=",
"dev": true
},
"concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
"dev": true
},
"convert-source-map": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.6.0.tgz",
"integrity": "sha512-eFu7XigvxdZ1ETfbgPBohgyQ/Z++C0eEhTor0qRwBw9unw+L0/6V8wkSuGgzdThkiS5lSpdptOQPD8Ak40a+7A==",
"dev": true,
"requires": {
"safe-buffer": "~5.1.1"
}
},
"core-js": {
"version": "2.6.2",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.2.tgz",
"integrity": "sha512-NdBPF/RVwPW6jr0NCILuyN9RiqLo2b1mddWHkUL+VnvcB7dzlnBJ1bXYntjpTGOgkZiiLWj2JxmOr7eGE3qK6g==",
"dev": true
},
"debug": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
"dev": true,
"requires": {
"ms": "2.0.0"
}
},
"deep-eql": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz",
"integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==",
"dev": true,
"requires": {
"type-detect": "^4.0.0"
}
},
"detect-indent": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz",
"integrity": "sha1-920GQ1LN9Docts5hnE7jqUdd4gg=",
"dev": true,
"requires": {
"repeating": "^2.0.0"
}
},
"escape-string-regexp": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
"dev": true
},
"esutils": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz",
"integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=",
"dev": true
},
"get-func-name": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz",
"integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=",
"dev": true
},
"globals": {
"version": "9.18.0",
"resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz",
"integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==",
"dev": true
},
"has-ansi": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz",
"integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=",
"dev": true,
"requires": {
"ansi-regex": "^2.0.0"
}
},
"home-or-tmp": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-2.0.0.tgz",
"integrity": "sha1-42w/LSyufXRqhX440Y1fMqeILbg=",
"dev": true,
"requires": {
"os-homedir": "^1.0.0",
"os-tmpdir": "^1.0.1"
}
},
"invariant": {
"version": "2.2.4",
"resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz",
"integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==",
"dev": true,
"requires": {
"loose-envify": "^1.0.0"
}
},
"is-finite": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz",
"integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=",
"dev": true,
"requires": {
"number-is-nan": "^1.0.0"
}
},
"js-tokens": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz",
"integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=",
"dev": true
},
"jsesc": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz",
"integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=",
"dev": true
},
"json5": {
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz",
"integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=",
"dev": true
},
"lodash": {
"version": "4.17.11",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz",
"integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==",
"dev": true
},
"loose-envify": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
"integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==",
"dev": true,
"requires": {
"js-tokens": "^3.0.0 || ^4.0.0"
}
},
"minimatch": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
"dev": true,
"requires": {
"brace-expansion": "^1.1.7"
}
},
"minimist": {
"version": "0.0.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
"dev": true
},
"mkdirp": {
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
"dev": true,
"requires": {
"minimist": "0.0.8"
}
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
"dev": true
},
"number-is-nan": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz",
"integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=",
"dev": true
},
"os-homedir": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz",
"integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=",
"dev": true
},
"os-tmpdir": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
"integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=",
"dev": true
},
"path-is-absolute": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
"dev": true
},
"pathval": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz",
"integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=",
"dev": true
},
"private": {
"version": "0.1.8",
"resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz",
"integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==",
"dev": true
},
"regenerate": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.0.tgz",
"integrity": "sha512-1G6jJVDWrt0rK99kBjvEtziZNCICAuvIPkSiUFIQxVP06RCVpq3dmDo2oi6ABpYaDYaTRr67BEhL8r1wgEZZKg==",
"dev": true
},
"regenerator-runtime": {
"version": "0.10.5",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz",
"integrity": "sha1-M2w+/BIgrc7dosn6tntaeVWjNlg=",
"dev": true
},
"regenerator-transform": {
"version": "0.10.1",
"resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.10.1.tgz",
"integrity": "sha512-PJepbvDbuK1xgIgnau7Y90cwaAmO/LCLMI2mPvaXq2heGMR3aWW5/BQvYrhJ8jgmQjXewXvBjzfqKcVOmhjZ6Q==",
"dev": true,
"requires": {
"babel-runtime": "^6.18.0",
"babel-types": "^6.19.0",
"private": "^0.1.6"
}
},
"regexpu-core": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-2.0.0.tgz",
"integrity": "sha1-SdA4g3uNz4v6W5pCE5k45uoq4kA=",
"dev": true,
"requires": {
"regenerate": "^1.2.1",
"regjsgen": "^0.2.0",
"regjsparser": "^0.1.4"
}
},
"regjsgen": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz",
"integrity": "sha1-bAFq3qxVT3WCP+N6wFuS1aTtsfc=",
"dev": true
},
"regjsparser": {
"version": "0.1.5",
"resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz",
"integrity": "sha1-fuj4Tcb6eS0/0K4ijSS9lJ6tIFw=",
"dev": true,
"requires": {
"jsesc": "~0.5.0"
}
},
"repeating": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz",
"integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=",
"dev": true,
"requires": {
"is-finite": "^1.0.0"
}
},
"safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
"dev": true
},
"slash": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz",
"integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=",
"dev": true
},
"source-map": {
"version": "0.5.7",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
"integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=",
"dev": true
},
"source-map-support": {
"version": "0.4.18",
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.18.tgz",
"integrity": "sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA==",
"dev": true,
"requires": {
"source-map": "^0.5.6"
}
},
"strip-ansi": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
"dev": true,
"requires": {
"ansi-regex": "^2.0.0"
}
},
"supports-color": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz",
"integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=",
"dev": true
},
"to-fast-properties": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz",
"integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=",
"dev": true
},
"trim-right": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz",
"integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=",
"dev": true
},
"type-detect": {
"version": "4.0.8",
"resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz",
"integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==",
"dev": true
},
"zeppelin-solidity": {
"version": "1.12.0",
"resolved": "https://registry.npmjs.org/zeppelin-solidity/-/zeppelin-solidity-1.12.0.tgz",
"integrity": "sha512-dgjPPnTmx14hAbTeOpTKemDeDCDdwglS0nquOAJG8h5o9zlb43FZafQSrMlIUUSp1EisDZfehrp5loGEYXHZBA=="
}
}
}

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 = "AvarCat"
const symbol = "ACat"
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,110 @@
/**
* 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')
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)
// },
development: {
host: 'localhost',
port: 7545,
gas: 3000000,
gasPrice: 21,
network_id: '*' // Match any network id
}
// 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"
// }
}
}
}

21
nftbapp/frontend-nftdapp/.gitignore vendored Normal file
View File

@@ -0,0 +1,21 @@
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw*

View File

@@ -0,0 +1,29 @@
# frontend-nftdapp
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
### Compiles and minifies for production
```
npm run build
```
### Run your tests
```
npm run test
```
### Lints and fixes files
```
npm run lint
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).

View File

@@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/app'
]
}

10075
nftbapp/frontend-nftdapp/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,32 @@
{
"name": "frontend-nftdapp",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build"
},
"dependencies": {
"axios": "^0.18.0",
"vue": "^2.5.21",
"vue-axios": "^2.1.4",
"vue-router": "^3.0.2",
"vuetify": "^1.4.1",
"web3": "^0.20.6"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^3.1.1",
"@vue/cli-service": "^3.1.1",
"vue-template-compiler": "^2.5.21"
},
"postcss": {
"plugins": {
"autoprefixer": {}
}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<link href='https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Material+Icons' rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet">
<title>frontend-nftdapp</title>
</head>
<body>
<noscript>
<strong>We're sorry but frontend-nftdapp doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>

View File

@@ -0,0 +1,52 @@
<template>
<v-app light>
<v-toolbar fixed color="teal lighten-2" app dark :clipped-left="true">
<v-toolbar-title>NFT APP</v-toolbar-title>
<v-spacer></v-spacer>
<div class="nav">
<a href="/">Home</a>
<a href="/wallet">Wallet</a>
<a href="/upload">Upload</a>
</div>
</v-toolbar>
<v-content class="contentWrapper">
<v-container fluid>
<router-view></router-view>
</v-container>
</v-content>
</v-app>
</template>
<script>
import 'vuetify/dist/vuetify.min.css'
export default {
name: 'app'
}
</script>
<style>
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
.nav a {
font-weight: bold;
color: #2c3e50;
margin: 10px;
}
.nav a.router-link-exact-active {
color: #42b983;
}
.contentWrapper {
padding-top: 20px;
}
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@@ -0,0 +1,57 @@
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<p>
For a guide and recipes on how to configure / customize this project,<br>
check out the
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
</p>
<h3>Installed CLI Plugins</h3>
<ul>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
</ul>
<h3>Essential Links</h3>
<ul>
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
</ul>
<h3>Ecosystem</h3>
<ul>
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
</ul>
</div>
</template>
<script>
export default {
name: 'HelloWorld',
props: {
msg: String
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>

View File

@@ -0,0 +1,64 @@
<template>
<v-container grid-list-md text-xs-center>
<v-layout row wrap>
<v-flex v-for="(auction, index) in auctions" :key="index" xs4>
<v-card>
<v-img :src="auction.image" height="200px"></v-img>
<div>Title: {{auction.title}}</div>
<div>Price: {{auction.price}} Ether</div>
<div>TokenId: {{auction.tokenId}}</div>
<div>Owner: {{auction.owner}}</div>
<div>Active: {{auction.active}}</div>
<div>Finalized: {{auction.finalized}}</div>
</v-card>
</v-flex>
</v-layout>
</v-container>
</template>
<script>
export default {
data() {
return {
ciMyNFT: null,
ciAuctions: null,
auctions: []
}
},
mounted() {
this.ciAuctions = this.$web3.eth.contract(this.$config.AUCTIONS_ABI).at(this.$config.AUCTIONS_CA)
this.ciMyNFT = this.$web3.eth.contract(this.$config.MYNFT_ABI).at(this.$config.MYNFT_CA)
this.getAuctions()
},
methods: {
getAuctions() {
this.ciAuctions.getCount({}, (error, result) => {
const count = result
for(let i=0; i<count; i++) {
this.ciAuctions.getAuctionById(i, {}, (err, result) => {
this.ciMyNFT.ownerOf(result[3], {}, (error, owner) => {
this.auctions.push({
title: result[0],
price: this.$web3.fromWei(result[1], 'ether'),
image: 'https://gateway.ipfs.io/ipfs/'+result[2],
tokenId: result[3],
owner: owner,
active: result[6],
finalized: result[7]
})
})
})
}
})
}
}
}
</script>

View File

@@ -0,0 +1,149 @@
<template>
<div>
<v-form class="form" ref="form">
<v-text-field
v-model="tokenId"
label="Unique ID">
</v-text-field>
<input
type="file"
@change="captureFile" />
<v-btn @click="uploadImg" outline color="teal">UploadImg</v-btn>
<img :src="uploadedImg()" width="300" />
<v-text-field
v-model="dataURI"
label="Data URI"
required
></v-text-field>
<v-btn @click="submit" outline color="teal">Submit</v-btn>
<div v-show="isRegistered">
<v-btn @click="transferToCA" outline color="teal">TransferToCA</v-btn>
</div>
</v-form>
<PostAuction v-bind:tokenid="tokenId" v-bind:metadata="dataURI" />
</div>
</template>
<script>
import PostAuction from '@/components/PostAuction.vue'
export default {
data() {
return {
account: null,
contractInstance: null,
file: null,
tokenId: null,
isRegistered: false,
dataURI: null
}
},
components: {
PostAuction
},
async mounted() {
this.account = await this.$getDefaultAccount()
this.contractInstance = this.$web3.eth.contract(this.$config.MYNFT_ABI).at(this.$config.MYNFT_CA)
this.tokenId = this._getRandomInt(123456789,999999999)
},
methods: {
_getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min
},
captureFile(event) {
event.stopPropagation()
this.file = event.target.files[0]
},
async uploadImg() {
if(!this.file){
alert("Please put the file on input.")
return
}
const formData = new FormData()
formData.append('file', this.file)
this.axios({
method: 'post',
baseURL: 'https://ipfs.infura.io:5001',
url: '/api/v0/add',
data: formData,
headers: {'Content-Type': 'multipart/form-data'}
}).then((response)=> {
this.dataURI = response.data.Hash
})
},
uploadedImg(){
return 'https://gateway.ipfs.io/ipfs/'+this.dataURI
},
submit() {
if(!this.dataURI){
alert("Fill in dataURI on the input")
return
}
this.contractInstance.registerUniqueToken(this.account, this.tokenId, this.dataURI, {
from: this.account,
gas: this.$config.GAS_AMOUNT
}, (error, result) => {
console.log("result",result)
})
this.watchTokenRegistered((error, result) => {
if(!error) {
alert("Token registered...!")
this.isRegistered = true
}
})
},
transferToCA() {
this.contractInstance.transferFrom(this.account, this.$config.AUCTIONS_CA, this.tokenId, {
from: this.account,
gas: this.$config.GAS_AMOUNT
}, (error, result) => {
console.log("result",result)
})
this.watchTransfered((error, result) => {
if(!error) alert("Token transfered to CA...!")
})
},
async watchTokenRegistered(cb) {
const currentBlock = await this.getCurrentBlock()
const eventWatcher = this.contractInstance.TokenRegistered({}, {fromBlock: currentBlock - 1, toBlock: 'latest'})
eventWatcher.watch(cb)
},
async watchTransfered(cb) {
const currentBlock = await this.getCurrentBlock()
const eventWatcher = this.contractInstance.Transfer({}, {fromBlock: currentBlock - 1, toBlock: 'latest'})
eventWatcher.watch(cb)
},
getCurrentBlock() {
return new Promise((resolve, reject ) => {
this.$web3.eth.getBlockNumber((err, blocknumber) => {
if(!err) resolve(blocknumber)
reject(err)
})
})
},
}
}
</script>

View File

@@ -0,0 +1,136 @@
<template>
<div class="containWrap">
<v-card class="cardG">
<div>
<p class="text-center address">
{{account}} <span class="reftxt">(Address)</span>
</p>
<p class="text-center balance">
{{balance}} Ether <span class="reftxt">(Balance)</span>
</p>
</div>
</v-card>
<h2>Transfer</h2>
<v-select v-model="selectedAuction" :items="auctionIds" label="Asset" @change="getAuctionById"></v-select>
<div v-show="selectedAuction">
<h3>Auction Info</h3>
<div>Title: {{auctionInfo.title}}</div>
<div>Price: {{auctionInfo.price}} Ether</div>
<div>TokenId: {{auctionInfo.tokenId}}</div>
<div>Owner: {{auctionInfo.owner}}</div>
</div>
<v-text-field
v-model="toAddress"
label="To Address"
required
></v-text-field>
<v-btn @click="finalizeAuction" outline color="teal">Finalize</v-btn>
</div>
</template>
<script>
export default {
data() {
return {
account: '',
balance: null,
ciMyNFT: null,
ciAuctions: null,
auctionIds:[],
toAddress: null,
selectedAuction: null,
auctionInfo: {
title: '',
price: 0,
tokenId: '',
owner: ''
}
}
},
async mounted() {
this.account = await this.$getDefaultAccount()
this.$web3.eth.getBalance(this.account, (error, result) => {
this.balance = this.$web3.fromWei(result, 'ether')
})
this.ciMyNFT = this.$web3.eth.contract(this.$config.MYNFT_ABI).at(this.$config.MYNFT_CA)
this.ciAuctions = this.$web3.eth.contract(this.$config.AUCTIONS_ABI).at(this.$config.AUCTIONS_CA)
this.getMyAuctions()
},
methods: {
getMyAuctions() {
this.ciAuctions.getAuctionsOf(this.account, {from: this.account, gas: this.$config.GAS_AMOUNT}, (error, result) => {
this.auctionIds = result
})
},
getAuctionById() {
this.ciAuctions.getAuctionById(this.selectedAuction, {from: this.account, gas: this.$config.GAS_AMOUNT}, (error, result) => {
console.log(result)
this.auctionInfo.title = result[0]
this.auctionInfo.price = this.$web3.fromWei(result[1], 'ether')
this.auctionInfo.tokenId = result[3]
this.ciMyNFT.ownerOf(result[3], {}, (error, owner) => {
this.auctionInfo.owner = owner
})
})
},
finalizeAuction() {
if(!this.toAddress) {
alert("please fill in to Address")
return
}
this.ciAuctions.finalizeAuction(this.selectedAuction, this.toAddress, {from: this.account, gas: this.$config.GAS_AMOUNT}, (error, result) => {
console.log(result)
})
this.watchFinalized((error, result) => {
if(!error) alert("Auction finalized...!")
})
},
async watchFinalized(cb) {
const currentBlock = await this.getCurrentBlock()
const eventWatcher = this.ciAuctions.AuctionFinalized({}, {fromBlock: currentBlock - 1, toBlock: 'latest'})
eventWatcher.watch(cb)
},
getCurrentBlock() {
return new Promise((resolve, reject ) => {
this.$web3.eth.getBlockNumber((err, blocknumber) => {
if(!err) resolve(blocknumber)
reject(err)
})
})
}
}
}
</script>
<style scoped>
.containWrap {
max-width: 600px;
margin: 0 auto;
}
.cardG {
margin: 10px;
padding: 10px;
}
.cardG .reftxt {
color: #b7afaf;
}
</style>

View File

@@ -0,0 +1,79 @@
<template>
<div>
<v-form class="form" ref="form">
<v-text-field
v-model="tokenid"
></v-text-field>
<v-text-field
v-model="auction.auctionTitle"
placeholder="e.g. My NFT"
label="Auction title"
persistent-hint
></v-text-field>
<v-text-field
v-model="auction.price"
placeholder="e.g. 1"
label="Price"
persistent-hint
></v-text-field>
<v-btn @click="createAuction()" outline color="teal">Create Auction</v-btn>
</v-form>
</div>
</template>
<script>
export default {
props: ['tokenid', 'metadata'],
data() {
return {
account: null,
contractInstance: null,
auction: {
auctionTitle: '',
price: null
},
}
},
async mounted() {
this.account = await this.$getDefaultAccount()
this.contractInstance = this.$web3.eth.contract(this.$config.AUCTIONS_ABI).at(this.$config.AUCTIONS_CA)
},
methods: {
async createAuction() {
if(!this.tokenid) {
alert("Check for tokenId")
return
}
const price = this.$web3.toWei(this.auction.price, 'ether')
this.contractInstance.createAuction(this.$config.MYNFT_CA, this.tokenid, this.auction.auctionTitle, this.metadata, price, {from: this.account, gas: this.$config.GAS_AMOUNT}, (error, transactionHash) => {
console.log("txhash",transactionHash)
})
this.watchCreated((error, result) => {
if(!error) alert("Creation completed...!")
})
},
async watchCreated(cb) {
const currentBlock = await this.getCurrentBlock()
const eventWatcher = this.contractInstance.AuctionCreated({}, {fromBlock: currentBlock - 1, toBlock: 'latest'})
eventWatcher.watch(cb)
},
getCurrentBlock() {
return new Promise((resolve, reject ) => {
this.$web3.eth.getBlockNumber((err, blocknumber) => {
if(!err) resolve(blocknumber)
reject(err)
})
})
}
}
}
</script>

View File

@@ -0,0 +1,12 @@
const MyNFT = require('./contracts/MyNFT')
const Auctions = require('./contracts/Auctions')
export default {
MYNFT_CA: '0x3cd92247e5331d3b51f6cbeff4e5d3ef420f1989',
AUCTIONS_CA: '0x5ffc6ca35a7ee8ed33228b47b49c21310e67339c',
MYNFT_ABI: MyNFT.abi,
AUCTIONS_ABI: Auctions.abi,
GAS_AMOUNT: 500000
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,39 @@
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import Vuetify from 'vuetify'
import axios from 'axios'
import VueAxios from 'vue-axios'
import Web3 from 'web3'
import Config from './config'
Vue.use(Vuetify)
Vue.use(VueAxios, axios)
Vue.config.productionTip = false
Vue.mixin({
created() {
const web3js = window.web3
if(typeof web3js !== 'undefined') {
this.$web3 = new Web3(web3js.currentProvider)
}
this.$getDefaultAccount = () => {
return new Promise((resolve, reject) => {
this.$web3.eth.getAccounts((err, data) => {
if(!err) resolve(data[0])
reject(err)
})
})
}
this.$config = Config
}
})
new Vue({
router,
render: h => h(App),
}).$mount('#app')

View File

@@ -0,0 +1,30 @@
import Vue from 'vue'
import Router from 'vue-router'
import Main from './views/Main.vue'
import Wallet from './views/Wallet.vue'
import Upload from './views/Upload.vue'
Vue.use(Router)
export default new Router({
mode: 'history',
base: process.env.BASE_URL,
routes: [
{
path: '/',
name: 'main',
component: Main
},
{
path: '/wallet',
name: 'wallet',
component: Wallet
},
{
path: '/upload',
name: 'upload',
component: Upload
}
]
})

View File

@@ -0,0 +1,15 @@
<template>
<div>
<h2>Main Page</h2>
<Marketplace />
</div>
</template>
<script>
import Marketplace from '@/components/Marketplace.vue'
export default {
components: {
Marketplace
}
}
</script>

View File

@@ -0,0 +1,15 @@
<template>
<div>
<h2>Upload Page</h2>
<MyUpload />
</div>
</template>
<script>
import MyUpload from '@/components/MyUpload.vue'
export default {
components: {
MyUpload
}
}
</script>

View File

@@ -0,0 +1,16 @@
<template>
<div>
<h2>Wallet Page</h2>
<MyWallet />
</div>
</template>
<script>
import MyWallet from '@/components/MyWallet.vue'
export default {
components: {
MyWallet
}
}
</script>

View File

@@ -0,0 +1,3 @@
> 1%
last 2 versions
not ie <= 8

21
numbergame/.gitignore vendored Normal file
View File

@@ -0,0 +1,21 @@
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw*

29
numbergame/README.md Normal file
View File

@@ -0,0 +1,29 @@
# bet-dapp
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
### Compiles and minifies for production
```
npm run build
```
### Run your tests
```
npm run test
```
### Lints and fixes files
```
npm run lint
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).

View File

@@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/app'
]
}

View File

@@ -0,0 +1,61 @@
pragma solidity ^0.4.18;
contract Ownable {
address owner;
function Ownable() public {
owner = msg.sender;
}
modifier Owned {
require(msg.sender == owner);
_;
}
}
contract Mortal is Ownable {
function kill() public Owned {
selfdestruct(owner);
}
}
contract Betting is Mortal {
uint minBet; // 최소 베팅액
uint winRate; // 배당률 (%)
event Won(bool _result, uint _amount);
function Betting(uint _minBet, uint _winRate) payable public {
require(_minBet > 0);
require(_winRate <= 100);
minBet = _minBet;
winRate = _winRate;
}
function() public {
revert();
}
function bet(uint _num) payable public {
require(_num > 0 && _num <= 5);
require(msg.value >= minBet);
uint winNum = random();
if (_num == winNum) {
uint amtWon = msg.value * (100 - winRate)/10;
if(!msg.sender.send(amtWon)) revert();
Won(true, amtWon);
} else {
Won(false, 0);
}
}
function getBalance() Owned public view returns(uint) {
return address(this).balance;
}
function random() public view returns (uint) {
return uint(keccak256(block.difficulty, block.number, now)) % 5 + 1;
}
}

9943
numbergame/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

20
numbergame/package.json Normal file
View File

@@ -0,0 +1,20 @@
{
"name": "bet-dapp",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build"
},
"dependencies": {
"vue": "^2.5.21",
"vue-router": "^3.0.2",
"vuex": "^3.0.1",
"web3": "^0.20.6"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^3.1.1",
"@vue/cli-service": "^3.1.1",
"vue-template-compiler": "^2.5.21"
}
}

View File

@@ -0,0 +1,5 @@
module.exports = {
plugins: {
autoprefixer: {}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>bet-dapp</title>
</head>
<body>
<noscript>
<strong>We're sorry but bet-dapp doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>

23
numbergame/src/App.vue Normal file
View File

@@ -0,0 +1,23 @@
<template>
<div id="app">
<router-view></router-view>
</div>
</template>
<script>
export default {
name: 'app'
}
</script>
<style>
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@@ -0,0 +1,57 @@
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<p>
For a guide and recipes on how to configure / customize this project,<br>
check out the
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
</p>
<h3>Installed CLI Plugins</h3>
<ul>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
</ul>
<h3>Essential Links</h3>
<ul>
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
</ul>
<h3>Ecosystem</h3>
<ul>
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
</ul>
</div>
</template>
<script>
export default {
name: 'HelloWorld',
props: {
msg: String
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>

View File

@@ -0,0 +1,101 @@
<template>
<div class="betting">
<h1>Bet Dapp Test</h1>
Amount: <input v-model="amount" placeholder="0 Ether">
<ul>
<li v-on:click="_clickNumber">1</li>
<li v-on:click="_clickNumber">2</li>
<li v-on:click="_clickNumber">3</li>
<li v-on:click="_clickNumber">4</li>
<li v-on:click="_clickNumber">5</li>
</ul>
<div v-if="pending" id="loader">Loading...</div>
<div class="event" v-if="winEvent">
Won: {{ winEvent._result }}
Amount: {{ winEvent._amount }} Wei
</div>
</div>
</template>
<script>
export default {
name: 'betting-component',
data() {
return {
amount: null,
pending: false,
winEvent: null
}
},
mounted () {
this.$store.dispatch('getContractInstance')
},
methods: {
_clickNumber (event) {
console.log('betting number', event.target.innerHTML, this.amount)
this.winEvent = null
this.pending = true
this.$store.state.contractInstance().bet(event.target.innerHTML, {
gas: 300000,
value: this.$store.state.web3.web3Instance().toWei(this.amount, 'ether'),
from: this.$store.state.web3.coinbase
}, (err, result) => {
if (err) {
console.error(err)
this.pending = false
} else {
const Won = this.$store.state.contractInstance().Won()
Won.watch((err, result) => {
if (err) {
console.error('won', error)
} else {
this.winEvent = result.args
this.winEvent._amount = parseInt(result.args._amount, 10)
this.pending = false
}
})
}
})
}
}
}
</script>
<style scoped>
.betting {
margin-top: 50px;
text-align:center;
}
ul {
margin: 25px;
list-style-type: none;
display: grid;
grid-template-columns: repeat(5, 1fr);
grid-column-gap:25px;
}
li{
padding: 20px;
margin-right: 3px;
border-radius: 30%;
cursor: pointer;
background-color:#fff;
color: #4b08e0;
box-shadow:3px 5px 1px #4b08e0;
}
li:hover{
background-color:#4b08e0;
color:white;
box-shadow:0px 0px 1px #4b08e0;
}
li:active{
opacity: 0.7;
}
*{
color: #444444;
}
</style>

View File

@@ -0,0 +1,21 @@
<template>
<div>
<DappMetamask />
<BettingComponent />
</div>
</template>
<script>
import DappMetamask from '@/components/dapp-metamask'
import BettingComponent from '@/components/betting-component'
export default {
name: 'betting-dapp',
beforeCreate () {
console.log('registerWeb3 Action dispatched')
this.$store.dispatch('registerWeb3')
},
components: {
DappMetamask,
BettingComponent
}
}
</script>

View File

@@ -0,0 +1,20 @@
<template>
<div class='metamask-info'>
<p>연결 상태 : {{ web3.isInjected }}</p>
<p>네트워크: {{ web3.networkId }}</p>
<p>코인베이스 주소: {{ web3.coinbase }}</p>
<p>잔액: {{ web3.balance }}</p>
</div>
</template>
<script>
export default {
name: 'dapp-metamask',
computed: {
web3 () {
return this.$store.state.web3
}
}
}
</script>
<style scoped>
</style>

12
numbergame/src/main.js Normal file
View File

@@ -0,0 +1,12 @@
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import { store } from './store/'
Vue.config.productionTip = false
new Vue({
router,
store,
render: h => h(App),
}).$mount('#app')

View File

@@ -0,0 +1,92 @@
const address = '0x3bc507d62132520239a96a1c40b00086efbf3bf3'
const ABI = [
{
"constant": false,
"inputs": [
{
"name": "_num",
"type": "uint256"
}
],
"name": "bet",
"outputs": [],
"payable": true,
"stateMutability": "payable",
"type": "function"
},
{
"constant": false,
"inputs": [],
"name": "kill",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"name": "_minBet",
"type": "uint256"
},
{
"name": "_winRate",
"type": "uint256"
}
],
"payable": true,
"stateMutability": "payable",
"type": "constructor"
},
{
"payable": false,
"stateMutability": "nonpayable",
"type": "fallback"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"name": "_result",
"type": "bool"
},
{
"indexed": false,
"name": "_amount",
"type": "uint256"
}
],
"name": "Won",
"type": "event"
},
{
"constant": true,
"inputs": [],
"name": "getBalance",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "random",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
}
]
export {address, ABI}

View File

@@ -0,0 +1,9 @@
import Web3 from 'web3'
import {address, ABI} from './betContract'
const getContract = new Promise(function (resolve, reject) {
const web3 = new Web3(window.web3.currentProvider)
const betContract = web3.eth.contract(ABI)
const betContractInstance = betContract.at(address)
resolve(betContractInstance)
})
export default getContract

View File

@@ -0,0 +1,54 @@
import Web3 from 'web3'
const getWeb3 = new Promise(function (resolve, reject) {
const web3js = window.web3
if (typeof web3js !== 'undefined') {
const web3 = new Web3(web3js.currentProvider)
resolve({
injectedWeb3: web3.isConnected(),
web3 () {
return web3
}
})
} else {
reject(new Error('Unable to connect to Metamask'))
}
})
.then(result => {
return new Promise(function (resolve, reject) {
result.web3().version.getNetwork((err, networkId) => {
if (err) {
reject(new Error('Unable to retrieve network ID'))
} else {
result = {...result, networkId}
resolve(result)
}
})
})
})
.then(result => {
return new Promise(function (resolve, reject) {
result.web3().eth.getCoinbase((err, coinbase) => {
if (err) {
reject(new Error('Unable to retrieve coinbase'))
} else {
result = {...result, coinbase}
resolve(result)
}
})
})
})
.then(result => {
return new Promise(function (resolve, reject) {
result.web3().eth.getBalance(result.coinbase, (err, balance) => {
if (err) {
reject(new Error('Unable to retrieve balance for address: ' + result.coinbase))
} else {
result = {...result, balance}
resolve(result)
}
})
})
})
export default getWeb3

View File

@@ -0,0 +1,9 @@
export const NETWORKS = {
'1': 'Main Net',
'2': 'Deprecated Morden test network',
'3': 'Ropsten test network',
'4': 'Rinkeby test network',
'42': 'Kovan test network',
'4447': 'Truffle Develop Network',
'5777': 'Ganache Blockchain'
}

View File

@@ -0,0 +1,42 @@
import Web3 from 'web3'
import {store} from '../store/'
const pollWeb3 = function (state) {
let web3 = window.web3
web3 = new Web3(web3.currentProvider)
setInterval(() => {
if (!web3 || !store.state.web3.web3Instance) {
return;
}
if (web3.eth.coinbase !== store.state.web3.coinbase) {
const newCoinbase = web3.eth.coinbase
web3.eth.getBalance(web3.eth.coinbase, function (err, newBalance) {
if (err) {
console.error(err)
} else {
store.dispatch('updateWeb3', {
coinbase: newCoinbase,
balance: parseInt(newBalance, 10)
})
}
})
} else {
web3.eth.getBalance(store.state.web3.coinbase, (err, newBalance) => {
if (err) {
console.log(err)
} else if (parseInt(newBalance, 10) !== store.state.web3.balance) {
store.dispatch('updateWeb3', {
coinbase: store.state.web3.coinbase,
balance: newBalance
})
}
})
}
}, 700)
}
export default pollWeb3

14
numbergame/src/router.js Normal file
View File

@@ -0,0 +1,14 @@
import Vue from 'vue'
import Router from 'vue-router'
import BettingDapp from '@/components/betting-dapp'
Vue.use(Router)
export default new Router({
routes: [
{
path: '/',
name: 'betting-dapp',
component: BettingDapp
}
]
})

View File

@@ -0,0 +1,58 @@
import Vue from 'vue'
import Vuex from 'vuex'
import state from './state'
import getWeb3 from '../network/getWeb3'
import pollWeb3 from '../network/pollWeb3'
import getContract from '../network/getContract'
Vue.use(Vuex)
export const store = new Vuex.Store({
strict: true,
state,
mutations: {
registerWeb3Instance (state, data) {
console.log('registerWeb3instance', data)
const result = data
let newWeb3 = state.web3
newWeb3.coinbase = result.coinbase
newWeb3.networkId = result.networkId
newWeb3.balance = parseInt(result.balance, 10)
newWeb3.isInjected = result.injectedWeb3
newWeb3.web3Instance = result.web3
state.web3 = newWeb3
pollWeb3()
},
updateWeb3Instance (state, data) {
console.log('updateWeb3Instance', data)
state.web3.coinbase = data.coinbase
state.web3.balance = parseInt(data.balance, 10)
},
registerContractInstance (state, data) {
console.log('contract instance: ', data)
state.contractInstance = () => data
}
},
actions: {
registerWeb3 ({commit}) {
getWeb3.then(result => {
console.log('commit result')
commit('registerWeb3Instance', result)
}).catch(e => {
console.error('error', e)
})
},
updateWeb3 ({commit}, data) {
commit('updateWeb3Instance', data)
},
getContractInstance ({commit}) {
getContract.then(result => {
commit('registerContractInstance', result)
}).catch(e => console.log(e))
}
}
})

View File

@@ -0,0 +1,12 @@
const state = {
web3: {
isInjected: false,
web3Instance: null,
networkId: null,
coinbase: null,
balance: null,
error: null
},
contractInstance: null
}
export default state

View File

@@ -0,0 +1,894 @@
{
"contractName": "Migrations",
"abi": [
{
"constant": true,
"inputs": [],
"name": "last_completed_migration",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "owner",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"constant": false,
"inputs": [
{
"name": "completed",
"type": "uint256"
}
],
"name": "setCompleted",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}
],
"bytecode": "0x608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506101c2806100606000396000f300608060405260043610610057576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063445df0ac1461005c5780638da5cb5b14610087578063fdacd576146100de575b600080fd5b34801561006857600080fd5b5061007161010b565b6040518082815260200191505060405180910390f35b34801561009357600080fd5b5061009c610111565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156100ea57600080fd5b5061010960048036038101908080359060200190929190505050610136565b005b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561019357806001819055505b505600a165627a7a7230582057ab4f3d2dc0ee96a250055d0353849a4bc5ad1c98a2ceaabcbefe7934899afc0029",
"deployedBytecode": "0x608060405260043610610057576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063445df0ac1461005c5780638da5cb5b14610087578063fdacd576146100de575b600080fd5b34801561006857600080fd5b5061007161010b565b6040518082815260200191505060405180910390f35b34801561009357600080fd5b5061009c610111565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156100ea57600080fd5b5061010960048036038101908080359060200190929190505050610136565b005b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561019357806001819055505b505600a165627a7a7230582057ab4f3d2dc0ee96a250055d0353849a4bc5ad1c98a2ceaabcbefe7934899afc0029",
"sourceMap": "34:311:0:-;;;123:50;8:9:-1;5:2;;;30:1;27;20:12;5:2;123:50:0;158:10;150:5;;:18;;;;;;;;;;;;;;;;;;34:311;;;;;;",
"deployedSourceMap": "34:311:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;82:36;;8:9:-1;5:2;;;30:1;27;20:12;5:2;82:36:0;;;;;;;;;;;;;;;;;;;;;;;58:20;;8:9:-1;5:2;;;30:1;27;20:12;5:2;58:20:0;;;;;;;;;;;;;;;;;;;;;;;;;;;240:103;;8:9:-1;5:2;;;30:1;27;20:12;5:2;240:103:0;;;;;;;;;;;;;;;;;;;;;;;;;;82:36;;;;:::o;58:20::-;;;;;;;;;;;;;:::o;240:103::-;223:5;;;;;;;;;;;209:19;;:10;:19;;;205:26;;;329:9;302:24;:36;;;;205:26;240:103;:::o",
"source": "pragma solidity >=0.4.21 <0.7.0;\n\ncontract Migrations {\n address public owner;\n uint public last_completed_migration;\n\n constructor() public {\n owner = msg.sender;\n }\n\n modifier restricted() {\n if (msg.sender == owner) _;\n }\n\n function setCompleted(uint completed) public restricted {\n last_completed_migration = completed;\n }\n}\n",
"sourcePath": "/Users/willpark/Desktop/bookwork-klaytn/project_codes/todofeed/backend-todofeed/contracts/Migrations.sol",
"ast": {
"absolutePath": "/Users/willpark/Desktop/bookwork-klaytn/project_codes/todofeed/backend-todofeed/contracts/Migrations.sol",
"exportedSymbols": {
"Migrations": [
36
]
},
"id": 37,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 1,
"literals": [
"solidity",
">=",
"0.4",
".21",
"<",
"0.7",
".0"
],
"nodeType": "PragmaDirective",
"src": "0:32:0"
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"documentation": null,
"fullyImplemented": true,
"id": 36,
"linearizedBaseContracts": [
36
],
"name": "Migrations",
"nodeType": "ContractDefinition",
"nodes": [
{
"constant": false,
"id": 3,
"name": "owner",
"nodeType": "VariableDeclaration",
"scope": 36,
"src": "58:20:0",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 2,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "58:7:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "public"
},
{
"constant": false,
"id": 5,
"name": "last_completed_migration",
"nodeType": "VariableDeclaration",
"scope": 36,
"src": "82:36:0",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "82:4:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "public"
},
{
"body": {
"id": 13,
"nodeType": "Block",
"src": "144:29:0",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 11,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 8,
"name": "owner",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3,
"src": "150:5:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 9,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 231,
"src": "158:3:0",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 10,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "158:10:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"src": "150:18:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"id": 12,
"nodeType": "ExpressionStatement",
"src": "150:18:0"
}
]
},
"documentation": null,
"id": 14,
"implemented": true,
"isConstructor": true,
"isDeclaredConst": false,
"modifiers": [],
"name": "",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 6,
"nodeType": "ParameterList",
"parameters": [],
"src": "134:2:0"
},
"payable": false,
"returnParameters": {
"id": 7,
"nodeType": "ParameterList",
"parameters": [],
"src": "144:0:0"
},
"scope": 36,
"src": "123:50:0",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
{
"body": {
"id": 22,
"nodeType": "Block",
"src": "199:37:0",
"statements": [
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"id": 19,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 16,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 231,
"src": "209:3:0",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 17,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "209:10:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"id": 18,
"name": "owner",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3,
"src": "223:5:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"src": "209:19:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": null,
"id": 21,
"nodeType": "IfStatement",
"src": "205:26:0",
"trueBody": {
"id": 20,
"nodeType": "PlaceholderStatement",
"src": "230:1:0"
}
}
]
},
"documentation": null,
"id": 23,
"name": "restricted",
"nodeType": "ModifierDefinition",
"parameters": {
"id": 15,
"nodeType": "ParameterList",
"parameters": [],
"src": "196:2:0"
},
"src": "177:59:0",
"visibility": "internal"
},
{
"body": {
"id": 34,
"nodeType": "Block",
"src": "296:47:0",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 32,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 30,
"name": "last_completed_migration",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5,
"src": "302:24:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"id": 31,
"name": "completed",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 25,
"src": "329:9:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "302:36:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 33,
"nodeType": "ExpressionStatement",
"src": "302:36:0"
}
]
},
"documentation": null,
"id": 35,
"implemented": true,
"isConstructor": false,
"isDeclaredConst": false,
"modifiers": [
{
"arguments": null,
"id": 28,
"modifierName": {
"argumentTypes": null,
"id": 27,
"name": "restricted",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 23,
"src": "285:10:0",
"typeDescriptions": {
"typeIdentifier": "t_modifier$__$",
"typeString": "modifier ()"
}
},
"nodeType": "ModifierInvocation",
"src": "285:10:0"
}
],
"name": "setCompleted",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 26,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 25,
"name": "completed",
"nodeType": "VariableDeclaration",
"scope": 35,
"src": "262:14:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 24,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "262:4:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "261:16:0"
},
"payable": false,
"returnParameters": {
"id": 29,
"nodeType": "ParameterList",
"parameters": [],
"src": "296:0:0"
},
"scope": 36,
"src": "240:103:0",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
}
],
"scope": 37,
"src": "34:311:0"
}
],
"src": "0:346:0"
},
"legacyAST": {
"absolutePath": "/Users/willpark/Desktop/bookwork-klaytn/project_codes/todofeed/backend-todofeed/contracts/Migrations.sol",
"exportedSymbols": {
"Migrations": [
36
]
},
"id": 37,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 1,
"literals": [
"solidity",
">=",
"0.4",
".21",
"<",
"0.7",
".0"
],
"nodeType": "PragmaDirective",
"src": "0:32:0"
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"documentation": null,
"fullyImplemented": true,
"id": 36,
"linearizedBaseContracts": [
36
],
"name": "Migrations",
"nodeType": "ContractDefinition",
"nodes": [
{
"constant": false,
"id": 3,
"name": "owner",
"nodeType": "VariableDeclaration",
"scope": 36,
"src": "58:20:0",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 2,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "58:7:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "public"
},
{
"constant": false,
"id": 5,
"name": "last_completed_migration",
"nodeType": "VariableDeclaration",
"scope": 36,
"src": "82:36:0",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "82:4:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "public"
},
{
"body": {
"id": 13,
"nodeType": "Block",
"src": "144:29:0",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 11,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 8,
"name": "owner",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3,
"src": "150:5:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 9,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 231,
"src": "158:3:0",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 10,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "158:10:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"src": "150:18:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"id": 12,
"nodeType": "ExpressionStatement",
"src": "150:18:0"
}
]
},
"documentation": null,
"id": 14,
"implemented": true,
"isConstructor": true,
"isDeclaredConst": false,
"modifiers": [],
"name": "",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 6,
"nodeType": "ParameterList",
"parameters": [],
"src": "134:2:0"
},
"payable": false,
"returnParameters": {
"id": 7,
"nodeType": "ParameterList",
"parameters": [],
"src": "144:0:0"
},
"scope": 36,
"src": "123:50:0",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
{
"body": {
"id": 22,
"nodeType": "Block",
"src": "199:37:0",
"statements": [
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"id": 19,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 16,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 231,
"src": "209:3:0",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 17,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "209:10:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"id": 18,
"name": "owner",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3,
"src": "223:5:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"src": "209:19:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": null,
"id": 21,
"nodeType": "IfStatement",
"src": "205:26:0",
"trueBody": {
"id": 20,
"nodeType": "PlaceholderStatement",
"src": "230:1:0"
}
}
]
},
"documentation": null,
"id": 23,
"name": "restricted",
"nodeType": "ModifierDefinition",
"parameters": {
"id": 15,
"nodeType": "ParameterList",
"parameters": [],
"src": "196:2:0"
},
"src": "177:59:0",
"visibility": "internal"
},
{
"body": {
"id": 34,
"nodeType": "Block",
"src": "296:47:0",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 32,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 30,
"name": "last_completed_migration",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5,
"src": "302:24:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"id": 31,
"name": "completed",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 25,
"src": "329:9:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "302:36:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 33,
"nodeType": "ExpressionStatement",
"src": "302:36:0"
}
]
},
"documentation": null,
"id": 35,
"implemented": true,
"isConstructor": false,
"isDeclaredConst": false,
"modifiers": [
{
"arguments": null,
"id": 28,
"modifierName": {
"argumentTypes": null,
"id": 27,
"name": "restricted",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 23,
"src": "285:10:0",
"typeDescriptions": {
"typeIdentifier": "t_modifier$__$",
"typeString": "modifier ()"
}
},
"nodeType": "ModifierInvocation",
"src": "285:10:0"
}
],
"name": "setCompleted",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 26,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 25,
"name": "completed",
"nodeType": "VariableDeclaration",
"scope": 35,
"src": "262:14:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 24,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "262:4:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "261:16:0"
},
"payable": false,
"returnParameters": {
"id": 29,
"nodeType": "ParameterList",
"parameters": [],
"src": "296:0:0"
},
"scope": 36,
"src": "240:103:0",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
}
],
"scope": 37,
"src": "34:311:0"
}
],
"src": "0:346:0"
},
"compiler": {
"name": "solc",
"version": "0.4.25+commit.59dbf8f1.Emscripten.clang"
},
"networks": {},
"schemaVersion": "2.0.2",
"updatedAt": "2020-03-23T08:11:45.049Z"
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,18 @@
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;
}
}

View File

@@ -0,0 +1,64 @@
pragma solidity 0.4.25;
contract TodoFeed {
event TodoCompleted (uint256 indexed todoId, address owner, string title, bytes photo, uint256 timestamp);
event TodoVerified (uint256 indexed todoId, address verifier);
TodoData[] public todoList;
mapping(uint256 => TodoData) public todoMap;
struct TodoData {
uint256 todoId; // Unique token id
address owner;
string title;
bytes photo; // Image source encoded in uint 8 array format
uint256 timestamp; // Uploaded time
bool isVerified; // check if is verified, default false.
address verifier; // verifier address
}
function writeTodo(string title, bytes photo) public {
uint256 todoId = todoList.length + 1;
TodoData memory newData = TodoData({
todoId : todoId,
owner : msg.sender,
title : title,
photo : photo,
timestamp : now,
isVerified: false,
verifier: address(0)
});
todoList.push(newData);
todoMap[todoId] = newData;
emit TodoCompleted(todoId, msg.sender, title, photo, now);
}
function verifyTodo(uint256 todoId) {
todoMap[todoId].isVerified = true;
todoMap[todoId].verifier = msg.sender;
emit TodoVerified(todoId, msg.sender);
}
function getTotalTodoCount () public view returns (uint) {
return todoList.length;
}
function getTodo (uint todoId) public view
returns(uint256, address, string, bytes, uint256, bool, address) {
require(todoMap[todoId].todoId != 0, "Todo does not exist");
return (
todoMap[todoId].todoId,
todoMap[todoId].owner,
todoMap[todoId].title,
todoMap[todoId].photo,
todoMap[todoId].timestamp,
todoMap[todoId].isVerified,
todoMap[todoId].verifier);
}
}

View File

@@ -0,0 +1 @@
[{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"todoList","outputs":[{"name":"todoId","type":"uint256"},{"name":"owner","type":"address"},{"name":"title","type":"string"},{"name":"photo","type":"bytes"},{"name":"timestamp","type":"uint256"},{"name":"isVerified","type":"bool"},{"name":"verifier","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"todoMap","outputs":[{"name":"todoId","type":"uint256"},{"name":"owner","type":"address"},{"name":"title","type":"string"},{"name":"photo","type":"bytes"},{"name":"timestamp","type":"uint256"},{"name":"isVerified","type":"bool"},{"name":"verifier","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"todoId","type":"uint256"},{"indexed":false,"name":"owner","type":"address"},{"indexed":false,"name":"title","type":"string"},{"indexed":false,"name":"photo","type":"bytes"},{"indexed":false,"name":"timestamp","type":"uint256"}],"name":"TodoCompleted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"todoId","type":"uint256"},{"indexed":false,"name":"verifier","type":"address"}],"name":"TodoVerified","type":"event"},{"constant":false,"inputs":[{"name":"title","type":"string"},{"name":"photo","type":"bytes"}],"name":"writeTodo","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"todoId","type":"uint256"}],"name":"verifyTodo","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getTotalTodoCount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"todoId","type":"uint256"}],"name":"getTodo","outputs":[{"name":"","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"string"},{"name":"","type":"bytes"},{"name":"","type":"uint256"},{"name":"","type":"bool"},{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"}]

View File

@@ -0,0 +1 @@
0xa47898be53fba0fecdb9b4e1dadea5bf0f3c77f7

View File

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

View File

@@ -0,0 +1,24 @@
const TodoFeed = artifacts.require('./TodoFeed.sol')
const fs = require('fs')
module.exports = function (deployer) {
deployer.deploy(TodoFeed)
.then(() => {
if (TodoFeed._json) {
fs.writeFile(
'deployedABI',
JSON.stringify(TodoFeed._json.abi, 2),
(err) => {
if (err) throw err
console.log(`The abi of ${TodoFeed._json.contractName} is recorded on deployedABI file`)
})
}
fs.writeFile(
'deployedAddress',
TodoFeed.address,
(err) => {
if (err) throw err
console.log(`The deployed contract address * ${TodoFeed.address} * is recorded on deployedAddress file`)
})
})
}

2789
todofeed/backend-todofeed/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,112 @@
/**
* 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 accounts
* 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();
const HDWalletProvider = require("truffle-hdwallet-provider-klaytn");
const NETWORK_ID = '1001'
const URL = 'https://api.baobab.klaytn.net:8651' // testnet
const PRIVATE_KEY = '0x64f34d1d035e8e329a8633764616d267b61ceb91dfd72dea594da53ae108eca8' //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: {
klaytn: {
provider: () => new HDWalletProvider(PRIVATE_KEY, URL),
network_id: NETWORK_ID,
gas: '8500000',
gasPrice: null,
},
// 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)
// },
// 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/v3/YOUR-PROJECT-ID`),
// 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"
// }
}
}
}

Submodule todofeed/frontend-todofeed added at 56352fc7d3