@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: 0x000052DBB0394202F5E1A0290DC1595870AC160515BE80781452FCB0A205644F801B, amount: 0.0019
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: 0x000052DBB0394202F5E1A0290DC1595870AC160515BE80781452FCB0A205644F801B, amount: 0.0019
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: 0.0018943
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 5.7e-6
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 0.0018943,
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
EB7132582F3ED50A579543D5EE929006502D17CA1D80CCEE23841FB5740AF3F01DAC71387E313128A761405AB1CC70F81BEC5451CC07E62934B82A85
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000C459...22FDAt 2023-11-30 02:30:15 UTCAmount 0.42130854 UCO
Previous public key
000143798393964B8DA0914FF2A9B662D5F4C7DCB6A3FD4A716A46589F5359D5F4DE
Previous signature
445B6261B6F94DF56BACBCE0E28C7F0AA3FB6F46DA6C8C2636F4FFCE73FC9279D65931D41FACA906BF443B9BC18BEBF511EFBBD8C1C35CFC40ACEA1F02EC6A08
Origin signature
3045022100FAA1808A3F17D7249A0571EFABB1EB8CBE548AEB7C8CFECCFF960F18726725F5022054B0D585D85481492F48A98BD12C1F9CCD5391AB03BB5B08C7076DCDB7955C6A
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
0036513D9951A904CDA7FCD0BE3E7B72AB9B8E98FEF56C834DCE8A122B94F6775A
Coordinator signature
DEDD457DE8F217EFEB0C40531569C9AB1D193D8FACF828CA6C910C5787CFF1EAD202B72D699C96890F32F6B6E344E40020DB870EC739F93B0FF4A720AE08110F
Validator #1 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #1 signature
C199714E04F28B0707CE17E6150B81F47F342111F3D480D77A68DF94EC377BB41DF300F02039A74D474428EAFF5DDF259612AD8A6217BD1F437CD1BEA460000B
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
0A0996061EA3BA4E70C9A89FBB7B5F51E93500B44CB3BE154D429F2187A086638D3D262D6075E55A437A2632A48AF27A49942026097398E800F7C40055EA910E