@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: 0x0000F0399652294DADBD09B8099A7FE9762B98E7DFEC079AB2F1F5D33D8C933FEFDD, 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: 0x0000F0399652294DADBD09B8099A7FE9762B98E7DFEC079AB2F1F5D33D8C933FEFDD, 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
9F22B24C773BB5EEE8CE0A48E20955C0C16BE57BA5FF3F678070E56D8C35079D3C6B0EDA34F86F087D0D34771215B780BF830AE59A57E0F69FACC811
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000F07F...04DCAt 2023-11-21 15:36:11 UTCAmount 0.3792799 UCO
Previous public key
0001405512BD6682AB5F15A998BE5E104F4FDC0AEBE825261EFFFCA6CB3F86A7BBC8
Previous signature
596FC9D81D9632A4587E714C18FB829234F1C9A06F0D09EE14ADF9FEBF39DB3380F9AE00F7843538B395F0DC4CCB09097D9A6F485925EDC2586790C6D5F5A609
Origin signature
304402202A135FE438DCB5277A1F20DC892345969361150EC1B92EF8B48F2EAA5A798F010220160DF7288A81E647520B4D6D5AD00A47BB73B6924B3ABD9DCB21BBD735120C96
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
00FB3E02BCD60A7B2813A52AFEDB01CAEB950DC8230396376381354A1CAD619068
Coordinator signature
FC47AA34421841166ED51A7606B451CB82E99AAB5F5B27F82662A9B09F282DC61B6988D93A7212153410C1F53C6521E3D2CCEF5F0457702CDD2A99AB11D3E700
Validator #1 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #1 signature
8CB9E9BEDF381BD6659335D0B5D25EC8E1C090024914FACABF0A1D8032F06DFFDD105065DFD88887872A5151A6449D331C2D58AF9426A0E970408B9F0DB84109
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
46B178065E5864EC4919745815B78723EA851D25DEC04AA91D52BB5373448DEF25E51073188B4C2590F2FC0BA5E6EFEBE027716F34B6E4C164558A1A67BF550B