@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701455700 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x000045EF655A0015C0746F2A6A13E14778DF5954FF4F7EFCCD15E1AE3B67CFB9E54C, amount: 112
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701455700
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x000045EF655A0015C0746F2A6A13E14778DF5954FF4F7EFCCD15E1AE3B67CFB9E54C, amount: 112
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 < 1701455700,
content: Crypto.hash(String.to_hex(secret)) == 0xB14620AA27F9E87A48BDEC637A1996AF7A55508935932508083E18A69911140A
]
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: 111.664
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.336
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 111.664,
end_time: 1701455700,
secret_hash: 0xB14620AA27F9E87A48BDEC637A1996AF7A55508935932508083E18A69911140A,
secret_hash_signature: [
r: 0x2064E0DC361DAF4D138D8AB7D44A0C7E34B5C9DF5262770E699288A8BCF1C222,
s: 0x3B4B7F9D5DF3892867D9271FEF965B2BABE323F0F5E77F7CF36E26EE22C296FC,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
0C6CC8368EE54F2626C78C4296EB95F37C3CDE9267CED3DC0D67683EF23AD4E39DB39F89FB8838ED6F65EE8F7B1A4CACF75D6B4AAAD5631EE40FB4E6
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00002EF7...E97EAt 2023-12-01 16:35:40 UTCAmount 112.42999778 UCO
Previous public key
0001FC6F38391574F779B3AD84DA2C23FCCDBA03251DD9F987C4D4A8F6B52D5141F2
Previous signature
6457B45388B537DC6161E52E0CB6A0D55D3740CF54B0964A7AC8E805901D100B69F434603D280BA2B55BCB199137E7D8C18714F11F4E7B977437EE4AFCF8890F
Origin signature
304502206313BE1ED07C6AF7D5B9504F96DB090486B5FDF45B9E896861B925B61903A32502210080625101358100066087C74AD71642E747670940DE46D10D20F263C60456DB41
Proof of work
01020451684966573439C38DA99334546FBBDE4A6D96A50B4A4ECBB6572CDBED023F079607407E254421D1779525D11C60D55684F0B403B93B95823554E29D1E2CDB16
Proof of integrity
00F2ABB2B47E88C9BCB16EDDC294B4682840ABD1B661FF5E5A8A2E33A76671FE63
Coordinator signature
38DE7E9391B1EDCB5A4C6A6FADCAA7AD0713E25FFDEB86E104ADCB8DD636329355B099853A359B7E4B5A55E4B0C96F87B780C3617778AE83E1196BF6CAFB250E
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
D6E3E4139FD44B89A00A52A0EA42E33C1A09CF81A1CBCD9CF11B87E9BF619D6DE7AD121A81EAB173715609E561FA5213E27F87A2AB8D0F385CE891548D0F5F09
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
4FA44AFC44B3B4D6B64E63F367D705C618E2AA6D140098ACCB725CCADE0B19A913C97DCC953FEC0DEDA89C94D6DE94D82BF110B7EE2D73C7C575BAF35ED9C903