How do I intercept the a plain Ether send to a contract?

haasboerhaasboer Member Posts: 8
I am trying to build a contract that relies on a set of other smaller contracts to auto-forward it funds. So when someone sends funds to address Ax, Ax forwards that to H. H then checks some internal state and splits the funds between itself and another storage contract C.

How would I go about this?

Comments

  • smalltalksmalltalk Member Posts: 16
    You just need a function with no name in your contract which is default function triggered on a send transaction. You can then grab the ethers sent from here and forward them to other contracts.

    function() {
    msg.value //contain the value sent to the contract
    }
Sign In or Register to comment.