@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
E26C604EB64669A240556D45B258771D623812CE7F9DBE011B6DE19EAD08D6E2F1D8B0EA1D8E201BB3D626FAFD9B04371874CFB707F2DB62041223C6
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00003655...C9A5At 2023-10-25 17:59:22 UTCAmount 0.57333636 UCO
Previous public key
0001FD867D11FDBEBC97B080BA9C08A37D1AD8190D1D7CEA975E706B417738A43726
Previous signature
6AA3E7D9076647934547A03F204A162942BEDF7175706FB27E93A553E73504EC412EA71AC85A6D2808717BB80DB3341CE35A8CB8B41C7BA6232805877E7D5F03
Origin signature
304502210090F43680B832E1F612737A37110FC8E4691170BCE6FA2BE2F4873148F890748B0220105EE4512BB638A69DA68BF920527D2A7B2F40D3F1CD27DD01EDCB97F5F2C0F4
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
00640810998BA086756BF6FDC7F3FA8415E859AA6C1DF82A2F2C6A74FAA9EB37F2
Coordinator signature
3AE52EBC7FAAA37751674735C029B0E680BE03817BC9DC8583797367B8C82D62F231FB24F0DE9D6927D438F2C790BB45DBD4E74ED18765AF2373E78B1A543606
Validator #1 public key
0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34
Validator #1 signature
74EA3C8890FC0DEEBE804F5A14CB66C3492A604CA4BA2C6F8A431963CF6FAD378F8D37ABD2D690E72B550BAEE9B4BD7E0E53A549E9192F1B40C3CB2C12C2D20C
Validator #2 public key
00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC
Validator #2 signature
0EB934D38A23DD06B53150F39C366E265691D14390EBA115E5B0C70777E3578B5FC7CD1722E5FCD460D7435BD132FAECA219FD626E97CF2A142A42564B839F0B