@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701800220 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x0000B57F380A6FDD0E091BF06894748657AC79686AED964A3F2A9DD87527632F6AE3, amount: 0.2, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701800220
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x0000B57F380A6FDD0E091BF06894748657AC79686AED964A3F2A9DD87527632F6AE3, amount: 0.2, 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 < 1701800220,
content: Crypto.hash(String.to_hex(secret)) == 0x3E3D53BC4560981746DD484BE5C0161E7FE872BDF7708DA9465B02924F536A73
]
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.1994, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.0006, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 0.1994,
end_time: 1701800220,
secret_hash: 0x3E3D53BC4560981746DD484BE5C0161E7FE872BDF7708DA9465B02924F536A73,
secret_hash_signature: [
r: 0xF3587FE287B38A549B5ECDC1C9690E2F46CE4822B5D0D89759EEDE89E5F8B475,
s: 0x4D8E59DBCD7C6CCE73BE93058FB64C3DEA4E536D2B352FCF2E2755B06EED9C59,
v: 27
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
EB9EE59EA55EF51AB7C0214438D4F5CDDE0E77F0CBF430D4CA0A77D7C50DBC7669E8DFB9C2A525DC62B180031ED05CFF6636649DF3CE4B5DE21F9E6B
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (2)
-
From 0000CA9C...B501At 2023-12-05 16:17:58 UTCAmount 0.42741148 UCO
-
From 0000AF10...B9CDAt 2023-12-05 16:17:40 UTCAmount 0.2 00003DF6...73B4
Previous public key
000192A6BDCFA0C002326D533BE1A49F1B2E0A7F250494AD3FC83EB2CA23B1931B97
Previous signature
03DD0403DDD1F9C042823F582AC74648103A8BAE9049581062C2F411DB30D74F1EE90077F32B67CEECE80554F4A45A2A536087E85813A45B625791EB1AC02509
Origin signature
3046022100D9FD6EFC5C4AD95130BF8C1FB0FB083447205003436E01178C8BC2C01ADAB116022100DAB91DAAC65B8026712A0C1AA1F099D5151533A419F26CF0019E4A1E3C00DF9A
Proof of work
010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712
Proof of integrity
00CBFDF7273EDA7C581989757B6F60EA10AFD1E59E6E4D6581E0DF1714D7CDF1B0
Coordinator signature
6F42F7E506E1E44891676F1EB20D05A4C080F2DC561B6BCA2621FCC1A17B74F5381D474DAEB92D725672B4417BE07C81A36985CC9BF806FB4E0D8A57B875E403
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
A51847B8164AEE0C15E03B885ED22751966100979A05BBCB71B55C86AA5DD72DD5D2E20F85ECB8EB7C11CE2E18EC98E28C5983424D415285B7923021756EA802
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
3D7FD928D6326E8E952123C8620CA9E86CE81EE7C611A5F50574737E8C5D1ABB95CB5337B5A8D7F89EBCE27E048123B1D1BC15893462D3CC65FCFEF9CEA66F04