@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: 0x0000F25C3DF408399FD5CC26D5A53C4081F6D6600B04B5EF4E41836D384F8B84C772, amount: 12.0869394
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: 0x0000F25C3DF408399FD5CC26D5A53C4081F6D6600B04B5EF4E41836D384F8B84C772, amount: 12.0869394
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: 12.05067859
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.03626081
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 12.05067859,
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
C8C7D9399B93B5B9CBF09438E31110DB137D04766657ED21D3147146D83C6AFBFB3160825B2E8C2030EABA4DF677821EF7D60DFB18B37B0C7E4C3BF2
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000F2D0...3A47At 2023-12-24 07:07:30 UTCAmount 0.43406382 UCO
Previous public key
0001F825A9A3396FFB218D2E647676BD5A81A022CDBC1C5FC4845884DFBBB493A8E0
Previous signature
F61C2B5A567F9138568B46F741CB2569C7FB5CF8E53FC93C5F15BC6EBABF9ADA76830708453B478EB472743ADC7ADFF409678A75B0BA3D299EEF391CCD076505
Origin signature
3044022077172D7906518C31C29F1FA29E3A7ECB0913FCB6A1F4FC9363D8FE569990E842022021F1E9D7C016F6E715731976CEE4B2AE8F65A89568F10578F7A50EA9C08AF61D
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
00D6456D746A010552F6359D58D4B7F66454B528B437BFBCC034836CDD66C46354
Coordinator signature
587E0D93CA6929711AACE191694C253A01011D4598D95B2F70C1D8555476D50FB9A6D5CDEB8275EF58A942BCAD1F10F436CE0770C069591B7D846775A8A9920C
Validator #1 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #1 signature
6C04A5310EE614266D194D5B0B353435A713E8DC97140D5E9069B1855D1FC318210A85B32FF36B2146C9FD71967801F555138DE50B293D07DA2B6EB426F15F05
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
5A49F4A4A9C93684C3BC8964085BC1AC09956D6E3819943F68CD1867DEB9FCB406ABF509A83AE4426CC64556893470F9AC46A1285013DE5B374FE417C838850C