@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: 0x000089DFCC99ACA4A7A4E82D7DF608F2A9E1B072B808A4E03BF35FE7895D7D0F5AF4, 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: 0x000089DFCC99ACA4A7A4E82D7DF608F2A9E1B072B808A4E03BF35FE7895D7D0F5AF4, 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
0AC94125287E0F23F96401A11EFE3378BD76666B5A7D6D6B5F9BF0AE927599B1330D775FAD7B5F05BDEE7897ED8D8C5741DC38D303019386D39215A8
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 000025B4...2F8AAt 2023-12-11 05:50:30 UTCAmount 0.43832032 UCO
Previous public key
00016D6202621F6009DCEC386AA2AEE6324BC12C6831AA25A358C2AAB6AE6D5F503C
Previous signature
7CFA19388E9F882E1F6C68CA0950C2F3A30332151D67FAF8234433096C0B879F20EFEF1BA0D58CF716F5277C43689C09947BA9CA486B1F9B110FD594D2B6C404
Origin signature
3044022002702CFAD23BF5375A3CA2BE7DC4B9BBA73122CF1EA5A4E3D10A8F2417C9B10E02200CAB27A5BF1D15341CEF8C35BCD07B890521F69F0EE0487D043BC959B5BC9689
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
00E1F76627B00AE5335824A3B3BBB18B8685691FC61A75CD5558C471E9662B974E
Coordinator signature
19138BC39E49CE554788249A2D93438F2E18524E8A9115A8A5A663A9C67C6909A87DD0FB68DB703CE7EA7DF600FF53A14EBC38FA7BA1B782B38ACEDD5A194A0B
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
380FC37F873573F683E36D9B5F0B22261241CFE2446831E5021FF6339056D574D97857A86BFE7A1A37A9D9D7B0CF0F0A58CD018C5586BB82F65DE8933FEEFB09
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
4A91899678003E7538811EA7752317CF14408B6A8774FF6D0703DD8488A05FB024FC329874D1E459AFF870D7BE0029AE79AEB6F23CA41B946CAA305F4176940E