@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701857340 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x0000229E63A69C9885130321C9FCDDFC8149C016D1EF0371C3B48F7E44069155ED9D, amount: 0.01, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701857340
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x0000229E63A69C9885130321C9FCDDFC8149C016D1EF0371C3B48F7E44069155ED9D, amount: 0.01, 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 < 1701857340,
content: Crypto.hash(String.to_hex(secret)) == 0x9B36B5BA3C1412EB1F5DC16CED6472041818A45BCE7ED1FFF383F962B883198E
]
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.00997, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 3.0e-5, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 0.00997,
end_time: 1701857340,
secret_hash: 0x9B36B5BA3C1412EB1F5DC16CED6472041818A45BCE7ED1FFF383F962B883198E,
secret_hash_signature: [
r: 0xC099B861825C2DE6118FE1FA38ACE09BD99ACBF176573D11480E71B40A275603,
s: 0x65CD8D800636A7618A958718C8A100AEA1E0648CA3855668820A697DDB2AED93,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
3793DB276B96F8FDC11893AF83C24E2AE416BACA23488079427EB47FB460D26E356224F0D2286E0FC022D790CF4756F8D8EB61730CDF9D0F125C10B6
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (2)
-
From 00006694...C4D0At 2023-12-06 08:09:48 UTCAmount 0.42778221 UCO
-
From 00005AF5...F82BAt 2023-12-06 08:09:32 UTCAmount 0.01 0000288B...B827
Previous public key
0001016A023E8CF0C8A2A97086BDD233A6C68A2652078F8E1593CBECECD1E680260B
Previous signature
29BC19F556D45B814246EA6BDC22F183622A7A5F047EB40EB0965156A045BB62DB1FA95B25808415F7A9B5A4BCEF586B42353389D0C1AB102D3E1B1604F7B506
Origin signature
3045022100A9238E2098363A619D04BF550EB8F210E56E3B4985299FE3AE93C04F8FEC80EC02206E10C4D82F8A37DC350495F1DCAB82C8E341E60850F55F03002FB27B14B484DF
Proof of work
0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45
Proof of integrity
00C356111F34497AC95C516A6B9883266B2CAC34BED06213C39B4DE96E8B96CB62
Coordinator signature
00F8E85DF12C880D13B058560602B96063B88F12DDC262F62CD2B3D4179AC5639795B4662C696EF05DED3DAE91F514EBF1709307CBBFEEF27C470FE4CD4BAB01
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
47F7B4C196477ADED9F768C76B2F29F9C76FA356C59D1884F8D53C129F229FF7F8C1DA801A3CA74622EE3962AD03B27176D0396A42B0144F6BB251CBDD421808
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
7449A1D52989505B0D7CA98FC2EA964B05219D1E452DBF6B525379F904C6F0CEA3B564A8D3A9D31380E684925A10AEC80C0C1E6AD190D6249308726A5CF9710C