@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701804300 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x000004BE34D15FF077A60B1FCE897083D215A3C392BF49CFF15030A774FA8FDEEBD4, amount: 150
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701804300
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x000004BE34D15FF077A60B1FCE897083D215A3C392BF49CFF15030A774FA8FDEEBD4, amount: 150
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 < 1701804300,
content: Crypto.hash(String.to_hex(secret)) == 0x5C8FC8482F707DF4266508DA3D94E36A0A09F99DB05372511B811A2F69B4CD15
]
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: 149.55
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.45
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 149.55,
end_time: 1701804300,
secret_hash: 0x5C8FC8482F707DF4266508DA3D94E36A0A09F99DB05372511B811A2F69B4CD15,
secret_hash_signature: [
r: 0xB995872498607265C05D1349F8DDCFAAA6F1EBF2DB2B68411EE1B959855C88E5,
s: 0x48C6E7E334D6D27AACA2F458EA7811B1FF9E1DEC1FEAC86EB21D104C4FA460F4,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
6FE0A830319BAAB5804E452AB5675661A64CD19D862D793F7976E1725271B6A09406AE90818C3DC2F895CB31EB22B82CC93C9CB537B68642187D5B39
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000DA3E...F799At 2023-12-05 17:25:53 UTCAmount 150.42469435 UCO
Previous public key
0001291567E65645587D13C3BDC132215687761F8711411C77061628A978416C3A22
Previous signature
37E0B224DC880D26C32751AC44A0FE9105013E36C84AF724C67099074DFA82DE5A2D8B306FC858B09DD62A27FD18A13EDAD8C611E9E03FE36A7631019D3CC305
Origin signature
304402204CCC60A9AFCFAE09F31F3441DDDCA5AE10DF4B429552BAE74365D3C80404CC9502206528953493BFE55ECF49E1EAA35B256B0659E7FC9D364608DFF404B2800D2B75
Proof of work
010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381
Proof of integrity
00F63F3376EA2F63AB772B72A640C315F3C13987E289844E352A8E8346596D27BE
Coordinator signature
FA888CA9BC935AD9DDDCC4CF5975B09784E07DDDCFDF785D934B8FB5A5941A5C6067BFDB0690F196E456E37E6F835A448B7C8ACCA5E9A0423F32C187A0506601
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
C0DF9B1123CBF4548BE4EA7946E57733A8B351AF5387B708C8B7EDC8F5CADAD42CF2F3E2BB304E1CC17BA91A4A0B08D41F8562BF2AC4ACA09C96DA338E041C0A
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
6FA41A31C7232C7B4B6D431A3048853ECBD7D480CD87FB5EB6774B3D71DE405F1EE2679EE7352BF02E8453E1A681236774477F3E1B01A7DE68ABD9B187C95600