@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1703806740 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000AAE847768F278B0D458240DC4E5205C2CB307B81D81865338F2C6B831F6006B1, amount: 8
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1703806740
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000AAE847768F278B0D458240DC4E5205C2CB307B81D81865338F2C6B831F6006B1, amount: 8
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 < 1703806740,
content: Crypto.hash(String.to_hex(secret)) == 0x27235297B1F069E3CB0899C65FDE9244C75BDA69013C2163A84D8BAC0D4A32C3
]
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: 7.976
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.024
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 7.976,
end_time: 1703806740,
secret_hash: 0x27235297B1F069E3CB0899C65FDE9244C75BDA69013C2163A84D8BAC0D4A32C3,
secret_hash_signature: [
r: 0xB43C7067EF5B08A924F9832029E883CDE754AC580D952D7899CEE43BB057294A,
s: 0x04213118DE31D87E555E6404BA4545A7A0F6519863EE85085D57BF517AA72080,
v: 27
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
50A9599186C46221B3CD2A8CBF105CE58CF0A8899F3C6107DA195C6601DFBF4BC921BFBE923D91B7E4C8EA33ACC2F4C033C56AEA9065B602C86CD86C
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000470D...F4F0At 2023-12-28 21:40:12 UTCAmount 8.40348408 UCO
Previous public key
0001BBE97735D06BEB2C43C16B66B258EE31A88214958097AA5F62EE073230A36C7C
Previous signature
50B9D2E8E0009D040F85DEFFBCDECDF65FC7E611C51798D296B273FEA7BC4E01E16843D57275394737E7C8E0719737AC01D39F1AAE3E0EAF687443E5821C7D08
Origin signature
304502206470000A9BFA02C7CB0FAD36C335E217B940992301BB06B9875668B6319D8EF70221009FB51557FDA01CFAE7A3B6FD40E4F5F881D2967702F835F18C62F996A7A7C4A6
Proof of work
010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B
Proof of integrity
00EE18B838FA47CB104E105F5464C75882AD679570BBA423875F58448EC2EB83A7
Coordinator signature
36ED0EC7E85B5F6281F28D7CB1D2F6C2EFF8D3739C5A7810615BB7AE100156D947E58A161691D737E1AA1098A2F808EE6AC6621525C0A759633928659B5FDE00
Validator #1 public key
000177BA744AC778DC2D51A1B7C622E7AC4BD1E1AA8DA2D0FCE71BAAB7DAD0E020E0
Validator #1 signature
15E9998BF636C55462F9EC78058C60DA4417613D1C3499CC3412725487A04D053EB55B937C5470553248216926E38335246D360B9E8C4801C8F60401E2F26E05
Validator #2 public key
00010F2A0E4C424582A94BD90E05FE6931628F91988ABBE387D365994F1F3FCF5A12
Validator #2 signature
E4A3398BCB94059B7F0F339439F9BA0F21DAC1029EA3DBC04F640BE4996405826E113E305AD49A4BA61D13D6907C98FD5031A8306F383BA1FF8802BBB71F3808