@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: 0x0000647409F94DE9798EA91E049B9AABA07B8CF3570A22056513B3437091C04B6807, 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: 0x0000647409F94DE9798EA91E049B9AABA07B8CF3570A22056513B3437091C04B6807, 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
A5F0FDB4CC49E7329FF5AFFF5755543E0A04E3949B4E090379268E9C1ED95C83131021F9A480651B834A6239C12AD28BA1976EE9051C2F8FDABC979E
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00009863...3131At 2023-11-21 15:56:46 UTCAmount 0.39412854 UCO
Previous public key
00014A485A8711DF81B3E39EDE7E1CE249B923347FB46C47CC8186D37A457C57B832
Previous signature
2D64978E20F7368BC94D893769C11811E4589132BA8B022BC89A3B5E893F3D00F6EA83A4F5C8E3D5C0859F0BF91F657CFE4C11E2EC53BFAD8C0CFCD57161A105
Origin signature
3045022100C9695CA15B36A90780247F74874A9B671EEEB7E39460F6D2D31ACA07D537367B02206A9F501F5C6EDFD6023CD78C820C4757EA828C3544FF44E1A43ABBD9D1B75AF3
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
007F08EEBE0CD964C51C14BA5F1A64C9B93D247DA86BF88F9A2AA1310E0C5DD074
Coordinator signature
1806C11EBA7DE8D1AD0016AB25395FB2A3BD2ECFBEBD8F8D984D4D09228AFE3BE6C67CA7B4BBB99FFD0C221D0525137CC9D5CA884EA599B831E82A802C1EE107
Validator #1 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #1 signature
30663D15C2CB3F74DFB6135247EB68E9FCCDEBEB69F3CE7507E0EE64B7C297641FD77A6843CA9A00DBD70D7714D04CEDDCF23032674B78430BF0F5C7C7A97A0D
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
D26B80BB71D69E1B586221138FD9A641487797DB519F8BFBDC17A4A77CE8395B3E68C41624D6DD578A54CD6DBCC65C196183F5F55169D2713947D4815CF84F08