@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: 0x00007D1163F2AEA7B80362450AB96D837F5A698980E2FCC0ABE1CDB01D9B7F0D2273, 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: 0x00007D1163F2AEA7B80362450AB96D837F5A698980E2FCC0ABE1CDB01D9B7F0D2273, 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
5ADEE199717299025F006F10BA9C1A29ACA7284A553491E7E5A57BE3294129A12B6900741A42C26582ACF264A6B42510A8D72541F5D2A02EB4DED8EB
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00005097...6B3DAt 2023-10-19 21:20:15 UTCAmount 0.4996613 UCO
Previous public key
000167736CF6EB12FB99AB50BD4580BE90EDE670CDA0466D65852219E9DE2EC21F26
Previous signature
1EB66A1A18E55597B5F7CF75F73875EABC8FBDF2BE5921D1C1A80F5E19F0E3416EC27DEF07282F29025E0D98C81E38FB749FA66FE06A39DE643E5ECB6529BD0D
Origin signature
304502210096224F1DC70AF7965C52D5049366F2DD4DF488AAB80524CEB5381F774E446815022029E595EAAF880939D4CD969E977E5242E05DF2CD1F22FEE2E1BC4D1ADAFB2F90
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
00DF818FC32CDC87E2EAF3DD8D18996A570436975C4F6AD690B5200700349D6F13
Coordinator signature
E2F448126BEBA6F0643EEC9411C19EC93ECFA669880B82AFC68590BF3C33780A31F18B9245910C50742C3DC33C2E390367296009436DA5ABA12F02F20919E50B
Validator #1 public key
0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34
Validator #1 signature
82CB46F1971E4FC82A3F4CFA3BE964D6A1F2AD71EB43EBDBD34086A68361A61EED18C417EAD962F1349CF54A5E5D88B62E4FBE44B0D1B9B26A074658117E0D04
Validator #2 public key
00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC
Validator #2 signature
CA14BB1502CFC04B6DFC62FC31E3B7E026D93069CA52CA8FC9585709EB07B01CD1611F3698973130116E0E61C3DD9D22339BE7E64239B2AE0B9709E239BCE009