@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701554820 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x0000064F114419DD1BA0B495E4B596513A180BCC4F58643496F0919DCC3B6313BEA1, amount: 0.04, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701554820
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x0000064F114419DD1BA0B495E4B596513A180BCC4F58643496F0919DCC3B6313BEA1, amount: 0.04, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
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) == 0x00008DD22E7496E86901E9B276A1BE6F9512EB09980CC04C7B76495EF37D5666A709
),
timestamp: transaction.timestamp < 1701554820,
content: Crypto.hash(String.to_hex(secret)) == 0x767253951FAA1D4E9EFF4A5936F96BC66D5D955D84AB586373A1A021A90F01F1
]
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: 0.03988, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 1.2e-4, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 0.03988,
end_time: 1701554820,
secret_hash: 0x767253951FAA1D4E9EFF4A5936F96BC66D5D955D84AB586373A1A021A90F01F1,
secret_hash_signature: [
r: 0x522BCF80147A2ADE0D2E2260A4C227A33E67BDC336E7D82405DF16FDCE116B34,
s: 0x76CB3068CA07D387114C66EBED385BECC013A004A07DF209427A15B4403E25B6,
v: 27
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
4A4F2723285352DC95B91AE21C9D093C0B5870BBF40281453731F53D616F6AF01E7B14197F9E5937E1153D3E4BF671414F13C23FA91853C5DC5B4F88
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (2)
-
From 0000894B...68B5At 2023-12-02 20:07:23 UTCAmount 0.42585012 UCO
-
From 000099F6...5EC8At 2023-12-02 20:07:07 UTCAmount 0.04 0000288B...B827
Previous public key
0001222AE0CAA1B3E03021820E44C59B7C40394DD8B2EFFDD436EF0F6039C5F7A9F6
Previous signature
3EF8F84D24F711F7F364101CA678AF40728BD04651C1B17226439AB671BFBEF5B1E242C85BD7D9B4FCE3B327B39CC45BADC8DEFE1E0699759B9C46EED3A4260E
Origin signature
3044022060770F776B86FFC61F04061A2EB6041E69D20F16A947D6661C8B6BCF3AD077D0022070F1C974E10EA107C139E241579471A630052942B58AC05958DD80BBD67247EA
Proof of work
01020451684966573439C38DA99334546FBBDE4A6D96A50B4A4ECBB6572CDBED023F079607407E254421D1779525D11C60D55684F0B403B93B95823554E29D1E2CDB16
Proof of integrity
00278AF48D731FB47DF9BBE2FEA2B59985C72248F8093073119F5F6FA934C6E95D
Coordinator signature
E4E80F083D8CD361BB6ED6352C2F5C0505D9DB7E790E3A2C57A5FE2B7ABFC5EF1A79E83A8301291BB501E264909F7515F069B012DB9344A4E85F98D7C8F58E00
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
3C41D23CFE9A892C7F9375A5BDD4B551762DBA3901AB925582BDD53A37CCFE3463B422EBC986B16A5CB4260257CAA7A780174821DAD3DE86F987B85E10709405
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
93C52B5F5A1D79507DE6EAE2727F00DBF05B7847916B1D248B109CC7212C1D962CF865D034FC214EC9949F2CE27678995EF054D80EFD71B583A94D3A9CC0D80C