@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701459900 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x0000F25C3DF408399FD5CC26D5A53C4081F6D6600B04B5EF4E41836D384F8B84C772, amount: 0.05069496, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701459900
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x0000F25C3DF408399FD5CC26D5A53C4081F6D6600B04B5EF4E41836D384F8B84C772, amount: 0.05069496, 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 < 1701459900,
content: Crypto.hash(String.to_hex(secret)) == 0x62A3F9ED9E22B17303070FF15079E770354415F815A22FCBD9D12FA2D0381AB0
]
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.05054288, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 1.5208e-4, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 0.05054288,
end_time: 1701459900,
secret_hash: 0x62A3F9ED9E22B17303070FF15079E770354415F815A22FCBD9D12FA2D0381AB0,
secret_hash_signature: [
r: 0xA65073F44896C20FB6DC58FF9782D74CB6FFFA56F930CEB7F31A684BBA385BAD,
s: 0x477C3F3662F28FCF423BB33D2BD4513122E2FDD2392289DA5A1A9148A7E115EE,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
E4446425A9FB8B546BA0A8A27D86CD46A4AF7200769BA5D2DD06356440B59B2E732D8DB69AFDF78DF5019E49B43EF138FE0F662DB566E3A9DF37E331
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (2)
-
From 0000309D...2398At 2023-12-01 17:45:23 UTCAmount 0.42849606 UCO
-
From 0000D4FD...D99BAt 2023-12-01 17:45:06 UTCAmount 0.05069496 00003DF6...73B4
Previous public key
00014779A2BC058A181F7FD7A9CE51C1AA1DA793E74B2A4EC0C8642CFEDA7F74D187
Previous signature
EA462A2E75BE0C440193D6D89B134DEBB866F2233CCDCCBA2A5BA75C8785176D3F81186710E2837A3193DF635A308C89073826CC516B43ABFA521F4CAFA6ED06
Origin signature
3044022078356217F7BCBC9E59A3A822D400E6192111194E14A454518A519F6B2F51706102203BD22ECD6982235E6E4FA892E15FC5AD1427CC220E02FB47E38810DEF3C41BC0
Proof of work
010104228ED9FE757FA46CEDCAE4E3FDDEC1EF6511A71B15E5611AA36EA41DFB969EF2FB83D72D13AD1E89873CD4EFF1364880B3557D72AE5188EF5E1BD09253CE235A
Proof of integrity
00CA9AAF0C355A37FD03BEBEAD01084EDCF1349FABAFA1FCA302A4C3165EE30ECD
Coordinator signature
8179385144CC6F1D32C1FD28F62DA2EB12F715481A00DAFE34F0938EDE2467D095BD0DBE824D09CCE39337FDBBD5338E8A631D24C1557F301CA94371FE998406
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
EE08767169A853297DDA773165D2E360868FD8DEBD0FB40C83149375938DFB393AF64F2FC40B29C7D3249A31CBDCAE56128EC1766D75CA2DBF323C070CF74B00
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
8C0988CCC7454A182CFC5AA07F08E0EB95B1ACD50FD7A0FC6F133CC49700024127D40360088921F28754115FE641BB7DB6FEEACD6B82B8AFC0146EDEECBC0400