Type
CONTRACT
Validation date
2023-10-25 17:18:15 UTC
Fee
0 UCO

Code (868 B)

@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1698261480 do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00008DD40CD42287A3C8282065F5BCA7259AC7014CD73109B570E946A977687C7BD0, amount: 0.01
Contract.set_code ""

end

condition triggered_by: transaction, on: refund(), as: [
  timestamp: timestamp >= 1698261480
]

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00008DD40CD42287A3C8282065F5BCA7259AC7014CD73109B570E946A977687C7BD0, 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 < 1698261480,
  content: Crypto.hash(String.to_hex(secret)) == 0x240FDFBBAD9EBCAEE0EAF04D91002CF5BD6578697EBAC5E90991AB41A5B30B8E
]

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: 1698261480,
    secret_hash: 0x240FDFBBAD9EBCAEE0EAF04D91002CF5BD6578697EBAC5E90991AB41A5B30B8E,
    secret_hash_signature: [
      r: 0xA9F2EB78CCF16E640053B557F7019F88F9E3B436A9E604003512B3C02DBB469E,
      s: 0x06CF21662410B589500A7AD01E711CA64B8D207518A9571F00F6336BD5DA149F,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    E73A84BDEEABA1B5458543B2E3A7507D9C1856A969866622AF96F062ADA125E3B75041C834793B9D9B6412927B1DDE58A5798A64F9B07FE5D30F08D9

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00015F028F37640DAA278B6D9A1715CB42353418D21A6297913849D5C09C14C3777D

Previous signature

EA87D52B6B46912020A3932B845BCEB652D2F1E230D3C4A813910C348292D5B2E7446C1A776A62ABDB33B012D1E57A718276A3EC3BF13944C06D245938F6FB0D

Origin signature

304402201CA27A5FF8FB817FC9774DD145EEA9EFB6D64E9FB0CC4DD3B008CA49EE7F6D0602204E073EE9813B6904F357DEFD403A5C964C09C2766CC23AE088C4DDDCEC3A53AA

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

00143F93065A780351FAC7B3F757E18CF000950028DC858678F76C271DFF34BB28

Coordinator signature

85F5FA6DB0F5AB094FB05B49CC1B3DCF8829281DEA2F148399C152EEB25A3CDB438CFB942114471847A0142A6622371D38130A50114A9EDB9CB4FEE7B06B2C0E

Validator #1 public key

00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC

Validator #1 signature

8EBB086F6707A9B02F8C57BA6FE6252541EA56C11EE85396C3C4F9AF2EDF74882039A7CDC5830C828445E2087C962A8F94AB35C660ABDF61A9E98643B6C80E0C

Validator #2 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #2 signature

8918554A479E00CBA9F94AD8B5EE8240012271ADFA0A50257A54E3BBEB6C83E4FFF1F12E33808C793B18F735269787BFF2C0164D0A9B94B4F2B2CF15F86FE60E