@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: 0x0000B3FE8A56F7970B8BF6E312DBEBA9A9CAEB6612D6E16A89EC179EDDF479001E45, amount: 1
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: 0x0000B3FE8A56F7970B8BF6E312DBEBA9A9CAEB6612D6E16A89EC179EDDF479001E45, amount: 1
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.997
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.003
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 0.997,
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
99162B6C57885ED6F2447DD679249327AD4690336E5DD53A687F10B13EBE3EAD5A6BC4E3F35CB7FCAA174362A4B5312A44E5E9F74950F65DD1E30D4C
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00009B36...1B96At 2023-11-15 16:07:53 UTCAmount 0.35132512 UCO
Previous public key
00019093851F0ECB3946D565DBE22E55C2CE406E8013D1D76B82D162F1E84775E57F
Previous signature
007267807E9F109A5C634A750458307DB57EF5F7FC13281499B79CAC8E9AD465D71874F8748FF57B3938E6DD8C4875DF64664411DB377ADE01BC3460C3F96902
Origin signature
3045022100E76A4E62F0EA05FC4682907F0283453AAB9B03191E4265A8A831091047D077A10220638A30011773F621CE217E80224671EC4FE0D93347D9D6BC5FC17CDFC985117B
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
00FB0F2E97515151237CDABB58CC113CCB78859D9311C5CE16EC212052BBECE8D2
Coordinator signature
EA0B3B8647781E9FE5B7485A81F1B34C6CF81CB4C3928BDD9404A57150C526EF78E3D3661DBE0D5A2CBF5FE107F5E2AA869C05102BC9FD306BD8451066568305
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
D449A62D04A685006A13BA506D7B966D175977BE37EEA73BBD8E036ACB235AFC90357D1BEBB85C9CB8CDFE5A7415E3118D4E7E12C2B4C4A640C323B3E1D8D10A
Validator #2 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #2 signature
A548204EA18D9E23013E297838BFE666FE6BC83C2ABDF9BFC729A7F586D833FCB9D4E79BDFD413BAFD37D6D6AE6B32780C351E086D9B0B9A1AC518F2E1B9E708