@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: 0x0000290636588E1AA2A069C0094185633D1A04CDE098D3A4E93AD53191B29C223F8E, amount: 3.8
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: 0x0000290636588E1AA2A069C0094185633D1A04CDE098D3A4E93AD53191B29C223F8E, amount: 3.8
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: 3.7886
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.0114
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 3.7886,
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
AACB0824D25F6D1AACBE09056D12CAA5EE3AEB9796BF8E33B169BA4FDBED269CFD98D7077119A0E0B3E0C238E9A803F30BD32CBEF28493A3D2650047
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000E2A6...C480At 2023-12-07 09:07:10 UTCAmount 0.40402697 UCO
Previous public key
00012F2743952BB3BCE162774E7FE611E4459C2C5C3526A7AF8975ED5CEC5BA097FA
Previous signature
5559E74F316B3AFFEBAC231216D3DC7930505E13F6972DFB67666ADF39A0C0E8AA32DF191F7E6A0C3A4296D6453BE373B161C434CA162FD55E1D3A5401DB900C
Origin signature
3045022100F81F98E3A252EC0B77DB2E927A1EB41BC61E1A48D6DE23E11FCBB11975BD26B602206F5028E404B3E0023BE56D148BC626709A7FDA2BC23ED5367A9124135F1F0A64
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
00BA5125A534E59BD51B2A880C44E642588087BCD9ED598101D693C516B252B271
Coordinator signature
EAE7A5693B4A202EC5F3233CA5306A4E76823731CEE7393F4CFCBB340238D71139E57A5324D167E8EF3E1B128B4D4D61F31B0CFF13B155C68DE7DAD4E4F12604
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
6CD4E3131EA53D82A45DAF2D683F0DB05A53856123BA3597AC5B12044F472699C13121F33E726419390E0D3D067CA18B275082CBA0296E1B8EDE7849F61DBF00
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
1FDEDC4730ECA85A3733C32F20B778B2B8C890B073D5975D501FFFE1FB8DE9A578E8E9B7FF202D2681C07999984F0C9D7DA6D45149733E539F39DFC1131D2407