From b306343ad8700c63328e24cb8b57a156e74ec452 Mon Sep 17 00:00:00 2001 From: anedge Date: Tue, 31 Oct 2017 10:01:37 +0530 Subject: [PATCH] Initial Commit --- .gitignore | 1 + build/contracts/BasicToken.json | 287 ++++++++++++++++++++++++++++ build/contracts/Migrations.json | 66 +++++++ build/contracts/Presale.json | 305 ++++++++++++++++++++++++++++++ build/contracts/SafeMath.json | 8 + build/contracts/owned.json | 27 +++ contracts/BasicToken.sol | 97 ++++++++++ contracts/Migrations.sol | 24 +++ contracts/Owner.sol | 16 ++ contracts/Presale.sol | 90 +++++++++ contracts/SafeMath.sol | 25 +++ migrations/1_initial_migration.js | 5 + migrations/2_token_migration.js | 9 + migrations/3_presale_migration.js | 9 + package.json | 5 + truffle-config.js | 9 + 16 files changed, 983 insertions(+) create mode 100644 .gitignore create mode 100644 build/contracts/BasicToken.json create mode 100644 build/contracts/Migrations.json create mode 100644 build/contracts/Presale.json create mode 100644 build/contracts/SafeMath.json create mode 100644 build/contracts/owned.json create mode 100644 contracts/BasicToken.sol create mode 100644 contracts/Migrations.sol create mode 100644 contracts/Owner.sol create mode 100644 contracts/Presale.sol create mode 100644 contracts/SafeMath.sol create mode 100644 migrations/1_initial_migration.js create mode 100644 migrations/2_token_migration.js create mode 100644 migrations/3_presale_migration.js create mode 100644 package.json create mode 100644 truffle-config.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ae84271 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +./node_modules \ No newline at end of file diff --git a/build/contracts/BasicToken.json b/build/contracts/BasicToken.json new file mode 100644 index 0000000..27e16db --- /dev/null +++ b/build/contracts/BasicToken.json @@ -0,0 +1,287 @@ +{ + "contract_name": "BasicToken", + "abi": [ + { + "constant": true, + "inputs": [], + "name": "name", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "bountyAccount", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_account", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "escrowAmount", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "decimals", + "outputs": [ + { + "name": "", + "type": "uint8" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_owner", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "newTokens", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_value", + "type": "uint256" + } + ], + "name": "burnTokens", + "outputs": [ + { + "name": "success", + "type": "bool" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "symbol", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_to", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "frozenAccount", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reserveAccount", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_account", + "type": "address" + }, + { + "name": "_frozen", + "type": "bool" + } + ], + "name": "freezeAccount", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "inputs": [], + "payable": false, + "type": "constructor" + }, + { + "payable": false, + "type": "fallback" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_from", + "type": "address" + }, + { + "indexed": false, + "name": "_value", + "type": "uint256" + } + ], + "name": "Burn", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "_account", + "type": "address" + }, + { + "indexed": false, + "name": "_frozen", + "type": "bool" + } + ], + "name": "FrozenFunds", + "type": "event" + }, + { + "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" + } + ], + "unlinked_binary": "0x6060604052341561000f57600080fd5b5b5b60008054600160a060020a03191633600160a060020a03161790555b6aa56fa5b99019a5c80000006001819055600160a060020a03331660009081526007602052604090205561006c64010000000061086661007282021704565b5b610181565b60028054600160a060020a0319908116720ee4243e16b8f0f41e55badc3ee899b476ada1179091556003805490911672301e2d3dbe5511c7d893e86d80abe2a4b049931790556001546064906019025b0460048190556064906007025b04600590815560048054600154600160a060020a03338116600081815260076020526040808220959094039094559454600354821684528284208190558454039384905560028054821684529282902084905591549091169291600080516020610b5e833981519152915190815260200160405180910390a3600354600554600160a060020a0391821691331690600080516020610b5e8339815191529060405190815260200160405180910390a35b565b6109ce806101906000396000f300606060405236156100cd5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100e0578063131740931461016b57806318160ddd1461019a5780632a8014ca146101bf578063313ce567146101e35780634c985dfb1461020c5780636d1b229d1461023057806370a082311461025a5780638da5cb5b1461028b57806395d89b41146102ba578063a9059cbb14610345578063b414d4b614610369578063dc184e701461039c578063e724529c146103cb575b34156100d857600080fd5b5b600080fd5b005b34156100eb57600080fd5b6100f36103f1565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101305780820151818401525b602001610117565b50505050905090810190601f16801561015d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561017657600080fd5b61017e610428565b604051600160a060020a03909116815260200160405180910390f35b34156101a557600080fd5b6101ad610437565b60405190815260200160405180910390f35b34156101ca57600080fd5b6100de600160a060020a036004351660243561043d565b005b34156101ee57600080fd5b6101f6610474565b60405160ff909116815260200160405180910390f35b341561021757600080fd5b6100de600160a060020a0360043516602435610479565b005b341561023b57600080fd5b610246600435610521565b604051901515815260200160405180910390f35b341561026557600080fd5b6101ad600160a060020a0360043516610601565b60405190815260200160405180910390f35b341561029657600080fd5b61017e610613565b604051600160a060020a03909116815260200160405180910390f35b34156102c557600080fd5b6100f3610622565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101305780820151818401525b602001610117565b50505050905090810190601f16801561015d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561035057600080fd5b6100de600160a060020a0360043516602435610659565b005b341561037457600080fd5b610246600160a060020a0360043516610669565b604051901515815260200160405180910390f35b34156103a757600080fd5b61017e61067e565b604051600160a060020a03909116815260200160405180910390f35b34156103d657600080fd5b6100de600160a060020a0360043516602435151561068d565b005b60408051908101604052600781527f56616c6f72656d00000000000000000000000000000000000000000000000000602082015281565b600354600160a060020a031681565b60015481565b60005433600160a060020a0390811691161461045857600080fd5b61046333838361071b565b61046e82600161068d565b5b5b5050565b601281565b60005433600160a060020a0390811691161461049457600080fd5b600160a060020a0382166000908152600760205260409020546104bd908263ffffffff61083516565b600160a060020a0383166000908152600760205260409020556001546104e9908263ffffffff61083516565b600155600160a060020a038083169030166000805160206109838339815191528360405190815260200160405180910390a35b5b5050565b6000805433600160a060020a0390811691161461053d57600080fd5b600160a060020a03331660009081526007602052604090205482901161056257600080fd5b600160a060020a03331660009081526007602052604090205461058b908363ffffffff61083516565b600160a060020a0333166000908152600760205260409020556001546105b7908363ffffffff61084f16565b600155600160a060020a0333167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca58360405190815260200160405180910390a25060015b5b919050565b60076020526000908152604090205481565b600054600160a060020a031681565b60408051908101604052600381527f564c520000000000000000000000000000000000000000000000000000000000602082015281565b61046e33838361071b565b5b5050565b60066020526000908152604090205460ff1681565b600254600160a060020a031681565b60005433600160a060020a039081169116146106a857600080fd5b600160a060020a03821660009081526006602052604090819020805460ff19168315151790557f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a5908390839051600160a060020a039092168252151560208201526040908101905180910390a15b5b5050565b600160a060020a03831660009081526007602052604090205481901161074057600080fd5b600160a060020a03831660009081526006602052604090205460ff161561076657600080fd5b600160a060020a03821660009081526006602052604090205460ff161561078c57600080fd5b600160a060020a0383166000908152600760205260409020546107b5908263ffffffff61084f16565b600160a060020a0380851660009081526007602052604080822093909355908416815220546107ea908263ffffffff61083516565b600160a060020a03808416600081815260076020526040908190209390935591908516906000805160206109838339815191529084905190815260200160405180910390a35b505050565b60008282018381101561084457fe5b8091505b5092915050565b60008282111561085b57fe5b508082035b92915050565b6002805473ffffffffffffffffffffffffffffffffffffffff19908116720ee4243e16b8f0f41e55badc3ee899b476ada1179091556003805490911672301e2d3dbe5511c7d893e86d80abe2a4b049931790556001546064906019025b0460048190556064906007025b04600590815560048054600154600160a060020a03338116600081815260076020526040808220959094039094559454600354821684528284208190558454039384905560028054821684529282902084905591549091169291600080516020610983833981519152915190815260200160405180910390a3600354600554600160a060020a03918216913316906000805160206109838339815191529060405190815260200160405180910390a35b5600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a72305820f2fb34ef8a0c8f363edddea6e183969d5e9a99f1cb05e6dcb77720e106064bda0029ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "networks": {}, + "schema_version": "0.0.5", + "updated_at": 1509347240995 +} \ No newline at end of file diff --git a/build/contracts/Migrations.json b/build/contracts/Migrations.json new file mode 100644 index 0000000..102c2d9 --- /dev/null +++ b/build/contracts/Migrations.json @@ -0,0 +1,66 @@ +{ + "contract_name": "Migrations", + "abi": [ + { + "constant": false, + "inputs": [ + { + "name": "new_address", + "type": "address" + } + ], + "name": "upgrade", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "last_completed_migration", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "completed", + "type": "uint256" + } + ], + "name": "setCompleted", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "inputs": [], + "payable": false, + "type": "constructor" + } + ], + "unlinked_binary": "0x6060604052341561000f57600080fd5b5b60008054600160a060020a03191633600160a060020a03161790555b5b6101e58061003c6000396000f300606060405263ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630900f010811461005e578063445df0ac1461007f5780638da5cb5b146100a4578063fdacd576146100d3575b600080fd5b341561006957600080fd5b61007d600160a060020a03600435166100eb565b005b341561008a57600080fd5b610092610182565b60405190815260200160405180910390f35b34156100af57600080fd5b6100b7610188565b604051600160a060020a03909116815260200160405180910390f35b34156100de57600080fd5b61007d600435610197565b005b6000805433600160a060020a039081169116141561017c5781905080600160a060020a031663fdacd5766001546040517c010000000000000000000000000000000000000000000000000000000063ffffffff84160281526004810191909152602401600060405180830381600087803b151561016757600080fd5b6102c65a03f1151561017857600080fd5b5050505b5b5b5050565b60015481565b600054600160a060020a031681565b60005433600160a060020a03908116911614156101b45760018190555b5b5b505600a165627a7a7230582052a54148a8569aa50cb818a633acc2d6da82363ef1abf9cb0c42e51e5f8541a10029", + "networks": {}, + "schema_version": "0.0.5", + "updated_at": 1509347312650 +} \ No newline at end of file diff --git a/build/contracts/Presale.json b/build/contracts/Presale.json new file mode 100644 index 0000000..c8d5415 --- /dev/null +++ b/build/contracts/Presale.json @@ -0,0 +1,305 @@ +{ + "contract_name": "Presale", + "abi": [ + { + "constant": false, + "inputs": [], + "name": "destroyContract", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "stage1Start", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "buyingPrice", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "stage1Bonus", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_presaleBonus", + "type": "uint256" + }, + { + "name": "_stage1Bonus", + "type": "uint256" + }, + { + "name": "_stage2Bonus", + "type": "uint256" + }, + { + "name": "_stage3Bonus", + "type": "uint256" + }, + { + "name": "_stage4Bonus", + "type": "uint256" + } + ], + "name": "changeBonus", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "withdrawEther", + "outputs": [ + { + "name": "success", + "type": "bool" + } + ], + "payable": true, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "stage4Bonus", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "presaleBonus", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "stage4Start", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_buyingPrice", + "type": "uint256" + } + ], + "name": "changeBuyingPrice", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "saleEnd", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "stage3Bonus", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "stage2Bonus", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "presaleStart", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_presaleStart", + "type": "uint256" + }, + { + "name": "_stage1Start", + "type": "uint256" + }, + { + "name": "_stage2Start", + "type": "uint256" + }, + { + "name": "_stage3Start", + "type": "uint256" + }, + { + "name": "_stage4Start", + "type": "uint256" + }, + { + "name": "_saleEnd", + "type": "uint256" + } + ], + "name": "changeTiming", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "stage3Start", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "stage2Start", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "inputs": [], + "payable": false, + "type": "constructor" + }, + { + "payable": true, + "type": "fallback" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_from", + "type": "address" + }, + { + "indexed": true, + "name": "_to", + "type": "address" + }, + { + "indexed": false, + "name": "_value", + "type": "uint256" + } + ], + "name": "EtherTransfer", + "type": "event" + } + ], + "unlinked_binary": "0x6060604052341561000f57600080fd5b5b5b60008054600160a060020a03191633600160a060020a03161790555b6359e3f680600155635a12c3c0600255635a1ff2c0600355635a2d21c0600455635a3a50c0600555635a477fc0600655603260075560196008556014600955600f600a908155600b556611c37937e08000600c555b5b610624806100926000396000f300606060405236156100f95763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663092a5cce81146101b65780630c087bc5146101cb578063399c0425146101f05780633ae344031461021557806341a4c5bf1461023a5780637362377b1461025e5780638703e5061461027a5780638da5cb5b1461029f57806399cb0823146102ce578063a9875d70146102f3578063be4c45d514610318578063c10b935814610330578063d5b3684514610355578063dc3228021461037a578063de8801e51461039f578063e628dbf9146103c4578063f90e292c146103eb578063fef636a814610410575b5b6000600c543481151561010957fe5b0490504260015410801561011e575042600254115b1561013e576801a055690d9db8000034101561013957600080fd5b61016d565b42600254108015610150575042600654115b1561016857601481101561013957600080fd5b61016d565b600080fd5b5b600054600160a060020a039081169033167f1c6b7c1dea17aff2728e18224d371cfd5fb0c7c451a86314957d8a6f66dcf7813460405190815260200160405180910390a35b50005b34156101c157600080fd5b6101c9610435565b005b34156101d657600080fd5b6101de61045d565b60405190815260200160405180910390f35b34156101fb57600080fd5b6101de610463565b60405190815260200160405180910390f35b341561022057600080fd5b6101de610469565b60405190815260200160405180910390f35b341561024557600080fd5b6101c960043560243560443560643560843561046f565b005b6102666104ac565b604051901515815260200160405180910390f35b341561028557600080fd5b6101de61054b565b60405190815260200160405180910390f35b34156102aa57600080fd5b6102b2610551565b604051600160a060020a03909116815260200160405180910390f35b34156102d957600080fd5b6101de610560565b60405190815260200160405180910390f35b34156102fe57600080fd5b6101de610566565b60405190815260200160405180910390f35b341561032357600080fd5b6101c960043561056c565b005b341561033b57600080fd5b6101de610591565b60405190815260200160405180910390f35b341561036057600080fd5b6101de610597565b60405190815260200160405180910390f35b341561038557600080fd5b6101de61059d565b60405190815260200160405180910390f35b34156103aa57600080fd5b6101de6105a3565b60405190815260200160405180910390f35b34156103cf57600080fd5b6101c960043560243560443560643560843560a4356105a9565b005b34156103f657600080fd5b6101de6105ec565b60405190815260200160405180910390f35b341561041b57600080fd5b6101de6105f2565b60405190815260200160405180910390f35b60005433600160a060020a039081169116141561045a57600054600160a060020a0316ff5b5b565b60025481565b600c5481565b60085481565b60005433600160a060020a0390811691161461048a57600080fd5b600785905560088490556009839055600a829055600b8190555b5b5050505050565b6000805433600160a060020a039081169116146104c857600080fd5b600054600160a060020a039081169030163180156108fc0290604051600060405180830381858888f19350505050151561050157600080fd5b600160a060020a033381169030167f1c6b7c1dea17aff2728e18224d371cfd5fb0c7c451a86314957d8a6f66dcf781813160405190815260200160405180910390a35060015b5b90565b600b5481565b600054600160a060020a031681565b60075481565b60055481565b60005433600160a060020a0390811691161461058757600080fd5b600c8190555b5b50565b60065481565b600a5481565b60095481565b60015481565b60005433600160a060020a039081169116146105c457600080fd5b6001869055600285905560038490556004839055600582905560068190555b5b505050505050565b60045481565b600354815600a165627a7a723058204ee7349e4823029e201d2641a8d09de97c5d0a8b16b67224ef3ee19317decb530029", + "networks": {}, + "schema_version": "0.0.5", + "updated_at": 1509347240995 +} \ No newline at end of file diff --git a/build/contracts/SafeMath.json b/build/contracts/SafeMath.json new file mode 100644 index 0000000..0331030 --- /dev/null +++ b/build/contracts/SafeMath.json @@ -0,0 +1,8 @@ +{ + "contract_name": "SafeMath", + "abi": [], + "unlinked_binary": "0x60606040523415600e57600080fd5b5b603680601c6000396000f30060606040525b600080fd00a165627a7a7230582052ccb341a19d1b9b387e614d47e970f9f7fe17a68092f52d21593068e96b0f4c0029", + "networks": {}, + "schema_version": "0.0.5", + "updated_at": 1509347240995 +} \ No newline at end of file diff --git a/build/contracts/owned.json b/build/contracts/owned.json new file mode 100644 index 0000000..a7b561a --- /dev/null +++ b/build/contracts/owned.json @@ -0,0 +1,27 @@ +{ + "contract_name": "owned", + "abi": [ + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "type": "function" + }, + { + "inputs": [], + "payable": false, + "type": "constructor" + } + ], + "unlinked_binary": "0x6060604052341561000f57600080fd5b5b60008054600160a060020a03191633600160a060020a03161790555b5b60bd8061003b6000396000f300606060405263ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416638da5cb5b8114603c575b600080fd5b3415604657600080fd5b604c6075565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b60005473ffffffffffffffffffffffffffffffffffffffff16815600a165627a7a72305820bd86def6ac7551c36b5e25addac1c2904b09eadb239e9e88da16729f17597ad80029", + "networks": {}, + "schema_version": "0.0.5", + "updated_at": 1509347791495 +} \ No newline at end of file diff --git a/contracts/BasicToken.sol b/contracts/BasicToken.sol new file mode 100644 index 0000000..9f21fb9 --- /dev/null +++ b/contracts/BasicToken.sol @@ -0,0 +1,97 @@ +pragma solidity ^0.4.16; + +import "./Owner.sol"; +import "./SafeMath.sol"; + +contract BasicToken is owned { + using SafeMath for uint256; + + // Token Variables Initialization + string public constant name = "Valorem"; + string public constant symbol = "VLR"; + uint8 public constant decimals = 18; + + uint256 public totalSupply; + uint256 constant initialSupply = 200000000 * (10 ** uint256(decimals)); + + address public reserveAccount; + address public bountyAccount; + + uint256 reserveToken; + uint256 bountyToken; + + mapping (address => bool) public frozenAccount; + mapping (address => uint256) public balanceOf; + + event Burn(address indexed _from,uint256 _value); + event FrozenFunds(address _account, bool _frozen); + event Transfer(address indexed _from,address indexed _to,uint256 _value); + + function BasicToken () { + totalSupply = initialSupply; + balanceOf[msg.sender] = initialSupply; + + bountyTransfers(); + } + + function bountyTransfers() internal { + reserveAccount = 0x000f1505CdAEb27197FB652FB2b1fef51cdc524e; + bountyAccount = 0x00892214999FdE327D81250407e96Afc76D89CB9; + + reserveToken = ( totalSupply * 25 ) / 100; + bountyToken = ( reserveToken * 7 ) / 100; + + balanceOf[msg.sender] = totalSupply - reserveToken; + balanceOf[bountyAccount] = bountyToken; + reserveToken = reserveToken - bountyToken; + balanceOf[reserveAccount] = reserveToken; + + Transfer(msg.sender,reserveAccount,reserveToken); + Transfer(msg.sender,bountyAccount,bountyToken); + } + + function _transfer(address _from,address _to,uint256 _value) internal { + require(balanceOf[_from] > _value); + require(!frozenAccount[_from]); + require(!frozenAccount[_to]); + + balanceOf[_from] = balanceOf[_from].sub(_value); + balanceOf[_to] = balanceOf[_to].add(_value); + Transfer(_from, _to, _value); + } + + function transfer(address _to,uint256 _value) { + _transfer(msg.sender, _to, _value); + } + + function freezeAccount(address _account, bool _frozen) onlyOwner { + frozenAccount[_account] = _frozen; + FrozenFunds(_account, _frozen); + } + + function burnTokens(uint256 _value) onlyOwner returns (bool success) { + require(balanceOf[msg.sender] > _value); + + balanceOf[msg.sender] = balanceOf[msg.sender].add(_value); + totalSupply = totalSupply.sub(_value); + Burn(msg.sender,_value); + + return true; + } + + function newTokens(address _owner, uint256 _value) onlyOwner { + balanceOf[_owner] = balanceOf[_owner].add(_value); + totalSupply = totalSupply.add(_value); + Transfer(this, _owner, _value); + } + + function escrowAmount(address _account, uint256 _value) onlyOwner { + _transfer(msg.sender, _account, _value); + freezeAccount(_account, true); + } + + function () { + revert(); + } + +} \ No newline at end of file diff --git a/contracts/Migrations.sol b/contracts/Migrations.sol new file mode 100644 index 0000000..a834043 --- /dev/null +++ b/contracts/Migrations.sol @@ -0,0 +1,24 @@ +pragma solidity ^0.4.16; + +contract Migrations { + address public owner; + uint public last_completed_migration; + + modifier restricted() { + if (msg.sender == owner) + _; + } + + function Migrations() { + owner = msg.sender; + } + + function setCompleted(uint completed) restricted { + last_completed_migration = completed; + } + + function upgrade(address new_address) restricted { + Migrations upgraded = Migrations(new_address); + upgraded.setCompleted(last_completed_migration); + } +} diff --git a/contracts/Owner.sol b/contracts/Owner.sol new file mode 100644 index 0000000..e657849 --- /dev/null +++ b/contracts/Owner.sol @@ -0,0 +1,16 @@ +pragma solidity ^0.4.16; + +contract owned { + address public owner; + + function owned() { + owner = msg.sender; + } + + modifier onlyOwner { + if (msg.sender != owner) { + revert(); + } + _; + } +} \ No newline at end of file diff --git a/contracts/Presale.sol b/contracts/Presale.sol new file mode 100644 index 0000000..5e73af2 --- /dev/null +++ b/contracts/Presale.sol @@ -0,0 +1,90 @@ +pragma solidity ^0.4.16; + +import "./Owner.sol"; +import "./SafeMath.sol"; + +contract Presale is owned { + + uint public presaleStart; + uint public stage1Start; + uint public stage2Start; + uint public stage3Start; + uint public stage4Start; + uint public saleEnd; + + uint256 public presaleBonus; + uint256 public stage1Bonus; + uint256 public stage2Bonus; + uint256 public stage3Bonus; + uint256 public stage4Bonus; + + uint256 public buyingPrice; + + function Presale() { + presaleStart = 1508112000; // 16 Oct + stage1Start = 1511179200; // 20 Nov + stage2Start = 1512043200; // 30 Nov + stage3Start = 1512907200; // 10 Dec + stage4Start = 1513771200; // 20 Dec + saleEnd = 1514635200; // 30 Dec + + presaleBonus = 50; + stage1Bonus = 25; + stage2Bonus = 20; + stage3Bonus = 15; + stage4Bonus = 10; + + buyingPrice = 5000000000000000; // 1 ETH = 200 VLR + } + + event EtherTransfer(address indexed _from,address indexed _to,uint256 _value); + + function changeTiming(uint _presaleStart,uint _stage1Start,uint _stage2Start,uint _stage3Start,uint _stage4Start,uint _saleEnd) onlyOwner { + presaleStart = _presaleStart; + stage1Start = _stage1Start; + stage2Start = _stage2Start; + stage3Start = _stage3Start; + stage4Start = _stage4Start; + saleEnd = _saleEnd; + } + + function changeBonus(uint256 _presaleBonus,uint256 _stage1Bonus,uint256 _stage2Bonus,uint256 _stage3Bonus,uint256 _stage4Bonus) onlyOwner { + presaleBonus = _presaleBonus; + stage1Bonus = _stage1Bonus; + stage2Bonus = _stage2Bonus; + stage3Bonus = _stage3Bonus; + stage4Bonus = _stage4Bonus; + } + + function changeBuyingPrice(uint256 _buyingPrice) onlyOwner { + buyingPrice = _buyingPrice; + } + + function withdrawEther() onlyOwner payable returns (bool success) { + require(owner.send(this.balance)); + + EtherTransfer(this, msg.sender, this.balance); + return true; + } + + function destroyContract() { + if (msg.sender == owner) { + selfdestruct(owner); + } + } + + function () payable { + uint256 tokens = msg.value / buyingPrice; + + if (presaleStart < now && stage1Start > now) { + require(msg.value >= 30 ether); + } else if (stage1Start < now && saleEnd > now) { + require(tokens >= 20); + } else { + revert(); + } + + EtherTransfer(msg.sender, owner, msg.value); + } + +} diff --git a/contracts/SafeMath.sol b/contracts/SafeMath.sol new file mode 100644 index 0000000..13acafb --- /dev/null +++ b/contracts/SafeMath.sol @@ -0,0 +1,25 @@ +pragma solidity ^0.4.16; + +library SafeMath { + function mul(uint256 a, uint256 b) internal constant returns (uint256) { + uint256 c = a * b; + assert(a == 0 || c / a == b); + return c; + } + + function div(uint256 a, uint256 b) internal constant returns (uint256) { + uint256 c = a / b; + return c; + } + + function sub(uint256 a, uint256 b) internal constant returns (uint256) { + assert(b <= a); + return a - b; + } + + function add(uint256 a, uint256 b) internal constant returns (uint256) { + uint256 c = a + b; + assert(c >= a); + return c; + } +} diff --git a/migrations/1_initial_migration.js b/migrations/1_initial_migration.js new file mode 100644 index 0000000..4d5f3f9 --- /dev/null +++ b/migrations/1_initial_migration.js @@ -0,0 +1,5 @@ +var Migrations = artifacts.require("./Migrations.sol"); + +module.exports = function(deployer) { + deployer.deploy(Migrations); +}; diff --git a/migrations/2_token_migration.js b/migrations/2_token_migration.js new file mode 100644 index 0000000..0e778cb --- /dev/null +++ b/migrations/2_token_migration.js @@ -0,0 +1,9 @@ +var BasicToken = artifacts.require("./BasicToken.sol"); +var Owner = artifacts.require("./Owner.sol"); +var SafeMath = reartifacts.quire("./SafeMath.sol"); + +module.exports = function (deployer) { + deployer.deploy(BasicToken); + deployer.link(BasicToken,Owner); + deployer.link(BasicToken,SafeMath); +}; \ No newline at end of file diff --git a/migrations/3_presale_migration.js b/migrations/3_presale_migration.js new file mode 100644 index 0000000..9a1e5be --- /dev/null +++ b/migrations/3_presale_migration.js @@ -0,0 +1,9 @@ +var Presale = artifacts.require("./Presale.sol"); +var Owner = artifacts.require("./Owner.sol"); +var SafeMath = reartifacts.quire("./SafeMath.sol"); + +module.exports = function (deployer) { + deployer.deploy(Presale); + deployer.link(BasicToken, Owner); + deployer.link(BasicToken, SafeMath); +}; \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..a107f59 --- /dev/null +++ b/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "zeppelin-solidity": "^1.3.0" + } +} diff --git a/truffle-config.js b/truffle-config.js new file mode 100644 index 0000000..6275961 --- /dev/null +++ b/truffle-config.js @@ -0,0 +1,9 @@ +module.exports = { + networks: { + development: { + host: "52.15.191.107", + port: 8545, + network_id: "*" // Match any network id + } + } +};