@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701543780 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x000024BF9D5BCBD7F48E4EA13B91004B20B71CC76611A12A74FFC29809EB3C1FF2F3, amount: 5
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701543780
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x000024BF9D5BCBD7F48E4EA13B91004B20B71CC76611A12A74FFC29809EB3C1FF2F3, 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 < 1701543780,
content: Crypto.hash(String.to_hex(secret)) == 0x08BC5E6F13EB7AC329FFE3465913FC7FBFDDD1F2081D3425210B739FF9F3838A
]
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: 1701543780,
secret_hash: 0x08BC5E6F13EB7AC329FFE3465913FC7FBFDDD1F2081D3425210B739FF9F3838A,
secret_hash_signature: [
r: 0x1D74EF298B1310BD6FCA506E4FBB6558EC2D4F03A895AF7567CCA8761D1FB0A3,
s: 0x68031D75D914FC4D145E4C3C723F0E65479F400A81777DFBD2EF1D34DF475643,
v: 27
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
A9A435D4A56ABBEB0D47D6472E80D8B26050DBF4EBF2D020D296BB49D3EF4FC302D5A06F8DD90D685AC03AE3A68D089BF42CCA0DA55279C40184EF13
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 000023A6...8B20At 2023-12-02 17:03:58 UTCAmount 5.4241055 UCO
Previous public key
00013E11E7666BF3C4F7006A2AAA6DA93A7E56003A4FC1360A21BB0D291818AFA9BE
Previous signature
F98F57DC6DAB4BF6C59CF98A558075D8129C1AF105DDD3A88FB2850A22C5720CE76C8EB03C3C27610C9FE4EE3AC3D8377E97C0B9BB67891690B7D92F994FB202
Origin signature
304502205910DB98D98F9548460B668523FBF001E032C0F104DAFC64726D406FF84203A5022100E2D34B38E5B0B9B2D44A2E4250F921D0CF3777D957EE5D453ABF722C188DED24
Proof of work
010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381
Proof of integrity
00FC54EA63812D34B1AAD7253F2786FAFF50010CEB73F9B7940601F0617FD3C21F
Coordinator signature
5EC34F42A34A961A17A5954B3CBA34F5B9AB363240EF83A33B10B2CD27B6D348788585862947B25157925A4E05A4548176FC72447764C4AC27F5A391A5F8370D
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
140F469A2F25C77BFE198AB8904D5EE6CDEFE5F630F38555174F78CE3843EFE8F4AB96734149C74072D69FB078006A39C75D16A64FB456399DD2183480867406
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
6DF89A9FDA79E3943A0925FAB33F4C46BF944C16B40C1791AF93D5D121CA02673E5D2571A6AC3334BC856A36BFFA353DA5D1145B28E03DB89AB36B4BCD14D50C