Type
CONTRACT
Validation date
2025-05-19 19:53:44 UTC
Fee
0 UCO

Code (949 B)

@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 >= 1747691580
]

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: 0xd5ca9f76495b853a5054814a10b6365ee8ed745b,
      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 < 1747691580,
  content: Crypto.hash(String.to_hex(secret)) == 0x48103BD2CB0177214A429550CD00C2C41B3B6E7185CFF0E7151A253C0EE8F633
]

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: 0xd5ca9f76495b853a5054814a10b6365ee8ed745b,
      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: 0xd5ca9f76495b853a5054814a10b6365ee8ed745b,
    ae_pool: 0x00002075E9FB5329C7F5149802EB75F925D79B5FEC5BFCF09DC81993CB9C39FEAF5D,
    status: 0 # PENDING
  ]
end

export fun get_htlc_data() do
  [
    amount: 361745.63441717,
    end_time: 1747691580,
    secret_hash: 0x48103BD2CB0177214A429550CD00C2C41B3B6E7185CFF0E7151A253C0EE8F633,
    secret_hash_signature: [
      r: 0x399232A1B2BFCEA68697C33861B5517F920B645CE6A3B7DD05663E4F6FAB70CF,
      s: 0x756B59A78ACFBEEA8B764D6BE015D305F3873E763D04EDC14F338EF9F858C4E2,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures