@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: 0x00002F226DD3C62155E95202F0935C8A8726996010D2CCCE7311F39824253AA65E70, amount: 177
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: 0x00002F226DD3C62155E95202F0935C8A8726996010D2CCCE7311F39824253AA65E70, amount: 177
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: 176.469
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.531
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 176.469,
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
C5DCCA2B9F44C536E02E725A8E9766E09936756370B6AE31CBB42718BC85BB1CFA3BECB921E4AECDA0CB2B467CD33EBC0213FB00A5BF55192743D338
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00004097...3A35At 2023-12-09 01:25:26 UTCAmount 0.41957724 UCO
Previous public key
000164F917AD7D940A501B74F16013E0F5AC7043DC916B2DE9797F4F2EAA65585969
Previous signature
5D658F24ACF96675A329912D38F36A6D374F56B9D2419B6B483442AB39D4E53320E26F1D128D901B8DC07CC52D7FD32CB9F93CAD1E963830925147F6B8FE7D02
Origin signature
304402204C62ADA75346A5397EF92052EA0AD990E5DAFB0A69E78DFA95DD944192950C9C02206BC08195B739EBB411A68AF5CDF497C5B334AA79E3FC46E102227F3B88CAF845
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
00F683FCE27F97E6D9214DAA33B12BE9F9F028BAF84AEA8037143046583C90669A
Coordinator signature
9D50EA8BA4DB9364E8B1AFAD30B697D9A9C89D4869940FD32A0B16E71C58B5233944A9F14B2BBD88A8EFBEF1F9CD391B6CA1E0C9E5B605D924B442F6BD7B990B
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
DB6490AD5D10F80650E0884305E4C79F0FBB2AF318800811C9E31DC3E221582BDA2F2ABF6F0EBF0BE05049EF7BC4A69AAFF1AB8D8A84B761F6FC44517D879B01
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
6519ABA6C35D8BD39030E7071BE545C1598856B399AF701468779AF67B942FAA56A9F2EE088D3FABFA35E99AFFED84D92CC3F553E085E09614F7C95CC7EDB504