Introduction

On December 2, 2024, Demox Labs tasked zkSecurity with auditing its Token Disbursement program. The specific code to review was shared via GitHub as a public repository (https://github.com/demox-labs/aleo-standard-programs at commit a5642c6f7f6150fc0d29dc30732894d31a9a3eeb). The audit lasted 3 workdays with 1 consultant.

The program was found to be clear, accompanied with thorough tests. A few findings have been reported to the demox-labs team, which are detailed in the following sections.

Note that security audits are a valuable tool for identifying and mitigating security risks, but they are not a guarantee of perfect security. Security is a continuous process, and organizations should always be working to improve their security posture.

Scope

The scope of the audit is the token_disbursement.aleo program.

Overview of Token Disbursement Program

The token_disbursement.aleo program is a vault to hold pAleo token and disburse a specific amount of tokens to the recipients after the one-year lock. If a disbursement is not claimed for too long (about one year after the unlock), the disbursement can be canceled, and the token will be transferred to a cold address. As pAleo is a liquid staking token of Aleo, the intrinsic value will continuously increase with the staking rewards. The recipients are able to withdraw the staking rewards before token unlock.

Below is the typical lifecycle of a disbursement (called Claim in the program):

  1. Create: The Claim is created by specifying claim_id, the amount of pAleo to lock and recipient address. In the same transaction, the caller will transfer the required pAleo token to the program.
  2. Withdraw Rewards: The recipient can withdraw the staking reward before unlock time. The receipt calls the withdraw_rewards function specifying claim_id and the amount of pAleo to withdraw. The program will check that after this withdrawal, the value of remaining pAleo is no less than the initially locked value. The recipient can withdraw many times, but only before the unlock time.
  3. Withdraw Principal: After the unlock time (about 1 year since mainnet genesis), the recipient can withdraw all the locked pAleo token in the Claim.
  4. Cancel: If a Claim is not withdrawn within 1 year after the unlock time, it can be canceled and the pAleo token will be transferred to a fixed cold address.