@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: 0x00003605944D6720BEDF147D7E63F48EC006FB059C2EA7A60E5A027E28CC53E7A200, amount: 6.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: 0x00003605944D6720BEDF147D7E63F48EC006FB059C2EA7A60E5A027E28CC53E7A200, amount: 6.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: 6.4805
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.0195
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 6.4805,
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
DEE64F97242D1008CEE466A089E1E6B795E2B3A96474EAF5704155E807821E55B1987A6AA79C80997288F0BF92BA488892D75AA5F5EE5355275F94FB
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00001C77...D351At 2023-12-09 07:12:10 UTCAmount 0.41789827 UCO
Previous public key
00016A566E52723ADB7AC254F20CE79E61A30DD725B0D5D5746D730C91FA457B2A4D
Previous signature
6B8A0929D82F48F469E4CB0B5E32AE871495EF3A248AEDD7F7FA78B87882B19393EE7ADDF278AD79B1B93545DE46EF64D333FD8FC7F7B6FF03D68234C48BC304
Origin signature
30440220257F306FF74BFC40774AFD9864E48CE6C1F9F53D54E5E29FD31A0AB0EDBDA65602202CEAF42BD14E9CACD35367A11E0F9E43A98FBD5CC0BFF0D58757902903C8CE39
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
006205936B778CB7C5A91CD81A2D0061C65B5AB82FC9E33A27FB240F13CFC78526
Coordinator signature
2EFD665BA51AB94F6DF5036AFAF828712C900E997783D4BE7623B9305C0D175E63B704B3E91C20FA98ADAA2CE4E166AEB1FCF007F2C64432F23F73BF88772F0B
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
223D9F48B057137215978D44AFFE2DEDC20A4CC3FD5895DAA7380CF7896858BD0C27FF135193B8A2C5BE7C562F769BDC541E51CDC50B4A72AE6270EE80BDA10A
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
DB2768B82983D6502CDC0340FE29514B6B78ECCEBC8F35A8BED1682F9EE553823273523D76FC58D1A47C674ADF012A6C531EE08DB4D23BB85A0749A45EE03E00