@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701316020 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x00006AFF130BEB6BE9B02B80FFC13DB5EABFB0A7D167BAFC9F2DF8F141D7755FB39F, amount: 0.1, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701316020
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x00006AFF130BEB6BE9B02B80FFC13DB5EABFB0A7D167BAFC9F2DF8F141D7755FB39F, amount: 0.1, 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 < 1701316020,
content: Crypto.hash(String.to_hex(secret)) == 0xC67BF3925A35FA5711C25E63DBCD0B3D3ECE8605A8660386A6F2D5B1D9375696
]
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: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.0003, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 0.0997,
end_time: 1701316020,
secret_hash: 0xC67BF3925A35FA5711C25E63DBCD0B3D3ECE8605A8660386A6F2D5B1D9375696,
secret_hash_signature: [
r: 0xB88A578A95AC6CAABD18D04A59832B04A8500F70FF81608CBEA9C3FA0DD9AD13,
s: 0x0F70EE1AFC2918C1EBCEEFA7B32576774A025DFA5AE2EFF102A430BD7A6B9592,
v: 27
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
89FA0D1A8673B0151CADBBD84C4A3A8CBFCCC84D01EC8C1DC658DBC4568E69F39D169EF66FF78308FCD7780E25DFA85AC374A4B35FF1A5D44EEB3ABD
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (2)
-
From 0000E300...5C6DAt 2023-11-30 01:47:31 UTCAmount 0.42589913 UCO
-
From 0000C756...5BC7At 2023-11-30 01:47:16 UTCAmount 0.1 00001A4A...01F1
Previous public key
0001CB5641B5A11C73C9B55DF249747C690DDFC67F39042420799244FB1866DC8147
Previous signature
6D051BD68DA2AD61D715C8D35D92F0248CB4C867B02A038A26D1316FBDA88837336890861E57A83FC57FE88A7BA3B81AE7665423948D81082FDA46CC1BC2A804
Origin signature
3046022100E506D4F26F7100252905110D016D8E5EE6E45ADD8D9867E38912C315011B9A00022100C0E33327B4A65E37A51A86E2DFC34EB4E98ECA5A94CCC841522EE9102453DD4C
Proof of work
010204E9BB401A767B0C92D5DB139379AAB18E1B449B455F49E3A44F3466B2D38E59F0516B79493A528A95E5A74CF46F79CF12DEB73293458F6A4403D2B3E57D697347
Proof of integrity
0003CE19BBA2799842DBDED21245EE1CAD51C8175A9C5F8D726F250DD7F6B8903B
Coordinator signature
067A5DFFA5874638B186EC7AF048EF231035C6EEE1B4C8D4379D80730EF41953A1FA5BD9B603C03EDD89746795CCF8B52307FB15C1E05EB76D192A54B547E601
Validator #1 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #1 signature
EE0F046DDD722C1A4F766952BFD61E440F5F9A41274092BF16DEEDC36899FC642D89D07059EB9D4644B0CB2327948BD51DC08A78EAE5A3C33878735B5435BA04
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
2C0F32CD771D20B62E6F139B10B40CC0779BE41292E1CAC8342CD5B59DE15AECBF414023D0519B029602CD5DC985D447428FF2317A327F7A41E67E6F9CA11E00