@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701943500 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00009A061CC4D1004B70AF07BF6CE746959BC5AA23714973B68E69B249813407BF9B, amount: 5
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701943500
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00009A061CC4D1004B70AF07BF6CE746959BC5AA23714973B68E69B249813407BF9B, amount: 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 < 1701943500,
content: Crypto.hash(String.to_hex(secret)) == 0x41D9988031954495AD3A9608D331F2B87E163B8DD05C71DA0DE2DE9B7BEA4A66
]
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: 4.985
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.015
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 4.985,
end_time: 1701943500,
secret_hash: 0x41D9988031954495AD3A9608D331F2B87E163B8DD05C71DA0DE2DE9B7BEA4A66,
secret_hash_signature: [
r: 0x77320E448A41E3563B019ADB1CA66678256C1712AC27DCFB15F765D9B881AE5F,
s: 0x43F03A4FB202847A52BC71D808C77A0A96B6F1D93BCF7EB981A046A5C3B5D59A,
v: 27
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
7794443A9BEEC336E269BD2DC9DBDD0281B6312A6CC6DA4737D3DAC232986E07A25F28511989B4B5F50F875F287F9F08FD261FD7A7987F0842F1ABE2
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000E408...AE11At 2023-12-07 08:05:17 UTCAmount 5.40403635 UCO
Previous public key
0001DE07041C1DC724CD5EB3741E24EA12C612BB91F480906394F884A6E797FAD327
Previous signature
4D04B1831562376004576C2468BB53CF1F2CAC6E916763429C24F8D3DB730D58E096FADD169DE79F5497096859AFCE9FB3B149068879926CAACC358D38E34509
Origin signature
304502202A685108EDC2FEDD66719270D7819D910A51296E9C7EB5FD4925B7AECDF69737022100C2FCE4D587431DEB398CBFA38D7395CBCD905EE4872D85AD1401640D67BA132D
Proof of work
010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B
Proof of integrity
005EB509BA0DD9542074E36C1E288B89ED4718A8419B9483AF9F1832DD8F4D162A
Coordinator signature
72B04AE9403F68C60ECD743BD41E55A8A371638830B17CA5775BCA90687EE90DEB2CB3F61F74DB2FEFF6131031CBAD800CB8006CB83D4A51AAEDA55C72F07C01
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
E1C979ACB93B4D63B00CB9F30F76C716DF2CF71FFDF6D7F91D7E0A54D61520AD0D2E54E5238AA1A359A8F8651D000F434BE6248B2DFF339EE9F8D023FEC97902
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
F31A771619D87C505177723257CE3BE9B58E341731B1733E3D279905A3A1FCBC72823291086FC51BCD991FC43CFB5A91CA264C6970F46E9B33452C0591C0B106