@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1702601640 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000A60676622E63BA85AD07A5216C78BF3A95BD8BCEB5617642C3C0133A4611A745, amount: 100
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1702601640
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000A60676622E63BA85AD07A5216C78BF3A95BD8BCEB5617642C3C0133A4611A745, amount: 100
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 < 1702601640,
content: Crypto.hash(String.to_hex(secret)) == 0xA5302D50875A651050A5F8325650B55507C3AF61FE621EA4DA9A9C01D873147D
]
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: 99.7
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.3
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 99.7,
end_time: 1702601640,
secret_hash: 0xA5302D50875A651050A5F8325650B55507C3AF61FE621EA4DA9A9C01D873147D,
secret_hash_signature: [
r: 0x9FBBBC4BB1FC7302515A7AB3D3DB92130F8128604CF5177E0BE5F9669E928313,
s: 0x68570C2D40C21F126AC900B8DCC5CBC820CA83554B8DE5468C739F56F8068650,
v: 27
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
5930D324BC5FDCF67840048D854936CD56AD6245A3D4345E700D3F4F63A8725BA12FC06D1E6F0822889E827DFDB20F559D5C1D79EDB3FE8B9E95235A
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000AC04...916FAt 2023-12-14 22:54:46 UTCAmount 100.44394357 UCO
Previous public key
00013246BAEF5DC7FFE7392F25B4E0D04C7C2E47992810C701C6684C27C3AED8E1A8
Previous signature
8C06E4BC736F70BFB4579B8E7AEFAD030A708E262B5406A149D2AA56CBD4138F8D340DC8489A1CCC61284877843125A85B8D47D5DBBF1C81E0E8105FB5370A05
Origin signature
30460221009AA2D658950AC56FD2FDE147D4E4B145D77F93CE106D01732FA0712B5E8FB8D8022100A71D43E1B6BDDAB1A8C4F6E28292BE5A726BA32B8417F17474DEE16A63132EFE
Proof of work
010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381
Proof of integrity
00DDBDDACD020B59880BC80D02ED8F5EE880A398764ADE578CA5EED795EB4EACC5
Coordinator signature
B4AF6C7050FB71AFC4CE974B8DAC8AA14815B550A5CE9158B7C2179895AD6581E5FC3794DFFE43D8BDBDAF72D0D22DE5B53CCB2BEAC7BFA4424679D58F9E8B08
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
95BA81B5EAEE494F10382A54FD265EB097D20DA41BDF2012638284A9EF25C11463F2FEE53C1693FE233D51CA3488FAC5078F5A065435E4D4E350B7162424BF05
Validator #2 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #2 signature
3BD4F8A0F38980613D8A103CC6C788CD0E1CF1111F97451C4AE248D255AF83AF58FADBD91E2A94E2EFE3FAF75BAF9345516A4A990C6AE9EC1A81F35DF51E1103