@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1702282320 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00009762FF4639B12A38471B9EDC2D1F0634D187B63E8BB34AFA1B59069DEADA84A8, amount: 6
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1702282320
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00009762FF4639B12A38471B9EDC2D1F0634D187B63E8BB34AFA1B59069DEADA84A8, amount: 6
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 < 1702282320,
content: Crypto.hash(String.to_hex(secret)) == 0xDEB3D802097681A1ED95684D800FB9977329592B3C25D1D837371DE71B3C3F4B
]
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: 5.982
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.018
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 5.982,
end_time: 1702282320,
secret_hash: 0xDEB3D802097681A1ED95684D800FB9977329592B3C25D1D837371DE71B3C3F4B,
secret_hash_signature: [
r: 0xFBE0A1111BC1B10BEBD9E80AF1AD87A6084523EC93B0C7A8A408E8B2066C423E,
s: 0x129CFC1E76DA7159E3EF9786643522D7B32E420291C89167479AA5739008A537,
v: 27
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
F3259DD9400A0483EBD978D6E7D4D62A361EE23949EF80409A9F5F82171C77B7BFB46598BDC825D525C6E62710E2B04B3E721FA1DD72EAA1B18C26DC
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 000056EC...A720At 2023-12-11 06:12:40 UTCAmount 6.44903647 UCO
Previous public key
00012BA97ACD0795B3B423287F67146DC07CC8E011712AEF8DA8A921DEFB8E9C6E9E
Previous signature
2FF83CDE2B1E48F5AAC0B69A00198735C3BB85FB2B9E95B4A4FEC38F4C6A11E6FD7CC1DC49F609B614CC7553D0849726B9D1B2086E742D037F8893877B630400
Origin signature
3046022100E98D40FB89D40BAE6C45896E56B82EF6F41D1FFA24D6BD16F99FF589AA494916022100CFC526CE4A6539DAEFEB61E26F5016C64A7AA5CFC3FB45D79DBB8639D76B4686
Proof of work
01010484B78F4110D8E9D6FBEC72759895CC9D4532177314FBAA8B07BC525FC1AF48F150EFBF104B1819106B8E3563CD0E1FAAE5325F8FCFE58FF744C35F47669D2704
Proof of integrity
00807A05BF8B1887B597A40D6A4815119421DE92DCF2EFA4347C81D3BCFA0855BF
Coordinator signature
D9BBA9280233C115CF8F502F3195797A5EA0934E916113F22931D3D7D31D074DD0A5E57A5EA4D175F80F62BE954D32D46A60A2F5B0DD765D467613AD7B800D0F
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
50E53E46E0B1E96ACE01962D9103DDB662342F19C1133BC398A450FE82FBD644FB055296CDB047F897FBA984F1EDE5BF5CC236AC609C618220AD8A5EC7E02303
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
DEF5E3B82C834CF396B26DEAD0B1794301F2BDF1E190844184700BD7946E4AC8BD77990DA5B7D740EBE5B0BACEB2C0FF4778639B2C729F9177AEE9E2EE27D808