I'm asking because I would like certain KT1 addresses return the funds back to the owner after a certain amount of blocks
Is there a parameter we can add to a KT1 contract so that it expires after a certain amount of blocks?
No, there is no built-in function for this. However, it can be accomplished with a smart contract, that when called by the owner after a certain deadline returns its balance. Currently, the deadline must be specified as a timestamp, but future versions of Michelson may include a
LEVEL instruction (see this merge request). It returns the block level of the current transactions, and so could be used to implement the behavior your describing.
However, there is currently now way of "expiring" or "suiciding" a contract in Michelson. Deployed contracts stay on the block chain forever. However, you can implement the contract so that after a certain deadline (specified using a timestamp or the
LEVEL instruction described above), all incoming calls are rejected.
Thank you for your answer. Say you reach that timestamp and there are still coins on the KT1 address, will those coins become untouchable in this scenerio? Dec 2, 2019 at 9:45
If you write the contract so that it always fails after the given timestamp, yes the tokens will be locked forever.– JulienDec 2, 2019 at 10:06