This commit is contained in:
Roman Storm 2017-11-09 18:16:40 -08:00
commit 6b1173b442
19 changed files with 15536 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
node_modules

28
.travis.yml Normal file
View File

@ -0,0 +1,28 @@
dist: trusty
sudo: required
group: beta
language: node_js
node_js:
- "8"
cache:
yarn: true
env:
-
- SOLIDITY_COVERAGE=true
matrix:
fast_finish: true
allow_failures:
- env: SOLIDITY_COVERAGE=true
script:
- yarn test
deploy:
provider: pages
local_dir: mochawesome-report
target_branch: gh-pages
email: travis@ci.com
name: Deployment Bot
skip_cleanup: true
github_token: $GITHUB_TOKEN # Set in travis-ci.org dashboard
on:
branch: master

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,474 @@
{
"contractName": "ERC20Basic",
"abi": [
{
"constant": true,
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "who",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "to",
"type": "address"
},
{
"name": "value",
"type": "uint256"
}
],
"name": "transfer",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "from",
"type": "address"
},
{
"indexed": true,
"name": "to",
"type": "address"
},
{
"indexed": false,
"name": "value",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
}
],
"bytecode": "0x",
"deployedBytecode": "0x",
"sourceMap": "",
"deployedSourceMap": "",
"source": "pragma solidity ^0.4.11;\n\n\n/**\n * @title ERC20Basic\n * @dev Simpler version of ERC20 interface\n * @dev see https://github.com/ethereum/EIPs/issues/179\n */\ncontract ERC20Basic {\n uint256 public totalSupply;\n function balanceOf(address who) public constant returns (uint256);\n function transfer(address to, uint256 value) public returns (bool);\n event Transfer(address indexed from, address indexed to, uint256 value);\n}\n",
"sourcePath": "zeppelin-solidity/contracts/token/ERC20Basic.sol",
"ast": {
"attributes": {
"absolutePath": "zeppelin-solidity/contracts/token/ERC20Basic.sol",
"exportedSymbols": {
"ERC20Basic": [
594
]
}
},
"children": [
{
"attributes": {
"literals": [
"solidity",
"^",
"0.4",
".11"
]
},
"id": 567,
"name": "PragmaDirective",
"src": "0:24:4"
},
{
"attributes": {
"baseContracts": [
null
],
"contractDependencies": [
null
],
"contractKind": "contract",
"documentation": "@title ERC20Basic\n@dev Simpler version of ERC20 interface\n@dev see https://github.com/ethereum/EIPs/issues/179",
"fullyImplemented": false,
"linearizedBaseContracts": [
594
],
"name": "ERC20Basic",
"scope": 595
},
"children": [
{
"attributes": {
"constant": false,
"name": "totalSupply",
"scope": 594,
"stateVariable": true,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "public"
},
"children": [
{
"attributes": {
"name": "uint256",
"type": "uint256"
},
"id": 568,
"name": "ElementaryTypeName",
"src": "179:7:4"
}
],
"id": 569,
"name": "VariableDeclaration",
"src": "179:26:4"
},
{
"attributes": {
"body": null,
"constant": true,
"implemented": false,
"isConstructor": false,
"modifiers": [
null
],
"name": "balanceOf",
"payable": false,
"scope": 594,
"stateMutability": "view",
"superFunction": null,
"visibility": "public"
},
"children": [
{
"children": [
{
"attributes": {
"constant": false,
"name": "who",
"scope": 576,
"stateVariable": false,
"storageLocation": "default",
"type": "address",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "address",
"type": "address"
},
"id": 570,
"name": "ElementaryTypeName",
"src": "228:7:4"
}
],
"id": 571,
"name": "VariableDeclaration",
"src": "228:11:4"
}
],
"id": 572,
"name": "ParameterList",
"src": "227:13:4"
},
{
"children": [
{
"attributes": {
"constant": false,
"name": "",
"scope": 576,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint256",
"type": "uint256"
},
"id": 573,
"name": "ElementaryTypeName",
"src": "266:7:4"
}
],
"id": 574,
"name": "VariableDeclaration",
"src": "266:7:4"
}
],
"id": 575,
"name": "ParameterList",
"src": "265:9:4"
}
],
"id": 576,
"name": "FunctionDefinition",
"src": "209:66:4"
},
{
"attributes": {
"body": null,
"constant": false,
"implemented": false,
"isConstructor": false,
"modifiers": [
null
],
"name": "transfer",
"payable": false,
"scope": 594,
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
"children": [
{
"children": [
{
"attributes": {
"constant": false,
"name": "to",
"scope": 585,
"stateVariable": false,
"storageLocation": "default",
"type": "address",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "address",
"type": "address"
},
"id": 577,
"name": "ElementaryTypeName",
"src": "296:7:4"
}
],
"id": 578,
"name": "VariableDeclaration",
"src": "296:10:4"
},
{
"attributes": {
"constant": false,
"name": "value",
"scope": 585,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint256",
"type": "uint256"
},
"id": 579,
"name": "ElementaryTypeName",
"src": "308:7:4"
}
],
"id": 580,
"name": "VariableDeclaration",
"src": "308:13:4"
}
],
"id": 581,
"name": "ParameterList",
"src": "295:27:4"
},
{
"children": [
{
"attributes": {
"constant": false,
"name": "",
"scope": 585,
"stateVariable": false,
"storageLocation": "default",
"type": "bool",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "bool",
"type": "bool"
},
"id": 582,
"name": "ElementaryTypeName",
"src": "339:4:4"
}
],
"id": 583,
"name": "VariableDeclaration",
"src": "339:4:4"
}
],
"id": 584,
"name": "ParameterList",
"src": "338:6:4"
}
],
"id": 585,
"name": "FunctionDefinition",
"src": "278:67:4"
},
{
"attributes": {
"anonymous": false,
"name": "Transfer"
},
"children": [
{
"children": [
{
"attributes": {
"constant": false,
"indexed": true,
"name": "from",
"scope": 593,
"stateVariable": false,
"storageLocation": "default",
"type": "address",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "address",
"type": "address"
},
"id": 586,
"name": "ElementaryTypeName",
"src": "363:7:4"
}
],
"id": 587,
"name": "VariableDeclaration",
"src": "363:20:4"
},
{
"attributes": {
"constant": false,
"indexed": true,
"name": "to",
"scope": 593,
"stateVariable": false,
"storageLocation": "default",
"type": "address",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "address",
"type": "address"
},
"id": 588,
"name": "ElementaryTypeName",
"src": "385:7:4"
}
],
"id": 589,
"name": "VariableDeclaration",
"src": "385:18:4"
},
{
"attributes": {
"constant": false,
"indexed": false,
"name": "value",
"scope": 593,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint256",
"type": "uint256"
},
"id": 590,
"name": "ElementaryTypeName",
"src": "405:7:4"
}
],
"id": 591,
"name": "VariableDeclaration",
"src": "405:13:4"
}
],
"id": 592,
"name": "ParameterList",
"src": "362:57:4"
}
],
"id": 593,
"name": "EventDefinition",
"src": "348:72:4"
}
],
"id": 594,
"name": "ContractDefinition",
"src": "155:267:4"
}
],
"id": 595,
"name": "SourceUnit",
"src": "0:423:4"
},
"compiler": {
"name": "solc",
"version": "0.4.18+commit.9cf6e910.Emscripten.clang"
},
"networks": {},
"schemaVersion": "1.0.1",
"updatedAt": "2017-11-10T02:14:36.625Z"
}

View File

@ -0,0 +1,827 @@
{
"contractName": "Migrations",
"abi": [
{
"constant": false,
"inputs": [
{
"name": "new_address",
"type": "address"
}
],
"name": "upgrade",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"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"
},
{
"constant": false,
"inputs": [
{
"name": "completed",
"type": "uint256"
}
],
"name": "setCompleted",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "constructor"
}
],
"bytecode": "0x6060604052341561000f57600080fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506102db8061005e6000396000f300606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100a05780638da5cb5b146100c9578063fdacd5761461011e575b600080fd5b341561007257600080fd5b61009e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610141565b005b34156100ab57600080fd5b6100b3610224565b6040518082815260200191505060405180910390f35b34156100d457600080fd5b6100dc61022a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561012957600080fd5b61013f600480803590602001909190505061024f565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610220578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b151561020b57600080fd5b6102c65a03f1151561021c57600080fd5b5050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102ac57806001819055505b505600a165627a7a723058200e88e6afa11a5d184f5f572f2a22c9ab2618d36ef3827f6d1a2ccad4e539d0590029",
"deployedBytecode": "0x606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100a05780638da5cb5b146100c9578063fdacd5761461011e575b600080fd5b341561007257600080fd5b61009e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610141565b005b34156100ab57600080fd5b6100b3610224565b6040518082815260200191505060405180910390f35b34156100d457600080fd5b6100dc61022a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561012957600080fd5b61013f600480803590602001909190505061024f565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610220578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b151561020b57600080fd5b6102c65a03f1151561021c57600080fd5b5050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102ac57806001819055505b505600a165627a7a723058200e88e6afa11a5d184f5f572f2a22c9ab2618d36ef3827f6d1a2ccad4e539d0590029",
"sourceMap": "26:488:0:-;;;178:58;;;;;;;;221:10;213:5;;:18;;;;;;;;;;;;;;;;;;26:488;;;;;;",
"deployedSourceMap": "26:488:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;347:165;;;;;;;;;;;;;;;;;;;;;;;;;;;;74:36;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;50:20;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;240:103;;;;;;;;;;;;;;;;;;;;;;;;;;347:165;409:19;161:5;;;;;;;;;;;147:19;;:10;:19;;;143:26;;;442:11;409:45;;460:8;:21;;;482:24;;460:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;143:26;347:165;;:::o;74:36::-;;;;:::o;50:20::-;;;;;;;;;;;;;:::o;240:103::-;161:5;;;;;;;;;;;147:19;;:10;:19;;;143:26;;;329:9;302:24;:36;;;;143:26;240:103;:::o",
"source": "pragma solidity ^0.4.17;\n\ncontract Migrations {\n address public owner;\n uint public last_completed_migration;\n\n modifier restricted() {\n if (msg.sender == owner) _;\n }\n\n function Migrations() public {\n owner = msg.sender;\n }\n\n function setCompleted(uint completed) public restricted {\n last_completed_migration = completed;\n }\n\n function upgrade(address new_address) public restricted {\n Migrations upgraded = Migrations(new_address);\n upgraded.setCompleted(last_completed_migration);\n }\n}\n",
"sourcePath": "/Users/rstorm/repos/presale-oracles/contracts/Migrations.sol",
"ast": {
"attributes": {
"absolutePath": "/Users/rstorm/repos/presale-oracles/contracts/Migrations.sol",
"exportedSymbols": {
"Migrations": [
56
]
}
},
"children": [
{
"attributes": {
"literals": [
"solidity",
"^",
"0.4",
".17"
]
},
"id": 1,
"name": "PragmaDirective",
"src": "0:24:0"
},
{
"attributes": {
"baseContracts": [
null
],
"contractDependencies": [
null
],
"contractKind": "contract",
"documentation": null,
"fullyImplemented": true,
"linearizedBaseContracts": [
56
],
"name": "Migrations",
"scope": 57
},
"children": [
{
"attributes": {
"constant": false,
"name": "owner",
"scope": 56,
"stateVariable": true,
"storageLocation": "default",
"type": "address",
"value": null,
"visibility": "public"
},
"children": [
{
"attributes": {
"name": "address",
"type": "address"
},
"id": 2,
"name": "ElementaryTypeName",
"src": "50:7:0"
}
],
"id": 3,
"name": "VariableDeclaration",
"src": "50:20:0"
},
{
"attributes": {
"constant": false,
"name": "last_completed_migration",
"scope": 56,
"stateVariable": true,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "public"
},
"children": [
{
"attributes": {
"name": "uint",
"type": "uint256"
},
"id": 4,
"name": "ElementaryTypeName",
"src": "74:4:0"
}
],
"id": 5,
"name": "VariableDeclaration",
"src": "74:36:0"
},
{
"attributes": {
"name": "restricted",
"visibility": "internal"
},
"children": [
{
"attributes": {
"parameters": [
null
]
},
"children": [],
"id": 6,
"name": "ParameterList",
"src": "134:2:0"
},
{
"children": [
{
"attributes": {
"falseBody": null
},
"children": [
{
"attributes": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"operator": "==",
"type": "bool"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"member_name": "sender",
"referencedDeclaration": null,
"type": "address"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 642,
"type": "msg",
"value": "msg"
},
"id": 7,
"name": "Identifier",
"src": "147:3:0"
}
],
"id": 8,
"name": "MemberAccess",
"src": "147:10:0"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 3,
"type": "address",
"value": "owner"
},
"id": 9,
"name": "Identifier",
"src": "161:5:0"
}
],
"id": 10,
"name": "BinaryOperation",
"src": "147:19:0"
},
{
"id": 11,
"name": "PlaceholderStatement",
"src": "168:1:0"
}
],
"id": 12,
"name": "IfStatement",
"src": "143:26:0"
}
],
"id": 13,
"name": "Block",
"src": "137:37:0"
}
],
"id": 14,
"name": "ModifierDefinition",
"src": "115:59:0"
},
{
"attributes": {
"constant": false,
"implemented": true,
"isConstructor": true,
"modifiers": [
null
],
"name": "Migrations",
"payable": false,
"scope": 56,
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
"children": [
{
"attributes": {
"parameters": [
null
]
},
"children": [],
"id": 15,
"name": "ParameterList",
"src": "197:2:0"
},
{
"attributes": {
"parameters": [
null
]
},
"children": [],
"id": 16,
"name": "ParameterList",
"src": "207:0:0"
},
{
"children": [
{
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"operator": "=",
"type": "address"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 3,
"type": "address",
"value": "owner"
},
"id": 17,
"name": "Identifier",
"src": "213:5:0"
},
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"member_name": "sender",
"referencedDeclaration": null,
"type": "address"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 642,
"type": "msg",
"value": "msg"
},
"id": 18,
"name": "Identifier",
"src": "221:3:0"
}
],
"id": 19,
"name": "MemberAccess",
"src": "221:10:0"
}
],
"id": 20,
"name": "Assignment",
"src": "213:18:0"
}
],
"id": 21,
"name": "ExpressionStatement",
"src": "213:18:0"
}
],
"id": 22,
"name": "Block",
"src": "207:29:0"
}
],
"id": 23,
"name": "FunctionDefinition",
"src": "178:58:0"
},
{
"attributes": {
"constant": false,
"implemented": true,
"isConstructor": false,
"name": "setCompleted",
"payable": false,
"scope": 56,
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
"children": [
{
"children": [
{
"attributes": {
"constant": false,
"name": "completed",
"scope": 35,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint",
"type": "uint256"
},
"id": 24,
"name": "ElementaryTypeName",
"src": "262:4:0"
}
],
"id": 25,
"name": "VariableDeclaration",
"src": "262:14:0"
}
],
"id": 26,
"name": "ParameterList",
"src": "261:16:0"
},
{
"attributes": {
"parameters": [
null
]
},
"children": [],
"id": 29,
"name": "ParameterList",
"src": "296:0:0"
},
{
"attributes": {
"arguments": [
null
]
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 14,
"type": "modifier ()",
"value": "restricted"
},
"id": 27,
"name": "Identifier",
"src": "285:10:0"
}
],
"id": 28,
"name": "ModifierInvocation",
"src": "285:10:0"
},
{
"children": [
{
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"operator": "=",
"type": "uint256"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 5,
"type": "uint256",
"value": "last_completed_migration"
},
"id": 30,
"name": "Identifier",
"src": "302:24:0"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 25,
"type": "uint256",
"value": "completed"
},
"id": 31,
"name": "Identifier",
"src": "329:9:0"
}
],
"id": 32,
"name": "Assignment",
"src": "302:36:0"
}
],
"id": 33,
"name": "ExpressionStatement",
"src": "302:36:0"
}
],
"id": 34,
"name": "Block",
"src": "296:47:0"
}
],
"id": 35,
"name": "FunctionDefinition",
"src": "240:103:0"
},
{
"attributes": {
"constant": false,
"implemented": true,
"isConstructor": false,
"name": "upgrade",
"payable": false,
"scope": 56,
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
"children": [
{
"children": [
{
"attributes": {
"constant": false,
"name": "new_address",
"scope": 55,
"stateVariable": false,
"storageLocation": "default",
"type": "address",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "address",
"type": "address"
},
"id": 36,
"name": "ElementaryTypeName",
"src": "364:7:0"
}
],
"id": 37,
"name": "VariableDeclaration",
"src": "364:19:0"
}
],
"id": 38,
"name": "ParameterList",
"src": "363:21:0"
},
{
"attributes": {
"parameters": [
null
]
},
"children": [],
"id": 41,
"name": "ParameterList",
"src": "403:0:0"
},
{
"attributes": {
"arguments": [
null
]
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 14,
"type": "modifier ()",
"value": "restricted"
},
"id": 39,
"name": "Identifier",
"src": "392:10:0"
}
],
"id": 40,
"name": "ModifierInvocation",
"src": "392:10:0"
},
{
"children": [
{
"attributes": {
"assignments": [
43
]
},
"children": [
{
"attributes": {
"constant": false,
"name": "upgraded",
"scope": 55,
"stateVariable": false,
"storageLocation": "default",
"type": "contract Migrations",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"contractScope": null,
"name": "Migrations",
"referencedDeclaration": 56,
"type": "contract Migrations"
},
"id": 42,
"name": "UserDefinedTypeName",
"src": "409:10:0"
}
],
"id": 43,
"name": "VariableDeclaration",
"src": "409:19:0"
},
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"isStructConstructorCall": false,
"lValueRequested": false,
"names": [
null
],
"type": "contract Migrations",
"type_conversion": true
},
"children": [
{
"attributes": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"overloadedDeclarations": [
null
],
"referencedDeclaration": 56,
"type": "type(contract Migrations)",
"value": "Migrations"
},
"id": 44,
"name": "Identifier",
"src": "431:10:0"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 37,
"type": "address",
"value": "new_address"
},
"id": 45,
"name": "Identifier",
"src": "442:11:0"
}
],
"id": 46,
"name": "FunctionCall",
"src": "431:23:0"
}
],
"id": 47,
"name": "VariableDeclarationStatement",
"src": "409:45:0"
},
{
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"isStructConstructorCall": false,
"lValueRequested": false,
"names": [
null
],
"type": "tuple()",
"type_conversion": false
},
"children": [
{
"attributes": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"member_name": "setCompleted",
"referencedDeclaration": 35,
"type": "function (uint256) external"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 43,
"type": "contract Migrations",
"value": "upgraded"
},
"id": 48,
"name": "Identifier",
"src": "460:8:0"
}
],
"id": 50,
"name": "MemberAccess",
"src": "460:21:0"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 5,
"type": "uint256",
"value": "last_completed_migration"
},
"id": 51,
"name": "Identifier",
"src": "482:24:0"
}
],
"id": 52,
"name": "FunctionCall",
"src": "460:47:0"
}
],
"id": 53,
"name": "ExpressionStatement",
"src": "460:47:0"
}
],
"id": 54,
"name": "Block",
"src": "403:109:0"
}
],
"id": 55,
"name": "FunctionDefinition",
"src": "347:165:0"
}
],
"id": 56,
"name": "ContractDefinition",
"src": "26:488:0"
}
],
"id": 57,
"name": "SourceUnit",
"src": "0:515:0"
},
"compiler": {
"name": "solc",
"version": "0.4.18+commit.9cf6e910.Emscripten.clang"
},
"networks": {
"321": {
"events": {},
"links": {},
"address": "0xc4c7497fbe1a886841a195a5d622cd60053c1376"
}
},
"schemaVersion": "1.0.1",
"updatedAt": "2017-11-10T02:14:36.866Z"
}

View File

@ -0,0 +1,841 @@
{
"contractName": "Ownable",
"abi": [
{
"constant": true,
"inputs": [],
"name": "owner",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
}
],
"bytecode": "0x6060604052341561000f57600080fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506102858061005e6000396000f30060606040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680638da5cb5b14610051578063f2fde38b146100a6575b600080fd5b341561005c57600080fd5b6100646100df565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156100b157600080fd5b6100dd600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610104565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561015f57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561019b57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505600a165627a7a7230582014dad562cecef1a4eb92770ceb2274c070c776ee00510869af5dd070d40bda9a0029",
"deployedBytecode": "0x60606040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680638da5cb5b14610051578063f2fde38b146100a6575b600080fd5b341561005c57600080fd5b6100646100df565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156100b157600080fd5b6100dd600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610104565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561015f57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561019b57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505600a165627a7a7230582014dad562cecef1a4eb92770ceb2274c070c776ee00510869af5dd070d40bda9a0029",
"sourceMap": "217:782:2:-;;;469:48;;;;;;;;502:10;494:5;;:18;;;;;;;;;;;;;;;;;;217:782;;;;;;",
"deployedSourceMap": "217:782:2:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;238:20;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;827:169;;;;;;;;;;;;;;;;;;;;;;;;;;;;238:20;;;;;;;;;;;;;:::o;827:169::-;647:5;;;;;;;;;;;633:19;;:10;:19;;;625:28;;;;;;;;923:1;903:22;;:8;:22;;;;895:31;;;;;;;;960:8;932:37;;953:5;;;;;;;;;;;932:37;;;;;;;;;;;;983:8;975:5;;:16;;;;;;;;;;;;;;;;;;827:169;:::o",
"source": "pragma solidity ^0.4.11;\n\n\n/**\n * @title Ownable\n * @dev The Ownable contract has an owner address, and provides basic authorization control\n * functions, this simplifies the implementation of \"user permissions\".\n */\ncontract Ownable {\n address public owner;\n\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n\n /**\n * @dev The Ownable constructor sets the original `owner` of the contract to the sender\n * account.\n */\n function Ownable() {\n owner = msg.sender;\n }\n\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(msg.sender == owner);\n _;\n }\n\n\n /**\n * @dev Allows the current owner to transfer control of the contract to a newOwner.\n * @param newOwner The address to transfer ownership to.\n */\n function transferOwnership(address newOwner) onlyOwner public {\n require(newOwner != address(0));\n OwnershipTransferred(owner, newOwner);\n owner = newOwner;\n }\n\n}\n",
"sourcePath": "zeppelin-solidity/contracts/ownership/Ownable.sol",
"ast": {
"attributes": {
"absolutePath": "zeppelin-solidity/contracts/ownership/Ownable.sol",
"exportedSymbols": {
"Ownable": [
488
]
}
},
"children": [
{
"attributes": {
"literals": [
"solidity",
"^",
"0.4",
".11"
]
},
"id": 434,
"name": "PragmaDirective",
"src": "0:24:2"
},
{
"attributes": {
"baseContracts": [
null
],
"contractDependencies": [
null
],
"contractKind": "contract",
"documentation": "@title Ownable\n@dev The Ownable contract has an owner address, and provides basic authorization control\nfunctions, this simplifies the implementation of \"user permissions\".",
"fullyImplemented": true,
"linearizedBaseContracts": [
488
],
"name": "Ownable",
"scope": 489
},
"children": [
{
"attributes": {
"constant": false,
"name": "owner",
"scope": 488,
"stateVariable": true,
"storageLocation": "default",
"type": "address",
"value": null,
"visibility": "public"
},
"children": [
{
"attributes": {
"name": "address",
"type": "address"
},
"id": 435,
"name": "ElementaryTypeName",
"src": "238:7:2"
}
],
"id": 436,
"name": "VariableDeclaration",
"src": "238:20:2"
},
{
"attributes": {
"anonymous": false,
"name": "OwnershipTransferred"
},
"children": [
{
"children": [
{
"attributes": {
"constant": false,
"indexed": true,
"name": "previousOwner",
"scope": 442,
"stateVariable": false,
"storageLocation": "default",
"type": "address",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "address",
"type": "address"
},
"id": 437,
"name": "ElementaryTypeName",
"src": "291:7:2"
}
],
"id": 438,
"name": "VariableDeclaration",
"src": "291:29:2"
},
{
"attributes": {
"constant": false,
"indexed": true,
"name": "newOwner",
"scope": 442,
"stateVariable": false,
"storageLocation": "default",
"type": "address",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "address",
"type": "address"
},
"id": 439,
"name": "ElementaryTypeName",
"src": "322:7:2"
}
],
"id": 440,
"name": "VariableDeclaration",
"src": "322:24:2"
}
],
"id": 441,
"name": "ParameterList",
"src": "290:57:2"
}
],
"id": 442,
"name": "EventDefinition",
"src": "264:84:2"
},
{
"attributes": {
"constant": false,
"implemented": true,
"isConstructor": true,
"modifiers": [
null
],
"name": "Ownable",
"payable": false,
"scope": 488,
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
"children": [
{
"attributes": {
"parameters": [
null
]
},
"children": [],
"id": 443,
"name": "ParameterList",
"src": "485:2:2"
},
{
"attributes": {
"parameters": [
null
]
},
"children": [],
"id": 444,
"name": "ParameterList",
"src": "488:0:2"
},
{
"children": [
{
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"operator": "=",
"type": "address"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 436,
"type": "address",
"value": "owner"
},
"id": 445,
"name": "Identifier",
"src": "494:5:2"
},
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"member_name": "sender",
"referencedDeclaration": null,
"type": "address"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 606,
"type": "msg",
"value": "msg"
},
"id": 446,
"name": "Identifier",
"src": "502:3:2"
}
],
"id": 447,
"name": "MemberAccess",
"src": "502:10:2"
}
],
"id": 448,
"name": "Assignment",
"src": "494:18:2"
}
],
"id": 449,
"name": "ExpressionStatement",
"src": "494:18:2"
}
],
"id": 450,
"name": "Block",
"src": "488:29:2"
}
],
"id": 451,
"name": "FunctionDefinition",
"src": "469:48:2"
},
{
"attributes": {
"name": "onlyOwner",
"visibility": "internal"
},
"children": [
{
"attributes": {
"parameters": [
null
]
},
"children": [],
"id": 452,
"name": "ParameterList",
"src": "616:2:2"
},
{
"children": [
{
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"isStructConstructorCall": false,
"lValueRequested": false,
"names": [
null
],
"type": "tuple()",
"type_conversion": false
},
"children": [
{
"attributes": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
}
],
"overloadedDeclarations": [
null
],
"referencedDeclaration": 609,
"type": "function (bool) pure",
"value": "require"
},
"id": 453,
"name": "Identifier",
"src": "625:7:2"
},
{
"attributes": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"operator": "==",
"type": "bool"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"member_name": "sender",
"referencedDeclaration": null,
"type": "address"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 606,
"type": "msg",
"value": "msg"
},
"id": 454,
"name": "Identifier",
"src": "633:3:2"
}
],
"id": 455,
"name": "MemberAccess",
"src": "633:10:2"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 436,
"type": "address",
"value": "owner"
},
"id": 456,
"name": "Identifier",
"src": "647:5:2"
}
],
"id": 457,
"name": "BinaryOperation",
"src": "633:19:2"
}
],
"id": 458,
"name": "FunctionCall",
"src": "625:28:2"
}
],
"id": 459,
"name": "ExpressionStatement",
"src": "625:28:2"
},
{
"id": 460,
"name": "PlaceholderStatement",
"src": "659:1:2"
}
],
"id": 461,
"name": "Block",
"src": "619:46:2"
}
],
"id": 462,
"name": "ModifierDefinition",
"src": "598:67:2"
},
{
"attributes": {
"constant": false,
"implemented": true,
"isConstructor": false,
"name": "transferOwnership",
"payable": false,
"scope": 488,
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
"children": [
{
"children": [
{
"attributes": {
"constant": false,
"name": "newOwner",
"scope": 487,
"stateVariable": false,
"storageLocation": "default",
"type": "address",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "address",
"type": "address"
},
"id": 463,
"name": "ElementaryTypeName",
"src": "854:7:2"
}
],
"id": 464,
"name": "VariableDeclaration",
"src": "854:16:2"
}
],
"id": 465,
"name": "ParameterList",
"src": "853:18:2"
},
{
"attributes": {
"parameters": [
null
]
},
"children": [],
"id": 468,
"name": "ParameterList",
"src": "889:0:2"
},
{
"attributes": {
"arguments": [
null
]
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 462,
"type": "modifier ()",
"value": "onlyOwner"
},
"id": 466,
"name": "Identifier",
"src": "872:9:2"
}
],
"id": 467,
"name": "ModifierInvocation",
"src": "872:9:2"
},
{
"children": [
{
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"isStructConstructorCall": false,
"lValueRequested": false,
"names": [
null
],
"type": "tuple()",
"type_conversion": false
},
"children": [
{
"attributes": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
}
],
"overloadedDeclarations": [
null
],
"referencedDeclaration": 609,
"type": "function (bool) pure",
"value": "require"
},
"id": 469,
"name": "Identifier",
"src": "895:7:2"
},
{
"attributes": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"operator": "!=",
"type": "bool"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 464,
"type": "address",
"value": "newOwner"
},
"id": 470,
"name": "Identifier",
"src": "903:8:2"
},
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": true,
"isStructConstructorCall": false,
"lValueRequested": false,
"names": [
null
],
"type": "address",
"type_conversion": true
},
"children": [
{
"attributes": {
"argumentTypes": [
{
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
}
],
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"type": "type(address)",
"value": "address"
},
"id": 471,
"name": "ElementaryTypeNameExpression",
"src": "915:7:2"
},
{
"attributes": {
"argumentTypes": null,
"hexvalue": "30",
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"subdenomination": null,
"token": "number",
"type": "int_const 0",
"value": "0"
},
"id": 472,
"name": "Literal",
"src": "923:1:2"
}
],
"id": 473,
"name": "FunctionCall",
"src": "915:10:2"
}
],
"id": 474,
"name": "BinaryOperation",
"src": "903:22:2"
}
],
"id": 475,
"name": "FunctionCall",
"src": "895:31:2"
}
],
"id": 476,
"name": "ExpressionStatement",
"src": "895:31:2"
},
{
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"isStructConstructorCall": false,
"lValueRequested": false,
"names": [
null
],
"type": "tuple()",
"type_conversion": false
},
"children": [
{
"attributes": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"overloadedDeclarations": [
null
],
"referencedDeclaration": 442,
"type": "function (address,address)",
"value": "OwnershipTransferred"
},
"id": 477,
"name": "Identifier",
"src": "932:20:2"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 436,
"type": "address",
"value": "owner"
},
"id": 478,
"name": "Identifier",
"src": "953:5:2"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 464,
"type": "address",
"value": "newOwner"
},
"id": 479,
"name": "Identifier",
"src": "960:8:2"
}
],
"id": 480,
"name": "FunctionCall",
"src": "932:37:2"
}
],
"id": 481,
"name": "ExpressionStatement",
"src": "932:37:2"
},
{
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"operator": "=",
"type": "address"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 436,
"type": "address",
"value": "owner"
},
"id": 482,
"name": "Identifier",
"src": "975:5:2"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 464,
"type": "address",
"value": "newOwner"
},
"id": 483,
"name": "Identifier",
"src": "983:8:2"
}
],
"id": 484,
"name": "Assignment",
"src": "975:16:2"
}
],
"id": 485,
"name": "ExpressionStatement",
"src": "975:16:2"
}
],
"id": 486,
"name": "Block",
"src": "889:107:2"
}
],
"id": 487,
"name": "FunctionDefinition",
"src": "827:169:2"
}
],
"id": 488,
"name": "ContractDefinition",
"src": "217:782:2"
}
],
"id": 489,
"name": "SourceUnit",
"src": "0:1000:2"
},
"compiler": {
"name": "solc",
"version": "0.4.18+commit.9cf6e910.Emscripten.clang"
},
"networks": {},
"schemaVersion": "1.0.1",
"updatedAt": "2017-11-10T02:14:36.615Z"
}

4675
build/contracts/Presale.json Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

23
contracts/Migrations.sol Normal file
View File

@ -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);
}
}

View File

@ -0,0 +1,97 @@
// Build and Tested by Roman Storm rstormsf@gmail.com
import "zeppelin-solidity/contracts/math/SafeMath.sol";
import "zeppelin-solidity/contracts/token/BasicToken.sol";
import "zeppelin-solidity/contracts/ownership/Ownable.sol";
pragma solidity ^0.4.17;
contract PresaleOracles is Ownable {
uint256 public startTime;
uint256 public endTime;
uint256 public cap;
uint256 public rate;
bool public isInitialized = false;
uint256 public totalInvestedInWei;
mapping(address => uint256) public investorBalances;
mapping(address => bool) public whitelist;
uint256 public investorsLength;
address public vault;
// TESTED by Roman Storm
function () public payable {
buy();
}
//TESTED by Roman Storm
function Presale() public {
}
//TESTED by Roman Storm
function initialize(uint256 _startTime, uint256 _endTime, uint256 _cap, address _vault) public onlyOwner {
require(!isInitialized);
require(_startTime != 0);
require(_endTime != 0);
require(_endTime > _startTime);
require(_cap != 0);
require(_vault != 0x0);
startTime = _startTime;
endTime = _endTime;
cap = _cap;
isInitialized = true;
vault = _vault;
}
//TESTED by Roman Storm
function buy() public payable {
require(whitelist[msg.sender]);
require(msg.value > 0);
require(isInitialized);
require(getTime() >= startTime && getTime() <= endTime);
require(totalInvestedInWei + msg.value <= cap);
address investor = msg.sender;
investorBalances[investor] += msg.value;
totalInvestedInWei += msg.value;
forwardFunds(msg.value);
}
//TESTED by Roman Storm
function forwardFunds(uint256 _amount) internal {
vault.transfer(_amount);
}
function claimTokens(address _token) public onlyOwner {
if (_token == 0x0) {
owner.transfer(this.balance);
return;
}
BasicToken token = BasicToken(_token);
uint256 balance = token.balanceOf(this);
token.transfer(owner, balance);
}
function whitelistInvestor(address _newInvestor) public onlyOwner {
if(!whitelist[_newInvestor]) {
whitelist[_newInvestor] = true;
investorsLength++;
}
}
function whitelistInvestors(address[] _investors) external onlyOwner {
require(_investors.length <= 250);
for(uint8 i=0; i<_investors.length;i++) {
address newInvestor = _investors[i];
if(!whitelist[newInvestor]) {
whitelist[newInvestor] = true;
investorsLength++;
}
}
}
function blacklistInvestor(address _investor) public onlyOwner {
if(whitelist[_investor]) {
delete whitelist[_investor];
if(investorsLength != 0) {
investorsLength--;
}
}
}
function getTime() internal view returns(uint256) {
return now;
}
}

View File

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

View File

@ -0,0 +1,10 @@
var PresaleOracles = artifacts.require("./PresaleOracles.sol");
module.exports = function(deployer, network) {
if(network !== 'development'){
deployer.deploy(PresaleOracles).then(async ()=> {
let presale = await PresaleOracles.deployed();
console.log(presale.address);
})
}
};

724
package-lock.json generated Normal file
View File

@ -0,0 +1,724 @@
{
"name": "presale-oracles",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"ansi-regex": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8="
},
"assertion-error": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.0.2.tgz",
"integrity": "sha1-E8pRXYYgbaC6xm6DTdOX2HWBCUw="
},
"balanced-match": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
},
"brace-expansion": {
"version": "1.1.8",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz",
"integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=",
"requires": {
"balanced-match": "1.0.0",
"concat-map": "0.0.1"
}
},
"browser-stdout": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz",
"integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8="
},
"builtin-modules": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz",
"integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8="
},
"camelcase": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz",
"integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo="
},
"chai": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chai/-/chai-4.1.2.tgz",
"integrity": "sha1-D2RYS6ZC8PKs4oBiefTwbKI61zw=",
"requires": {
"assertion-error": "1.0.2",
"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==",
"requires": {
"check-error": "1.0.2"
}
},
"chai-bignumber": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/chai-bignumber/-/chai-bignumber-2.0.2.tgz",
"integrity": "sha512-BIdRNjRaoRj4bMsZLKbIZPMNKqmwnzNiyxqBYDSs6dFOCs9w8OHPuUE8e1bH60i1IhOzT0NjLtCD+lKEWB1KTQ=="
},
"check-error": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz",
"integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII="
},
"cliui": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz",
"integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=",
"requires": {
"string-width": "1.0.2",
"strip-ansi": "3.0.1",
"wrap-ansi": "2.1.0"
}
},
"code-point-at": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz",
"integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c="
},
"commander": {
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz",
"integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=",
"requires": {
"graceful-readlink": "1.0.1"
}
},
"concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
},
"debug": {
"version": "2.6.8",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz",
"integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=",
"requires": {
"ms": "2.0.0"
}
},
"decamelize": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
"integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA="
},
"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==",
"requires": {
"type-detect": "4.0.5"
}
},
"diff": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/diff/-/diff-3.2.0.tgz",
"integrity": "sha1-yc45Okt8vQsFinJck98pkCeGj/k="
},
"error-ex": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz",
"integrity": "sha1-+FWobOYa3E6GIcPNoh56dhLDqNw=",
"requires": {
"is-arrayish": "0.2.1"
}
},
"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="
},
"find-up": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz",
"integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=",
"requires": {
"path-exists": "2.1.0",
"pinkie-promise": "2.0.1"
}
},
"fs-extra": {
"version": "0.30.0",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz",
"integrity": "sha1-8jP/zAjU2n1DLapEl3aYnbHfk/A=",
"requires": {
"graceful-fs": "4.1.11",
"jsonfile": "2.4.0",
"klaw": "1.3.1",
"path-is-absolute": "1.0.1",
"rimraf": "2.6.2"
}
},
"fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
},
"get-caller-file": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.2.tgz",
"integrity": "sha1-9wLmMSfn4jHBYKgMFVSstw1QR+U="
},
"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="
},
"glob": {
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz",
"integrity": "sha1-gFIR3wT6rxxjo2ADBs31reULLsg=",
"requires": {
"fs.realpath": "1.0.0",
"inflight": "1.0.6",
"inherits": "2.0.3",
"minimatch": "3.0.4",
"once": "1.4.0",
"path-is-absolute": "1.0.1"
}
},
"graceful-fs": {
"version": "4.1.11",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz",
"integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg="
},
"graceful-readlink": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz",
"integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU="
},
"growl": {
"version": "1.9.2",
"resolved": "https://registry.npmjs.org/growl/-/growl-1.9.2.tgz",
"integrity": "sha1-Dqd0NxXbjY3ixe3hd14bRayFwC8="
},
"has-flag": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz",
"integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo="
},
"he": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz",
"integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0="
},
"hosted-git-info": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.5.0.tgz",
"integrity": "sha512-pNgbURSuab90KbTqvRPsseaTxOJCZBD0a7t+haSN33piP9cCM4l0CqdzAif2hUqm716UovKB2ROmiabGAKVXyg=="
},
"inflight": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
"requires": {
"once": "1.4.0",
"wrappy": "1.0.2"
}
},
"inherits": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
},
"invert-kv": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz",
"integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY="
},
"is-arrayish": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz",
"integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0="
},
"is-builtin-module": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz",
"integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=",
"requires": {
"builtin-modules": "1.1.1"
}
},
"is-fullwidth-code-point": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz",
"integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=",
"requires": {
"number-is-nan": "1.0.1"
}
},
"is-utf8": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz",
"integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI="
},
"json3": {
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/json3/-/json3-3.3.2.tgz",
"integrity": "sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE="
},
"jsonfile": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz",
"integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=",
"requires": {
"graceful-fs": "4.1.11"
}
},
"klaw": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/klaw/-/klaw-1.3.1.tgz",
"integrity": "sha1-QIhDO0azsbolnXh4XY6W9zugJDk=",
"requires": {
"graceful-fs": "4.1.11"
}
},
"lcid": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz",
"integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=",
"requires": {
"invert-kv": "1.0.0"
}
},
"load-json-file": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz",
"integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=",
"requires": {
"graceful-fs": "4.1.11",
"parse-json": "2.2.0",
"pify": "2.3.0",
"pinkie-promise": "2.0.1",
"strip-bom": "2.0.0"
}
},
"lodash._baseassign": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz",
"integrity": "sha1-jDigmVAPIVrQnlnxci/QxSv+Ck4=",
"requires": {
"lodash._basecopy": "3.0.1",
"lodash.keys": "3.1.2"
}
},
"lodash._basecopy": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz",
"integrity": "sha1-jaDmqHbPNEwK2KVIghEd08XHyjY="
},
"lodash._basecreate": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/lodash._basecreate/-/lodash._basecreate-3.0.3.tgz",
"integrity": "sha1-G8ZhYU2qf8MRt9A78WgGoCE8+CE="
},
"lodash._getnative": {
"version": "3.9.1",
"resolved": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz",
"integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U="
},
"lodash._isiterateecall": {
"version": "3.0.9",
"resolved": "https://registry.npmjs.org/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz",
"integrity": "sha1-UgOte6Ql+uhCRg5pbbnPPmqsBXw="
},
"lodash.assign": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/lodash.assign/-/lodash.assign-4.2.0.tgz",
"integrity": "sha1-DZnzzNem0mHRm9rrkkUAXShYCOc="
},
"lodash.create": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/lodash.create/-/lodash.create-3.1.1.tgz",
"integrity": "sha1-1/KEnw29p+BGgruM1yqwIkYd6+c=",
"requires": {
"lodash._baseassign": "3.2.0",
"lodash._basecreate": "3.0.3",
"lodash._isiterateecall": "3.0.9"
}
},
"lodash.isarguments": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz",
"integrity": "sha1-L1c9hcaiQon/AGY7SRwdM4/zRYo="
},
"lodash.isarray": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.4.tgz",
"integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U="
},
"lodash.keys": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz",
"integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=",
"requires": {
"lodash._getnative": "3.9.1",
"lodash.isarguments": "3.1.0",
"lodash.isarray": "3.0.4"
}
},
"memorystream": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/memorystream/-/memorystream-0.3.1.tgz",
"integrity": "sha1-htcJCzDORV1j+64S3aUaR93K+bI="
},
"minimatch": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
"requires": {
"brace-expansion": "1.1.8"
}
},
"minimist": {
"version": "0.0.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0="
},
"mkdirp": {
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
"requires": {
"minimist": "0.0.8"
}
},
"mocha": {
"version": "3.5.3",
"resolved": "https://registry.npmjs.org/mocha/-/mocha-3.5.3.tgz",
"integrity": "sha512-/6na001MJWEtYxHOV1WLfsmR4YIynkUEhBwzsb+fk2qmQ3iqsi258l/Q2MWHJMImAcNpZ8DEdYAK72NHoIQ9Eg==",
"requires": {
"browser-stdout": "1.3.0",
"commander": "2.9.0",
"debug": "2.6.8",
"diff": "3.2.0",
"escape-string-regexp": "1.0.5",
"glob": "7.1.1",
"growl": "1.9.2",
"he": "1.1.1",
"json3": "3.3.2",
"lodash.create": "3.1.1",
"mkdirp": "0.5.1",
"supports-color": "3.1.2"
}
},
"moment": {
"version": "2.19.1",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.19.1.tgz",
"integrity": "sha1-VtoaLRy/AdOLfhr8McELz6GSkWc="
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
},
"normalize-package-data": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz",
"integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==",
"requires": {
"hosted-git-info": "2.5.0",
"is-builtin-module": "1.0.0",
"semver": "5.4.1",
"validate-npm-package-license": "3.0.1"
}
},
"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="
},
"once": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
"requires": {
"wrappy": "1.0.2"
}
},
"original-require": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/original-require/-/original-require-1.0.1.tgz",
"integrity": "sha1-DxMEcVhM0zURxew4yNWSE/msXiA="
},
"os-locale": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz",
"integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=",
"requires": {
"lcid": "1.0.0"
}
},
"parse-json": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz",
"integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=",
"requires": {
"error-ex": "1.3.1"
}
},
"path-exists": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz",
"integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=",
"requires": {
"pinkie-promise": "2.0.1"
}
},
"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="
},
"path-type": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz",
"integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=",
"requires": {
"graceful-fs": "4.1.11",
"pify": "2.3.0",
"pinkie-promise": "2.0.1"
}
},
"pathval": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz",
"integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA="
},
"pify": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw="
},
"pinkie": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz",
"integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA="
},
"pinkie-promise": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz",
"integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=",
"requires": {
"pinkie": "2.0.4"
}
},
"read-pkg": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz",
"integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=",
"requires": {
"load-json-file": "1.1.0",
"normalize-package-data": "2.4.0",
"path-type": "1.1.0"
}
},
"read-pkg-up": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz",
"integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=",
"requires": {
"find-up": "1.1.2",
"read-pkg": "1.1.0"
}
},
"require-directory": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
"integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I="
},
"require-from-string": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-1.2.1.tgz",
"integrity": "sha1-UpyczvJzgK3+yaL5ZbZJu+5jZBg="
},
"require-main-filename": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz",
"integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE="
},
"rimraf": {
"version": "2.6.2",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz",
"integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==",
"requires": {
"glob": "7.1.1"
}
},
"semver": {
"version": "5.4.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz",
"integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg=="
},
"set-blocking": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
"integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc="
},
"solc": {
"version": "0.4.18",
"resolved": "https://registry.npmjs.org/solc/-/solc-0.4.18.tgz",
"integrity": "sha512-Kq+O3PNF9Pfq7fB+lDYAuoqRdghLmZyfngsg0h1Hj38NKAeVHeGPOGeZasn5KqdPeCzbMFvaGyTySxzGv6aXCg==",
"requires": {
"fs-extra": "0.30.0",
"memorystream": "0.3.1",
"require-from-string": "1.2.1",
"semver": "5.4.1",
"yargs": "4.8.1"
}
},
"spdx-correct": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-1.0.2.tgz",
"integrity": "sha1-SzBz2TP/UfORLwOsVRlJikFQ20A=",
"requires": {
"spdx-license-ids": "1.2.2"
}
},
"spdx-expression-parse": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-1.0.4.tgz",
"integrity": "sha1-m98vIOH0DtRH++JzJmGR/O1RYmw="
},
"spdx-license-ids": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz",
"integrity": "sha1-yd96NCRZSt5r0RkA1ZZpbcBrrFc="
},
"string-width": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
"integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
"requires": {
"code-point-at": "1.1.0",
"is-fullwidth-code-point": "1.0.0",
"strip-ansi": "3.0.1"
}
},
"strip-ansi": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
"requires": {
"ansi-regex": "2.1.1"
}
},
"strip-bom": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz",
"integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=",
"requires": {
"is-utf8": "0.2.1"
}
},
"supports-color": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.1.2.tgz",
"integrity": "sha1-cqJiiU2dQIuVbKBf83su2KbiotU=",
"requires": {
"has-flag": "1.0.0"
}
},
"truffle": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/truffle/-/truffle-4.0.1.tgz",
"integrity": "sha512-PybO+GMq3AvsfCWfEx4sbuaJlDL19iR8Ff20cO0TtP599N5JbMLlhwlffvVInPgFjP+F11vjSOYj3hT8fONs5A==",
"requires": {
"mocha": "3.5.3",
"original-require": "1.0.1",
"solc": "0.4.18"
}
},
"type-detect": {
"version": "4.0.5",
"resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.5.tgz",
"integrity": "sha512-N9IvkQslUGYGC24RkJk1ba99foK6TkwC2FHAEBlQFBP0RxQZS8ZpJuAZcwiY/w9ZJHFQb1aOXBI60OdxhTrwEQ=="
},
"validate-npm-package-license": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz",
"integrity": "sha1-KAS6vnEq0zeUWaz74kdGqywwP7w=",
"requires": {
"spdx-correct": "1.0.2",
"spdx-expression-parse": "1.0.4"
}
},
"which-module": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/which-module/-/which-module-1.0.0.tgz",
"integrity": "sha1-u6Y8qGGUiZT/MHc2CJ47lgJsKk8="
},
"window-size": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/window-size/-/window-size-0.2.0.tgz",
"integrity": "sha1-tDFbtCFKPXBY6+7okuE/ok2YsHU="
},
"wrap-ansi": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz",
"integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=",
"requires": {
"string-width": "1.0.2",
"strip-ansi": "3.0.1"
}
},
"wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
},
"y18n": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz",
"integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE="
},
"yargs": {
"version": "4.8.1",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-4.8.1.tgz",
"integrity": "sha1-wMQpJMpKqmsObaFznfshZDn53cA=",
"requires": {
"cliui": "3.2.0",
"decamelize": "1.2.0",
"get-caller-file": "1.0.2",
"lodash.assign": "4.2.0",
"os-locale": "1.4.0",
"read-pkg-up": "1.0.1",
"require-directory": "2.1.1",
"require-main-filename": "1.0.1",
"set-blocking": "2.0.0",
"string-width": "1.0.2",
"which-module": "1.0.0",
"window-size": "0.2.0",
"y18n": "3.2.1",
"yargs-parser": "2.4.1"
}
},
"yargs-parser": {
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-2.4.1.tgz",
"integrity": "sha1-hVaN488VD/SfpRgl8DqMiA3cxcQ=",
"requires": {
"camelcase": "3.0.0",
"lodash.assign": "4.2.0"
}
},
"zeppelin-solidity": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/zeppelin-solidity/-/zeppelin-solidity-1.3.0.tgz",
"integrity": "sha512-q+WyqvQjE5gpKgXrhD8LBh0Njg7GI/zs4lKX14y0j7ISJIxe68hihSjaMU05V0M0qAbxgRC43AFTt7CxNsO8nQ=="
}
}
}

19
package.json Normal file
View File

@ -0,0 +1,19 @@
{
"name": "presale-oracles",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Roman Storm",
"license": "MIT",
"dependencies": {
"chai": "^4.1.2",
"chai-as-promised": "^7.1.1",
"chai-bignumber": "^2.0.2",
"moment": "^2.19.1",
"truffle": "^4.0.1",
"zeppelin-solidity": "^1.3.0"
}
}

View File

@ -0,0 +1,24 @@
pragma solidity ^0.4.17;
import '../contracts/PresaleOracles.sol';
contract PresaleOraclesMock is PresaleOracles {
uint256 mockTime = 0;
function PresaleOraclesMock() public
PresaleOracles()
{
}
// Debug method to redefine current time
function setTime(uint256 _time) public {
mockTime = _time;
}
function getTime() internal view returns (uint256) {
if (mockTime != 0) {
return mockTime;
} else {
return now;
}
}
}

246
test/presale.js Normal file
View File

@ -0,0 +1,246 @@
const PresaleOracles = artifacts.require("PresaleOraclesMock.sol");
const BigNumber = web3.BigNumber;
require('chai')
.use(require('chai-as-promised'))
.use(require('chai-bignumber')(web3.BigNumber))
.should();
const moment = require('moment');
const ETHER = new web3.BigNumber(10).toPower(18);
function getTime() {
return Math.floor(Date.now() / 1000);
}
function latestTime() {
return web3.eth.getBlock('latest').timestamp;
}
let PRESALE_START_DATE, PRESALE_END_DATE;
contract('Presale', function(accounts) {
let presaleContract;
beforeEach(async () => {
presaleContract = await PresaleOracles.new();
});
it('constructor should set owner', async () => {
accounts[0].should.be.equal(
await presaleContract.owner()
);
});
it('can not buy if not initialized', async () => {
await presaleContract.sendTransaction({amount: ETHER})
.should.be.rejectedWith('invalid opcode');
})
describe('#initilize', async () => {
beforeEach(() => {
PRESALE_START_DATE = moment('2017-12-11T16:00:00Z').unix();
PRESALE_END_DATE = moment('2017-12-18T16:00:00Z').unix();
})
it('rejects if not sent by owner', async () => {
await presaleContract.initialize(PRESALE_START_DATE, PRESALE_END_DATE, ETHER, accounts[1], {from: accounts[1]})
.should.be.rejectedWith('invalid opcode');
})
it('sets values', async () => {
await presaleContract.initialize(PRESALE_START_DATE, PRESALE_END_DATE, ETHER, accounts[1], {from: accounts[0]})
true.should.be.equal(
await presaleContract.isInitialized()
)
PRESALE_START_DATE.should.be.bignumber.equal(
await presaleContract.startTime()
)
PRESALE_END_DATE.should.be.bignumber.equal(
await presaleContract.endTime()
)
ETHER.should.be.bignumber.equal(
await presaleContract.cap()
)
accounts[1].should.be.equal(
await presaleContract.vault()
)
})
it('cannot initialize twice', async () => {
// require(!isInitialized);
await presaleContract.initialize(PRESALE_START_DATE, PRESALE_END_DATE, ETHER, accounts[1], {from: accounts[0]})
await presaleContract.initialize(PRESALE_START_DATE, PRESALE_END_DATE, ETHER, accounts[1], {from: accounts[0]})
.should.be.rejectedWith('invalid opcode');
})
it('startTime cannot be 0', async () => {
// require(_startTime != 0);
await presaleContract.initialize(0, PRESALE_END_DATE, ETHER, accounts[1], {from: accounts[1]})
.should.be.rejectedWith('invalid opcode');
})
it('endTime cannot be 0', async () => {
// require(_endTime != 0);
await presaleContract.initialize(PRESALE_START_DATE, 0, ETHER, accounts[1], {from: accounts[1]})
.should.be.rejectedWith('invalid opcode');
})
it('endTime cannot be less than startTime', async () => {
// require(_endTime > _startTime);
await presaleContract.initialize(PRESALE_END_DATE, PRESALE_START_DATE, ETHER, accounts[1], {from: accounts[1]})
.should.be.rejectedWith('invalid opcode');
})
it('cap cannot be 0', async () => {
// require(_cap != 0);
await presaleContract.initialize(PRESALE_START_DATE, PRESALE_END_DATE, 0, accounts[1], {from: accounts[1]})
.should.be.rejectedWith('invalid opcode');
})
it('vault cannot be 0x0', async () => {
// require(_vault != 0x0);
await presaleContract.initialize(PRESALE_START_DATE, PRESALE_END_DATE, ETHER, '0x0', {from: accounts[1]})
.should.be.rejectedWith('invalid opcode');
})
})
describe('#buy', async () => {
beforeEach(async () => {
PRESALE_START_DATE = moment('2017-12-11T16:00:00Z').unix();
PRESALE_END_DATE = moment('2017-12-18T16:00:00Z').unix();
await presaleContract.initialize(PRESALE_START_DATE, PRESALE_END_DATE, ETHER.mul(2), accounts[1], {from: accounts[0]})
})
it('cannot buy if not whitelisted', async () => {
// require(whitelist[msg.sender]);
await presaleContract.sendTransaction({amount: ETHER})
.should.be.rejectedWith('invalid opcode');
})
it('cannot buy if not value is 0', async () => {
// require(msg.value > 0);
await presaleContract.setTime(PRESALE_START_DATE);
await presaleContract.whitelistInvestor(accounts[0]);
await presaleContract.sendTransaction({value: 0})
.should.be.rejectedWith('invalid opcode');
})
it('can not buy if not initialized', async () => {
// require(isInitialized);
await presaleContract.sendTransaction({amount: ETHER})
.should.be.rejectedWith('invalid opcode');
})
it('can not buy if time is not within startTime&endTime', async ()=> {
// require(now >= startTime && now <= endTime);
await presaleContract.setTime(PRESALE_START_DATE - 1);
await presaleContract.whitelistInvestor(accounts[0]);
await presaleContract.sendTransaction({value: ETHER})
.should.be.rejectedWith('invalid opcode');
await presaleContract.setTime(PRESALE_END_DATE + 1);
await presaleContract.sendTransaction({value: ETHER})
.should.be.rejectedWith('invalid opcode');
})
it('can not buy more than cap', async () => {
// require(totalInvestedInWei + msg.value <= cap);
await presaleContract.setTime(PRESALE_START_DATE);
await presaleContract.whitelistInvestor(accounts[0]);
await presaleContract.sendTransaction({value: ETHER.mul(2) + 1})
.should.be.rejectedWith('invalid opcode');
})
it('happy path', async () => {
// investorBalances[investor] += msg.value;
// totalInvestedInWei += msg.value;
// forwardFunds(msg.value);
const vault = accounts[1];
const preVaultBalance = await web3.eth.getBalance(vault);
await presaleContract.setTime(PRESALE_START_DATE);
await presaleContract.whitelistInvestor(accounts[0]);
await presaleContract.sendTransaction({value: ETHER});
ETHER.should.be.bignumber.equal(
await presaleContract.investorBalances(accounts[0])
)
ETHER.should.be.bignumber.equal(
await presaleContract.totalInvestedInWei()
)
preVaultBalance.add(ETHER).should.be.bignumber.equal(
await web3.eth.getBalance(vault)
)
await presaleContract.sendTransaction({value: ETHER});
ETHER.mul(2).should.be.bignumber.equal(
await presaleContract.investorBalances(accounts[0])
)
ETHER.mul(2).should.be.bignumber.equal(
await presaleContract.totalInvestedInWei()
)
preVaultBalance.add(ETHER.mul(2)).should.be.bignumber.equal(
await web3.eth.getBalance(vault)
)
})
})
describe('#whitelistInvestor', async ()=>{
it('cannot by called by non-owner', async ()=> {
await presaleContract.whitelistInvestor(accounts[0], {from: accounts[1]})
.should.be.rejectedWith('invalid opcode');
})
it('whitelists an investor', async ()=> {
'0'.should.be.bignumber.equal(
await presaleContract.investorsLength()
)
false.should.be.equal(
await presaleContract.whitelist(accounts[0])
)
await presaleContract.whitelistInvestor(accounts[0]);
true.should.be.equal(
await presaleContract.whitelist(accounts[0])
)
'1'.should.be.bignumber.equal(
await presaleContract.investorsLength()
)
})
})
describe('#whitelistInvestors', async ()=>{
it('cannot by called by non-owner', async ()=> {
await presaleContract.whitelistInvestors([accounts[0]], {from: accounts[1]})
.should.be.rejectedWith('invalid opcode');
})
it('whitelists investors', async ()=> {
'0'.should.be.bignumber.equal(
await presaleContract.investorsLength()
)
false.should.be.equal(
await presaleContract.whitelist(accounts[0])
)
await presaleContract.whitelistInvestors([accounts[0], accounts[1], accounts[2]]);
true.should.be.equal(
await presaleContract.whitelist(accounts[2])
)
'3'.should.be.bignumber.equal(
await presaleContract.investorsLength()
)
})
})
describe('#blacklistInvestor', async ()=>{
it('cannot by called by non-owner', async ()=> {
await presaleContract.blacklistInvestor(accounts[0], {from: accounts[1]})
.should.be.rejectedWith('invalid opcode');
})
it('blacklist an investors', async ()=> {
'0'.should.be.bignumber.equal(
await presaleContract.investorsLength()
)
false.should.be.equal(
await presaleContract.whitelist(accounts[0])
)
await presaleContract.whitelistInvestors([accounts[0], accounts[1], accounts[2]]);
true.should.be.equal(
await presaleContract.whitelist(accounts[0])
)
'3'.should.be.bignumber.equal(
await presaleContract.investorsLength()
)
await presaleContract.blacklistInvestor(accounts[0]);
false.should.be.equal(
await presaleContract.whitelist(accounts[0])
)
'2'.should.be.bignumber.equal(
await presaleContract.investorsLength()
)
})
})
});

4
truffle-config.js Normal file
View File

@ -0,0 +1,4 @@
module.exports = {
// See <http://truffleframework.com/docs/advanced/configuration>
// to customize your Truffle configuration!
};

11
truffle.js Normal file
View File

@ -0,0 +1,11 @@
module.exports = {
// See <http://truffleframework.com/docs/advanced/configuration>
// to customize your Truffle configuration!
networks: {
development: {
host: "localhost",
port: 8545,
network_id: "*" // Match any network id
}
}
};