From 4f85e0be7ad1d27bdcb5911021e58db90adad08f Mon Sep 17 00:00:00 2001 From: Roman Storm Date: Tue, 19 Jun 2018 23:16:18 -0700 Subject: [PATCH] changes --- README.md | 2 +- contracts/contracts/DeprecatedStormSender.sol | 4 +- contracts/contracts/EternalStorage.sol | 4 +- ...EternalStorageProxyForStormMultisender.sol | 4 +- contracts/contracts/Migrations.sol | 2 +- .../contracts/OwnedUpgradeabilityProxy.sol | 4 +- .../contracts/OwnedUpgradeabilityStorage.sol | 4 +- contracts/contracts/Proxy.sol | 4 +- contracts/contracts/SafeMath.sol | 4 +- .../contracts/UpgradeabilityOwnerStorage.sol | 4 +- contracts/contracts/UpgradeabilityProxy.sol | 4 +- contracts/contracts/UpgradeabilityStorage.sol | 4 +- contracts/contracts/multisender/Claimable.sol | 4 +- contracts/contracts/multisender/Ownable.sol | 4 +- .../multisender/UpgradebleStormSender.sol | 36 +- ...alStorageProxyForStormMultisender_flat.sol | 14 +- .../flats/UpgradebleStormSender_flat.sol | 71 ++-- contracts/package-lock.json | 14 +- contracts/package.json | 2 +- package.json | 4 +- public/index.html | 5 +- src/App.js | 3 +- src/abis/StormMultisender.json | 380 +++++++++++++++++- src/components/4.js | 1 + src/components/Header.js | 2 +- src/components/Retry.js | 77 ++++ src/components/index.js | 3 +- src/getWeb3.js | 2 +- src/stores/tokenStore.js | 16 +- src/stores/txStore.js | 37 +- src/stores/web3Store.js | 6 +- 31 files changed, 617 insertions(+), 108 deletions(-) create mode 100644 src/components/Retry.js diff --git a/README.md b/README.md index 08919255..3093e0e6 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ This Dapp allows a user to send thousands of token transfers in a very effecient 2. Make sure you have an account in MetaMask which has a token balance. 3. Make sure your MetaMask is pointed to the network that you would like to use. 4. Make sure your MetaMask account is unlocked. -5. Go to https://poanetwork.github.io/multisender/#/ +5. Go to https://rstormsf.github.io/multisender/#/ 6. Wait for the full page to load. 7. Select a token from the dropdown that you would like to send. 8. Provide either JSON or CSV text in the textarea (see example below). diff --git a/contracts/contracts/DeprecatedStormSender.sol b/contracts/contracts/DeprecatedStormSender.sol index f43719c3..28e92b35 100644 --- a/contracts/contracts/DeprecatedStormSender.sol +++ b/contracts/contracts/DeprecatedStormSender.sol @@ -1,6 +1,6 @@ // Roman Storm Multi Sender -// To Use this Dapp: https://poanetwork.github.io/multisender -pragma solidity 0.4.19; +// To Use this Dapp: https://rstormsf.github.io/multisender +pragma solidity 0.4.23; /** diff --git a/contracts/contracts/EternalStorage.sol b/contracts/contracts/EternalStorage.sol index 43e81bf3..7c6d09be 100644 --- a/contracts/contracts/EternalStorage.sol +++ b/contracts/contracts/EternalStorage.sol @@ -1,6 +1,6 @@ // Roman Storm Multi Sender -// To Use this Dapp: https://poanetwork.github.io/multisender -pragma solidity 0.4.19; +// To Use this Dapp: https://rstormsf.github.io/multisender +pragma solidity 0.4.23; /** diff --git a/contracts/contracts/EternalStorageProxyForStormMultisender.sol b/contracts/contracts/EternalStorageProxyForStormMultisender.sol index 7e3837fa..c8ec62f0 100644 --- a/contracts/contracts/EternalStorageProxyForStormMultisender.sol +++ b/contracts/contracts/EternalStorageProxyForStormMultisender.sol @@ -1,6 +1,6 @@ // Roman Storm Multi Sender -// To Use this Dapp: https://poanetwork.github.io/multisender -pragma solidity 0.4.19; +// To Use this Dapp: https://rstormsf.github.io/multisender +pragma solidity 0.4.23; import "./EternalStorage.sol"; import "./OwnedUpgradeabilityProxy.sol"; diff --git a/contracts/contracts/Migrations.sol b/contracts/contracts/Migrations.sol index 52c6d26d..2d85fdfe 100644 --- a/contracts/contracts/Migrations.sol +++ b/contracts/contracts/Migrations.sol @@ -1,5 +1,5 @@ // Roman Storm Multi Sender -// To Use this Dapp: https://poanetwork.github.io/multisender +// To Use this Dapp: https://rstormsf.github.io/multisender pragma solidity ^0.4.17; contract Migrations { diff --git a/contracts/contracts/OwnedUpgradeabilityProxy.sol b/contracts/contracts/OwnedUpgradeabilityProxy.sol index 175ef362..4b03727c 100644 --- a/contracts/contracts/OwnedUpgradeabilityProxy.sol +++ b/contracts/contracts/OwnedUpgradeabilityProxy.sol @@ -1,6 +1,6 @@ // Roman Storm Multi Sender -// To Use this Dapp: https://poanetwork.github.io/multisender -pragma solidity 0.4.19; +// To Use this Dapp: https://rstormsf.github.io/multisender +pragma solidity 0.4.23; import "./UpgradeabilityProxy.sol"; import "./UpgradeabilityOwnerStorage.sol"; diff --git a/contracts/contracts/OwnedUpgradeabilityStorage.sol b/contracts/contracts/OwnedUpgradeabilityStorage.sol index ca42c4b3..105d741d 100644 --- a/contracts/contracts/OwnedUpgradeabilityStorage.sol +++ b/contracts/contracts/OwnedUpgradeabilityStorage.sol @@ -1,6 +1,6 @@ // Roman Storm Multi Sender -// To Use this Dapp: https://poanetwork.github.io/multisender -pragma solidity 0.4.19; +// To Use this Dapp: https://rstormsf.github.io/multisender +pragma solidity 0.4.23; import "./EternalStorage.sol"; import "./UpgradeabilityStorage.sol"; diff --git a/contracts/contracts/Proxy.sol b/contracts/contracts/Proxy.sol index f0ad9c62..013f6af1 100644 --- a/contracts/contracts/Proxy.sol +++ b/contracts/contracts/Proxy.sol @@ -1,6 +1,6 @@ // Roman Storm Multi Sender -// To Use this Dapp: https://poanetwork.github.io/multisender -pragma solidity 0.4.19; +// To Use this Dapp: https://rstormsf.github.io/multisender +pragma solidity 0.4.23; /** diff --git a/contracts/contracts/SafeMath.sol b/contracts/contracts/SafeMath.sol index c2dff728..1c81d4a0 100644 --- a/contracts/contracts/SafeMath.sol +++ b/contracts/contracts/SafeMath.sol @@ -1,6 +1,6 @@ // Roman Storm Multi Sender -// To Use this Dapp: https://poanetwork.github.io/multisender -pragma solidity 0.4.19; +// To Use this Dapp: https://rstormsf.github.io/multisender +pragma solidity 0.4.23; /** diff --git a/contracts/contracts/UpgradeabilityOwnerStorage.sol b/contracts/contracts/UpgradeabilityOwnerStorage.sol index bf8442b0..f2c2600f 100644 --- a/contracts/contracts/UpgradeabilityOwnerStorage.sol +++ b/contracts/contracts/UpgradeabilityOwnerStorage.sol @@ -1,6 +1,6 @@ // Roman Storm Multi Sender -// To Use this Dapp: https://poanetwork.github.io/multisender -pragma solidity 0.4.19; +// To Use this Dapp: https://rstormsf.github.io/multisender +pragma solidity 0.4.23; /** diff --git a/contracts/contracts/UpgradeabilityProxy.sol b/contracts/contracts/UpgradeabilityProxy.sol index 0af68009..418fb162 100644 --- a/contracts/contracts/UpgradeabilityProxy.sol +++ b/contracts/contracts/UpgradeabilityProxy.sol @@ -1,6 +1,6 @@ // Roman Storm Multi Sender -// To Use this Dapp: https://poanetwork.github.io/multisender -pragma solidity 0.4.19; +// To Use this Dapp: https://rstormsf.github.io/multisender +pragma solidity 0.4.23; import "./Proxy.sol"; import "./UpgradeabilityStorage.sol"; diff --git a/contracts/contracts/UpgradeabilityStorage.sol b/contracts/contracts/UpgradeabilityStorage.sol index df6f3d9d..b9fb5b29 100644 --- a/contracts/contracts/UpgradeabilityStorage.sol +++ b/contracts/contracts/UpgradeabilityStorage.sol @@ -1,6 +1,6 @@ // Roman Storm Multi Sender -// To Use this Dapp: https://poanetwork.github.io/multisender -pragma solidity 0.4.19; +// To Use this Dapp: https://rstormsf.github.io/multisender +pragma solidity 0.4.23; /** diff --git a/contracts/contracts/multisender/Claimable.sol b/contracts/contracts/multisender/Claimable.sol index 2577c322..63801664 100644 --- a/contracts/contracts/multisender/Claimable.sol +++ b/contracts/contracts/multisender/Claimable.sol @@ -1,6 +1,6 @@ // Roman Storm Multi Sender -// To Use this Dapp: https://poanetwork.github.io/multisender -pragma solidity 0.4.19; +// To Use this Dapp: https://rstormsf.github.io/multisender +pragma solidity 0.4.23; import "./Ownable.sol"; import "../EternalStorage.sol"; diff --git a/contracts/contracts/multisender/Ownable.sol b/contracts/contracts/multisender/Ownable.sol index d28d796f..305a6c38 100644 --- a/contracts/contracts/multisender/Ownable.sol +++ b/contracts/contracts/multisender/Ownable.sol @@ -1,6 +1,6 @@ // Roman Storm Multi Sender -// To Use this Dapp: https://poanetwork.github.io/multisender -pragma solidity 0.4.19; +// To Use this Dapp: https://rstormsf.github.io/multisender +pragma solidity 0.4.23; import "../EternalStorage.sol"; diff --git a/contracts/contracts/multisender/UpgradebleStormSender.sol b/contracts/contracts/multisender/UpgradebleStormSender.sol index f398b31d..37180c91 100644 --- a/contracts/contracts/multisender/UpgradebleStormSender.sol +++ b/contracts/contracts/multisender/UpgradebleStormSender.sol @@ -1,6 +1,6 @@ // Roman Storm Multi Sender -// To Use this Dapp: https://poanetwork.github.io/multisender -pragma solidity 0.4.19; +// To Use this Dapp: https://rstormsf.github.io/multisender +pragma solidity 0.4.23; import "../OwnedUpgradeabilityStorage.sol"; import "./Claimable.sol"; @@ -100,16 +100,36 @@ contract UpgradebleStormSender is OwnedUpgradeabilityStorage, Claimable { } function multisendToken(address token, address[] _contributors, uint256[] _balances) public hasFee payable { - uint256 total = 0; + if (token == 0x000000000000000000000000000000000000bEEF){ + multisendEther(_contributors, _balances); + } else { + uint256 total = 0; + require(_contributors.length <= arrayLimit()); + ERC20 erc20token = ERC20(token); + uint8 i = 0; + for (i; i < _contributors.length; i++) { + erc20token.transferFrom(msg.sender, _contributors[i], _balances[i]); + total += _balances[i]; + } + setTxCount(msg.sender, txCount(msg.sender).add(1)); + Multisended(total, token); + } + } + + function multisendEther(address[] _contributors, uint256[] _balances) public payable { + uint256 total = msg.value; + uint256 fee = currentFee(msg.sender); + require(total >= fee); require(_contributors.length <= arrayLimit()); - ERC20 erc20token = ERC20(token); - uint8 i = 0; + total = total.sub(fee); + uint256 i = 0; for (i; i < _contributors.length; i++) { - erc20token.transferFrom(msg.sender, _contributors[i], _balances[i]); - total += _balances[i]; + require(total >= _balances[i]); + total = total.sub(_balances[i]); + _contributors[i].transfer(_balances[i]); } setTxCount(msg.sender, txCount(msg.sender).add(1)); - Multisended(total, token); + Multisended(msg.value, 0x000000000000000000000000000000000000bEEF); } function claimTokens(address _token) public onlyOwner { diff --git a/contracts/flats/EternalStorageProxyForStormMultisender_flat.sol b/contracts/flats/EternalStorageProxyForStormMultisender_flat.sol index 4135cc0b..08932d82 100644 --- a/contracts/flats/EternalStorageProxyForStormMultisender_flat.sol +++ b/contracts/flats/EternalStorageProxyForStormMultisender_flat.sol @@ -2,7 +2,7 @@ // File: contracts/EternalStorage.sol // Roman Storm Multi Sender -// To Use this Dapp: https://poanetwork.github.io/multisender +// To Use this Dapp: https://rstormsf.github.io/multisender pragma solidity 0.4.20; @@ -24,7 +24,7 @@ contract EternalStorage { // File: contracts/UpgradeabilityOwnerStorage.sol // Roman Storm Multi Sender -// To Use this Dapp: https://poanetwork.github.io/multisender +// To Use this Dapp: https://rstormsf.github.io/multisender pragma solidity 0.4.20; @@ -56,7 +56,7 @@ contract UpgradeabilityOwnerStorage { // File: contracts/Proxy.sol // Roman Storm Multi Sender -// To Use this Dapp: https://poanetwork.github.io/multisender +// To Use this Dapp: https://rstormsf.github.io/multisender pragma solidity 0.4.20; @@ -98,7 +98,7 @@ contract Proxy { // File: contracts/UpgradeabilityStorage.sol // Roman Storm Multi Sender -// To Use this Dapp: https://poanetwork.github.io/multisender +// To Use this Dapp: https://rstormsf.github.io/multisender pragma solidity 0.4.20; @@ -133,7 +133,7 @@ contract UpgradeabilityStorage { // File: contracts/UpgradeabilityProxy.sol // Roman Storm Multi Sender -// To Use this Dapp: https://poanetwork.github.io/multisender +// To Use this Dapp: https://rstormsf.github.io/multisender pragma solidity 0.4.20; @@ -167,7 +167,7 @@ contract UpgradeabilityProxy is Proxy, UpgradeabilityStorage { // File: contracts/OwnedUpgradeabilityProxy.sol // Roman Storm Multi Sender -// To Use this Dapp: https://poanetwork.github.io/multisender +// To Use this Dapp: https://rstormsf.github.io/multisender pragma solidity 0.4.20; @@ -244,7 +244,7 @@ contract OwnedUpgradeabilityProxy is UpgradeabilityOwnerStorage, UpgradeabilityP // File: contracts/EternalStorageProxyForStormMultisender.sol // Roman Storm Multi Sender -// To Use this Dapp: https://poanetwork.github.io/multisender +// To Use this Dapp: https://rstormsf.github.io/multisender pragma solidity 0.4.20; diff --git a/contracts/flats/UpgradebleStormSender_flat.sol b/contracts/flats/UpgradebleStormSender_flat.sol index 0c3385c5..378fe712 100644 --- a/contracts/flats/UpgradebleStormSender_flat.sol +++ b/contracts/flats/UpgradebleStormSender_flat.sol @@ -2,8 +2,8 @@ // File: contracts/EternalStorage.sol // Roman Storm Multi Sender -// To Use this Dapp: https://poanetwork.github.io/multisender -pragma solidity 0.4.20; +// To Use this Dapp: https://rstormsf.github.io/multisender +pragma solidity 0.4.24; /** @@ -24,8 +24,7 @@ contract EternalStorage { // File: contracts/UpgradeabilityOwnerStorage.sol // Roman Storm Multi Sender -// To Use this Dapp: https://poanetwork.github.io/multisender -pragma solidity 0.4.20; +// To Use this Dapp: https://rstormsf.github.io/multisender /** @@ -56,8 +55,7 @@ contract UpgradeabilityOwnerStorage { // File: contracts/UpgradeabilityStorage.sol // Roman Storm Multi Sender -// To Use this Dapp: https://poanetwork.github.io/multisender -pragma solidity 0.4.20; +// To Use this Dapp: https://rstormsf.github.io/multisender /** @@ -91,8 +89,7 @@ contract UpgradeabilityStorage { // File: contracts/OwnedUpgradeabilityStorage.sol // Roman Storm Multi Sender -// To Use this Dapp: https://poanetwork.github.io/multisender -pragma solidity 0.4.20; +// To Use this Dapp: https://rstormsf.github.io/multisender @@ -108,8 +105,7 @@ contract OwnedUpgradeabilityStorage is UpgradeabilityOwnerStorage, Upgradeabilit // File: contracts/SafeMath.sol // Roman Storm Multi Sender -// To Use this Dapp: https://poanetwork.github.io/multisender -pragma solidity 0.4.20; +// To Use this Dapp: https://rstormsf.github.io/multisender /** @@ -161,8 +157,7 @@ library SafeMath { // File: contracts/multisender/Ownable.sol // Roman Storm Multi Sender -// To Use this Dapp: https://poanetwork.github.io/multisender -pragma solidity 0.4.20; +// To Use this Dapp: https://rstormsf.github.io/multisender @@ -207,7 +202,7 @@ contract Ownable is EternalStorage { * @dev Sets a new owner address */ function setOwner(address newOwner) internal { - OwnershipTransferred(owner(), newOwner); + emit OwnershipTransferred(owner(), newOwner); addressStorage[keccak256("owner")] = newOwner; } } @@ -215,8 +210,7 @@ contract Ownable is EternalStorage { // File: contracts/multisender/Claimable.sol // Roman Storm Multi Sender -// To Use this Dapp: https://poanetwork.github.io/multisender -pragma solidity 0.4.20; +// To Use this Dapp: https://rstormsf.github.io/multisender @@ -252,7 +246,7 @@ contract Claimable is EternalStorage, Ownable { * @dev Allows the pendingOwner address to finalize the transfer. */ function claimOwnership() public onlyPendingOwner { - OwnershipTransferred(owner(), pendingOwner()); + emit OwnershipTransferred(owner(), pendingOwner()); addressStorage[keccak256("owner")] = addressStorage[keccak256("pendingOwner")]; addressStorage[keccak256("pendingOwner")] = address(0); } @@ -261,8 +255,7 @@ contract Claimable is EternalStorage, Ownable { // File: contracts/multisender/UpgradebleStormSender.sol // Roman Storm Multi Sender -// To Use this Dapp: https://poanetwork.github.io/multisender -pragma solidity 0.4.20; +// To Use this Dapp: https://rstormsf.github.io/multisender @@ -317,11 +310,11 @@ contract UpgradebleStormSender is OwnedUpgradeabilityStorage, Claimable { } function txCount(address customer) public view returns(uint256) { - return uintStorage[keccak256("txCount", customer)]; + return uintStorage[keccak256(abi.encodePacked("txCount", customer))]; } function arrayLimit() public view returns(uint256) { - return uintStorage[keccak256("arrayLimit")]; + return uintStorage[keccak256(abi.encodePacked("arrayLimit"))]; } function setArrayLimit(uint256 _newLimit) public onlyOwner { @@ -361,31 +354,51 @@ contract UpgradebleStormSender is OwnedUpgradeabilityStorage, Claimable { } function multisendToken(address token, address[] _contributors, uint256[] _balances) public hasFee payable { - uint256 total = 0; + if (token == 0x000000000000000000000000000000000000bEEF){ + multisendEther(_contributors, _balances); + } else { + uint256 total = 0; + require(_contributors.length <= arrayLimit()); + ERC20 erc20token = ERC20(token); + uint8 i = 0; + for (i; i < _contributors.length; i++) { + erc20token.transferFrom(msg.sender, _contributors[i], _balances[i]); + total += _balances[i]; + } + setTxCount(msg.sender, txCount(msg.sender).add(1)); + emit Multisended(total, token); + } + } + + function multisendEther(address[] _contributors, uint256[] _balances) public payable { + uint256 total = msg.value; + uint256 userfee = currentFee(msg.sender); + require(total >= userfee); require(_contributors.length <= arrayLimit()); - ERC20 erc20token = ERC20(token); - uint8 i = 0; + total = total.sub(userfee); + uint256 i = 0; for (i; i < _contributors.length; i++) { - erc20token.transferFrom(msg.sender, _contributors[i], _balances[i]); - total += _balances[i]; + require(total >= _balances[i]); + total = total.sub(_balances[i]); + _contributors[i].transfer(_balances[i]); } setTxCount(msg.sender, txCount(msg.sender).add(1)); - Multisended(total, token); + emit Multisended(msg.value, 0x000000000000000000000000000000000000bEEF); } function claimTokens(address _token) public onlyOwner { if (_token == 0x0) { - owner().transfer(this.balance); + owner().transfer(address(this).balance); return; } ERC20 erc20token = ERC20(_token); uint256 balance = erc20token.balanceOf(this); erc20token.transfer(owner(), balance); - ClaimedTokens(_token, owner(), balance); + emit ClaimedTokens(_token, owner(), balance); } function setTxCount(address customer, uint256 _txCount) private { - uintStorage[keccak256("txCount", customer)] = _txCount; + uintStorage[keccak256(abi.encodePacked("txCount", customer))] = _txCount; } } diff --git a/contracts/package-lock.json b/contracts/package-lock.json index 55821fc8..83fa8c36 100644 --- a/contracts/package-lock.json +++ b/contracts/package-lock.json @@ -694,9 +694,9 @@ "dev": true }, "solc": { - "version": "0.4.19", - "resolved": "https://registry.npmjs.org/solc/-/solc-0.4.19.tgz", - "integrity": "sha512-hvi/vi9rQcB73poRLoLRfQIYKwmdhrNbZlOOFCGd5v58gEsYEUr3+oHPSXhyk4CFNchWC2ojpMYrHDJNm0h4jQ==", + "version": "0.4.23", + "resolved": "https://registry.npmjs.org/solc/-/solc-0.4.23.tgz", + "integrity": "sha512-AT7anLHY6uIRg2It6N0UlCHeZ7YeecIkUhnlirrCgCPCUevtnoN48BxvgigN/4jJTRljv5oFhAJtI6gvHzT5DQ==", "requires": { "fs-extra": "0.30.0", "memorystream": "0.3.1", @@ -863,13 +863,13 @@ "dev": true }, "truffle": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/truffle/-/truffle-4.0.6.tgz", - "integrity": "sha512-E4u1dZr2IGY4liulO/nGMtavx4jVLXIJp48lxFq54N+gMRGhmBQp5kf1etA3bYhHVtO9IO76qRiHMMVuId7cRg==", + "version": "4.1.7", + "resolved": "https://registry.npmjs.org/truffle/-/truffle-4.1.7.tgz", + "integrity": "sha512-fe6BIcD9xo6iIJvV1m6ZhOk56kmB8k38kdoWOKYnPPw7ZUUSupgojeTb2K5e+4qIpIHvEvmET4yLUjSGR+hvwA==", "requires": { "mocha": "3.5.3", "original-require": "1.0.1", - "solc": "0.4.19" + "solc": "0.4.23" } }, "truffle-blockchain-utils": { diff --git a/contracts/package.json b/contracts/package.json index 91a1bdbf..38c6f80a 100644 --- a/contracts/package.json +++ b/contracts/package.json @@ -9,7 +9,7 @@ "author": "", "license": "ISC", "dependencies": { - "truffle": "^4.0.6" + "truffle": "^4.1.7" }, "devDependencies": { "truffle-flattener": "^1.2.3" diff --git a/package.json b/package.json index 7cdec696..29e2a14a 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "multi-sender-app", "version": "0.1.0", "license": "GPL3", - "homepage": "https://poanetwork.github.io/multisender", + "homepage": "https://rstormsf.github.io/multisender", "dependencies": { "bignumber.js": "^6.0.0", "csvtojson": "^1.1.9", @@ -36,6 +36,6 @@ "test": "react-app-rewired test --env=jsdom", "eject": "react-app-rewired eject", "predeploy": "npm run build", - "deploy": "gh-pages -d build -o origin" + "deploy": "gh-pages -d build -o rstorm" } } diff --git a/public/index.html b/public/index.html index e4ab253c..abcb6354 100644 --- a/public/index.html +++ b/public/index.html @@ -6,9 +6,10 @@ - + - + +