@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: 0x0000A13340CA5E06989B6600C5B84FE8CDFEF4CBBA34041203EB1FD0DB386A469337, amount: 6
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: 0x0000A13340CA5E06989B6600C5B84FE8CDFEF4CBBA34041203EB1FD0DB386A469337, amount: 6
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: 5.982
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.018
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 5.982,
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
9926506CD5D05FCF6AC2E920625CBC4A1AA79BDDBF2346A1A394EB5041A0115B424C3636EAC10AAB719C8E0FCF1214CE49C1741526BE8CE21CB9DCED
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000B95A...6B4EAt 2023-12-11 05:04:29 UTCAmount 0.43813442 UCO
Previous public key
00016075515ABAEBA69323EEB744BC529D3445F52D740F6A72E0974969D7A85C5CC2
Previous signature
525FFC220BABCADFE4119BF920FC68572786C2EB62737C5102EB324D386A7D6F84E9FA95A07E92416ECDB5A01B0AD5CD3F9BFFC24B3BEDE1010A071D0773BF08
Origin signature
3045022100943474F602B91EF6A7BBABF2C55D03387F2A643C65AA8E0DFB01A9ACCA8B1A5402202C93E929124216124C4E423CEE98662BED8A87E4D3A83834096CD62F64130E0D
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
0092342402E27855E4A0FAA30A44FA941240005F4A4BD419DDE518AD414CB739EA
Coordinator signature
1B32CAE142AA97FCA13B706CA572B211E23C6F27217B6DCF442B306813E3146D6B7474B26A6545F57F7CCD0FD8D73535618E3ABE7A6100DE25F040A1A9F9110A
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
B983633F1FA2563D96A11D0601265E23FD573B59D7178E5EEDFF62B0F1616C49715C04CF1455723FBA349817EB54ED58D9BCBCC53138373F28EB242228F45D0E
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
EC6B71BAD98AEC9822968A100DF50E011CBE39D0B1DBAA0F324C491C64778DF2A906D6C7C0606C0C0B1B2F3A83982D11083D4F8EB18C2978843F34EDA4BF5005