@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1702144260 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x000066062AE51C8EDDB115B895B4917CF9A25F20A0CDAEEDCFC62085AB197F6B48FC, amount: 0.01, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1702144260
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x000066062AE51C8EDDB115B895B4917CF9A25F20A0CDAEEDCFC62085AB197F6B48FC, amount: 0.01, 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 < 1702144260,
content: Crypto.hash(String.to_hex(secret)) == 0xB4FDF955F06F700E4165B63D28333DFDDA70A02823C88C20A8847200E41242FD
]
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: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 3.0e-5, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 0.00997,
end_time: 1702144260,
secret_hash: 0xB4FDF955F06F700E4165B63D28333DFDDA70A02823C88C20A8847200E41242FD,
secret_hash_signature: [
r: 0x260712F1FE1D387D6E331F37A2B597BA766413D38170B1D61159E85A2A2381BF,
s: 0x5DDF8525749D236E61555FEA756C8C5EF0A008D6080A625B61819D31B880581E,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
8E427AE1EAA70BBD22C6D966E42E1894E27FEC3395C045F3CB2270836FAB5ECA4EC52AB52E50B1860F9CC1B439F5737B073FCD0009B0C3B32E7D8EC1
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (2)
-
From 0000416C...18C7At 2023-12-09 15:51:44 UTCAmount 0.41075563 UCO
-
From 0000F63A...77E5At 2023-12-09 15:51:28 UTCAmount 0.01 00003DF6...73B4
Previous public key
00010650792FF22BEA9DA33C358DE5E770A1385D09D8C24B75CE836C5F21628AED50
Previous signature
90877C29B5991A97F65B801C94D3BC611A1C5DEAF15B6A250BF844B2491099DCF3B0D2C34D884761BC3EBF890B50DE44479FC895D228581B68A11B648E6A4408
Origin signature
3045022100C1078D74DB4C216F6D58C03F635F8117CC6857A55D323B6CA873F4826957E94802203377739F27569CC58E488B1A7B6174F9A5B16AD08FF3C84BD9D992F831D4B480
Proof of work
010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712
Proof of integrity
0013795FF5ED76E0D6F3CDBDAD014BCF6E42C17341D99094C4F0046EF0D0420D67
Coordinator signature
7FFD01E23D679B5F012F83491B09AA3163D80709373A63712329AC0BE31E31ABBEEF00E0489DD70D46A3987897632980ED9873EAAEC402E2D0D5FAA28832D107
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
5651A38294D3884C2E3A612B00959E34D2B6BE62EBB38A378F7EA07112E932B7246E4CD0AEB0619D6752DCCF21F05B97F475CC5BFAC565C5505AFF38EA97A40C
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
697BA789998312051525D11AFE02ECC9888DE0C6DBCC08FB23AA0314B711D4ECE0991BBE40DD5B39AFA53D065F33595E3994DB1CC48E51726D0F6E6C03A56503