@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1700604780 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00000BC0EBA2DBCE4455B46F5E51AFAABA6EB4C7FBA1D4E2E6DABD55DC70F9A04D6F, amount: 1
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1700604780
]
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: 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 < 1700604780,
content: Crypto.hash(String.to_hex(secret)) == 0xD9C00FD910831A321F34C0A91AE8870C5813598D93CCA42CA8244F584AA6B571
]
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: 1700604780,
secret_hash: 0xD9C00FD910831A321F34C0A91AE8870C5813598D93CCA42CA8244F584AA6B571,
secret_hash_signature: [
r: 0xA77D59F99F3751B8D49FD252F4768D42BFDC0D18F5F79965D480A6AC9BA377C0,
s: 0x299B6CC95022A5C423C09D251D798D69968AE6C44BC8624A81A8F48A78619233,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
18124E22A7266229FF115E23C9CF941A01985E0AACF922BA9538426BCE7F07286E60944E1A004A9AA9E0AD1FAA0D98EBC7E728EE800CDBD98038A12C
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00006B67...3AF0At 2023-11-21 20:13:23 UTCAmount 1.38421349 UCO
Previous public key
00012DE8D27190F7CCF4F54F033CE25A991D428BA63A001EAC15E2925EA565577243
Previous signature
EE5213EE60A307726C934433EDD2CCAEBF1697E771974E34F156589D8B29BAF53F5549F22D66FA2290F94E1753294C65B81A2A02C5E8B898BA2FDE607F033602
Origin signature
3045022000D3C389AB484275906A5B1B5CAAA8769F2640334875C57258E884BE85E2B60F022100EA22386133AA84D6031A6AE1E4FD9AF10D729E34A27FAC1AAE7FD263931752C5
Proof of work
010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90
Proof of integrity
00EA3B9DB721FE8F654FC6A0C9899CCBB4DDB47765CA0F5818D5842B3A6A68C942
Coordinator signature
D1D9FF5EE8FF6C73AC711E4FB97635D25FE483424D39B046ACDA9E4FD72401DFA3A2D32A51756BF05BFC30DA70589B825D74A1F59E3DAE10629704674899CD04
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
38B0E8E838173447E55B31840BEB65F815289C99884E6A50355EE0CB8E3C9416E003D6815474FF56C5FB9601CA931FF9C6984996B93DDC3A4BCB285B04FE7604
Validator #2 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #2 signature
C08AA8E69E368C5CE3C820CDB9A07E2906C6313C1519CE879C1C40061CCA74BFC7F0D60134B5E91DEB6FB926304EC9669DAD6F60569EFE9A0454D68511B87401