@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: 0x0000CB30ACA5320066B4413E9D4190EA13562F3225BB5F49A975ABD91CFFDAFED88D, amount: 5 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: 0x0000CB30ACA5320066B4413E9D4190EA13562F3225BB5F49A975ABD91CFFDAFED88D, amount: 5 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: 4.985 Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.015 Contract.set_code next_code end export fun get_htlc_data() do [ amount: 4.985, 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
BD5057943DD4F55E0A511135A08A023A808D8AD90F227F5265253F61D4687886C4319826B1A6EBF2391EA350F8161A7A718D94331A10699687F2D99F
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 000091B7...D73EAt 2023-10-23 15:45:13 UTCAmount 0.59954426 UCO
Previous public key
0001AAA98059C743B32DEBA04411C0FBE543740D5CF2085230FE664FBC2D3C7C8957
Previous signature
97E45611CDAB8AE0790E2EAC037D02676564A532EC2BFEC52437EC5A0F82A79FDC6AA84CF3D28EA1CC66F53787BF702CB19D213056D87EF66C2AFE94B9C07000
Origin signature
304402207186C1CA6529ED97489E1485B7F7AF0B00206CDC607AB7C4276AA9AC45A55307022066632394B34B51BC3F960033B0D048F02FE0775605A3ECF4015EF16906AF4AF3
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
00E00CD7DCF44B4785FFE0ABB521DBAC36B234C15F9F2E2801E1710E6DDDC97155
Coordinator signature
0ECD432076EE236560E1639F2DFF5B2E03607EDE86BCC1A0E3E08806B1F3C3D8E6014340EF3B879B49BD7AA55336D149D54E2B75DF6F692E395C2768643B640B
Validator #1 public key
0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34
Validator #1 signature
12F0E72592A125892D076B87D2812B62C5732A4EEA73AC6BD9445906E981BC593FD253A27472DE0CDF0893C2FA60DCFFE5F1190FBA27BC52AD1F067E62C99106
Validator #2 public key
00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC
Validator #2 signature
F5781BEBB6AE807057624263353521CE70A76A2CC36A3B6631E243581223568D779EAD65022DDAE3064E7A60543061B16CE3FB3B44C72ACE5F667EDE6D81BA0D