algorandfoundation / TEALScript

A subset of TypeScript for developing Algorand Smart Contracts. Enables ASC development with native TypeScript syntax, tooling, and IDE support
https://tealscript.algo.xyz
MIT License
51 stars 16 forks source link

FV, LV, Lease Support #151

Open blainedwards8 opened 1 year ago

blainedwards8 commented 1 year ago

I noticed that txns don't allow for fv, lv and lease support. This would be very beneficial.

joe-p commented 1 year ago

Can you explain where exactly you want these fields supported? They don't apply to inner transactions and I'm not sure why you'd want to check them in an app.

blainedwards8 commented 11 months ago

These are useful to ensure you don't have a duplicate transaction within a given set of blocks based on a given lease value. One example would be a contract that allows a receiver to receive x amount of token every 1000 blocks. When receiving a request, the smart contract would make the check and if the request hasn't been performed in that set of blocks, it would issue an inner transaction to give the receiver the coins. I can give you an example in Teal if you would like to see it.

These values are defined here under the block Common Fields for Teal: https://developer.algorand.org/docs/get-details/transactions/transactions/

FirstValid - fv LastValid - lv Lease - lx

I am an attorney and these are useful in creating spend thrift trusts (or allowances).

pbennett commented 3 months ago

It's a [sender / lease ] pair thats tracked up through its LastValid round. So any duplicate wouldn't even be allowed into the mempool at all. A contract would never find a conflict because one would never be submitted.