BAEL-1461
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
# Using Truffle
|
||||
|
||||
Basic Truffle walkthrough readme.
|
||||
|
||||
See also: http://truffleframework.com/docs/
|
||||
|
||||
# Bash
|
||||
|
||||
Truffle install
|
||||
|
||||
```bash
|
||||
$ npm install truffle -g
|
||||
$ truffle version
|
||||
```
|
||||
|
||||
Truffle commands:
|
||||
|
||||
```bash
|
||||
$ truffle init
|
||||
$ truffle compile
|
||||
$ truffle migrate
|
||||
$ truffle test
|
||||
```
|
||||
|
||||
# Directory Structure
|
||||
|
||||
The command `$ truffle init` will create a directory structure in the specified root according to the following:
|
||||
|
||||
```
|
||||
root -|
|
||||
|-build (Compiled Solc JSON Output Dir)
|
||||
|-contracts (Solc Contracts to be Compiled and Migrated)
|
||||
|-migrations (Specify the Order and Dependencies of Contracts to Be Deployed)
|
||||
|-test (Truffle Tests)
|
||||
```
|
||||
|
||||
# Compile
|
||||
|
||||
Truffle will compile the smart contracts and expose their **JSON ABI's for use with Web3.js** or **Binary ABI's for use with Web3J**.
|
||||
|
||||
# Migration
|
||||
|
||||
Truffle will let you deploy your Solc contracts directly to a blockchin of your choice.
|
||||
@@ -0,0 +1,455 @@
|
||||
{
|
||||
"contractName": "ConvertLib",
|
||||
"abi": [
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "amount",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"name": "conversionRate",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "convert",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "convertedAmount",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
}
|
||||
],
|
||||
"bytecode": "0x60d161002f600b82828239805160001a6073146000811461001f57610021565bfe5b5030600052607381538281f30073000000000000000000000000000000000000000030146060604052600436106056576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806396e4ee3d14605b575b600080fd5b8115606557600080fd5b608260048080359060200190919080359060200190919050506098565b6040518082815260200191505060405180910390f35b60008183029050929150505600a165627a7a72305820ab84b2740847d7b84a33de9738ae9cf9aabac1b68e6a64d60bd5020b9b6235e40029",
|
||||
"deployedBytecode": "0x73000000000000000000000000000000000000000030146060604052600436106056576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806396e4ee3d14605b575b600080fd5b8115606557600080fd5b608260048080359060200190919080359060200190919050506098565b6040518082815260200191505060405180910390f35b60008183029050929150505600a165627a7a72305820ab84b2740847d7b84a33de9738ae9cf9aabac1b68e6a64d60bd5020b9b6235e40029",
|
||||
"sourceMap": "28:148:0:-;;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": "28:148:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;50:123;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;109:20;154:14;145:6;:23;138:30;;50:123;;;;:::o",
|
||||
"source": "pragma solidity ^0.4.17;\r\n\r\nlibrary ConvertLib{\r\n\tfunction convert(uint amount,uint conversionRate) returns (uint convertedAmount)\r\n\t{\r\n\t\treturn amount * conversionRate;\r\n\t}\r\n}\r\n",
|
||||
"sourcePath": "C:\\workspace\\current_workspace\\web3java\\dev_truffle\\contracts\\ConvertLib.sol",
|
||||
"ast": {
|
||||
"absolutePath": "/C/workspace/current_workspace/web3java/dev_truffle/contracts/ConvertLib.sol",
|
||||
"exportedSymbols": {
|
||||
"ConvertLib": [
|
||||
16
|
||||
]
|
||||
},
|
||||
"id": 17,
|
||||
"nodeType": "SourceUnit",
|
||||
"nodes": [
|
||||
{
|
||||
"id": 1,
|
||||
"literals": [
|
||||
"solidity",
|
||||
"^",
|
||||
"0.4",
|
||||
".17"
|
||||
],
|
||||
"nodeType": "PragmaDirective",
|
||||
"src": "0:24:0"
|
||||
},
|
||||
{
|
||||
"baseContracts": [],
|
||||
"contractDependencies": [],
|
||||
"contractKind": "library",
|
||||
"documentation": null,
|
||||
"fullyImplemented": true,
|
||||
"id": 16,
|
||||
"linearizedBaseContracts": [
|
||||
16
|
||||
],
|
||||
"name": "ConvertLib",
|
||||
"nodeType": "ContractDefinition",
|
||||
"nodes": [
|
||||
{
|
||||
"body": {
|
||||
"id": 14,
|
||||
"nodeType": "Block",
|
||||
"src": "133:40:0",
|
||||
"statements": [
|
||||
{
|
||||
"expression": {
|
||||
"argumentTypes": null,
|
||||
"commonType": {
|
||||
"typeIdentifier": "t_uint256",
|
||||
"typeString": "uint256"
|
||||
},
|
||||
"id": 12,
|
||||
"isConstant": false,
|
||||
"isLValue": false,
|
||||
"isPure": false,
|
||||
"lValueRequested": false,
|
||||
"leftExpression": {
|
||||
"argumentTypes": null,
|
||||
"id": 10,
|
||||
"name": "amount",
|
||||
"nodeType": "Identifier",
|
||||
"overloadedDeclarations": [],
|
||||
"referencedDeclaration": 3,
|
||||
"src": "145:6:0",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_uint256",
|
||||
"typeString": "uint256"
|
||||
}
|
||||
},
|
||||
"nodeType": "BinaryOperation",
|
||||
"operator": "*",
|
||||
"rightExpression": {
|
||||
"argumentTypes": null,
|
||||
"id": 11,
|
||||
"name": "conversionRate",
|
||||
"nodeType": "Identifier",
|
||||
"overloadedDeclarations": [],
|
||||
"referencedDeclaration": 5,
|
||||
"src": "154:14:0",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_uint256",
|
||||
"typeString": "uint256"
|
||||
}
|
||||
},
|
||||
"src": "145:23:0",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_uint256",
|
||||
"typeString": "uint256"
|
||||
}
|
||||
},
|
||||
"functionReturnParameters": 9,
|
||||
"id": 13,
|
||||
"nodeType": "Return",
|
||||
"src": "138:30:0"
|
||||
}
|
||||
]
|
||||
},
|
||||
"documentation": null,
|
||||
"id": 15,
|
||||
"implemented": true,
|
||||
"isConstructor": false,
|
||||
"isDeclaredConst": false,
|
||||
"modifiers": [],
|
||||
"name": "convert",
|
||||
"nodeType": "FunctionDefinition",
|
||||
"parameters": {
|
||||
"id": 6,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [
|
||||
{
|
||||
"constant": false,
|
||||
"id": 3,
|
||||
"name": "amount",
|
||||
"nodeType": "VariableDeclaration",
|
||||
"scope": 15,
|
||||
"src": "67:11:0",
|
||||
"stateVariable": false,
|
||||
"storageLocation": "default",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_uint256",
|
||||
"typeString": "uint256"
|
||||
},
|
||||
"typeName": {
|
||||
"id": 2,
|
||||
"name": "uint",
|
||||
"nodeType": "ElementaryTypeName",
|
||||
"src": "67:4:0",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_uint256",
|
||||
"typeString": "uint256"
|
||||
}
|
||||
},
|
||||
"value": null,
|
||||
"visibility": "internal"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"id": 5,
|
||||
"name": "conversionRate",
|
||||
"nodeType": "VariableDeclaration",
|
||||
"scope": 15,
|
||||
"src": "79:19:0",
|
||||
"stateVariable": false,
|
||||
"storageLocation": "default",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_uint256",
|
||||
"typeString": "uint256"
|
||||
},
|
||||
"typeName": {
|
||||
"id": 4,
|
||||
"name": "uint",
|
||||
"nodeType": "ElementaryTypeName",
|
||||
"src": "79:4:0",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_uint256",
|
||||
"typeString": "uint256"
|
||||
}
|
||||
},
|
||||
"value": null,
|
||||
"visibility": "internal"
|
||||
}
|
||||
],
|
||||
"src": "66:33:0"
|
||||
},
|
||||
"payable": false,
|
||||
"returnParameters": {
|
||||
"id": 9,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [
|
||||
{
|
||||
"constant": false,
|
||||
"id": 8,
|
||||
"name": "convertedAmount",
|
||||
"nodeType": "VariableDeclaration",
|
||||
"scope": 15,
|
||||
"src": "109:20:0",
|
||||
"stateVariable": false,
|
||||
"storageLocation": "default",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_uint256",
|
||||
"typeString": "uint256"
|
||||
},
|
||||
"typeName": {
|
||||
"id": 7,
|
||||
"name": "uint",
|
||||
"nodeType": "ElementaryTypeName",
|
||||
"src": "109:4:0",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_uint256",
|
||||
"typeString": "uint256"
|
||||
}
|
||||
},
|
||||
"value": null,
|
||||
"visibility": "internal"
|
||||
}
|
||||
],
|
||||
"src": "108:22:0"
|
||||
},
|
||||
"scope": 16,
|
||||
"src": "50:123:0",
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
}
|
||||
],
|
||||
"scope": 17,
|
||||
"src": "28:148:0"
|
||||
}
|
||||
],
|
||||
"src": "0:178:0"
|
||||
},
|
||||
"legacyAST": {
|
||||
"absolutePath": "/C/workspace/current_workspace/web3java/dev_truffle/contracts/ConvertLib.sol",
|
||||
"exportedSymbols": {
|
||||
"ConvertLib": [
|
||||
16
|
||||
]
|
||||
},
|
||||
"id": 17,
|
||||
"nodeType": "SourceUnit",
|
||||
"nodes": [
|
||||
{
|
||||
"id": 1,
|
||||
"literals": [
|
||||
"solidity",
|
||||
"^",
|
||||
"0.4",
|
||||
".17"
|
||||
],
|
||||
"nodeType": "PragmaDirective",
|
||||
"src": "0:24:0"
|
||||
},
|
||||
{
|
||||
"baseContracts": [],
|
||||
"contractDependencies": [],
|
||||
"contractKind": "library",
|
||||
"documentation": null,
|
||||
"fullyImplemented": true,
|
||||
"id": 16,
|
||||
"linearizedBaseContracts": [
|
||||
16
|
||||
],
|
||||
"name": "ConvertLib",
|
||||
"nodeType": "ContractDefinition",
|
||||
"nodes": [
|
||||
{
|
||||
"body": {
|
||||
"id": 14,
|
||||
"nodeType": "Block",
|
||||
"src": "133:40:0",
|
||||
"statements": [
|
||||
{
|
||||
"expression": {
|
||||
"argumentTypes": null,
|
||||
"commonType": {
|
||||
"typeIdentifier": "t_uint256",
|
||||
"typeString": "uint256"
|
||||
},
|
||||
"id": 12,
|
||||
"isConstant": false,
|
||||
"isLValue": false,
|
||||
"isPure": false,
|
||||
"lValueRequested": false,
|
||||
"leftExpression": {
|
||||
"argumentTypes": null,
|
||||
"id": 10,
|
||||
"name": "amount",
|
||||
"nodeType": "Identifier",
|
||||
"overloadedDeclarations": [],
|
||||
"referencedDeclaration": 3,
|
||||
"src": "145:6:0",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_uint256",
|
||||
"typeString": "uint256"
|
||||
}
|
||||
},
|
||||
"nodeType": "BinaryOperation",
|
||||
"operator": "*",
|
||||
"rightExpression": {
|
||||
"argumentTypes": null,
|
||||
"id": 11,
|
||||
"name": "conversionRate",
|
||||
"nodeType": "Identifier",
|
||||
"overloadedDeclarations": [],
|
||||
"referencedDeclaration": 5,
|
||||
"src": "154:14:0",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_uint256",
|
||||
"typeString": "uint256"
|
||||
}
|
||||
},
|
||||
"src": "145:23:0",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_uint256",
|
||||
"typeString": "uint256"
|
||||
}
|
||||
},
|
||||
"functionReturnParameters": 9,
|
||||
"id": 13,
|
||||
"nodeType": "Return",
|
||||
"src": "138:30:0"
|
||||
}
|
||||
]
|
||||
},
|
||||
"documentation": null,
|
||||
"id": 15,
|
||||
"implemented": true,
|
||||
"isConstructor": false,
|
||||
"isDeclaredConst": false,
|
||||
"modifiers": [],
|
||||
"name": "convert",
|
||||
"nodeType": "FunctionDefinition",
|
||||
"parameters": {
|
||||
"id": 6,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [
|
||||
{
|
||||
"constant": false,
|
||||
"id": 3,
|
||||
"name": "amount",
|
||||
"nodeType": "VariableDeclaration",
|
||||
"scope": 15,
|
||||
"src": "67:11:0",
|
||||
"stateVariable": false,
|
||||
"storageLocation": "default",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_uint256",
|
||||
"typeString": "uint256"
|
||||
},
|
||||
"typeName": {
|
||||
"id": 2,
|
||||
"name": "uint",
|
||||
"nodeType": "ElementaryTypeName",
|
||||
"src": "67:4:0",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_uint256",
|
||||
"typeString": "uint256"
|
||||
}
|
||||
},
|
||||
"value": null,
|
||||
"visibility": "internal"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"id": 5,
|
||||
"name": "conversionRate",
|
||||
"nodeType": "VariableDeclaration",
|
||||
"scope": 15,
|
||||
"src": "79:19:0",
|
||||
"stateVariable": false,
|
||||
"storageLocation": "default",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_uint256",
|
||||
"typeString": "uint256"
|
||||
},
|
||||
"typeName": {
|
||||
"id": 4,
|
||||
"name": "uint",
|
||||
"nodeType": "ElementaryTypeName",
|
||||
"src": "79:4:0",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_uint256",
|
||||
"typeString": "uint256"
|
||||
}
|
||||
},
|
||||
"value": null,
|
||||
"visibility": "internal"
|
||||
}
|
||||
],
|
||||
"src": "66:33:0"
|
||||
},
|
||||
"payable": false,
|
||||
"returnParameters": {
|
||||
"id": 9,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [
|
||||
{
|
||||
"constant": false,
|
||||
"id": 8,
|
||||
"name": "convertedAmount",
|
||||
"nodeType": "VariableDeclaration",
|
||||
"scope": 15,
|
||||
"src": "109:20:0",
|
||||
"stateVariable": false,
|
||||
"storageLocation": "default",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_uint256",
|
||||
"typeString": "uint256"
|
||||
},
|
||||
"typeName": {
|
||||
"id": 7,
|
||||
"name": "uint",
|
||||
"nodeType": "ElementaryTypeName",
|
||||
"src": "109:4:0",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_uint256",
|
||||
"typeString": "uint256"
|
||||
}
|
||||
},
|
||||
"value": null,
|
||||
"visibility": "internal"
|
||||
}
|
||||
],
|
||||
"src": "108:22:0"
|
||||
},
|
||||
"scope": 16,
|
||||
"src": "50:123:0",
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
}
|
||||
],
|
||||
"scope": 17,
|
||||
"src": "28:148:0"
|
||||
}
|
||||
],
|
||||
"src": "0:178:0"
|
||||
},
|
||||
"compiler": {
|
||||
"name": "solc",
|
||||
"version": "0.4.21+commit.dfe3193c.Emscripten.clang"
|
||||
},
|
||||
"networks": {},
|
||||
"schemaVersion": "2.0.0",
|
||||
"updatedAt": "2018-04-14T03:37:39.678Z"
|
||||
}
|
||||
@@ -0,0 +1,251 @@
|
||||
{
|
||||
"contractName": "Example",
|
||||
"abi": [
|
||||
{
|
||||
"inputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "constructor"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [],
|
||||
"name": "ExampleFunction",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
}
|
||||
],
|
||||
"bytecode": "0x60606040523415600e57600080fd5b60848061001c6000396000f300606060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063b818dacd146044575b600080fd5b3415604e57600080fd5b60546056565b005b5600a165627a7a72305820bebcbbdf06550591bc772dfcb0eadc842f95953869feb7a9528bac91487d95240029",
|
||||
"deployedBytecode": "0x606060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063b818dacd146044575b600080fd5b3415604e57600080fd5b60546056565b005b5600a165627a7a72305820bebcbbdf06550591bc772dfcb0eadc842f95953869feb7a9528bac91487d95240029",
|
||||
"sourceMap": "28:134:1:-;;;50:45;;;;;;;;28:134;;;;;;",
|
||||
"deployedSourceMap": "28:134:1:-;;;;;;;;;;;;;;;;;;;;;;;;101:58;;;;;;;;;;;;;;;:::o",
|
||||
"source": "pragma solidity ^0.4.17;\r\n\r\ncontract Example {\r\n function Example() {\r\n // constructor\r\n }\r\n\r\n function ExampleFunction() {\r\n // example function\r\n }\r\n}",
|
||||
"sourcePath": "C:\\workspace\\current_workspace\\web3java\\dev_truffle\\contracts\\Example.sol",
|
||||
"ast": {
|
||||
"absolutePath": "/C/workspace/current_workspace/web3java/dev_truffle/contracts/Example.sol",
|
||||
"exportedSymbols": {
|
||||
"Example": [
|
||||
27
|
||||
]
|
||||
},
|
||||
"id": 28,
|
||||
"nodeType": "SourceUnit",
|
||||
"nodes": [
|
||||
{
|
||||
"id": 18,
|
||||
"literals": [
|
||||
"solidity",
|
||||
"^",
|
||||
"0.4",
|
||||
".17"
|
||||
],
|
||||
"nodeType": "PragmaDirective",
|
||||
"src": "0:24:1"
|
||||
},
|
||||
{
|
||||
"baseContracts": [],
|
||||
"contractDependencies": [],
|
||||
"contractKind": "contract",
|
||||
"documentation": null,
|
||||
"fullyImplemented": true,
|
||||
"id": 27,
|
||||
"linearizedBaseContracts": [
|
||||
27
|
||||
],
|
||||
"name": "Example",
|
||||
"nodeType": "ContractDefinition",
|
||||
"nodes": [
|
||||
{
|
||||
"body": {
|
||||
"id": 21,
|
||||
"nodeType": "Block",
|
||||
"src": "69:26:1",
|
||||
"statements": []
|
||||
},
|
||||
"documentation": null,
|
||||
"id": 22,
|
||||
"implemented": true,
|
||||
"isConstructor": true,
|
||||
"isDeclaredConst": false,
|
||||
"modifiers": [],
|
||||
"name": "Example",
|
||||
"nodeType": "FunctionDefinition",
|
||||
"parameters": {
|
||||
"id": 19,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [],
|
||||
"src": "66:2:1"
|
||||
},
|
||||
"payable": false,
|
||||
"returnParameters": {
|
||||
"id": 20,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [],
|
||||
"src": "69:0:1"
|
||||
},
|
||||
"scope": 27,
|
||||
"src": "50:45:1",
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
},
|
||||
{
|
||||
"body": {
|
||||
"id": 25,
|
||||
"nodeType": "Block",
|
||||
"src": "128:31:1",
|
||||
"statements": []
|
||||
},
|
||||
"documentation": null,
|
||||
"id": 26,
|
||||
"implemented": true,
|
||||
"isConstructor": false,
|
||||
"isDeclaredConst": false,
|
||||
"modifiers": [],
|
||||
"name": "ExampleFunction",
|
||||
"nodeType": "FunctionDefinition",
|
||||
"parameters": {
|
||||
"id": 23,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [],
|
||||
"src": "125:2:1"
|
||||
},
|
||||
"payable": false,
|
||||
"returnParameters": {
|
||||
"id": 24,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [],
|
||||
"src": "128:0:1"
|
||||
},
|
||||
"scope": 27,
|
||||
"src": "101:58:1",
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
}
|
||||
],
|
||||
"scope": 28,
|
||||
"src": "28:134:1"
|
||||
}
|
||||
],
|
||||
"src": "0:162:1"
|
||||
},
|
||||
"legacyAST": {
|
||||
"absolutePath": "/C/workspace/current_workspace/web3java/dev_truffle/contracts/Example.sol",
|
||||
"exportedSymbols": {
|
||||
"Example": [
|
||||
27
|
||||
]
|
||||
},
|
||||
"id": 28,
|
||||
"nodeType": "SourceUnit",
|
||||
"nodes": [
|
||||
{
|
||||
"id": 18,
|
||||
"literals": [
|
||||
"solidity",
|
||||
"^",
|
||||
"0.4",
|
||||
".17"
|
||||
],
|
||||
"nodeType": "PragmaDirective",
|
||||
"src": "0:24:1"
|
||||
},
|
||||
{
|
||||
"baseContracts": [],
|
||||
"contractDependencies": [],
|
||||
"contractKind": "contract",
|
||||
"documentation": null,
|
||||
"fullyImplemented": true,
|
||||
"id": 27,
|
||||
"linearizedBaseContracts": [
|
||||
27
|
||||
],
|
||||
"name": "Example",
|
||||
"nodeType": "ContractDefinition",
|
||||
"nodes": [
|
||||
{
|
||||
"body": {
|
||||
"id": 21,
|
||||
"nodeType": "Block",
|
||||
"src": "69:26:1",
|
||||
"statements": []
|
||||
},
|
||||
"documentation": null,
|
||||
"id": 22,
|
||||
"implemented": true,
|
||||
"isConstructor": true,
|
||||
"isDeclaredConst": false,
|
||||
"modifiers": [],
|
||||
"name": "Example",
|
||||
"nodeType": "FunctionDefinition",
|
||||
"parameters": {
|
||||
"id": 19,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [],
|
||||
"src": "66:2:1"
|
||||
},
|
||||
"payable": false,
|
||||
"returnParameters": {
|
||||
"id": 20,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [],
|
||||
"src": "69:0:1"
|
||||
},
|
||||
"scope": 27,
|
||||
"src": "50:45:1",
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
},
|
||||
{
|
||||
"body": {
|
||||
"id": 25,
|
||||
"nodeType": "Block",
|
||||
"src": "128:31:1",
|
||||
"statements": []
|
||||
},
|
||||
"documentation": null,
|
||||
"id": 26,
|
||||
"implemented": true,
|
||||
"isConstructor": false,
|
||||
"isDeclaredConst": false,
|
||||
"modifiers": [],
|
||||
"name": "ExampleFunction",
|
||||
"nodeType": "FunctionDefinition",
|
||||
"parameters": {
|
||||
"id": 23,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [],
|
||||
"src": "125:2:1"
|
||||
},
|
||||
"payable": false,
|
||||
"returnParameters": {
|
||||
"id": 24,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [],
|
||||
"src": "128:0:1"
|
||||
},
|
||||
"scope": 27,
|
||||
"src": "101:58:1",
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
}
|
||||
],
|
||||
"scope": 28,
|
||||
"src": "28:134:1"
|
||||
}
|
||||
],
|
||||
"src": "0:162:1"
|
||||
},
|
||||
"compiler": {
|
||||
"name": "solc",
|
||||
"version": "0.4.21+commit.dfe3193c.Emscripten.clang"
|
||||
},
|
||||
"networks": {},
|
||||
"schemaVersion": "2.0.0",
|
||||
"updatedAt": "2018-04-14T03:37:39.710Z"
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,8 @@
|
||||
pragma solidity ^0.4.17;
|
||||
|
||||
library ConvertLib{
|
||||
function convert(uint amount,uint conversionRate) returns (uint convertedAmount)
|
||||
{
|
||||
return amount * conversionRate;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
pragma solidity ^0.4.17;
|
||||
|
||||
contract Example {
|
||||
function Example() {
|
||||
// constructor
|
||||
}
|
||||
|
||||
function ExampleFunction() {
|
||||
// example function
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
pragma solidity ^0.4.17;
|
||||
|
||||
contract Migrations {
|
||||
address public owner;
|
||||
uint public last_completed_migration;
|
||||
|
||||
modifier restricted() {
|
||||
if (msg.sender == owner) _;
|
||||
}
|
||||
|
||||
function Migrations() public {
|
||||
owner = msg.sender;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
module.exports = deployer => {
|
||||
deployer.deploy(artifacts.require("./Migrations.sol"));
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
const Example = artifacts.require("./Example.sol"),
|
||||
ConvertLib = artifacts.require("./ConvertLib.sol");
|
||||
|
||||
module.exports = deployer => {
|
||||
deployer.deploy(ConvertLib);
|
||||
deployer.link(ConvertLib, Example);
|
||||
deployer.deploy(Example);
|
||||
};
|
||||
@@ -0,0 +1,20 @@
|
||||
module.exports = {
|
||||
contracts_build_directory: "./build/contracts",
|
||||
networks: {
|
||||
live: {
|
||||
network_id: 1, // Ethereum public network
|
||||
host: 'localhost',
|
||||
port: 8545
|
||||
},
|
||||
testnet: {
|
||||
network_id: 3, // Official Ethereum test network (Ropsten)
|
||||
host: 'localhost',
|
||||
port: 8545
|
||||
},
|
||||
development: {
|
||||
host: 'localhost',
|
||||
port: 8545,
|
||||
network_id: '*'
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user