Cheque

The Cheque contract is the primary contract for project financing, serving as the main entity for consensus decision verification processes...

The Cheque contract is the primary contract for project financing, serving as the main entity for consensus decision verification processes. It also acts as the sole credential for withdrawing funds from the fund pool during project financing.

Contract Functions

The Cheque contract, as an extension of the Distribution contract, provides functionalities such as creating cheques, users checking cheques (participating in verification), cancelling checks, and withdrawing distribution funds. Cheques play a crucial role in the project financing verification process. Alpha vouchers can use Position Tokens to check or cancel checks to express guarantees for projects and withdraw guarantees, facilitating the consensus matching process of community decision-making.

Structure

The Cheque contract inherits from the Distribution contract and utilizes the SafeMath and SafeMath32 libraries to ensure the security of numerical operations.

Variables

  • chequeIndex: Index for cheques, starting from 1.

  • cheques: Mapping storing details of each cheque.

  • cheque2Owner: Records the owner of each cheque.

  • cheque2Time: Records the creation time of each cheque.

  • cheque2Claimed: Records the amount that has already been claimed for each cheque.

  • userCheck2Cheque: Records user participation in each cheque.

The Function

  1. Events

    • NewChequeCreated: Triggered upon creation of a cheque.

    • NewChequeWithdraw: Triggered when withdrawing distribution funds.

    • NewCheck: Triggered when a user checks a cheque.

    • NewCancelCheck: Triggered when a user cancels a check.

  2. Cheque Management

    • createCheque: Creates a new cheque, requiring a fee payment.

    • withdraw: Allows the cheque owner to withdraw funds, subject to conditions.

  3. Participation and Cancellation of Consensus Decisions

    • check: Allows a user to check a cheque, expressing support for the project.

    • cancelCheck: Allows a user to cancel a check, withdrawing their support.

  4. Query Functions

    • getPending: Retrieves the current amount available for withdrawal and check progress.

    • getTargetIdFromCheque: Retrieves the project ID based on the cheque code.

Logic

  • Users create a check using the createCheque function and pay the corresponding fee.

  • Users can endorse a project by using the check function to check the check.

  • Users may cancel a check using the cancelCheck function and return the guarantee if conditions are met.

  • After a check is successfully endorsed, check owners can withdraw financing funds using the withdraw function.

Interface

Last updated