diff --git a/packages/hardhat/contracts/Distributor.sol b/packages/hardhat/contracts/Distributor.sol index bfb37cd9..0c630835 100644 --- a/packages/hardhat/contracts/Distributor.sol +++ b/packages/hardhat/contracts/Distributor.sol @@ -55,8 +55,7 @@ contract Distributor { } if (msg.value > total) { - (bool sent, ) = msg.sender.call{value: msg.value - total}(""); - require(sent, "FAILED_CONTRACT_DRAIN"); + SafeTransferLib.safeTransferETH(msg.sender, msg.value - total); } emit ethDistributed(msg.sender, id); diff --git a/packages/react-app/src/contracts/hardhat_contracts.json b/packages/react-app/src/contracts/hardhat_contracts.json index 3e75e371..129bb1ff 100644 --- a/packages/react-app/src/contracts/hardhat_contracts.json +++ b/packages/react-app/src/contracts/hardhat_contracts.json @@ -5,7 +5,7 @@ "chainId": "1", "contracts": { "Distributor": { - "address": "0x3E1516166E38eF3C995BDad7a27e8B1643e3450D", + "address": "0x14313eB3823D0268C49d2D977b6Fb1eE2233Ef20", "abi": [ { "anonymous": false, @@ -113,7 +113,7 @@ "chainId": "4", "contracts": { "Distributor": { - "address": "0x0e76C65F57D88DD35079E19CEa92a3bA197C18D4", + "address": "0xEa99C58645f897ac8BF530538e36e6D651ff8bF7", "abi": [ { "anonymous": false, @@ -221,7 +221,115 @@ "chainId": "5", "contracts": { "Distributor": { - "address": "0x80fB8Dc425f13b9118d8B382803cAA5289F93218", + "address": "0xC7fE6Af7dAa0e3f98d56ebbABdE0b97EfA5Ed42f", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "string", + "name": "id", + "type": "string" + } + ], + "name": "ethDistributed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": true, + "internalType": "string", + "name": "id", + "type": "string" + } + ], + "name": "tokenDistributed", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "recipients", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "values", + "type": "uint256[]" + }, + { + "internalType": "string", + "name": "id", + "type": "string" + } + ], + "name": "distributeEther", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ERC20", + "name": "token", + "type": "address" + }, + { + "internalType": "address[]", + "name": "recipients", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "values", + "type": "uint256[]" + }, + { + "internalType": "string", + "name": "id", + "type": "string" + } + ], + "name": "distributeToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ] + } + } + } + }, + "137": { + "matic": { + "name": "matic", + "chainId": "137", + "contracts": { + "Distributor": { + "address": "0x9bb1f87f3e80bee26bcb491489c1b41e0e15b16d", "abi": [ { "anonymous": false,