@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: 0x0000E5677A1C2119C8A63F0EA794DA1FBEFEE06E05101CB9C831AA191C3491CC02A5, amount: 112
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: 0x0000E5677A1C2119C8A63F0EA794DA1FBEFEE06E05101CB9C831AA191C3491CC02A5, amount: 112
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: 111.664
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.336
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 111.664,
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
36B2AC3057587C9570669B03BE4ADCF441ACDD1B914729755CD7AC156E2447E4BDA8E2409891C1F615148E160EC69DA2D22317E9B8DEDAE93EBD294C
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 000062F6...2EBFAt 2023-11-30 22:10:34 UTCAmount 0.40793128 UCO
Previous public key
0001ADBA2E786C862C6DE0BCFE48BD38F2389291BD6506D7C09B05F31B4CB4D1A5AF
Previous signature
B110D75087A632E377577D1DD7A1EF974987350E9CFC4C3065594AEBE700882EE9408CD586C32B84D9A83E8966909AA7E6624ECDB57BB5F1BFBAFD7A68390B09
Origin signature
3045022100AACE1D7B1027B1F9887A65F53FD8E4C679487EFADAF1E5629047582BB4AB358F0220117302A0CE2EF294CE456D200B7A4148F9B4464F09CAC232D9060F9D351671FB
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
008B310F0709B9DCCD355E9952EF9D9A58E917E4D66883B298E19ADDAFC958D033
Coordinator signature
BD459F11EE92900F2F78DE2C9536EB91ECFC100BBB85537FDF00725869722F9CBA941588E429367693B6695F3E9275B528B37F5FF3593BBF11BFEF51DB6FFB0A
Validator #1 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #1 signature
0979394FDE3DB0DFB0A6D9E43F70F5A26BF03868EFB396E05A05E19370E0F8FACCEE7977A635784DE6CB639603F4A6068830F3EB8EAA6961CDD5953F410CC105
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
891841FAB67AE8CEDFC0ADEAA85A2612E05235AB6A4FED798CCEE5072A06481C97A4A1D57914B49E3C1A6720E7FDE33DC00A7605553F91E7FB6CA62254AA2509