@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: 0x00000BC0EBA2DBCE4455B46F5E51AFAABA6EB4C7FBA1D4E2E6DABD55DC70F9A04D6F, amount: 98.49694984
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: 0x00000BC0EBA2DBCE4455B46F5E51AFAABA6EB4C7FBA1D4E2E6DABD55DC70F9A04D6F, amount: 98.49694984
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: 98.201459
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.29549084
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 98.201459,
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
7E7A3E3A4E8FD93DA1A7B424A754B933CD74CCBD7A14F56B319ADE05802E2F65FE73C777901CB239D1DACC1BE78A3698925B85AB73B5C945FAD87CCB
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000C470...E59EAt 2023-12-11 16:53:56 UTCAmount 0.4514016 UCO
Previous public key
0001BF7144BF1B2163C54CC2422A7806FC46C00E523F6B530D8B7527FE425D266CB8
Previous signature
F13575814FA1FD9B22A6AF82E06CD3516C6AC483B94DDC500DF25766F7387A023C91880ABE0F23FF43F7E1E339B8622E7E59A0FE8F6A475EF845B659FDC16101
Origin signature
3045022100BBD88A90961D8A92C7657D785AA3884455EA70546B08A5A2E3BC1BDFE5C571BC0220231D1C24ADF370ADFDD781AFAA04882666B84B1E398F2782A1C096A766305FA7
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
00746B54F5009128648642448FF64D160989E8515EBA4EE6C646000B6D4B3A58BA
Coordinator signature
5187757EAA048024D1036807F6BFDBF4BC3C515EA32B68619E18DE62D6D72AF8041422D97485861EB2F1B2916F40D2F617D816EAE0C83BF10E93478145C4C00C
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
32C07F21EE915E309083FB0CA2102DAA8230F8EF6A8312AC908DD69AED0E9257675FF760B4E3B838DBA991FEFB605CC607C2962FF331FD224EA7E8DC6006AA08
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
873A5FDC0EB233CEBE1DF9647F0F2DD2B9384943B647A9216C4DB0DFB7E0E99723C5C5B5CCF66CD783AB1C58FC6EA780BB8E5E0545DBC4A703480511E327C003