@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701958260 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x00009343CD750E8E78FE56A41D3907631AC762408B5D17C45D457B9AE7E637269851, amount: 0.0198403, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701958260
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x00009343CD750E8E78FE56A41D3907631AC762408B5D17C45D457B9AE7E637269851, amount: 0.0198403, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
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) == 0x00008DD22E7496E86901E9B276A1BE6F9512EB09980CC04C7B76495EF37D5666A709
),
timestamp: transaction.timestamp < 1701958260,
content: Crypto.hash(String.to_hex(secret)) == 0xEA4AE8AD12A8705D1655D27764BFC0C20EC5CC863CEF5416E733509BFF64457E
]
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.01978078, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 5.952e-5, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 0.01978078,
end_time: 1701958260,
secret_hash: 0xEA4AE8AD12A8705D1655D27764BFC0C20EC5CC863CEF5416E733509BFF64457E,
secret_hash_signature: [
r: 0x5347323F9CEBD1903317A8A24DC1ED6ED85BCB666B2EC55CF41A5EFB8EC781A0,
s: 0x402AC95B3D51AEFFB41D4DFE261E3CFEA1E444B65D8E26FBAC9360F0D8FB4011,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
E35A5182E09B017524F069289FE9B773951B9B4FB4D2AAD7E3BD4559C4C10D5E99B1109CB78C41B429226EF778214E48C8633D7BD6E29E1B58ECBE41
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (2)
-
From 0000AE37...EE2FAt 2023-12-07 12:12:13 UTCAmount 0.40940901 UCO
-
From 0000FBC7...54BFAt 2023-12-07 12:11:59 UTCAmount 0.0198403 0000288B...B827
Previous public key
0001407FC242DAA874B5A77C39B1CFCD6C587772564FED2B062BBD02DA1742116ADB
Previous signature
E7689F2D5D890654EAE5D3EFB84002ED094B6E62B68E6C32F823E0FF559480D740CB3140533FD71BB4C364E9F8F8E50CA29E00B80047FA9FE68A78F804E07E05
Origin signature
304402204368B3BA5E3D5BF3360EEB8936F55C45B774700A04CA1C1C58534C0D8C3E9E67022035670798995F21EB03BCA6DBECF46D7C2A96C3974148B5C8C49001ADF8D7A8C5
Proof of work
010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712
Proof of integrity
00B63AAC8C9A86C3EDBDB8364C98E9D5EDEE4EC0D7F39B961EF645B234E9F344A9
Coordinator signature
D23BFD3EA4C1F35178F4500EB25159649D832FEF9FCCC3CD3E04FBC4D3731A8B0296206F34ECB195E256F2F883ECC9364BA4F99E921205047C8EA040F432E905
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
8A2A700A36D8918EDE5DCCCC86F05BA9B283F7E98C430391525257DD04FBF8722690D6154D1F83101BF292A4C0E99789B17A6B82DF872B05310FC05F0D5FBA02
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
5644D2E8C9A4A6B3E83386C939EC5F81356BEB9950EA66CA193447EA001393104BB4B32279B0397C4519803526489FA588391750B10F0762358DDCAD0E251C00