@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701442620 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x00004D0AC7C11BC49690EEB0A16B3051A7BCD0E20A0ECE056852B59435CEBA359AEC, amount: 1.0e-5, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701442620
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x00004D0AC7C11BC49690EEB0A16B3051A7BCD0E20A0ECE056852B59435CEBA359AEC, amount: 1.0e-5, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
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) == 0x0000072E418B60C6DABD272BC2728B17B352B8104F068D11365D50134F96A4199609
),
timestamp: transaction.timestamp < 1701442620,
content: Crypto.hash(String.to_hex(secret)) == 0xBF01249EEAFD36007AF5BFDB6E4B5B69CC33A8B1665629ACFABDCB09F4621627
]
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: 9.97e-6, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 3.0e-8, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 9.97e-6,
end_time: 1701442620,
secret_hash: 0xBF01249EEAFD36007AF5BFDB6E4B5B69CC33A8B1665629ACFABDCB09F4621627,
secret_hash_signature: [
r: 0x12453FF034BE08E7969F78DDCC2A30DCFB7E1617D455421532D95073D3906B7D,
s: 0x6021257CC81CB87163013D7C0225B61013CB2A885D8AEF8505D23863D40D26BB,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
36E45014F84060DE482FDFA05FB597633E761E1924F44A68DB22AC86A3407142302FA6BB13588EAD615058A88FDDA158F2420355388FCB2A3C241294
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (2)
-
From 0000E33B...F52FAt 2023-12-01 12:57:56 UTCAmount 0.42841881 UCO
-
From 0000E217...265CAt 2023-12-01 12:57:38 UTCAmount 0.00001 00001A4A...01F1
Previous public key
0001F8A008269AE22711A6EC3DBF44716D78376766BA6C17FCD65B7BBAD0BB0E6BBD
Previous signature
F2998372A137260743EADAB1936AE4F2BB2D46F153D353ED6FC6212899ED251FDE1729967E86E44BFC6C320596DA06579A379CCDA5D34B18846AD137C119C500
Origin signature
304502200274DB1D9D60C8EEB9E6A082C5A4944A9D5AA4FAE08628E0B81DBBB522A87E52022100A318ED630F218D9E2454AB7B15C2FFCC3B157FEA4835D96141304413B193B9B1
Proof of work
0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45
Proof of integrity
00CF38363D022E52754038E96776EBAB5F45B5992D63FD7F38D21102A7A788B0B0
Coordinator signature
9A66D87D290298FCADD497C390CACE5AE8B201F3AA0687E51A629805BABFFA5753176FCB33CF84EA17D38823D0D3219E3E61FE13F0BBA28C131A88B38D10130C
Validator #1 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #1 signature
14E36F9B9CCEF6955EA4590B682C6D1D1FA5927ECA137B5FCD415CF36A6119C3687D349B644E36C4053E302B2626793879C7FD81AE6545A8A205C212F1E91A00
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
82D396DA3798C70755A3CE1FC880F03C719FF4F8B632DCB10FC903E815E812D8F5AD46ABF16F610F0F90454E26E55EC611E01A0C05879E173AEB7EAC07375B03