@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1702218120 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00001E1E48F6AB5F8EB097562D0ABCF19A61E920DB0ADC62F31B62F34C3EC7481015, amount: 30
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1702218120
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00001E1E48F6AB5F8EB097562D0ABCF19A61E920DB0ADC62F31B62F34C3EC7481015, amount: 30
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 < 1702218120,
content: Crypto.hash(String.to_hex(secret)) == 0xE4E6D8C053EB163E70107ECECA300023EE0BE5DEAA0EF0C8BA414965DB105C01
]
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: 29.91
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.09
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 29.91,
end_time: 1702218120,
secret_hash: 0xE4E6D8C053EB163E70107ECECA300023EE0BE5DEAA0EF0C8BA414965DB105C01,
secret_hash_signature: [
r: 0x46ABC0A442EE39A38B73F099A2C86D42240623F836C04FE53BB58C8757631E18,
s: 0x76E26D74E52A12AC9A2BECA696383ACACA89074E0EB4F9ECECFEE5AD8CEF5933,
v: 27
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
2F0B14363C3A2AE542BD6D066C7459ACCC3199358255D586B2762B2B95201B9EE31EAC0D2D64B1A43DB29637B5333623431E55642FDE25C63C6DA0F1
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00006340...DE71At 2023-12-10 12:23:07 UTCAmount 30.42762086 UCO
Previous public key
00016BD1EEDC7725B55ADBDFD7D2DF66C7F6B3AFF0D9B9D9ABC444A6041FEDFE946D
Previous signature
2E3EEBA71A0B8822D31299E65078B57F48251D2C8F9D79A08F67B1DE1B2A10B5E1B9DE75CA1AAA13C5514EAA31A1BE4D89C76F2729F11BE391A096F43C3CE901
Origin signature
3044022021421719C504FDF26B13265F59AB115C99974346B2BB65248B58A4FE71B4A30F022000BAE9234BBF16340D706690C54F02459E3412FB1D2B6C365DE6281E69467FBF
Proof of work
0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45
Proof of integrity
00720C76F116C11C7009496C5792C96CF4D8ECFB458A546F75BAF45D2D7B13D270
Coordinator signature
930885DE697C9F4D48720E88DD97A583DE921B90F51C95D73E2EC97CD1A8E4067ED4BBD8F23FD1D3926F864C1A68B7B6B55217C2A8312AFBEEC5722D35EB4B07
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
98C82B1F8A2883232B76FBD395D8ACFFE2937AEEA140E3FFADBBBA7985FB52D5DCB9EDCD3F622FCA3A30E15C4D80181A3B40F3FE6F506EA3D19D4D069596830D
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
C6EB1FAFECDD1C6B82E454B7AE1A9556322FB2CA62C5D4E5D6B20F05983EB1E557C51B596A41B5F75D777286599EF6C6E4DC6171C54CC4814441113F8693B706