Some major questions I have:
- What does
eosio.code
mean? - When do we require
eosio.code
? - Why it is not mentioned in the official EOSIO developer's documentation?
Please refer to official documentation: https://developers.eos.io/welcome/latest/getting-started/smart-contract-development/adding-inline-actions/#step-1-adding-eosiocode-to-permissions
eosio.code
is a special permission that can be used to allow the smart contract to call an action without the authorization of a specific user. It is used to allow smart contracts to call inline actions.
You need to include the eosio.code
permission on any smart contract that will be calling inline actions. Usually it is added as an additional permission to the active key permission, you can do this several ways:
cleos set account permission CONTRACT active --add-code -p CONTRACT
This assumes that you have a simple key running on active permission, if this isn't the case then the JSON payload has to be adjusted accordingly.
cleos set account permission CONTRACT active '{"threshold":1, "keys":[{"key":"YOUR_PUBLIC_KEY_HERE", "weight":1}], "accounts":[{"permission":{"actor":"CONTRACT","permission":"eosio.code"}, "weight":1}], "waits":[]}' owner -p CONTRACT
It is, but perhaps it wasn't at the time of posting the question.
If you are mentioning about eosio.code please refer to this.
https://github.com/EOSIO/eos/issues/3013#issuecomment-388983168
eosio.code
permission?