@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: 0.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: 0.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.0997 Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.0003 Contract.set_code next_code end export fun get_htlc_data() do [ amount: 0.0997, 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
2D4B84238021172164C7287F11115F938019694DBB703C361DC4F1032ED011CA111631FAE6F8BFF770648F52E1F0333AF30B4FAE51D96AC7CE2CD3B5
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00005D58...9B01At 2023-11-15 20:20:37 UTCAmount 0.3480725 UCO
Previous public key
0001A1EC4AAB253F2BDA81A465B6033A369CA19192700F385B9D0417A3CD9B65F723
Previous signature
DC9B4501FA7F4C7D7A4ED3FB7278FD7C70FE703E9E53A862E3B807DB8679C7576FCF080ECCAF9B3A86957670682238903CF08D2D8C78C526B2EF8472CFEA2503
Origin signature
30450221008E4F67736E450639A49D5F65CB1FDD16993C524AD13B64A66ED8F9D939E4A33C02202FEEC805049CAF7D12449B99AC2E3D89033A17F7F4DE64EF0841F62849815FAC
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
0028202F4FDA9014E22DBE034AA5ED5758C70E80041665EEDCB75A35ABB95C75BD
Coordinator signature
5BF72BA24873FABBE7A380B0669115918D36418D214ED8E31A72D7F0FFABA2C36941351769F30407FBEDAA8973E7A0AB8453BB4F243ECF23B24908A0A6D88F02
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
97E6B99D46C43C7862E5818A7FCF1EDA24F1A402ACC214614458BDA24ADB43EA1FBF6C5E2DBF470FD0EB0C4E6F43844DD870CC38660CA0FCD3713BC1DEFAAD0B
Validator #2 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #2 signature
B6E8580FED27A3E0753D5A9079B5D83035F52DCDB85D3EEF8312256053E4A2AC6C4DB5C95ACE6719F23EF4A50B9D2ED07936C89F13A72E4A44E9FF8A19791B0E