Smart contracts to forward ETH to a pre-defined address.
- Accept incoming transactions from both normal and contract addresses. Be able to recieve any ETH/Tokens intentionally or unintentionally.
- Contract's balance (ETH and/or tokens) must be able to move to the pre-defined recipient i.e. we don't want money to be burned/stuck/lost in this contract in any cases.
- Contracts are pre-generated with Recipient's address being assigned in the constructor.
- Forwarding happens in a passive mode which requires a trigger to sweep the balance.
- Recipient can call other smart contracts via a proxy method. This is to recover ERC20 mistakenly sent to the Forward contract.
- Stateless, should not have any internal states except the recipient. In other words, it only serves one purpose which is forwarding the fund.
npm install
- (Optional) Install ganache:
https://truffleframework.com/ganache
- After sending ETH to the Forwarder contract, call
sweep
method to forward the balance to the pre-defined recipient
import contracts from '@wetrustplatform/forward-contracts;
// Available fields are shown in the ./dist.js
const { abi, bytecode, source } = contracts.PassiveForwarder;
These fields are copied from the ./build
folder generated by npm run compile
node_modules/.bin/truffle compile
node dist.js
git commit -v -a
npm publish
GPL-3.0 © WeTrustPlatform