@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701863520 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x000070C7056DC223A1CBCD752558A92B7E2020176540FD854381D88B3F1421537663, amount: 0.00992015, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701863520
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x000070C7056DC223A1CBCD752558A92B7E2020176540FD854381D88B3F1421537663, amount: 0.00992015, 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 < 1701863520,
content: Crypto.hash(String.to_hex(secret)) == 0x8B888809F6993CE83F5F586629A601396C596E4F487C2FB23B7780E37E49F566
]
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.00989039, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 2.976e-5, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 0.00989039,
end_time: 1701863520,
secret_hash: 0x8B888809F6993CE83F5F586629A601396C596E4F487C2FB23B7780E37E49F566,
secret_hash_signature: [
r: 0xF256DDA808B4855E922E36DD0DB3F6D7A34A2C345C27D050445FB77C48FEA419,
s: 0x0458FA8D398205268DB851E63D83898982ED60748868719F79FFEE4463420E05,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
24AEF7E1C9ACE211E1E0803179FDE733A1A32D573C98F6D658D0660D2E357E2577E8CFCA36293B9C3CE18DC8F8E98AC91EC6820668799074F22CE473
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (2)
-
From 00000407...963DAt 2023-12-06 09:52:43 UTCAmount 0.43026602 UCO
-
From 000055EE...E52FAt 2023-12-06 09:52:28 UTCAmount 0.00992015 0000288B...B827
Previous public key
000140247678CD19AFAF8857BA42B6602D3E8DE017E48E7883D3CE551032E9607AB2
Previous signature
EB49985D1414E61DAAE35279E9095B69EF39F4DD4531F60D151795B93DD89BDFD07C66614D7BC0957DD91253BD630989C2BF4BA36700F427A27105D3A4F9130C
Origin signature
304502203187B566C23DA30D19D8D475C2D5D3917EF1899F8AA6776FD08B12C5EBDA00E9022100DB6E391CF94097E195DB4CE716929670CE7656ECAF55814E774017C3A391251C
Proof of work
010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712
Proof of integrity
00527159253F175F441181D13F0E9D445E4687C82AC3F76E01642BBEA64A0D0395
Coordinator signature
46BBAFAEE032022D16977AA1812BBF12EB6CBBDF7700CA3CD31449630DB796FA29E89691432D7B334EAF5E3ADDF6A9BFCBDC7B399DF71EC4319AE19206505207
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
EA55DEEBF776AF8574A42C7B1B685A80327FA30E173DF121EF23470C841ADFD5391501A911284A58570920F38C190B180837DFDCA859214E4321791A5C971B08
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
B0943E976BA427E026EEEF99B23F7318B6519BDA366F2470B1730C3AAA6656370E558A95919E1FD224E82793BC120EEB02C25EA50FCD288232D4B61D4611CC04