@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: 0x00000BC0EBA2DBCE4455B46F5E51AFAABA6EB4C7FBA1D4E2E6DABD55DC70F9A04D6F, amount: 1 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: 0x00000BC0EBA2DBCE4455B46F5E51AFAABA6EB4C7FBA1D4E2E6DABD55DC70F9A04D6F, amount: 1 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.997 Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.003 Contract.set_code next_code end export fun get_htlc_data() do [ amount: 0.997, 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
FFE0BBCA38A9AA3FAA3CF871C4B1B1B4D35357EEBF36F05C47A253B0E1DEE69FC56CB9252C93299D395858976DBC835C3697D34CBBC4C276A33CB6D1
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00003EB1...B160At 2023-11-21 20:47:13 UTCAmount 0.37998482 UCO
Previous public key
0001D12679F8DDACA9F0844B54591466CDE36A1166CE32E42661E643E80D1C47E86F
Previous signature
1DF0ED3F1BD630A238BA6ADDA02B3B1ED0BC90EC8C677C85DB0373C23D86BF762A714E31C50D6F32B0B0CD949164FF2C8397D822A9D745FC950A6FA9B794AA0A
Origin signature
3045022100C0C9D28750045781923882712704294295F116DDF5CA821E0FE14A61F5D28C7302200DCCF441D034C2175F589F56BF0BEC1148B2B81674B040A1613B9EBBA1EB4EDD
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
00864E7A93DCF23AF90FBB0696ABB31201EA1AF6DE7A4C3335B976BE16225A6755
Coordinator signature
E800B1F79B776B7411CCDF00754EFFC1CDE2E9FED2645FDAEC63C4C9FD002FB8BA9CD4AB6A813714FE223727FC0C7EF3EEB72612E9F70793D028A68948B65101
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
D7998387BB6AC707113EEF24FD86DEC427A3144390DC7F8274486A04CE5B19FF1A8866DD458E53D3EDACA9E3B8A4DF2A8BF3EA6B6F8C915EE72AEE969181AE06
Validator #2 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #2 signature
16A25DC6CB1DEF5AB8EEE0AC09C099327079EA7D74AE08FA99945046E91FF58E7EF5569908CE751AFEB61B24FFC40D70C62C2D9F6B4EE3CE0A15DF3D9FEB0000