@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) == 0x0000072E418B60C6DABD272BC2728B17B352B8104F068D11365D50134F96A4199609
)
]
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: 0x0000B3C419BA2FDFA2DAEF6B333EB6E1E23EE55D4E0EFAA6B67AF97187FFCC927460, amount: 0.9, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
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: 0x0000B3C419BA2FDFA2DAEF6B333EB6E1E23EE55D4E0EFAA6B67AF97187FFCC927460, amount: 0.9, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
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) == 0x0000072E418B60C6DABD272BC2728B17B352B8104F068D11365D50134F96A4199609
),
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.8973, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.0027, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 0.8973,
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
C3562776B0FF35BE9605B1D946C2D0710D1A8CE45C48F54CAE2A19C0946EDF72B57AF9E62A3DBDA80083C4AC36965746E0162875A9B8CBEBD39A77BE
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00008642...7021At 2024-01-25 15:13:16 UTCAmount 0.43801654 UCO
Previous public key
000153985145FC158107B9C5486FBC9D8DAA8F39B7E4E5A82729E7C13A7A518781C0
Previous signature
CC26EE5E3CDDA1EEEF169668E752FB6A733924DC25C886A48741C0F7647199EA2E44CF8AEE9B905A875D48F8EC1BA4100C5277845FC850A13944B821A1661D06
Origin signature
30450221009091021D127F9CD598B25CBF28E08BC4501E63295AF04BB7E907FD864753A5BB02207B20EEB47DF0828E0292E09F2FE2ABCDB82A4A022A57669EBAAB8D4E5DB3EB5B
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
00887C15E63B385FBD1EE42EEC15AC40018B489CB823C570F97D66D5DEB61502AB
Coordinator signature
869A0826A7D23E10735119F1FEB768D2AE16F828B175EC8FA2F1C8F4FAD0E77CC8A4233B119F6D10C7850B4667FFC3377193F542244D7101B9E768C55BBC8704
Validator #1 public key
000134772A943DC0F7038B1BABA39E18841C12DD6682B1B6D1D15E08D7CAF5339AB0
Validator #1 signature
BC4940D3807D995E00797E92304C0D1FFCE5A5C2A163B555389EC6DB7853748898FD0949B0C7C625B977598FD613A5D62920870C91818A97617B011AE11AFA0C
Validator #2 public key
000103E30584AD8DE66F9E29419D5D0ABEE5A76722C9FD0D012BDDE3A6E2B149C48D
Validator #2 signature
675C7D6DEA97BD4DBE2A25A939E9FA6D0AFACDF9E84C7D78E088B1A046DC7F5EE77FF28A0FF721CEE0F83D938260256F8EC784811B20DC45AECF6BF16C74100F