Browse / Search / Iterate on-chain objects inside entry function

Hi Friends!

I’m looking to create an entry function in my smart contract, which doesn’t take input parameters on the call (at least not all), but instead uses objects (NFTs) existing on the chain as input data.

E.g. imagine function public entry fun reward_my_friends() which:

  • searches for NFTs/objects of specific type, e.g. MyFriend, created by me and including name and wallet address of one person each
  • distributes (i.e. divides and transfers) constant amount of money among those persons (or rather their wallets)

I can fairly easy create entry function with normal input arguments which satisfies the second requirement, of course, but how about the first?

Thanks in advance!

6 Likes

You can not ‘read’ objects off the chain in move. Passing the objects to the entry point is your only approach.

1 Like

Hooray. I am no longer blocked.

1 Like