@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: 0x0000CB2A9F08F4D17280DFDE1E2CEB0830ECECE5E2469EB81E94713C16F37777A5C4, amount: 2 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: 0x0000CB2A9F08F4D17280DFDE1E2CEB0830ECECE5E2469EB81E94713C16F37777A5C4, amount: 2 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: 1.994 Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.006 Contract.set_code next_code end export fun get_htlc_data() do [ amount: 1.994, 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
25A0F5C7F629078F3565584FADF712D7BECB3243101809B812A12A94CD5FAB127F02C9950C248639F8EBC5AE30F4ED9AD36380419BD0EFCE0EC26FA3
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00003545...46BDAt 2023-10-27 09:53:33 UTCAmount 0.56617846 UCO
Previous public key
0001B9BAD9C44C005FBEF4A3BD43E60F805532B14B76C8C40CDDF6712B7663F1FD8B
Previous signature
18667792160A2978BE27B443E6ED0DB2F330054ACDE724CED384F5C9693BE9BE10005E7D6C0CE84035C7F9C39DB3FC98FAF70385793048184A0D0D19A5F46003
Origin signature
304402206C3F4CAA6F05EF872A600BC66263BF28581C36672CD235CB312A00002108FE3A0220179AF7B97090F185E66373728EC83AADECA78C195C30F0CEB3B543A82F1A0D87
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
002AA7F0697D8645C4CF9D52B0A681B0D66266C972DDD0C586F09ED7AFFE652BA7
Coordinator signature
67765E5A66E48AFB43FDCF0A37A836D7B9EA23FC2B411B21008A3399C06BF1407B356EFFB746CF268B23FA2F7CFCECED89CBB93395F41C207F79916A7D404A0D
Validator #1 public key
0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34
Validator #1 signature
9101FA3C6926ABEF6E9ED9B373BA637CE01182773E047735CDB77B16E6DB4DA460CA5D22746AE9A57213008467045D76BE091CF284D92881DAA438569B3F5B02
Validator #2 public key
00011ED0B570D680BE5ECD58D2D121689DA73C46DCB38A01C6E10D06286040ADE30A
Validator #2 signature
85C4F8A733074433C0BADFB183A9D7657F5AAF3E26B3A1DE36037825A9886CEB4407066FAE949A7771F728D452E5F1802A5010C7F9AA7786F1C46551C855D400