@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1702056720 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00007D315DBBD21D4AC008F6C9A589653C00B41D944C44F426C9F787CF03961D2F10, amount: 85
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1702056720
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00007D315DBBD21D4AC008F6C9A589653C00B41D944C44F426C9F787CF03961D2F10, amount: 85
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 < 1702056720,
content: Crypto.hash(String.to_hex(secret)) == 0xE833A094BD3BDE4A434B6F5A98CC0176D51475EE0E20FF0EAFF465111A7676CC
]
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: 84.745
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.255
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 84.745,
end_time: 1702056720,
secret_hash: 0xE833A094BD3BDE4A434B6F5A98CC0176D51475EE0E20FF0EAFF465111A7676CC,
secret_hash_signature: [
r: 0x09A42500BD26E2D61B2FC9ABBCBE78986DA967B6F24B09D3274FD3B6B65C5968,
s: 0x034A57E0A735F7574CA7FB2EB6A9E9CDD5DF0E50C446D62B851E042B82A12654,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
AFA02582C18C06BF2BC486727A10C96FA0C88D4BEC00BB069152D8FEFAF42310C508BE0F9095149E9E61EBF9C5AF9C403AAEEFF8F14A850ADE99F0A0
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000712C...61D9At 2023-12-08 15:33:02 UTCAmount 85.41550974 UCO
Previous public key
00016AB5028CC7FF7CCD05D002A69C499EB09E0113D117DDCC9B32BBB438452CE76B
Previous signature
1971989CE877A3EDD5EFAD3567BEE2665431C8502BAB8CE1C189C3F9CAD7ED89C2E8378B272FB3DA856EF773EA54896F532C5AF7CFBD8D91E053B4C02966AA0C
Origin signature
3046022100BE7014387BB53568669FFC1F2A641894BEDA72BC1FE7948CAE9DA50213C1B195022100BE5F5A819B1717B6F865C2FDB4B1607BAEE684009081A5A1E21B108220B96709
Proof of work
0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45
Proof of integrity
00D26C5AF2A7FC3F83647D26E71F053A527AE5A6135693BDCA529A5B99FA60414C
Coordinator signature
77B8EBB1D6A1FBB2365DD57266A44DBFDCED34CDF549E535B4D2F52525FD9AAE0B54E5BF21790054ED69C9A27B57C508795368821E4DB8DE2F7AB714A62DB105
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
F3DE21B6768E0D719F97CC82632B744EDD8D3D158B525E107C8361A912729509D0BF93FC53919530DB3A5B5021E5EC3E6D5EF639868F9C743C57EFBB7794A505
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
BBFBE31C0C07CE60B49AC95F32CB4574858B6BD9B01E93EF3071787216DEAACDD83B273169F79BD2215C6CD8453B8AB6410FADBD7F4AA5B1F469822BD69AA506