@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.01 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.01 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: 0.00997 Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 3.0e-5 Contract.set_code next_code end export fun get_htlc_data() do [ amount: 0.00997, 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
C6104F07ECD84D02F1872131276A82CD3ECC8323C39C1D470B4C0F95DCD731B405E8DC01F47898CDD2E1DBE11CBC343B251DA1196734D7F351A612B5
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000E533...7944At 2023-10-25 17:17:49 UTCAmount 0.57496638 UCO
Previous public key
00015DE15A0D2AA0495DF2DBD7465C47D6FED87B993084DA959B69359DDC071185AD
Previous signature
97F6D5C8B01A88867CDA2C2A9F44BD794270803ABDE29525130C3E7FFFC810224BDD1CA2FE4D0FE1525B9F0C7467032AB5785880705A2FAEFF37552C38072A0B
Origin signature
3045022100963A52584F80A92F718865484B8BDD0CDADBAE1EBEF6D44E29C96A1CAACE265B02203F2812043EC04750F1B5CC0E846F453485D09B7C9AE7476FC612D9C204E40D55
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
00130B33E99EE72D2CA96FA71E4E9EA4E79994A28391E7B9995C518908EEAB5A23
Coordinator signature
E9E39EF73CF2B80AA532E82E5C90A4C78E895FDCD56CAAAEA7F7A2E40D64973186AF852CF830577870EFE3B37997F4F462CB991C3196D1E11F2E4CDE94EEF80A
Validator #1 public key
00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC
Validator #1 signature
4B9075CEC0D9AAB9C85BCC7C9F238BD1BCA95A362EF69C80DC4DD8D2B62DD69D4093D3CC18EF1FABB742EFE646308E29A01F77858136C5D2E74021F0746D6D0B
Validator #2 public key
0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34
Validator #2 signature
D3D8C6FBA626C6FE668B5B5771B591FD4CE3D23E858250C0E35853B4C0030622499F60F5CBC81B0DC611C0755CC5890902AAAC78C497415A20C8579E66C3190B