@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) == 0x000066706D704329CA8C2A4153991E2DDACC968622CA10217CA14952EB7ABB966C30
)
]
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_token_transfer to: 0x000066062AE51C8EDDB115B895B4917CF9A25F20A0CDAEEDCFC62085AB197F6B48FC, amount: 0.0004, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
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_token_transfer to: 0x000066062AE51C8EDDB115B895B4917CF9A25F20A0CDAEEDCFC62085AB197F6B48FC, amount: 0.0004, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
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) == 0x000066706D704329CA8C2A4153991E2DDACC968622CA10217CA14952EB7ABB966C30
),
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_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 3.988e-4, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 1.2e-6, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 3.988e-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
6E02267494BFA23A09778C819077F8CAC2C48FF940AD845B1920F8AB905AD30B545023942FA683CB07392DAF07DC61BA40DE83AE9945BAE8B1AD82C1
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000B562...8A49At 2023-12-09 15:30:16 UTCAmount 0.41580435 UCO
Previous public key
0001C621B1507374AD77439C349ECEFD1C142F53AB3329B281E5BD7EE63F3BB85C99
Previous signature
A7030C02B57AD418FB638CB87AD4BA52EDB253E80F523C09776BB17F93BBE45F7B0F4F6DBD213DC15D99EEF195F9FCECC072D46BF842E715875C644C81694D04
Origin signature
3045022100CF425BD05CFC84C0CFC61CB7E3B1B0DABEA5D3A039C3119F82375EFADA5CCE7B02201528A14411934629C89780D53F7876603D22B8538EF0238E81DABA60EBE8075C
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
0018DFA3BBA3ECD638BD8D9DE0BBB493D0D07FD7B55D27B585D4689752DD06D0D3
Coordinator signature
DE65425F7D1D426A22D9DC6E0D0A0CBB4F8E8F8E814D9259E6B7D208A1C2C80AD0AD6E0EC3316A74FDDA535C9B4AE5F6D5C3080B3FDD0AA44E6D1CBB6946050D
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
B64203D5DFC87E9C8DCE2EAF910A9DE13A0F1E337F6D96654227AF5BCDCF3F2FD8B914DCDEA961D5DCF4AEC2CD520E634FC6D9B569E6B80E21F189EA081AEC00
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
823A8B649654EF77AFC3C2BCDB0CBEAA817F971F521A0AA18A6F381975DE2CBE917C1506F3678E1B75FC5700443B2CBFDA664EAF062F6A4B97FB8CD41C2FA501