Type
CONTRACT
Validation date
2025-05-19 19:53:12 UTC
Fee
1 UCO

Code (886 B)

@version 1

condition triggered_by: transaction, on: set_secret_hash(_secret_hash, _secret_hash_signature, _end_time, _evm_pool), 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) == 0x00002075E9FB5329C7F5149802EB75F925D79B5FEC5BFCF09DC81993CB9C39FEAF5D
  )
]

actions triggered_by: transaction, on: set_secret_hash(secret_hash, secret_hash_signature, end_time, evm_pool) do
  Contract.set_code """
  @version 1

  condition triggered_by: transaction, on: refund(secret, secret_signature), as: [
    previous_public_key: (
      previous_address = Chain.get_previous_address()
      Chain.get_genesis_address(previous_address) == 0x00002075E9FB5329C7F5149802EB75F925D79B5FEC5BFCF09DC81993CB9C39FEAF5D
    ),
    timestamp: timestamp >= #{end_time}
  ]

  actions triggered_by: transaction, on: refund(secret, secret_signature) do
    Contract.set_type "transfer"
    # Send back the token to the user address
    Contract.add_uco_transfer to: 0x00000C27FF313EE00BB2D681B794A581BD605C38F1D2BDEEAB8597A83AA0E3552E7F, amount: 361745.63441717

    Contract.set_code \"""
    @version 1

    export fun info() do
      [
        evm_pool: #{evm_pool},
        ae_pool: 0x00002075E9FB5329C7F5149802EB75F925D79B5FEC5BFCF09DC81993CB9C39FEAF5D,
        status: 2 # REFUNDED
      ]
    end

    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
    \"""
  end

  condition triggered_by: transaction, on: reveal_secret(secret, secret_signature, _evm_contract), 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) == 0x00002075E9FB5329C7F5149802EB75F925D79B5FEC5BFCF09DC81993CB9C39FEAF5D
    ),
    timestamp: transaction.timestamp < #{end_time},
    content: Crypto.hash(String.to_hex(secret)) == 0x#{secret_hash}
  ]

  actions triggered_by: transaction, on: reveal_secret(secret, secret_signature, evm_contract) do
    Contract.set_type "transfer"
        Contract.add_uco_transfer to: 0x00002075E9FB5329C7F5149802EB75F925D79B5FEC5BFCF09DC81993CB9C39FEAF5D, amount: 361745.63441717
    # Transfer fee is less than the minimum decimals


    Contract.set_code \"""
    @version 1

    export fun info() do
      [
        evm_contract: \#{evm_contract},
        evm_pool: #{evm_pool},
        ae_pool: 0x00002075E9FB5329C7F5149802EB75F925D79B5FEC5BFCF09DC81993CB9C39FEAF5D,
        status: 1 # WITHDRAWN
      ]
    end

    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
    \"""
  end

  export fun info() do
    [
      evm_pool: #{evm_pool},
      ae_pool: 0x00002075E9FB5329C7F5149802EB75F925D79B5FEC5BFCF09DC81993CB9C39FEAF5D,
      status: 0 # PENDING
    ]
  end

  export fun get_htlc_data() do
    [
      amount: 361745.63441717,
      end_time: #{end_time},
      secret_hash: 0x#{secret_hash},
      secret_hash_signature: [
        r: 0x#{secret_hash_signature.r},
        s: 0x#{secret_hash_signature.s},
        v: #{secret_hash_signature.v}
      ]
    ]
  end
  """
end

export fun info() do
  [
    ae_pool: 0x00002075E9FB5329C7F5149802EB75F925D79B5FEC5BFCF09DC81993CB9C39FEAF5D,
    status: 0 # PENDING
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    925A672C11A92CDAF9B1DE230940041A4CAA1444BA516C440EB98ADD6994AF0B7B980A1734437FD0F2A83916B1C44B28C6B2DA257FC389B9F9E88E89

    Authorized keys

    • 000122A6CD9ED07E46835D6E88E5BD0BEE84C3F5E5DBF8E916AD9B2EC912C44AFEC2

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00013F0142944951C6CAF7D2FFD8F3AF6096F3F0A0C634DBF3E0CC9DE7607C37F8F5

Previous signature

05021F8164286F47F24D2CCDA4E708D60598A0C62148D0A48F3B1D3460F21916BC6524B9B559C792462A7A2F887B1AF19FC9B7ABE2649456A621C98434784108

Origin signature

3045022100BF65DF9278A076AF57A4A81D3190875F9E06BB2D148957F83E6119048194F0CF02205FDE88D059D5D055D7F8A6B223C65B3B4D33FA91C2AF5CCB5AD8FC5EF47EF1C9

Proof of work

010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6

Proof of integrity

00272B4E9F6C754720CA4F093F4EBE34F972E2F2C5FDC8CDB9C8C2BAC944A3A930

Coordinator signature

FE7F62E87093EBD21AF9B95304E165077E1A3B92788001F41650A57C00B3AA4FE66B32DCCCAD02A77B783331734E1FC1BB37509B6574E1DA0F3C7AF67A4DFE06

Validator #1 public key

0001959E3582B8A0A55C8B199B564D5B10C740A45E5EF6B782032C790C3AAF0BCC3E

Validator #1 signature

5FAA484EDF1527B04DF33705C090AC8B51CA2DD471BE50ADD78199A89F63D7B399D27B871A3C019BA9FF01B66627DC8D9577269CD1E4909560A8AB3C83CF0508

Validator #2 public key

000105B4FDF46B9FE90C30A471DCE4D296CCCDC27242C6CDA6E48622F4330C646100

Validator #2 signature

AF322D30A7556736B968823D38F809711D07116DBD517F74AB92790E3647639B8CEDC045D0172798551B8B3C5632FD6F3469842266DC992C26D805B2CB1B100D