@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701328440 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000044A41B6D429CA334861E96A8CE7FA4658C7641533DE6BF891E2F4AEC46D5863, amount: 5
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701328440
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000044A41B6D429CA334861E96A8CE7FA4658C7641533DE6BF891E2F4AEC46D5863, amount: 5
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 < 1701328440,
content: Crypto.hash(String.to_hex(secret)) == 0x86687187D6CA4C9B35BD124D1EAC9EC8DC4CB05BCDC5D23F892DA52A7C17A5C1
]
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: 4.985
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.015
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 4.985,
end_time: 1701328440,
secret_hash: 0x86687187D6CA4C9B35BD124D1EAC9EC8DC4CB05BCDC5D23F892DA52A7C17A5C1,
secret_hash_signature: [
r: 0x955C4CE616795697F05392AE9EA6F4E454A67D0AB25ADD8A91E39254890CE69A,
s: 0x6F8237238B4676849E27C9A75C675049164B77791CCB48A50E02B94AF2ABEF39,
v: 27
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
FF421A71F6994841020D9054CB6951F144D8EE359A9C5A463A00A3B6E3FE7AA7DCDF5874A0BF0FDE8FB5D0FF01BC5C8FE821EB8F7BDC35AAE7E6D88D
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000CB08...7B3DAt 2023-11-30 05:15:03 UTCAmount 5.42232688 UCO
Previous public key
0001D7857B44E5577DCA95C90A3C5087AF1AA7633909863EDF43306D4F5685B1BA0B
Previous signature
349212834D8CB48D3093335DECC024D9D70E4D19038CA28D8848F21D8872AFD457E4AC8E712EA0EF7BCB9798AEAF0FB3265F2C5DA59E44DC6975A42BC3BFCF0A
Origin signature
304402201ACDF9F6097FFEF04774EAABDFDD57AB5B5883F7C041C8A85B26C500266B0921022038694719AAB31BA769F010B11D52B875675082FB1BF8AC0915C2B96052A228EB
Proof of work
010204E9BB401A767B0C92D5DB139379AAB18E1B449B455F49E3A44F3466B2D38E59F0516B79493A528A95E5A74CF46F79CF12DEB73293458F6A4403D2B3E57D697347
Proof of integrity
00D6DE1515D2E3CA6F4CFFC716B635607D0D9778732D3EA69AFA919B53EFBB86DB
Coordinator signature
06D6C57D90FFC197FB0E28BCB0CFF6C43A66D54D197B31981E4F104CF9D32FDA308947A33AD43701283D942B285857B9434C7E90DF551A8BC88569887F836B07
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
5B4C52DBE194C5D520276B379511BF74F22F82B1FE5485D8A59DE1F7E0404702C09944B38FC4CCD350BFCA8A9A1525FD3C21513466435F8E2885678486167909
Validator #2 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #2 signature
CCA3F4CFCCAA1F1ED3860A76380C6F58EB6DD48788DE0C4411DEEDC2FAA2E648C8E541397EE36307119E8F3DB98A9BB48E8DB86EB0B7DD09E7DB57CE9C762C00