@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: 0x00008DD40CD42287A3C8282065F5BCA7259AC7014CD73109B570E946A977687C7BD0, amount: 0.001 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: 0x00008DD40CD42287A3C8282065F5BCA7259AC7014CD73109B570E946A977687C7BD0, amount: 0.001 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-4 Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 3.0e-6 Contract.set_code next_code end export fun get_htlc_data() do [ amount: 9.97e-4, 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
E828CCDA214C4F7F180F1831D0E1C8A8E748D2088D88ADA821C613D75C8958431A631FE097A98607B79E5059D6C48F7947323087066676A474E3D520
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000985B...0B3BAt 2023-10-25 17:40:07 UTCAmount 0.57333636 UCO
Previous public key
0001F1FA00D8FCF8DFA95B85BD977EBF1A4B112A477BF5216197D619A548428E1758
Previous signature
3E7876C3CB7CB1B05BD56DB163FA5EB5E4644EDC4B6414F1F629BE6491C76734A273B70FE710F72A8225D50069FF3093C50BBEBDB9AE6B1871143558BB184D01
Origin signature
30440220613E431161819E72E2CBEBBBA266F5F3EBC8033FC61DBF927CB1E55B8AC354F20220603D032CE64FB14D54DA9B7676AFC2A8AC04B8B2B38AB648251CFDD2CBD4B5AB
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
001A2266A7FB3D898064A2891B82BBC9946DC6FF44ADADBD508787B49E9418A0B1
Coordinator signature
B9BE7DF9FDCD62A12CC53A3ABACD44198FB261C0F50A486C0F0D0FECEE84101E209E00E19C6FEA90BB68B813FFCF6C68816AFEFE6938A164333597D6B5E3DB06
Validator #1 public key
0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34
Validator #1 signature
2E8823F2ECCE9A3934E893D6471575F22A9196825104CB4237ED8E39E9588BA4D1914E05425BA8F4D0ACE875B5B0F3A903B3E1B03E203B72788AA4B8E77FDE0A
Validator #2 public key
00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC
Validator #2 signature
B4493FB88F0637A1F78F635AAC66ABA79C5CBA9534DAF9A4F97F15C72BFF9E69B34319C5CC4AFA33F1CD383368D8982FF920B511D2BC3F3B2FBC8C8DDE61170F