@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1700011020 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x00001675BECDA24450FAD82114A15B58567979E8E7AEA1CFFC54CE8C1779513EA2AF, amount: 0.1, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1700011020
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x00001675BECDA24450FAD82114A15B58567979E8E7AEA1CFFC54CE8C1779513EA2AF, amount: 0.1, 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 < 1700011020,
content: Crypto.hash(String.to_hex(secret)) == 0xAE39F0EDCB53ECD2038FC3081964F242F4EA59DAC8A676D1AD3C765039BE0B93
]
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.0997, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.0003, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 0.0997,
end_time: 1700011020,
secret_hash: 0xAE39F0EDCB53ECD2038FC3081964F242F4EA59DAC8A676D1AD3C765039BE0B93,
secret_hash_signature: [
r: 0x9AC99851161CBB14C59BE15D7FA4FEB2155DCE9762214B44019DB5F9E90A3BB3,
s: 0x6E918DF04AD2F1F1BBC4E49DAA718ECBC35435292F5697B617041D66891E2191,
v: 27
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
0634915943C31873FEE297E1D83E8EB79969D4072275D4D5B89A793521687E085558D4F09B8DF33B239038D8A873BEA397D71D82540EFA664130BC2D
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (2)
-
From 0000EAA7...55FEAt 2023-11-14 23:17:55 UTCAmount 0.35751768 UCO
-
From 00002460...EA6EAt 2023-11-14 23:17:45 UTCAmount 0.1 00003DF6...73B4
Previous public key
000127794C6EFDB0DD95BF3F07065020411B6D0B53063875DBD41358AEB1442C81CE
Previous signature
B764AB397A373F7E7C10210F836B23D9C7D8E0D234A4D008945D057AEF626E0D6E8569FC263F877C02DC94AE619440596725B5AF9D2A97E8A8856FC47A891D09
Origin signature
3045022100A3B96AC00EE555269AD350135C130654CC8B99A5C4D52A14801B5395B73E9857022053068933B8FAF35B273D206D13D6FAC0A4C6BC6101DD257AD5B1FC66DCB27B69
Proof of work
010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712
Proof of integrity
00E3B1E7865F2B7B699256DC2D671DAFC41E36896BA0F416DCB95338F3A02A3DD2
Coordinator signature
EC2FD4915D85EFB0E95212666258183BB0ACE62E57A3FB3C31CC1E27628872A15100F519E108EB56C20A45FBF4E9BAC949C27B6806342FAE3E7D090BE3FE3808
Validator #1 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #1 signature
32C923ACE1326097F291DE71AA24998A586CDE5C287F347CC06F0C5FB277380F8A2D990D4FD1252FF384B9E4EEAEC16D0FC40819A623F699C69EAE44285B0007
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
33221BB016B8E3657831E8A47C35BB9ECFDB636BEF74363D00FB066261A301E78010D9F71FBC123324340F0623D66F0D6EC613A9756CEDCC7560C60D795B380B