@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: 0x00008E0EC52551622C6DE09650E45EAFC50345A32CABE18A7D51D7148085A3DA08A2, amount: 111 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: 0x00008E0EC52551622C6DE09650E45EAFC50345A32CABE18A7D51D7148085A3DA08A2, amount: 111 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: 110.667 Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.333 Contract.set_code next_code end export fun get_htlc_data() do [ amount: 110.667, 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
B056F07D679CA6ECB25F606256BA3107375D2E0748922C33B41DE5161973BF9A7D8F8597332ECDC969DCB349F98A99F0E0694A130F9BD364880DAC13
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000BD73...AECBAt 2023-11-30 21:46:48 UTCAmount 0.41119734 UCO
Previous public key
0001BAEBB082295509B5743EFC0084B44963C0462059B9852597AD3E74A98EE85408
Previous signature
5BEB4B0CDB32C8AAF31DE18829299B0D20A1D26CAB4B5B5A2F646B852F6923C7D4CA89E594E422B6FE4DEFEB3C00E5E696FE5F5C81FB4A8AEDA5FD57ED752B05
Origin signature
3044022000B3047D41E53AE24F6B2D1C68B26CBA3873D592DD0BF3D56B093818B42E83AF022072CD750167C806D6551C17ECCD8CCD7B9858901C019C8E13739EC80CC5C52528
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
001DEE7FBCCCE11831233482802E45C31D680B033E5634E3859E2B7E3EF7C4C733
Coordinator signature
769718547CF48BE4E2EFB831D2BB7B02FF4EA4104D82F82E8053A50EEE73E4390A5E6979F5CED0497BA179F02188BE5BEE2FC46A9E15FF1AEDC2B6C2AE39550F
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
C7E2F88441C5D79640F3A8EFC0A2CE4B3960EFABB82317DE7D28AF3CED51A5938D1C8675FC6026D7098FF1E460366F169432A04A97E1093C3B7C55166E9E970C
Validator #2 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #2 signature
CA7ADA8BCF8D620C590BEFDCBF1DF69D7AC9A9DE9925C5F555EB31FD01B67B5922A84DF3458D02A1147EBE4AB76DBE74CF80531F8B378305C12C72E615F33101