@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: 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: 0x0000AAE847768F278B0D458240DC4E5205C2CB307B81D81865338F2C6B831F6006B1, 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
09B79574271132A410EA07F2AA68426D7CDFD166167947738B25D1E2FC2DD2104AB89091B9B7E1C9A9EC380E243297A7728217610D1B3D82886F75BE
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000CBE5...E6C4At 2023-12-28 22:11:33 UTCAmount 0.4054635 UCO
Previous public key
00014E4E50F9AE69E69D130E96D5EE40E1151F6935FDD3D75E4C8F33240652C6B53E
Previous signature
63190D95416FC16D37F3B508A02DF23C2B04C41F57BDA069FFB5F7D5CF19FD99C10CF97C99B91B8E4659158B611834FECF43C1E9CAAE86202B15C67391FB400C
Origin signature
3045022100F1477FDBF7E3ED326292AC29FC9F75A80AC6071325628206D6D912177461D4F1022072AC356CF00A175F863864753F8A5DD0A33CF1DA0A7993EFC027A02C4E76569D
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
006F61282A9DB078ADA44F1E7C27BA6F88F1B51FCB93C999EB9E53F9ADF55A6EC9
Coordinator signature
FDA3DCE28F9D169BE3703BEBA7D8701686DD5D917DC559FD174D262E1D649C5321AB5C57BFE6746EFE7C5001CA66FBC925216408228D0214BAAD050EFE18CA00
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
6FF5A687F49CB53F76945118BD8F471E9F1D23623BA599C69E02C8CDFA7F58F1828499718412C1C337BD95234E655AB2D5B9A9AA50B788ECB529D9957AA9430C
Validator #2 public key
00011ED0B570D680BE5ECD58D2D121689DA73C46DCB38A01C6E10D06286040ADE30A
Validator #2 signature
47AECC4187B0D0AD597CA008AA9F10388F1AE961D3E1143B43673CD2E7990F8F6BE9968840BABDDDA5B4CE946E4320E7EBC06A2FE62DEC4C63AB6E87124F0D02