@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: 0x0000A66E9C4FA87C868BF49B1336D3C2E318F1D0FD20A44CD10BDD3464329B97F474, amount: 7
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: 0x0000A66E9C4FA87C868BF49B1336D3C2E318F1D0FD20A44CD10BDD3464329B97F474, amount: 7
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: 6.979
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.021
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 6.979,
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
C0B4ACD5DD938C3302DF92057A6A45FEA35DDAB98CB14720CF9D3FA1984DC80169214B8BEC719C8442FECF9E857248D557FD9D310A304E88BB57DCAD
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00007EFB...1A66At 2023-12-14 04:33:52 UTCAmount 0.43729988 UCO
Previous public key
0001D2C244A1F5BF5747613FBCA0DF401972CD0EAA28813B03B5DC173D41393DC229
Previous signature
910449AE6DE7038327069EF4BC1CBCCAF806EC0B87CFD389C1C32DC34CA0C7E39402ED7F3EBA5A33AF0A019F43A7F651A0238D5C1D0EA872F20D4AE7F357F30C
Origin signature
304402204140EDDD38346EF6F9B9400AD11B52AAA96B8A78679B6782BBA3967DC144328C022013CED6714178C2CDEE37CC285EBE2E71E9870EB12A5DE7342485B91006F9C6AC
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
00ABC441E70B99F977D043B2DB1E9DC397584C5C87F98B947846FA5AC20273053A
Coordinator signature
D7AD48BFB5E59CDA2F61346A697E872B316E75C2C400789FA52D7A944796C530EA4DD446602E197B1C58130594051736F26B3D969F8D163A89E5D43FB798A70E
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
F30E24793DCF59B28D63A8A31780545200AEF4FCE99A572FAE498374A99C9511FF2CB01F86886199F7A40B4EF108518CAFC1E07039518650DFB50913D549EF0A
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
C69AAC127BDCC591BB13D577919F2D2093EB2E560FAA0CBCD6C85A88A2CED8B84E283FA76C32267B2F60A9F6E4C217F19E60E197180AF137A26A51428279390B