@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1699990620 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000BF431D64A7F738BA91391C9400F404AED16DAC00E04F65677FAA511B4B0CADF0, amount: 100
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1699990620
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000BF431D64A7F738BA91391C9400F404AED16DAC00E04F65677FAA511B4B0CADF0, amount: 100
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 < 1699990620,
content: Crypto.hash(String.to_hex(secret)) == 0x4C8B9A9827B965AB390ADE890AC74F1FDA790893E114699BBE6B7A350069AD5A
]
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: 99.7
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.3
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 99.7,
end_time: 1699990620,
secret_hash: 0x4C8B9A9827B965AB390ADE890AC74F1FDA790893E114699BBE6B7A350069AD5A,
secret_hash_signature: [
r: 0x8D3BBF1A056D172A2C932C254B286C4E727430D8DC8DC8ADE4BFCECF08C42EEE,
s: 0x030FD92D878BD36CC8C1628AB2FF866E39B3FE60C2BFE5250ABCFD1879CBC85F,
v: 27
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
5CC103A2BB7428B4CC2E682AD701B08AB7F0B2CB6205E986E04B46781E9115848EFDF286D83A8769A063C5729552EEDB70EEDB71DD1BDCA53425C034
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000198F...1E96At 2023-11-14 17:37:42 UTCAmount 100.34128558 UCO
Previous public key
0001CD2BEA49158CBCACB38DF7697B3D1DD3B704CD073E72EE45B5AF773A28F8EEC8
Previous signature
F4BCD810066BE705A01D0F68ABD9F3F42F5AB16CCB33EF28F105B2B3EE2A93578D5744E88AB89CBFAF5D7AF38933EE1B13D089DAD02DD9DC493F8756C178910C
Origin signature
3045022100D3EAAD0D4B7D29B82C259C0B1822AC2AEA678DD28F79122A166A4AF370E3030402207156EB387B59508CCD34A65B876E4E2E69432971D98A18FE1A215B3D16DB926D
Proof of work
01020451684966573439C38DA99334546FBBDE4A6D96A50B4A4ECBB6572CDBED023F079607407E254421D1779525D11C60D55684F0B403B93B95823554E29D1E2CDB16
Proof of integrity
00B44811D2084D89DBC044C78A5BDCFEC0E6B24DB97DF9C75F1EA2646E02157E10
Coordinator signature
5AFC3D0CF84D8DBECCD8AB4844CC24B632F1EE7BBAFA68E22D78EA9F8841021BC0FB79531AA3FB5FBFAAE957830DC52A4A7EE30C0D9A7B6E3B89E2379CD1AB0F
Validator #1 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #1 signature
FA9F88FCA109499B52FC2753C02724B1FFA60B8F527F087FB2BB4C51341900272CC61A60E983F5C57A85D0979B6681C1DD0AE314B8FED0BBDD1C5A59D9EBDE0C
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
E5CD07D6ABEF00E3622132C6E9128944D6A2D5859CDC611F403FFD86F63AA90D4D929454C6586A49BB4A135306AAB216B8CFC13B3518EFC55BC502C3DC54CB04