Type
CONTRACT
Validation date
2023-11-15 16:08:09 UTC
Fee
0 UCO

Code (863 B)

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

end

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

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

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.997
  Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.003

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.997,
    end_time: 1700071680,
    secret_hash: 0x34BBBE55DA8B99FE73AB37D51D1FCCCCC1866DDAEF86B8F77E88D12D5FB523C4,
    secret_hash_signature: [
      r: 0x07727B90853257D48657527EE45553BE831064063B5FF817B4C93A8A9E71CC29,
      s: 0x05DCFF3A913553E27B1593ED9950AFBA8F922605D744C297BA9118FAE9D62F4C,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    63A7B1509C4781254BC9261E273CD47240E5B5670497CAD50235BD75B964EBED4F4AD20510B898126B1F1AC39D5212A607994B7E221BE95C5FAF5884

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00011FA4A4E368E161F6FE08586128A951A0091F3088F1EE11BAD1C252620C382FEE

Previous signature

C2030D9367814772C79C2548BEB57ED8EE21EF31247376B325AE8926761CD7E3A7A14109A6BBCBC4AC28F2EF44AD2B5E6CD0E013466119FCCC736E5772933B0A

Origin signature

304502201D89B8B05B829C9C38E59193B2C66EE6549B02C36308D9C3C656D117111C897B022100ABC66D0DFEC80899683125EB86C1581537643AED549739682CC9842BA1EB42BE

Proof of work

010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381

Proof of integrity

00F71F5AFDCE85BD608AC84C4659597CF37B52049A156483DBAFEA1D8C7A8A9CCB

Coordinator signature

D895964A8022659E6D628CFCC9676653CB3EEDF942953105911D97D8717663E7B8103701A8DEC5D7B272C4AC88848071BF5300EA49E89BF74D80AD120DA86609

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

B1CC0A1DC3BD7721A5A8A84F49589783F5AEF6C8AE5B083A6B6ED93A5C52D759D56C48D3EFF6CB81BDBE0E11F34CDAEBDA83EBC60600B1F105E12C05058E5801

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

69C6EC4C1CD8BFB166161C98EAE0DE06A90A1E0A41068BB8A7DB767C3B880E030BD47A0B8315CE91CD9A234B7B48512DCF5E7FF02939348C4B6332900BEF9B09