From e143f872da40aff2bcb391892a181fe29071d2e4 Mon Sep 17 00:00:00 2001 From: karan Date: Wed, 5 Dec 2018 21:02:01 +0530 Subject: [PATCH 1/3] airdrop changes --- .gitignore | 2 ++ contracts/AirDrop.sol | 13 ++++++++++++- migrations/2_deploy_contracts.js | 7 ++++--- package.json | 3 ++- truffle.js | 10 ++++++++++ 5 files changed, 30 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 123ae94..4047351 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,5 @@ build/Release # Dependency directory # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git node_modules +package-lock.json +build/ diff --git a/contracts/AirDrop.sol b/contracts/AirDrop.sol index f7aa506..7b6ea68 100644 --- a/contracts/AirDrop.sol +++ b/contracts/AirDrop.sol @@ -59,7 +59,7 @@ contract AirDrop is Ownable { } /* - Airdrop function which take up a array of address,token amount and eth amount and call the + Airdrop function which take up a array of address, single token amount and eth amount and call the transfer function to send the token plus send eth to the address is balance is 0 */ function doAirDrop(address[] _address, uint256 _amount, uint256 _ethAmount) onlyOwner public returns (bool) { @@ -75,6 +75,17 @@ contract AirDrop is Ownable { } } + /* + Airdrop function which take up a array of address, indvidual token amount and eth amount + */ + function sendBatch(address[] _recipients, uint[] _values) onlyOwner public returns (bool) { + require(_recipients.length == _values.length); + for (uint i = 0; i < _values.length; i++) { + tokenInstance.transfer(_recipients[i], _values[i]); + } + return true; + } + function transferEthToOnwer() onlyOwner public returns (bool) { require(owner.send(this.balance)); diff --git a/migrations/2_deploy_contracts.js b/migrations/2_deploy_contracts.js index 3b1556d..a5b5988 100644 --- a/migrations/2_deploy_contracts.js +++ b/migrations/2_deploy_contracts.js @@ -3,9 +3,10 @@ var AirDrop = artifacts.require("./AirDrop.sol"); var SpringToken = artifacts.require("./SPRINGToken.sol"); var Attestation = artifacts.require("./Attestation.sol"); -module.exports = function(deployer,network,accounts) { - deployer.deploy(SpringToken,1000000).then(function() { - return deployer.deploy(AirDrop, SpringToken.address); +module.exports = function(deployer, network, accounts) { + deployer.deploy(SpringToken, 1000000) + .then(function() { + return deployer.deploy(AirDrop, 0x1d08d05638a2a006707cec99dba40aae3b9d54fc); }).then(function() { return deployer.deploy(VanityURL); }).then(function() { diff --git a/package.json b/package.json index 67a5d66..6591086 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,8 @@ }, "dependencies": { "solc": "^0.4.25", - "truffle": "^4.1.14" + "truffle": "^4.1.14", + "truffle-hdwallet-provider-privkey": "^0.3.0" }, "devDependencies": {}, "scripts": { diff --git a/truffle.js b/truffle.js index efdb253..793a184 100644 --- a/truffle.js +++ b/truffle.js @@ -1,3 +1,5 @@ +var HDWalletProvider = require("truffle-hdwallet-provider-privkey"); + module.exports = { networks: { development: { @@ -5,6 +7,14 @@ module.exports = { port: 8545, gas: 6721975, network_id: "*" // Match any network id + }, + ropsten: { + provider: function() { + return new HDWalletProvider(["87BAA9CC66610DA8466516EFC29A6AFC167113EAEAE907637874A4F9AF01868F"], + "https://ropsten.infura.io/BbBlRVGSUuAagrvyIjdr") + }, + network_id: 3, + gas: 4600000 } } }; From 5c4d1d26c7b5af7f5bf645269332f174de295265 Mon Sep 17 00:00:00 2001 From: karan Date: Wed, 5 Dec 2018 22:12:58 +0530 Subject: [PATCH 2/3] fixed hard code --- migrations/2_deploy_contracts.js | 2 +- truffle.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/migrations/2_deploy_contracts.js b/migrations/2_deploy_contracts.js index a5b5988..bf39089 100644 --- a/migrations/2_deploy_contracts.js +++ b/migrations/2_deploy_contracts.js @@ -6,7 +6,7 @@ var Attestation = artifacts.require("./Attestation.sol"); module.exports = function(deployer, network, accounts) { deployer.deploy(SpringToken, 1000000) .then(function() { - return deployer.deploy(AirDrop, 0x1d08d05638a2a006707cec99dba40aae3b9d54fc); + return deployer.deploy(AirDrop, SpringToken); }).then(function() { return deployer.deploy(VanityURL); }).then(function() { diff --git a/truffle.js b/truffle.js index 793a184..9bb8260 100644 --- a/truffle.js +++ b/truffle.js @@ -10,8 +10,8 @@ module.exports = { }, ropsten: { provider: function() { - return new HDWalletProvider(["87BAA9CC66610DA8466516EFC29A6AFC167113EAEAE907637874A4F9AF01868F"], - "https://ropsten.infura.io/BbBlRVGSUuAagrvyIjdr") + return new HDWalletProvider([""], + "https://ropsten.infura.io/") }, network_id: 3, gas: 4600000 From a8a6d59e4e3065c278918c42e1103b9d1f2125a8 Mon Sep 17 00:00:00 2001 From: karan Date: Wed, 5 Dec 2018 22:16:29 +0530 Subject: [PATCH 3/3] fixed hard code --- migrations/2_deploy_contracts.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/migrations/2_deploy_contracts.js b/migrations/2_deploy_contracts.js index bf39089..83a729d 100644 --- a/migrations/2_deploy_contracts.js +++ b/migrations/2_deploy_contracts.js @@ -4,9 +4,9 @@ var SpringToken = artifacts.require("./SPRINGToken.sol"); var Attestation = artifacts.require("./Attestation.sol"); module.exports = function(deployer, network, accounts) { - deployer.deploy(SpringToken, 1000000) + deployer.deploy(SpringToken, 1000000) .then(function() { - return deployer.deploy(AirDrop, SpringToken); + return deployer.deploy(AirDrop, SpringToken.address); }).then(function() { return deployer.deploy(VanityURL); }).then(function() {