@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1702279380 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000E1BD3ED17C87EE4A7354501DBCEBD07D9D927499C2958B0944F97262BBE892B0, amount: 5
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1702279380
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000E1BD3ED17C87EE4A7354501DBCEBD07D9D927499C2958B0944F97262BBE892B0, 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 < 1702279380,
content: Crypto.hash(String.to_hex(secret)) == 0x975922F6D40B53BDE8B3B27F7E29AC512062176624778104FC471019A7FA3E7B
]
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: 1702279380,
secret_hash: 0x975922F6D40B53BDE8B3B27F7E29AC512062176624778104FC471019A7FA3E7B,
secret_hash_signature: [
r: 0x95E8F8A1513C42814861FFFAC4F4C32132CAA54EC5DE056127A356E11C5B5C7A,
s: 0x42C63371D6BAB8BE973E6F7A09D584660047AE3FC74EF464D0B74E6491C584C5,
v: 27
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
1ED772FB5DD5FF5ED8B3982D6254256728197013DD7D2682F63137EABE76DD70600057B7DFD166FFB6274CAA12A29671E4789181E298C4E8B80E3491
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 000086D0...D712At 2023-12-11 05:23:45 UTCAmount 5.4404694 UCO
Previous public key
000185F244F36821BDCD8338637DF2122BD3E0EA8B74BF25A6E5554AF75EBC325343
Previous signature
5D269A81277CB2AFF87612891C41CF33A1C12BFD28BD9FDEA0A81556D97F4DD2241D046BC4671363D880F65BC87E74CD7018CB24C342053218E4B9EAA92CA506
Origin signature
30450221009D43E3BE343734AF6364D07A352FFF87C0E01FC05D4432056EB879B7C9497E6102207FF5F2A8531F4C735CAF5A0981E142F53B2E22B638E98BB18B96B68557680C92
Proof of work
010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381
Proof of integrity
005905A97AF255235BE4BA85DE09B554C7DD530AAD553001384664B816A9392FC0
Coordinator signature
5B0DF5E2160DBFEFC1ABAF84E21920F21FDFEE2F677ED3727FB629A2ED2B7D932925254AE86E51F5F24C9E011A49A05E571B0E7F123636BCFAC44AD351F81E0A
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
A02EC6EA52BD80FAB506AA65545DE68A5A85257C14633520D4B73C36928CD0867F4C196524663B97453C52958FA9FFE6257711D677701FCC8BBAAC244343FB09
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
801B079B8D7FC8962711EED1CA0ADC651AA27C54BA2114D2A466E3272EAA8878FED8E0101D0E62C8F324BDC3F3DD84684DCBB01821B0569241C8FA72934A4E03