@version 1 condition triggered_by: transaction, on: set_secret_hash(_secret_hash, _secret_hash_signature, _end_time), as: [ previous_public_key: ( # Transaction is not yet validated so we need to use previous address # to get the genesis address previous_address = Chain.get_previous_address() Chain.get_genesis_address(previous_address) == 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801 ) ] actions triggered_by: transaction, on: set_secret_hash(secret_hash, secret_hash_signature, end_time) do next_code = """ @version 1 # Automate the refunding after the given timestamp actions triggered_by: datetime, at: #{end_time} do Contract.set_type "transfer" # Send back the token to the user address Contract.add_uco_transfer to: 0x00009E731DE71C9598A6C853EA89C736B1DAC3652AE00753651B642536AB14821F06, amount: 1 Contract.set_code "" end condition triggered_by: transaction, on: refund(), as: [ timestamp: timestamp >= #{end_time} ] actions triggered_by: transaction, on: refund() do Contract.set_type "transfer" # Send back the token to the user address Contract.add_uco_transfer to: 0x00009E731DE71C9598A6C853EA89C736B1DAC3652AE00753651B642536AB14821F06, amount: 1 Contract.set_code "" end condition triggered_by: transaction, on: reveal_secret(secret, secret_signature), as: [ previous_public_key: ( # Transaction is not yet validated so we need to use previous address # to get the genesis address previous_address = Chain.get_previous_address() Chain.get_genesis_address(previous_address) == 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801 ), timestamp: transaction.timestamp < #{end_time}, content: Crypto.hash(String.to_hex(secret)) == 0x#{secret_hash} ] actions triggered_by: transaction, on: reveal_secret(secret, secret_signature) do next_code = """ @version 1 export fun get_secret() do [ secret: 0x\#{secret}, secret_signature: [ r: 0x\#{secret_signature.r}, s: 0x\#{secret_signature.s}, v: \#{secret_signature.v} ] ] end \""" Contract.set_type "transfer" Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 0.997 Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.003 Contract.set_code next_code end export fun get_htlc_data() do [ amount: 0.997, end_time: #{end_time}, secret_hash: 0x#{secret_hash}, secret_hash_signature: [ r: 0x#{secret_hash_signature.r}, s: 0x#{secret_hash_signature.s}, v: #{secret_hash_signature.v} ] ] end """ Contract.set_code next_code end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
38122F1A89B7727B4B3C5492CDB6BA9DB4B4A6DAC8B767760C2AC15A0EFE8123C24B110196AF16B3102E1BEFF0742DE3FB3D9676E169ED0ADA480A8B
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00004C20...447CAt 2023-10-24 14:39:48 UTCAmount 0.62672856 UCO
Previous public key
0001A71FDDFAEF24FE71EEE8F0BE4C858AFF38B9A75F62EB79665C16C82FB296DFC1
Previous signature
9C679056C0F38689B8E178EF9DD54874D022D0F6F263FBCAEC8BDE8305FD95FB744BED7BEEA50BDA671D07F8B4D95FA7C22EB4D1B3E6461B168A025F01684E0F
Origin signature
304402207EDCB08A4E92CCE1F75CEAE5AFF8F454706CF4EFB9A2C7AC9AA769CB3D3D668402204A25F1F0C2F73D3AD07FED5A631D90A85352CA427C14DBD369F3773BA3CE6E1A
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
0028510D5678DB761D36DFBAB3A0E3436FC9CFA1896824E49A65F5EE03F5440984
Coordinator signature
91D0E7A8E1F3597D748050F4F2BCED4C7C5D8DE0B4CB7EDA7C8C04209D9D3A197B4D4F8FB9D7196EC6F0F3EB4BF0575D3520EE530B558DEB27F68E778B484204
Validator #1 public key
0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34
Validator #1 signature
6341A6E9398C44890F12A7655002D343A7DAE5F8C6062B63FB8356EAEF5407E6CB07AA0AD4E541E7AC006EEB21A983C6CE8C80EFAEBEC63323E02D9CD394780B
Validator #2 public key
00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC
Validator #2 signature
C532D0DB3595203AC68BE16857CAEE3280A0B3B149D2341FB850057784E737E42136F3FECF102D0B941D0CFD49EFA5C2A919B510843316F9A3E0E316F2FFE802