@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: 0x0000F74EE60CE89C9227127F41A4DCD1946F11721BF74D07C812591D48611D3601F7, amount: 10 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: 0x0000F74EE60CE89C9227127F41A4DCD1946F11721BF74D07C812591D48611D3601F7, amount: 10 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: 9.97 Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.03 Contract.set_code next_code end export fun get_htlc_data() do [ amount: 9.97, 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
CE13F18975C2D116351B217DF7D6E5FB47E6CAD5E7E4B33C2BC6437CF966E84DE3FE91D5A9BBC641AA56E09319523B784CC6BBDDB6BA47CD1F9A83A7
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000BCC1...ADD7At 2023-11-15 09:58:49 UTCAmount 0.35496456 UCO
Previous public key
00016BF9ED79990A8FCAE5608FDA810C3C6308421C686CEB77ACC7E5DF86A47831B2
Previous signature
22EC9B58D3B1B402CBDC2656E8B99E73A1176213617EE65D30EEB21244AA4961D1ED77A5F9A52D416C114510F7B415C3922B0A290045B8DFFCF08F719A7E1F07
Origin signature
3044022031390C59B0A4C33F92740F5F202A83A56CD3EC92604BB9FD8A48002C86CE86A2022031DE743865463E98A14C63FB9C7A357CB52D7C86E8FAEF7E3904D3A3EDBC4755
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
00D7E472486F8E818B0692D221F0DDC21DE5CAEF10645B4139A5B295F253E399C0
Coordinator signature
78D349CEE107F438C24F4E56368CFDFE34B5DFFA4887FB4C691F879FAE0B563DCA42B2750FF3682E9BE09F909A052D76488F4415D83F4576D3DD8A905008D40D
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
C180F2CE6BD121C6AD13063E58360977DEBD48DC69F842044514A32509FDA423F278F6C2C7FEFEC2683417C5B4C47E846AD02347C5395982E79E3431C960EE02
Validator #2 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #2 signature
3A241729890292AF8D0889977FFA7920B1C3AC0D7CE305BC3B3DE91E968246B21DBDE4940EFB77CFCA63C79CAD61C29984A9252020DEF879FEF6C09D80288301