@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: 0x0000AAE847768F278B0D458240DC4E5205C2CB307B81D81865338F2C6B831F6006B1, amount: 8
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: 0x0000AAE847768F278B0D458240DC4E5205C2CB307B81D81865338F2C6B831F6006B1, amount: 8
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: 7.976
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.024
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 7.976,
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
DE11C0201A1BA398CB8C91D91B13CBF028481E04E85CE9EB6DB6B5C82713EB9E425FC0FE7A993167AD64FECA9F931A20709BF8C5E1D2B98808CCC67A
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00009A91...7B54At 2023-12-28 21:39:48 UTCAmount 0.40348408 UCO
Previous public key
0001C93E5BC30DC44575206EE6DBC5F3163EE6677FBE1B67C6BD0921329A420DC974
Previous signature
EF375BBF1B4B6E265AD7981BEEBA4E03880CF177474749C59959ED4F5684EB6A24563D6C968469DEA75862E6E48A46381FE520BD8D8DE12DCE5F26C67A549103
Origin signature
3045022100F3C136B8CEDA2E62CBB67652690E24DEC2B6542D5E1BFD376AD719BF6BEF289002202B4C40C36600348CE121CE3A4BA30B4ABB1EDD9CA465B7CB3933ACA0C0ED1173
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
007C17C38A73CEE53D19D5ACABC0460A3428A0B965C055D90DEC19E5C48928D850
Coordinator signature
AA0E03820916CFCF94D742741BA836B846C6E45266665D81FDA22FD5A0E20FFD220B6E902AD7B2E945F25198BE66C7CCADA8154241E3256AC8463A8EB8984202
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
6E9A3A452F78D0EDD8B2A9FA3EE0881821F999762F41D2F236158B55C46E4E93F0FDC77D1280B198B14E96FC3FB81D933ED298540D1C536078331A840E17BC07
Validator #2 public key
000162E6ADFF9FBBBC4BDBB3CD56A5A13A1E8576C3619ADC58A189F7E9A3A77FF95D
Validator #2 signature
0AE465D5C395B4292C65A91D588CC449936B84ACEC5BA26C80234E3B30A18B41D1A79EB590B2D97B6688D74781C47602AF15105AB4C27C43C9240EA7E838A104