2

I know that you can bill another user for storage but what if i want to bill another smart contract which in turn will then bill its users. Is it possible?

1
  • I haven't tried it, but assuming the permissions are right, a smart contract can bill any account, including one passed from a different smart contract in an inline action
    – confused00
    Jul 23, 2018 at 8:24

1 Answer 1

3

Yes, as @confused00 mentioned in his comment, you can bill the RAM storage to either the account of the current contract itself (_self) or any account for which the transaction includes permissions. This means it's based on a per-transaction scheme, which means that for example:

  1. Account randy submits a transaction signed by his account for an action in contract1
  2. contract1 can store something in DB billed to either contract1 account or randy account
  3. If contract1 sends an inline action to contract2 then contract2 can store something billed to either contract2 or any of the permissions given in the inline action to it (contract1 or randy)

contract1 can decide what permissions to pass on to contract2 in the inline action.

In the documentation for emplace you can see there's a parameter for defining who is billed for the storage: https://developers.eos.io/eosio-cpp/reference#emplace

In the documentation for inline actions and permission levels you can see how to send actions and set the permissions: https://developers.eos.io/eosio-cpp/reference#structeosio_1_1permission__level

EDIT: Also more related information here: How to authorize inline action of another contract within a contract?

2
  • Okay! Thanks for your detailed explanation!!!
    – Randy
    Jul 24, 2018 at 1:37
  • No problem! If my answer was useful to you then please mark it as accepted. Thanks! Jul 24, 2018 at 14:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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