If I have a contract that has multiple payable functions, could I create additional contracts that use their default function to call the primary contract's specific function allowing the user to send funds direct from their exchange account and thus lowering the barrier for new users and avoiding requiring metamask etc. So basically each payable function on the primary will have a corresponding contract that simply calls the correct primary contract function but I can still manage state inside the primary contract.

  • What is your exact question? – Ismael Nov 18 '17 at 4:59
  • My question is whether what I've described would be considered a reasonable practice and if there are any caveats like @Edmund described below. – Ldizzle Nov 18 '17 at 15:54

Yes, you can do this. There is a modest gas overhead to calling one contract from another, compared to calling the function you intend to call directly, but it shouldn't be prohibitative.

However, this may still be more complex for users than a simple send, as they will need to provide more gas than they would if they were calling a normal token's falllback payable function: Usually you expect to only need to send enough gas to log an event, so you may still have trouble with wallets that know too little about Ethereum to be able to call arbitrary messages.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.