@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701295020 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00009C856ED9DA892A894103149A40831E478F0EB48EEDBB428D45E8F8887C6B628B, amount: 0.01
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701295020
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00009C856ED9DA892A894103149A40831E478F0EB48EEDBB428D45E8F8887C6B628B, amount: 0.01
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 < 1701295020,
content: Crypto.hash(String.to_hex(secret)) == 0x415962B3E3418732BE71A1A24F514D1B029A40BC574565356F9F00EC6BB56A83
]
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.00997
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 3.0e-5
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 0.00997,
end_time: 1701295020,
secret_hash: 0x415962B3E3418732BE71A1A24F514D1B029A40BC574565356F9F00EC6BB56A83,
secret_hash_signature: [
r: 0x1007F833FDB490AEAD1C25F576A1FB987D6B290433A7A0E149181089BBF1DDB4,
s: 0x62E097E7462120875AB9ABD9D0B8B99964D4CAA4BA27E1FD62F9FEE9F72C426F,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
4C9FD47F1ECC28201215749E8DFD5AE9632E4A9A7C589185BEF0660A29C3BEFE9111790725698BCF7D84EA12CF218F88D69BFDCCB225C98C8C825FDB
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000D649...D5B2At 2023-11-29 19:57:26 UTCAmount 0.4336208 UCO
Previous public key
00017A50E0D9C0DB1E0D95843473AD0B499BF68E6A6CDD2A5AEF29B0AC59B67E59E8
Previous signature
F612C525A8A0B83DF7C125C587B555BBCE3D7AC170D291A7206AB881F6FCF6CD13B30889069C9F6E2B0298677A15BFF0846A2CF433995EBAF6475A7FB482BB08
Origin signature
3045022100988CD9DC9E4ECA39520096F59793AAC578191D2B6E2EB8775D48BD5CD58B1E240220156289BCF9244122D1C3021D0A16E0D634D867149AEDE3C33DFEC6257357B62E
Proof of work
010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381
Proof of integrity
000090C9D247D560B9EB7B9BD220281F93508920AD1572CBEAA00F35ECFD7433A9
Coordinator signature
D379EA04F2B3F5B4D0E48F8B0D8646A3ED2F0101C99CF48EDDD310236D6CE5987D409DDF57F6C10503112DBA9C1191EC698327DE67F030ED01DD145493872B06
Validator #1 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #1 signature
94239C9BB10199A4B62CDA6AE70A40FB3F4E489E3918FF4CF3A1FCEF2A131AF63C0B2B702F71CFD06DEAFDE7C174B3656E9F5CF22016DEC5C71C3E5344D8A909
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
9AC0F5366C72402B01F25C36DFEEA7369CE35B430AFBAF783046EF6D861C74C0FB7E2E024C41EBAADDD760680CADC8E3847CE83C79D08B3CD95F346DEBB04104