@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
F7B375C46D70234F50E47336EDBC0ED4720971B13E6ECFC690CC08586B3B1B29528F88091EBCD4765E344CAC2EA55C3A6CF67D715E6C0D09706EF856
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00007B16...8662At 2023-10-25 15:26:16 UTCAmount 0.56372402 UCO
Previous public key
0001CB030E6D387B17579995CED3FC20EE873207AEE3C46AD78F99A3E51F7A290064
Previous signature
86EAB4EA10B49F39D4C0C54B63D0062EC2B85A304D7897DBF613E9DA2D48C574E55A7C7F097B5E25BF9B2FA88F939B820A4212A7F29D294C7572D9C68B884E04
Origin signature
304402201F2EDF8B81EB7EDE843D06291B9C1955F66E9BE5B28517F9025057D52C18B96002204D7A8FAF77A0ACCA3BE0D587B72F26B4B869DD7B850F989369BE903DDD053F03
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
00C1EDD0B9BFD992B13433B45E8399B0C1D008BEEEF141CFCE8C7E84CA73CC3ED6
Coordinator signature
8B57833BFDF7D9397E7A673A9381723AD7A9A3CD59C4BA024639B563C160A78154CC39B2BE2E920D48CAA2E014F14E66A13FBF9F0BF56A3F0393E0F0B868220C
Validator #1 public key
0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34
Validator #1 signature
B9D7170BF789BD135C64D9EB22B5EA2BED5E727CABF90A7A78A8C9ED28F876983F1C675DAFB269C34BB2ED0C072B49C9D5C6AA9ECC8756C0E0D204A1FF2E8601
Validator #2 public key
00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC
Validator #2 signature
EEA4888B852B557F935E7BABECF53C3D425CCC989BB533586CF5826349B35F7616B3174F30BBD81A3091022F24C85470DD1757ACD0F6F8A37A01ACAF05226904