@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: 0x0000E1BD3ED17C87EE4A7354501DBCEBD07D9D927499C2958B0944F97262BBE892B0, 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: 0x0000E1BD3ED17C87EE4A7354501DBCEBD07D9D927499C2958B0944F97262BBE892B0, 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
A00949F97FC01636194BB443AC88F9A373F7D81600414ED0B8551B9E0E314EDE57037A95C1C4CC5B2241049B21130F379F5EBC18D222CBE83EA00962
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000C224...B299At 2023-12-11 05:23:17 UTCAmount 0.4404694 UCO
Previous public key
000180D455D5EDB6692E8DA674892ED4B17387BE776C51B58C99B537B3EE508CAF6C
Previous signature
59B2E37B9F26BB1F4809CBC74564E8C76D14BD1585DEEDCFD511EC5878D86FDB97BA53CE54A63271F2722E639E941E678E1630AB9175625EB61D6CEC3435EC01
Origin signature
3044022052A660681418840A33788E52990EF36DEA862D7F42D0EA85EFBC4E61AA9E2F7D022039781AF9FBEB6BA3225835C66A241F3E5D42EC0B75D8BA6E64CC66C56AB175D8
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
0019C0B28386D069CF834A84C5FF44956300A9B06825BCF7E51C158B9141F32FF9
Coordinator signature
96D8E6BE39FBF65B325648DE5D24335646FF390D0C813C47B751A101F985AA13EE8B977EB11ED434DE89B96901A6DCFFA7916623D8A7F8F1CFA6299DA0F74D0A
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
BAA750EB8AF1D091A5AB3A5F78634CCB7F97811D2B57588F94C65E4DF928DED51AAD6F5AADF21E597B96A431AABFEDF89382DF773A117A1D475D283842762B0B
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
2A53C9D2A1742A14C7880ED21917EE33FD8E436549E2419F446EA443C3CB52F5C7CA2183EBD61F8A3119B058B433307ECE2DBDC6D56F16A6E8A8A0D789E5A707