@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: 0x00005812E57B735BA93F77AC9DCF7DFD402B8C562D8AD7AF7EF3C9B5D408F4BDDF5D, amount: 0.02976045, 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: 0x00005812E57B735BA93F77AC9DCF7DFD402B8C562D8AD7AF7EF3C9B5D408F4BDDF5D, amount: 0.02976045, 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.02967117, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 8.928e-5, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 0.02967117,
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
B6CD25D0F7E2E20FF653737A64067A114F3FACA3A7F250A761D4452668A3743B936DD8C7180264850B9064CD7B63EC0F27068E45DB09F7DA5B3B69D9
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00003F6A...4C5CAt 2023-12-07 13:30:33 UTCAmount 0.40585992 UCO
Previous public key
000123537AB27452F2704E720747B203C015A59D6BE79419F485730EC02D422FD758
Previous signature
D0C7D9E88F026B4EA0864BB20F32C9FEF43F5EF3FE48D9C335DA7A711EED222EECBAFE43DA3281AC53C81026A1B538F6AC246850F37722BC8BF0CA79EBF8D30D
Origin signature
30450221008DEF4C3BF0899372BA2C77F30A893B90DBE9AD848E05FBD3B5BBD58BA40A034502201771A9D4B76356E62C198A1E16D0EB6455BEFBC688A1502D2B799B8C89F08F32
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
00F9BE4F4BD7F0CF4BD378C62739B3123E02EAE0E16694E20F0293A0D9F5B34267
Coordinator signature
150BD39BC302B10283C6A338DD11BC7C73013A8084D30249D60B99497886A0CA32DA8F1A9850441EBBB59C0FAA6D0A4141BC373A0394B22C6B2113CB18490400
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
47EF538207C836A6B953F5BBE153B376A4723F4949C88E641BE23A91508FCD63BF7FD600D30330FA1EA4EE1C610D823F872C45F1D13EB3492DCCE7176F6A1201
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
AA39AAAE2167B6ADC11D4B4A9FBF88A9282D48F2DDB661D7F48C3CC5D4220A4236724EFAB0F45C7441670247C668EB3711BBCD213BB6EEAEA2A8688783357B01