@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: 0x0000AAE847768F278B0D458240DC4E5205C2CB307B81D81865338F2C6B831F6006B1, amount: 7
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: 0x0000AAE847768F278B0D458240DC4E5205C2CB307B81D81865338F2C6B831F6006B1, amount: 7
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.979
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.021
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 6.979,
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
2E918DCFDE27EA018BB5FC4EFA2564E72D768A5FF046F9E988DFB1F3C4A0EC7DB1CBF45E3627EB273A0CD2939912F4E50218E35EF9EE167D188F3F66
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00008F14...56EBAt 2023-12-28 21:26:12 UTCAmount 0.40451095 UCO
Previous public key
0001F5BBDBA721B4985E68D4EE36893F3B54553D0D4A0AB18FDB4D4125D4D9C3FE28
Previous signature
725ADAE9608CEA8502A43F48582AD5B636245C0C80C00DE2BC0EAF0C76C9E3FAB66C63B42E8D1BE83318A41F9BDCBD3B1D3A8B5B010704686F6243687CBA550A
Origin signature
3044022057D72DD0350160EA0232810422927AA8E0AAE1A4062DBAADF3784B6021F55CBC0220071C9B28B5412CF3B7FD6906003FBBF8464355118C7E90A428F8AC2DEC937229
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
0052FE1122A8273B43C92221BC62FDA58596F9C9C1A1D9A0C363244155DDD01CD5
Coordinator signature
D664E1406A93B726FA2DCC71837B0E0AF31BD3647B9BB56894D0C53D5B766C6C389356A8B2797C5630FBD2E173AED822B683E44F6F3BC360CEB8A5ED5E46B70B
Validator #1 public key
000134772A943DC0F7038B1BABA39E18841C12DD6682B1B6D1D15E08D7CAF5339AB0
Validator #1 signature
A120AB4E90C3E62ACE49855A00967217820EA93576403CD9440BE962BB6BB918AED5A7922EB43B8D358E84AD9B2FA59D3CA7CF659DF4B3E6DE84318574964003
Validator #2 public key
000177BA744AC778DC2D51A1B7C622E7AC4BD1E1AA8DA2D0FCE71BAAB7DAD0E020E0
Validator #2 signature
F8A07DA0AF8B1A6BE971BF9D2C22364DB1A7F3A21B639F37959994BD11E05821E6E89C7A03DD104DF62A047F4C4B5D7B889361EA7641E858E7AC68D2FE1CBE04