Type
CONTRACT
Validation date
2026-03-20 18:55:08 UTC
Fee
1 UCO

Code (874 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: 0x000078568EA8D66A60EC971FF34A4A53487674EDBB88CF58ED2BB73AD05CE21A94E8, amount: 5500

    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: 5500
    # 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: 5500,
      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

    6F9E6D7B4C6646C0332B703B1E81A84E87A89B73BD4FE842AAA938BD2AA5C5D1C0F44212EADC1DA084555DC6FFB5704CCD9EFD2ABB186404E6207656

    Authorized keys

    • 000122A6CD9ED07E46835D6E88E5BD0BEE84C3F5E5DBF8E916AD9B2EC912C44AFEC2

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001B78FC3E44181288C74FF1158CA59ACE079FFA81C7DF0D674003C65CBEE83F74A

Previous signature

16623EA2E50C2FD8E6A566526E631AA69D58CD0A4CB128ED7585CD2516B4DD6D42D01DBCD38E469DEEB9979A2F08F4077C5D9610893F01B038C1E2ABE663500D

Origin signature

304402206BA875E05E893B2492C0A3B0EBDB594986FCCC01899097A40526892FB28FDE87022040408D3900BF5F10E2C0896D8C3EB1F76689A2EE49D9475EA044F6FBE7C93041

Proof of work

010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6

Proof of integrity

00C58A24A3A1FC6EDE40FB42B82CA3B765BBA1BFFBA70E469D46D9F24F4C9DC28E

Coordinator signature

EFE6591531041E272D3A5A03B2CB0363AAF2F7857CF637A97C94BBCDEA8F3088F0592439EB31BEC38B6E181EAABBD6987F380D3512802D8839B6F3C7B168C600

Validator #1 public key

000194955FCB15F67BC30BEED9E236E6B2EA06605A170A78A8942AC96BC29E4B7B13

Validator #1 signature

3FA0F578D692F5B4A061779F5AA7D1B639D010526714569E6B1B15D59D7624B0E56EAFD3ADA13E0DC9807E869490A9B4D391C9B9AABABA5117BCC268334E1F0F