Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions abi/MultiSender.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,47 @@
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_token",
"type": "address"
},
{
"internalType": "address[]",
"name": "_targets",
"type": "address[]"
},
{
"internalType": "uint256",
"name": "_amount",
"type": "uint256"
}
],
"name": "batchSendFixedERC20",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address payable[]",
"name": "_targets",
"type": "address[]"
},
{
"internalType": "uint256",
"name": "_amount",
"type": "uint256"
}
],
"name": "batchSendFixedEther",
"outputs": [],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
Expand Down
353 changes: 283 additions & 70 deletions cli/send.ts

Large diffs are not rendered by default.

8,625 changes: 8,625 additions & 0 deletions cli/testaddress.csv

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions contracts/MultiSender.sol
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,21 @@ contract MultiSender is OwnableUpgradeable, ReentrancyGuardUpgradeable {
return true;
}

function batchSendFixedERC20(
address _token,
address[] memory _targets,
uint256 _amount
) public {
require(_targets.length > 0, "none address provided");

IERC20Upgradeable token = IERC20Upgradeable(_token);
uint256 total = _amount * _targets.length;
for (uint256 i = 0; i < _targets.length; i++) {
token.safeTransferFrom(msg.sender, _targets[i], _amount);
}
emit MultisendToken(total, _token);
}

function batchSendEther(
address payable[] memory _targets,
uint256[] memory _amounts
Expand All @@ -66,6 +81,23 @@ contract MultiSender is OwnableUpgradeable, ReentrancyGuardUpgradeable {
emit MultisendToken(total, address(0));
}

function batchSendFixedEther(
address payable[] memory _targets,
uint256 _amount
) public payable {
require(_targets.length > 0, "none address provided");
uint256 total = _targets.length * _amount;

require(msg.value >= total, "insufficient fund");

for (uint256 i = 0; i < _targets.length; i++) {
(bool sent, ) = _targets[i].call{value: _amount}("");
require(sent, "transfer eth failed");
}

emit MultisendToken(total, address(0));
}

function claimBalance(address _token) public onlyOwner {
uint256 balance = 0x0;
address _owner = this.owner();
Expand Down
2 changes: 1 addition & 1 deletion front-end/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function MyApp({ Component, pageProps }: AppProps) {
<ContextProvider>
<Component {...pageProps} />
</ContextProvider>
<link rel="stylesheet" href="https://web3camp.us/globals.css"/>
<link rel="stylesheet" href="./globals.css"/>
</>
}

Expand Down
24 changes: 19 additions & 5 deletions front-end/pages/components/footerBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import styled from "styled-components";
import {Container} from 'react-bootstrap';
const Footer = styled.div`
height: 80px;
margin-top: 100px;
margin-top: 60px;
width: 100%;
padding-top: 15px;
background: #fff;
font-size: 14px;
.midBox{
display: flex;
justify-content: space-between;
Expand All @@ -15,18 +19,28 @@ const Footer = styled.div`
.lft{
padding-left: 10px;
}
a{
display: inline-block;
margin-left: 20px;
}
`
export default function footerBox(){
return <Footer>
<Container>
<div className="midBox">
<div className="lft">&copy; 2022 Web3camp.us</div>
<a href="https://web3camp.us" target="_blank" rel="noreferrer">
<div className="lft">&copy; 2022 Web3camp.us</div>
</a>

<div>
<a href="https://github.com/Web3-Camp/multisender" target="_blank" rel="noreferrer">
<img src="https://web3camp.us/assets/images/GitHub-Mark.png" alt=""/>
<a href="https://github.com/Web3Camp-Labs/multisender" target="_blank" rel="noreferrer">
<img src="./github.png" alt=""/>
</a>
<a href="https://twitter.com/Web3Camp" target="_blank" rel="noreferrer">
<img src="./Twitter.png" alt=""/>
</a>
</div>
</div>
</Container>
</Footer>
</Footer>
}
42 changes: 23 additions & 19 deletions front-end/pages/components/step2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -242,25 +242,25 @@ export default function Step2(props:Iprops) {
//
// if (chainId === 1) {
// sender = contracts.mainnet;
// // url = 'https://etherscan.io/tx/';
// // url = 'https://etherscan.io/tx';
// // } else if (chainId === 42) {
// // sender = contracts.kovan;
// // url = 'https://kovan.etherscan.io/tx/';
// // url = 'https://kovan.etherscan.io/tx';
// // } else if (chainId === 128) {
// // sender = contracts.heco;
// // url = 'https://hecoinfo.com/tx/';
// // url = 'https://hecoinfo.com/tx';
// // } else if (chainId === 256) {
// // sender = contracts.hecotest;
// // url = 'https://testnet.hecoinfo.com/tx/';
// // url = 'https://testnet.hecoinfo.com/tx';
// } else if (chainId === 137) {
// sender = contracts.polygon;
// // url = 'https://polygonscan.com/tx/';
// // url = 'https://polygonscan.com/tx';
// } else if (chainId === 56) {
// sender = contracts.bsc;
// // url = 'https://bscscan.com/tx/';
// // url = 'https://bscscan.com/tx';
// } else if (chainId === 97) {
// sender = contracts.bsctest;
// // url = 'https://testnet.bscscan.com/tx/';
// // url = 'https://testnet.bscscan.com/tx';
// } else {
// console.error('Unsupported network!!!!');
// return;
Expand Down Expand Up @@ -393,11 +393,10 @@ export default function Step2(props:Iprops) {

settips(`Sending Ether in progress... (${txIndex}/${Math.ceil(addressArray.length / pageSize)})`);
dispatch({ type: ActionType.TIPS, payload: `Sending Ether in progress... (${txIndex}/${Math.ceil(addressArray.length / pageSize)})` })

await multiSender.connect(signer).batchSendEther(addressArr, amountWeiArr, { from: account, value: ethers.utils.hexValue(sendValue) }).then((data: {
transactionHash: string; hash: string;
}) => {
console.log('batchSendEther', data);
try{
let res = await multiSender.connect(signer).batchSendEther(addressArr, amountWeiArr, { from: account, value: ethers.utils.hexValue(sendValue) })
let data = await res.wait();
console.log('batchSendEther', res);
txHashArr.push(data.hash || data?.transactionHash);
if (txIndex >= Math.ceil(addressArray.length / pageSize)) {
setshowLoading(false);
Expand All @@ -406,12 +405,13 @@ export default function Step2(props:Iprops) {
handleNext(3);

}
}).catch((err: any) => {
}catch (err: any){
console.error('batchSendEther error: ', err);
setErrorTips(err.data?.message || err.message)
setErrorTips(err.data?.message || err.message)
setshowLoading(false);
dispatch({ type: ActionType.TIPS, payload: null })
});
}


}
// setTxHashList(txHashArr);
Expand Down Expand Up @@ -468,8 +468,9 @@ export default function Step2(props:Iprops) {
}

const downLoadExcel = (data:string[]) => {
if (importRecord == null ) return;
let amountStr = `Address,amount\n`;
if (importRecord == null || !data.length) return;
let amountStr = `Address,Amount\n`;
let addressStr = "";
importRecord.map((item)=>{
const { address, amount} = item;
let isSuccess = false;
Expand All @@ -479,10 +480,13 @@ export default function Step2(props:Iprops) {
}
}
if(!isSuccess){
amountStr += `${address},${amount} \n`;
addressStr += `${address},${amount} \n`;
}
});
console.log(amountStr)
amountStr += addressStr;
console.log(addressStr.split("\n"))
if(addressStr.split("\n").length === 1) return;


let uri = `data:text/csv;charset=utf-8,\ufeff ${amountStr}`;

Expand Down
14 changes: 7 additions & 7 deletions front-end/pages/config/url.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
[
{
"id": 1,
"url": "https://etherscan.io/tx/"
"url": "https://etherscan.io/tx"
},
{
"id": 42,
"url": "https://kovan.etherscan.io/tx/"
"url": "https://kovan.etherscan.io/tx"
},
{
"id": 56,
"url": "https://bscscan.com/tx/"
"url": "https://bscscan.com/tx"
},
{
"id": 97,
"url": "https://testnet.bscscan.com/tx/"
"url": "https://testnet.bscscan.com/tx"
},
{
"id": 128,
"url": "https://hecoinfo.com/tx/"
"url": "https://hecoinfo.com/tx"
},
{
"id": 137,
"url": "https://polygonscan.com/tx/"
"url": "https://polygonscan.com/tx"
},
{
"id": 256,
"url": "https://testnet.hecoinfo.com/tx/"
"url": "https://testnet.hecoinfo.com/tx"
}
]
4 changes: 2 additions & 2 deletions front-end/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ const NavBox = styled.div`
height: 80px;
}
li{
background: #fff;
padding: 0 40px;
background: #FAFBFC;
padding: 0 20px;
.circle{
width: 80px;
height: 80px;
Expand Down
Binary file added front-end/public/Twitter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added front-end/public/github.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
82 changes: 82 additions & 0 deletions front-end/public/globals.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
@font-face {
font-family: "AdobeGurmukhi-Bold";
src: url("https://web3camp.us/AdobeGurmukhi-Bold.otf");
}
@font-face {
font-family: "Helvetica";
src: url('https://web3camp.us/Helvetica.ttc');
}

html,
body {
padding: 0;
margin: 0;
background: #FAFBFC;
color: #666666;
}
* {
padding: 0;
margin: 0;
font-family: "Helvetica";
}

a{
text-decoration: none;
color: #666666;
}
a:hover{
color: purple;
}

ul,li{
list-style: none;
padding: 0;
margin: 0;
}
.btn-flat {
background-color: #2D1D0A;
color: white;
/*width: 152px;*/
/*height: 46px;*/
font-family: "Helvetica";
}
.btn-flat:focus{
outline: none;
}
.btn-flat:hover{
background: purple;
color: white;
}
.spinner-primary{
color: purple;
}
.backgroun-gray{
background: #f8f8f8;
}
.form-check-input:checked {
background-color: purple;
border-color: purple;
}
.form-check-input:focus{
outline: none;
border-color: #ccc;
}
.header{
/*box-shadow: 0 0 5px #ccc;*/
padding:23px 0;
background: #fff;
}
.header img{
height: 45px;
}
.headerTxt{
font-family: "Helvetica";
font-weight: bolder;
font-size: 32px;
/* text-transform: uppercase; */
}
.headetRht{
text-align: right;
font-size: 12px;
padding-top: 20px;
}
2 changes: 1 addition & 1 deletion scripts/deployed/bnbchain-test/contracts.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"sender": "0xc5c13B7eA0eB0D9ceC345C16349a2b114517b66b"
"sender": "0x2F2457c9cFE688F3E40851B8A85fEc5da847664E"
}
Loading
Loading