Skip to content

Contracts for forwarding donations to the recipient's address

License

Notifications You must be signed in to change notification settings

WeTrustPlatform/forward-contracts

Repository files navigation

Build Status

Forward Contracts

Overview

Smart contracts to forward ETH to a pre-defined address.

Requirements

  • 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.

Getting started

  • 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

Use as node_modules

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

Publish npm

  • node_modules/.bin/truffle compile
  • node dist.js
  • git commit -v -a
  • npm publish

License

GPL-3.0 © WeTrustPlatform

About

Contracts for forwarding donations to the recipient's address

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published