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 Answer
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:
- Account
randy
submits a transaction signed by his account for an action incontract1
contract1
can store something in DB billed to eithercontract1
account orrandy
account- If
contract1
sends an inline action tocontract2
thencontract2
can store something billed to eithercontract2
or any of the permissions given in the inline action to it (contract1
orrandy
)
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?
-
-
No problem! If my answer was useful to you then please mark it as accepted. Thanks! Jul 24, 2018 at 14:24