Skip to content

Commit 9b9ffc4

Browse files
authored
Merge pull request #36 from SpringRole/karan/airdrop/changes
airdrop changes
2 parents 9558cd2 + a8a6d59 commit 9b9ffc4

File tree

5 files changed

+29
-4
lines changed

5 files changed

+29
-4
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@ build/Release
2525
# Dependency directory
2626
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
2727
node_modules
28+
package-lock.json
29+
build/

contracts/AirDrop.sol

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ contract AirDrop is Ownable {
5959
}
6060

6161
/*
62-
Airdrop function which take up a array of address,token amount and eth amount and call the
62+
Airdrop function which take up a array of address, single token amount and eth amount and call the
6363
transfer function to send the token plus send eth to the address is balance is 0
6464
*/
6565
function doAirDrop(address[] _address, uint256 _amount, uint256 _ethAmount) onlyOwner public returns (bool) {
@@ -75,6 +75,17 @@ contract AirDrop is Ownable {
7575
}
7676
}
7777

78+
/*
79+
Airdrop function which take up a array of address, indvidual token amount and eth amount
80+
*/
81+
function sendBatch(address[] _recipients, uint[] _values) onlyOwner public returns (bool) {
82+
require(_recipients.length == _values.length);
83+
for (uint i = 0; i < _values.length; i++) {
84+
tokenInstance.transfer(_recipients[i], _values[i]);
85+
}
86+
return true;
87+
}
88+
7889

7990
function transferEthToOnwer() onlyOwner public returns (bool) {
8091
require(owner.send(this.balance));

migrations/2_deploy_contracts.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ var AirDrop = artifacts.require("./AirDrop.sol");
33
var SpringToken = artifacts.require("./SPRINGToken.sol");
44
var Attestation = artifacts.require("./Attestation.sol");
55

6-
module.exports = function(deployer,network,accounts) {
7-
deployer.deploy(SpringToken,1000000).then(function() {
6+
module.exports = function(deployer, network, accounts) {
7+
deployer.deploy(SpringToken, 1000000)
8+
.then(function() {
89
return deployer.deploy(AirDrop, SpringToken.address);
910
}).then(function() {
1011
return deployer.deploy(VanityURL);

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
},
99
"dependencies": {
1010
"solc": "^0.4.25",
11-
"truffle": "^4.1.14"
11+
"truffle": "^4.1.14",
12+
"truffle-hdwallet-provider-privkey": "^0.3.0"
1213
},
1314
"devDependencies": {},
1415
"scripts": {

truffle.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
1+
var HDWalletProvider = require("truffle-hdwallet-provider-privkey");
2+
13
module.exports = {
24
networks: {
35
development: {
46
host: "localhost",
57
port: 8545,
68
gas: 6721975,
79
network_id: "*" // Match any network id
10+
},
11+
ropsten: {
12+
provider: function() {
13+
return new HDWalletProvider(["<Priv key goes here>"],
14+
"https://ropsten.infura.io/<Infura pub key>")
15+
},
16+
network_id: 3,
17+
gas: 4600000
818
}
919
}
1020
};

0 commit comments

Comments
 (0)