This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
Allow contracts to query whether an address is a contract #9064
Labels
J0-enhancement
An additional feature request.
Z1-easy
Can be fixed primarily by duplicating and adapting code by an intermediate coder
The following APIs should be introduced for contracts to call:
Technically,
caller_is_origin
might not be required asis_contract(self.caller())
could be used for that. However,caller_is_origin
can be implemented without any storage lookup and therefore uses less gas. Sometimes it is useful to check whether a contract is called by another contract or the origin.caller_is_origin
is a cheap way to do so.Please note that when being called as RPC the origin can indeed be a contract just because the RPC allows the sender to be specified freely. This does not matter here because during on-chain execution the origin can never be a contract and therefore no interaction with dry-running can occur.
Does this API make sense to you @Robbepop @cmichi @ascjones ?
The issue came up here: use-ink/ink#804
The text was updated successfully, but these errors were encountered: