@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1702535640 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000A66E9C4FA87C868BF49B1336D3C2E318F1D0FD20A44CD10BDD3464329B97F474, amount: 7
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1702535640
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000A66E9C4FA87C868BF49B1336D3C2E318F1D0FD20A44CD10BDD3464329B97F474, amount: 7
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 < 1702535640,
content: Crypto.hash(String.to_hex(secret)) == 0x62314CED06F7D2E3D8217311A8084C85E3476712D41F51FC6F450057CF34E9A6
]
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: 6.979
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.021
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 6.979,
end_time: 1702535640,
secret_hash: 0x62314CED06F7D2E3D8217311A8084C85E3476712D41F51FC6F450057CF34E9A6,
secret_hash_signature: [
r: 0xED8F5058CCB1BB4267379E1318F2CFC4965288B996DE2EF9D47754E178203A30,
s: 0x07289CFE3B2EF014B6D5F7895DBD8E709586DD6A331D510A49055C9EAB7BFA23,
v: 27
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
D4D3EF32CEF583CCA3364178C4D0EF57A6F12A53AA20911068D4B2BC6DFBB8FC17CD3B96E049A07C29363BF0A62CEAB6BB4F4ABFAB425C01EF0257E4
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000CC02...A2EFAt 2023-12-14 04:34:19 UTCAmount 7.43729988 UCO
Previous public key
0001A4E80A0C613A96C285EFECF7FA1999D1B03C2ADED7805ECA8550EDCD04B580C8
Previous signature
4C574A2C47923AA2BBF6A9548D10AF72748DAFCE7DA1C2EA6725912FDB2386BA1D2CA5A1129F2483A15DB13C1C52E31D3A01B4F9802AF57F90941C1D839C330F
Origin signature
3046022100DA34E02A6991C321C708E01E31A4FDB62A8F3A6E319416512A928FB352D6877B022100BFCCC8ABC7238BACC27C1A8611F62E6361B80655494C387046246FEEDE8A8100
Proof of work
01010484B78F4110D8E9D6FBEC72759895CC9D4532177314FBAA8B07BC525FC1AF48F150EFBF104B1819106B8E3563CD0E1FAAE5325F8FCFE58FF744C35F47669D2704
Proof of integrity
0026596BD4CFCD22E2774488D354AE8E595788B13F768E61D20AAD76F6F3224E5A
Coordinator signature
235D5D46137DCDBEBA7E69DA2DB1C48C21ABC05B5CC10C19ED56C73ACD493B8B7ED87381E0299000E475BA6C62CDBB14C955F2C8C661622D2BF9CE7A59B34904
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
106F57E46C905FEE8CE955AF4FAB26A6B0B72C1054A82FA8F16D0C49790D27BE77857352031094E6FE2C150694CE743F28402A9D3AF7372D10DB4654B26DA309
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
3C82772210D9AE5C3D0C0AC7E82610C8BA3653CC161663AA9DEECA213A261EA79914E6C45828C0E76D0DA8212BF4FAF390F1DCA0F4EF9AE5F6A043F76014B009