@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) == 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801
)
]
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_uco_transfer to: 0x00009A061CC4D1004B70AF07BF6CE746959BC5AA23714973B68E69B249813407BF9B, amount: 5
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_uco_transfer to: 0x00009A061CC4D1004B70AF07BF6CE746959BC5AA23714973B68E69B249813407BF9B, amount: 5
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) == 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801
),
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_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 4.985
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.015
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 4.985,
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
527DFDBC9593316EF4B116FA642EE8D16ECD5F1F1862BA323A2F845AB147F9FC4A9E47A2B6335BE7EFEF8F4B0262C5688E84FBD5DA54B31E2ECDE0F3
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 000053AA...7CB6At 2023-12-07 08:04:50 UTCAmount 0.40403635 UCO
Previous public key
00013E6E8FC0C6A41FAFFC438990AFD7C774E82C66E8A6D91313699143C4B7371F4B
Previous signature
2F1A703663C3EEDEF9FA07DB0B66589BA0372BF09BF7A074D17B7246500920ADC84717E6349258818494C9C9EE0070E647D22A4BD26A1966EC3EF02E730E9208
Origin signature
3045022100962FFF543AC7429D3459C011E84E67A3E55683FF9E52FA5ACF47F8DFF5A97A8E02201FC6AE93AE2D4A9FE5322300E42368FF1E6FDC74D5BF1E911692E97A432C74FC
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
003C46866CE97F9F9D304FFE7DC3D738D09D31E5873E6962C150E8E10DCD856C35
Coordinator signature
A08140DF9D53FBC259ED66B75ADA604648D1329888D2C907ECF50AE05BBB5AAC0F2B3931D25F941DEDAABCFEC1A6DA5521BA3E4F6B940CF231673259089C8A0A
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
D55E8BD227E18AFA533026BC49E3FE34799FA08E1B2ABCA57A08AA42354AF3FEA54AF133A1767631C07570127F32734F0E4CAE08EFCB90384C6EF1B7916D1804
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
D930E66B9CDAB2BE90577CBB25B6C6F41EA95D1E6013BC3103731D4D1064B1845F7F154E25263827A5828F45433CEA2F8FD2F7AD613D83B65BB30DCCF94BD502