@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701938340 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00009379E9B4077E699B5C224285B8999030A72B98F11CB1F772965C5BFFF304F009, amount: 7
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701938340
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00009379E9B4077E699B5C224285B8999030A72B98F11CB1F772965C5BFFF304F009, 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 < 1701938340,
content: Crypto.hash(String.to_hex(secret)) == 0x707AE53692173FABBE15B0FD2F92253AC64EDACF75A207488FF2CBEDA8159CE2
]
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: 1701938340,
secret_hash: 0x707AE53692173FABBE15B0FD2F92253AC64EDACF75A207488FF2CBEDA8159CE2,
secret_hash_signature: [
r: 0x78C60798BE49AE53905FDE2D220E8DDB57C98829647B21ED72F148735ED49580,
s: 0x6C05BCFCEEAB4B440DEADEDB00C9D6A32BAE4679FD47B3C1669BDB6391C1EB49,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
62228C1CAAD00A929D963D0692CDE346377DD7F5141241EFB51372D304D6359BE324F3AD09911D241017CF7D2D4CA92698FAC0F7ABB541ADF38C11E1
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00008216...DF11At 2023-12-07 06:39:53 UTCAmount 7.4063406 UCO
Previous public key
0001C9205BE5DC5CD0BF500104234B023C57E6DE0FB8956A014D069EC2C9A50AF06F
Previous signature
8E3E4DC6B697B81CAF3BDB090B2E60D5C350477F6D5C6B1940241817F1DEDFB8327BA855D040C1AF97A40A87B0BB032D2D9B252E2CA78ACE457D4007423D1506
Origin signature
304402204BDC3228AE8748D8E142D519E0F20CAC39FCD09245AF9993705C9024B3DCF5A2022065918A669A0AF44564ECF792AEA550C4E40B84604F9C83A72BAA160AC4A290B5
Proof of work
0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45
Proof of integrity
000F9B3EBABDBA08655EC86C54E3CF7F881A3956C5C1A11AA6A685A1AF5E46177E
Coordinator signature
852355FB7A9107A364A165C30D2834679E97D620A3EBAD29E604A7A76B4F5C1DF7B5FEDBC0904DC6055D6D8A9D335DA9F21ED3906320EB286786F8616986EF02
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
143837F080D8BFC20D82C169E161D779AB744AB9B2160C4986BD2972D266877AA3FB95EFC4889BE1714452BA2556CE75C33100E6D0D75DF4ACDFA975955C5D03
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
37FC727ECCEE6A610AEB68E9FA7D50EEFC8CDAFD40550623E42E0D78D133841BF0CD8C781015CD12113DB5508E94A01949F75F68A7F4BB189221FC1975653B0D