Smart Contract Flow
Developer can essentially get information regarding interaction with PDA

Initialize Smart Contract

The owner of the NFT can initialize a smart contract and Program derived address ( PDA ) is created from the mint key of the NFT to store specific data including payment rate, expiry, transferability, and state (issued, transferred, or terminated).
  • Owner invokes StreamMoney smart contract and transfers ownership of NFT to contract owned PDA.
  • PDA is created using program ID and mint key as bump seed. Thus, every token is going to have a unique PDA.
  • Conditional ownership constraints are written to PDA's data including payment rate, initial owner, expiry, borrower, state, etc. Once issued, the state is set to "issued".
  • All NFTs held by StreamMoney smart contract can be queried with a specific filter to list on any marketplace.
  • When NFT is claimed by the relevant party, the state changes to "transferred" and borrower, expiry parameters are updated.
  • Upon expiry of utility, withdraw function can be invoked to revoke conditional ownership and to terminate the contract, one or more invalidators can be assigned as the only public keys that can perform an expiry.
The lifecycle of the contract is completed upon cancellation, necessary payments are settled, and the token is returned back to the issuer ( and can no longer be used in case of use based expiry).
Copy link