@version 1
condition triggered_by: transaction, on: set_secret_hash(_secret_hash, _secret_hash_signature, _end_time), 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
)
]
actions triggered_by: transaction, on: set_secret_hash(secret_hash, secret_hash_signature, end_time) do
next_code = """
@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: #{end_time} do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x0000EF7F5DADD1E56D5DD8460A4C5053B1403716AB605B376E343F792A68D1E2F29F, amount: 0.015, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= #{end_time}
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x0000EF7F5DADD1E56D5DD8460A4C5053B1403716AB605B376E343F792A68D1E2F29F, amount: 0.015, 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 < #{end_time},
content: Crypto.hash(String.to_hex(secret)) == 0x#{secret_hash}
]
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.014955, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 4.5e-5, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 0.014955,
end_time: #{end_time},
secret_hash: 0x#{secret_hash},
secret_hash_signature: [
r: 0x#{secret_hash_signature.r},
s: 0x#{secret_hash_signature.s},
v: #{secret_hash_signature.v}
]
]
end
"""
Contract.set_code next_code
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
7E1ADD79DCABC99D9449E6F4E4DC10CE59EA60605BEFC05247D45D1F900247136BDCE2D27C56A09F6A44554BC33F49B54CA5F5FADABDC7FB1FC419E4
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000A8C0...64CAAt 2023-12-06 09:14:27 UTCAmount 0.43037426 UCO
Previous public key
0001F478C88A1447DD91A300B76EC13DB42E7896799BE31123429BB323099485121C
Previous signature
A59495FEDCA17DCA8F3D7DEC03787810D04C4F910A1634346EBAEBB5D8A61C8DDF09C0A2972F5C369AE5183B07A84B0F9990ED82C3CABD60BF5EF8AE90D7D50C
Origin signature
304402200EA876D8042693D41B27D75C77A35D04C82B8D9DA0C8DEC6F418443747A1A3F0022064B0CE178CBB852D1CB8A52A0C8BCE312477AD35FAFBE216309BB2E3A0A279A2
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
00394A84C658BE43D99FA99822C91225FFCF56866754C219D24B5F33C1959CB22C
Coordinator signature
7CF50810BA55E34883C85AD11125B04CD74FF014B8504258D112042A5E2B87522DE43AFDF76FE4E735829302C3D363A6F419E4C07B9770E2BDED7319354B5E09
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
EE3B79D2E9451B38BD6F0F342B010989614FB31A3AE9BFBDD85FE75F4D3E0B9638A1479CD19031AF08C253E2BC00680DAFED27EF08EE2B0520D5ED7988EBE902
Validator #2 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #2 signature
8B86668E18D9BA3F04006897E9C213A494A13E60F1BB58FEC45D336395C44827284C890759BE53435F93F802500FDCAF0F7C8ADBE24A9007BDE2BCBF6CB82B09