@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701542220 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x000079B40CB20AB1624178169798B0C9D9245BE746399864BE620B3099689DB824B9, amount: 1
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701542220
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x000079B40CB20AB1624178169798B0C9D9245BE746399864BE620B3099689DB824B9, amount: 1
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 < 1701542220,
content: Crypto.hash(String.to_hex(secret)) == 0x0C9CBE992760936580C8E1CC9351C37BEDD8849DB69291DABEADA722BC974C3D
]
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: 0.997
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.003
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 0.997,
end_time: 1701542220,
secret_hash: 0x0C9CBE992760936580C8E1CC9351C37BEDD8849DB69291DABEADA722BC974C3D,
secret_hash_signature: [
r: 0xCB5D9DB7F55E8B9604673146919B33CB6336B0EF22F219D339A6E3C55C23879B,
s: 0x4516CF93F7A120D1B2B4DBCB5ACF55164BBB865AC87FB1A0EFD03504EAAB5018,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
5F5B1EB77F061DAC479A6403224720D505794796120C7FE12D5EE74E1E39BCC7DA0F19FDEC527EB3B9E00C4AA7E66F7EF01920DFDA5FB239B041E7F6
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00008DAD...F4A4At 2023-12-02 16:37:15 UTCAmount 1.42142402 UCO
Previous public key
000184AA7F4AA7040A992A2B70D76318BF969123920E8F1D535388ED83B678DB8925
Previous signature
3FFC6956A6EA5B63E77D5472F2E52B5A7CFF536D80FD0FEEE8ACBB7F939312E81A17432678DE602B5444A3DA6B22B8085E6AEFB42267CFAED4911FC73F2D4C06
Origin signature
304402204F920253A1EE2B35DBFBFB4046989B4E993BC3C18FC8BD3B48AF8F639F1A0569022030117AA60BF8BDFB18DDA7BDD26F04B3B93A74B65C9668FF650C445666AE217E
Proof of work
010204E9BB401A767B0C92D5DB139379AAB18E1B449B455F49E3A44F3466B2D38E59F0516B79493A528A95E5A74CF46F79CF12DEB73293458F6A4403D2B3E57D697347
Proof of integrity
00F9EB985D3F53F7AB397F925BCE6442E91EB754129C581CB974D5C2EF8ECA3522
Coordinator signature
9E4A2D17DE80110787AD0D44C63A7EF329119AD8CA120E258A481C2C40D922EE59EAE3B21524EBF66B4687657C787E7A06A0017FACAE5631133BB296758F7B09
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
FCC08895CDC25FFA95940C2D467CA36176D8672C5E9BB4EA84FC6811027FB3957788ADBC107D9D4FAEE346F5334AFAD0AE1E10F66169BD26D8CD925F909F850C
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
045CDFA97966FAE29488AF5C7FAE4A2A64B02C235CE9E17899C9EB7C1E7CC123C8733746C4B443E4D4EC1EB411ED3769F97E07BF97A222FE970914D7DAF0C106