Original NFT method call
In order to execute calls on original NFT, there are a couple of pre-requisites one must be aware of:
The caller must be the owner of a wrapper token for the original NFT token (or sign a transaction with its private key, in case of meta transactions
The method must be whitelisted by the lender (valid for state-changing calls, not for read-only methods)
Calling state-changing method
The method call will be targeted at the original NFT contract mirrored by the wrapper contract and can also accept the value that will be forwarded to the target contract. This can be done by calling the method on wrapper contract:
tokenId
- must be provided as a parameter so the whitelist of method selectors can be checked if the method defined bydata
can be called on the original contract, if it has a value at all. In essence, this call takes into consideration if the method selector extracted fromdata
is checked if it’s whitelisted.data
(can be empty value
) - represents call data being passed upon forwarding and it's also used to extract the target method selector in order to check the whitelist if set. In case this parameter has no value, the call is forwarded without checking the whitelist.signature
(can be empty value
) - generated based ondata
on the client side of the application and is useful in case there is a gas station functionality or transaction delegation. Based on the signature anddata
, the signer is extracted and used as the sender. This parameter is optional and in case it has no value, the original sender of the transaction will be taken into account.
Example of generating a signature for data
In order to call any static call (eg. calling balanceOf
method) on the original contract, the wrapper contract has implemented fallback
function which will just forward the call to the original contract. This method does not check if the method is whitelisted, therefore any read call on the original contract is allowed.
In order to invoke it, make a static call to the wrapper contract with encoded data of the call, which will be forwarded to the original contract.
Last updated