Current Timestamp in Sway

Is there any way to get the current timestamp in sway? Context: I want to prevent a price update with a future timestamp in my contract so I want to check with the current timestamp, is that possible? Otherwise, what would the alternative suggestion be in this case?

Hi @cctdaniel

can you take a look at this example here and see if you can piggyback some code sway-applications/timelock at 32ad29b742bc0cd786e79908ad3578d5b508c2c7 · FuelLabs/sway-applications (github.com)

There are other examples that make use of timestamp in sway examples repo like the name-registry

searching the sway-applications repo is a good place to see how many other things can be achieved
FuelLabs/sway-applications: Swaypplications (github.com)

hope that helps

1 Like