Linking an Application to an NFD
Last updated
Last updated
Contracts can now verify their account address with an NFD. There is no direct API for this as the contract that wants to verify its address must make the actual call via an inner transaction to the NFD.
The verification process is a 2-step process.
First, the OWNER of the NFD needs to update the user-defined property (u.cav.algo.a) with the raw 32-byte PK of the contract's account address (the Algorand GetApplicationAddress SDK for eg). The NFD API can be used to get the transaction for this, or you can update it directly using a contract call.
Second, once u.cav.algo.a is set, you next need to call the NFD Registry contract (see Registry Application IDs) to 'verify' the address in the NFD FROM THE CONTRACT BEING VERIFIED. The NFD can verify its own vault contract address if desired. In this case, the Owner of the NFD is allowed to verify the vault address.
The Reti code that does this is probably the best example.
To set the address to be verified. See this section of the Reti UI (the linkPoolToNfd helper function):
Notice it pays the MBR, updates the u.cav.algo.a field, then calls the Reti Staking Pool contract's 'linkToNfd' ABI method.
The linkToNfd method Tealscript code is here: