@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701360240 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x000033959A276240B3CE0BD4BE4785523CB6E76A02351C2A0E6DC35A748FA83EFB88, amount: 0.0245, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701360240
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x000033959A276240B3CE0BD4BE4785523CB6E76A02351C2A0E6DC35A748FA83EFB88, amount: 0.0245, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
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) == 0x0000072E418B60C6DABD272BC2728B17B352B8104F068D11365D50134F96A4199609
),
timestamp: transaction.timestamp < 1701360240,
content: Crypto.hash(String.to_hex(secret)) == 0xB10430F5FBC2A0F9F0778CAF7CCB23732C79027CB0B2D5B3267B0FCAFD0C744A
]
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.0244265, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 7.35e-5, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 0.0244265,
end_time: 1701360240,
secret_hash: 0xB10430F5FBC2A0F9F0778CAF7CCB23732C79027CB0B2D5B3267B0FCAFD0C744A,
secret_hash_signature: [
r: 0x50567A2C60781A7203BE869F93AFBDEC47AC8B6B9651179B8B3704755FAAAEF9,
s: 0x17D5FEAC54288A0E9F39B832CF25A9545CAC45D47749147CB8EB8F134A8C2F82,
v: 27
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
75A35EB305BB3982ED8C3B21F28AAB46E6C9DAEA92CDA33DF4C91743DBBB8040244CA1AE9B92D1DF1DC51D6441DED80526228A88F030A62BAF67B225
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (2)
-
From 00000BC3...F0F7At 2023-11-30 14:04:53 UTCAmount 0.41864026 UCO
-
From 0000CE2F...6426At 2023-11-30 14:04:40 UTCAmount 0.0245 00001A4A...01F1
Previous public key
00013DD853E6CFC52F04A3175C256279CD3DD1316B6268A3D4B0C5E7B600D9124954
Previous signature
81FF1CB9F3DC24CF4EA9B77239B0867E0A0C07BD4281BF9FFCCD06AD99DD79B32F09D59992F5664598C6A9FCEF45094DBD763DAA7CB9A2BE00880EF74ED68406
Origin signature
30450220371E361B0C59CDCFB26C04145CC54606230B5F76E7844D1E1467CBE8D740AEA7022100B8F5D440AA2CC7212CBCB2103A5DDA8C50053FBD1C2E3D046EB3D22FA4EE7F6B
Proof of work
010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381
Proof of integrity
00B8E1D2F15A75CE69240ECACEF44D8680FB37E3B1D1B1685965B5ED79A32D9C58
Coordinator signature
4E6F56D554C8619EFE2C818E35829A5023A0EA2212455E3979E35BBC2BFAEDF26BF830196B9DEFD426E27735F41214FA884FCFB69C35683537538A99DC99EB03
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
2DF5BBCAA277203C16A7F8BB07B1082A510C4E1560F4DDF87018FDAF492877BA7053BC24FCF6E0F643F00059A42FA408E92ED2F025289A7CB2B8EEB6FC7BFB06
Validator #2 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #2 signature
D2E3E73CA21444D4EFA9DBA660CCD59FA55C11DA391650A3FB569522F18CE5796D58876661482053A63D45221F42EDE139A1F19DAF262924FAECE6FC4AE9B804