@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: 0x00008DD40CD42287A3C8282065F5BCA7259AC7014CD73109B570E946A977687C7BD0, amount: 0.001
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: 0x00008DD40CD42287A3C8282065F5BCA7259AC7014CD73109B570E946A977687C7BD0, amount: 0.001
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: 9.97e-4
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 3.0e-6
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 9.97e-4,
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
36B9ADDF8AE4BA61531A1A083DB0F562DABF795B3FC6798E22DC813B619FD24A89DE23ECCBCADC2E62B6C552FE43E8F78DE0B8C715CA9CC7CA3015DB
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000C055...FA6DAt 2023-10-25 17:43:08 UTCAmount 0.57301078 UCO
Previous public key
00019AB7EF27D56E73BFD049E8481413262622A416AAFA9317FC3117297F580A2954
Previous signature
F60F3878660C6EBC57B488CCF4ADFF5E65A314093587E8476717E9FFD6F7BCBEEE1E7462DC9FFF472E9DAFA91ADF9FD98072DC2383F8560F1A4CC77F1F5B0702
Origin signature
304402204685FB9E5613EE4C580CD7CDE339BA58171A8E95E1B763479F0D2DEAC368EB020220157E8EB39B652B1E0F6AF3A0FE2900352FF2D55613B71E84B60BA99615D07F4F
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
00D9938838215B8A1F9F01D281BDA9922FFF08EC2FCA425F7166091C9B2CC23BCE
Coordinator signature
FA16D0893028BFB12A4F2B0E8050CFAB6DE01850ACB9F0B9B58B69D5E905384937B45DE2219EB7C1C916BD26B0A922B21C6A25FCD3B9983A3CB69E07342EB10C
Validator #1 public key
0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34
Validator #1 signature
F7510BE6041170FAA2489E66C070A2D07E6601DE03D6ADC296F096D481BB61D67D7EF8BF1B7B99CA7935499D75B03EFA642C7CC6E7B76EADE53DC4E126D6EA05
Validator #2 public key
00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC
Validator #2 signature
8C19976B3810766623D8B4BCBE1AA1EAB766D385B33C9FD90B9E5EA6059B93BB8ABABDBD8B23D3F9802DE67E863A26D52C716B2B06D4B763A61C91D5CD5A8804