@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: 0x000066DD68582F5BFAB67EB0DF35126EAA13F0A1209B92E94ABE85F57F0284D083F5, amount: 0.01488023, 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: 0x000066DD68582F5BFAB67EB0DF35126EAA13F0A1209B92E94ABE85F57F0284D083F5, amount: 0.01488023, 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.01483559, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 4.464e-5, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 0.01483559,
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
43DFC63A4842D085D1F157C31067C001B5BA57BD886E0D67A0E319CA9C47A39A2C77949962972BEEBB5B4C3B409E45590A39EBADAF7D7BF7E1CEB558
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000168A...F413At 2023-12-06 10:42:45 UTCAmount 0.43026876 UCO
Previous public key
0001B7C04DF3B0B08C166505CA42EBE3AE9A45333DFFAB4AFE074A3AEF2F817AF7CC
Previous signature
E7DD5C75280E9B38F5155DD2487FB775E3587753EFCA8A4FCEC4BBC9D263634F79C8DAF567CCDB0CB381322DEF7DDE8D8360CC36BDD8BFF708BB22F6662BAB09
Origin signature
30450221009557B2FEDF6F6B54F05858835B8AC6F0FCD6945133C51F7BF5E68BB076606AB7022046099244745FA5F7F6A7C4AE731ADCA15BC7E26C8A6050330A63CCCCE883B690
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
009F1F3B235FCA3E1E7EBC95FE6E4ED1C526A91190DAB76D560D83F1F67DD4976E
Coordinator signature
EDD47AAE01CD7D212E5431777048132006078D707A57C0F6C6C5FBB43A5E00E7D2322637F57359B64C104ABB0809624E7ABCC563ED539A1297964D1939F6150D
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
517BC3B89951ED0346E751DFE74014A256383AAA4621B1621FAE22B33F246312A2630E6A69797FF545BA913B3F83535F48344490082F8101750A9B6C439D880E
Validator #2 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #2 signature
853222A0AF6C1935F0F7F4C89D5A57032AB3CF04B47DFAC3C5AF4AA4F59A91E19BD7A83EEEFBA3F1AF720C2F194812044D002F1B5E27CDE601C6E1B0B9E76A05