@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: 9
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: 9
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: 8.973
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.027
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 8.973,
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
734D3E4BCEC77864D122BA4B1B58490ED3D5717E524AC9518A711C88DE85EE99E86168730B79BF5F0492E229AB92EA4F7F0C68FB724F0694FC0F38FE
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00003AA3...6CDBAt 2023-12-28 21:46:56 UTCAmount 0.40348408 UCO
Previous public key
0001D7796B3F98F58D17F28FBCBC37B064CF2BFED71D37792219A951A53020951177
Previous signature
944B199D8A3FDC9AD41D752C4A6A134C11397D781C70BB624AD0CA09E000836ACF4B236EBD54C42882272525C342355ABE7726D5FF986857C10E99A078E25D08
Origin signature
3045022100A88618565775A2F05DE4673AC1EF1F9D69F88EC245E543912D84BEA33EA80BDD02200223C54120EDE69008527B1AE767F75F442682D1ABDA5FAF082F56CF1A5CA0FA
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
000C71B1DCB5ABB42A5B0D822AC284515A1CAE38CCCE6F7BC3850B542BEF26BE0E
Coordinator signature
A2E2B35615318D1E847F9031BA47B3A6D977230EFCE7D07A34612337888EDD20F1B8695B46246E236D63143818547C70A2BC123A6FF65CC910A83E769BAD3F0D
Validator #1 public key
000177BA744AC778DC2D51A1B7C622E7AC4BD1E1AA8DA2D0FCE71BAAB7DAD0E020E0
Validator #1 signature
7E4DB621B9856908ACD5EC9C5F3A0DCD18D95902C2BEA433EFCFD2E1847E641140F9960C518544FE11AABA0CBB72BDA97156CF83779BF4843946D8C06671CC08
Validator #2 public key
00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC
Validator #2 signature
2C597498216D2E9C34EDBFC9663CF402831106024B710327B8D03BB5362823987F085084B95C17D98C1DCF6F5725485709CD7FE7B2A38A01103261B5E497FD05