@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: 0.0001 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: 0.0001 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.97e-5 Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 3.0e-7 Contract.set_code next_code end export fun get_htlc_data() do [ amount: 9.97e-5, 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
134D61D0BDB4DE210D35E6981F65D0DB5F475E4B12D3EC3F79632F4AB29D0D74C041FD49AA2C48EAFE02FB377E3A16680079F58625C6240BEE169BB7
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00007A14...2BD6At 2023-11-21 16:41:58 UTCAmount 0.38003476 UCO
Previous public key
00011F3D264420BBD9C310391A3CB84A6DA6E907D98E249B8E322605F7D51277268C
Previous signature
712E806E43684C5BCDE3D369611F6F24EAB7685DDCBFDD5269095FD373BA3D64145D8E49D8B4F5D5966C0432FB329BAD9B55C65A59F35D324C42175E92A71800
Origin signature
304502210082D33A082F251746CA9518A016C85C4D23AA5AAD4433BA21F98F9676EAA72B9102206CB3CC87F058DA30F8FBC7B7906B12E7A6A470FB96E90D280AAE0AFCAA271856
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
00226D3C3B38F9544300EF0D52741C90A7A87B426AAC504B1ABF40327596A1EC77
Coordinator signature
F2E78F35E22BFA288C4FE9B722FCD5A53484B7E2E11AB127D8B7942068AE9B58077F6F6A95FE2FC1C64C74D978A37BFD1A53C9EE3EC221E0D88302AFB4C7760A
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
24784AA81B16CA4E41CCF30AC5C5E1229E608E8C9E36EA723AED06D5E6F413E61FDDB2D73F2EF1A73CAF5316B987019F896217D56D8E687D7C25F3DBCD854105
Validator #2 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #2 signature
1496AF5F396C5C7B4E941627BBFD7CE4F1AC261F59B31C46255CBDF1316BD7C90B4D1D742CAFE4CB0A85562E0D3E6547B3ED9C5686F7B5859B0BF3E3ED99F405