Avalend Finance

Smart Contract Audit Report

Audit Summary

Avalend Finance Audit Report Avalend Finance is creating a new ERC-20 governance token and a token vesting contract in support of their platform.

For this audit, we reviewedAvalend Finance's Token and Vesting contracts at 0xA216F344FCd412C129E0c012798A137E332F8955 on the Avalanche Blockchain.

Audit Findings

Please ensure trust in the team prior to investing as they have some control in the ecosystem.
Date: March 29th, 2022.
Updated: April 6th, 2022 to resolve findings #1, #3 and #5.

Finding #1 - Token - High (Resolved)

Description: Token mints, burns, and transfers do not update delegated votes along with the token.
Risk/Impact: The number of votes and tokens owned by users will become internally inconsistent when a token is minted or transferred.
Recommendation: The _beforeTokenTransfer function should be modified to add the appropriate _moveDelegates() calls.
Resolution: The team has created internal mint and transfer functions.

Finding #2 - Token - Informational

Description: The _minters array and MAX_SUPPLY constant are unused.
Recommendation: Initialization of these variables can be removed for additional gas savings.

Finding #3 - Token - Informational (Resolved)

Description: mintToFarm() contains redundant code. The internal mint function already requires that it is not minting to the 0 address.
require(_farm != address(0), "!_address");
Recommendation: This line should be removed for additional gas savings on each call.
Resolution: The team has removed this line.

Finding #4 - Token - Informational

Description: Contract was deployed using Solidity v0.8.6 which is protected against overflow/underflow errors.
Recommendation: The SafeMath library can be removed for additional gas savings.

Finding #5 - Token - Informational (Resolved)

Description: Several functions are declared public, but are never called internally.
TokenVesting.release(), Token.initialize()
Recommendation: These functions should be declared external for additional gas savings on each call.
Resolution: The team has declared these functions external.

Contracts Overview

  • As the contracts are implemented with Solidity v0.8.6, they are safe from any possible overflows/underflows.
Token Contract:
  • At the time of writing this report, there are 4 total token holders. The token allocation is as follows:
    • 33% of the total supply belongs to the Owner.
    • 33% of the total supply belongs to a wallet.
    • 16.6% of the total supply belongs to a Token Vesting contract that will begin distributing to the Owner at 04:45 September 19th, 2022 UTC and will end at 04:45 July 16th, 2023 UTC.
    • 16.6% of the total supply belongs to a Token Vesting contract that will begin distributing to the Owner at 04:45 June 21st, 2022 UTC and will end at 04:45 August 20th, 2022 UTC.
  • Each token represents votes intended to be used in a DAO where one token represents one vote.
  • Users may delegate their votes to another address allowing them to vote on behalf of the user.
  • Once votes are delegated, the user must explicitly delegate back to themselves to regain their votes.
  • Users also have the option to delegate through the use of a signed message, allowing for a gasless delegation for the user.
  • The Owner may add and remove addresses from a blacklist at any time, preventing that address from minting, burning, and transferring tokens.
  • This contract complies with the ERC-20 token standard.
Vesting Contract:
  • This contract is used to facilitate a token vesting structure.
  • The tokens deposited in this contract are all subject to a single vesting schedule, no matter when they were deposited.
  • On construction, the caller names the beneficiary address who will receive the tokens when they are distributed. The caller provides a start time, cliff duration, and vesting duration to determine the end time.
  • Once the cliff time has elapsed, anybody can release vested tokens proportional to the amount of time elapsed in the vesting period.
  • When released, tokens are sent to the beneficiary.

Audit Results

Vulnerability CategoryNotesResult
Arbitrary Jump/Storage WriteN/APASS
Centralization of ControlThe Owner can add any address to the blacklist at any time.WARNING
Compiler IssuesN/APASS
Delegate Call to Untrusted ContractN/APASS
Dependence on Predictable VariablesN/APASS
Ether/Token TheftN/APASS
Flash LoansN/APASS
Front RunningN/APASS
Improper EventsN/APASS
Improper Authorization SchemeN/APASS
Integer Over/UnderflowN/APASS
Logical IssuesN/APASS
Oracle IssuesN/APASS
Outdated Compiler VersionN/APASS
Race ConditionsN/APASS
Signature IssuesN/APASS
Unbounded LoopsN/APASS
Unused CodeN/APASS
Overall Contract Safety PASS

Inheritance Chart

Smart Contract Audit - Inheritance

Function Graph

Smart Contract Audit - Graph

Functions Overview

 ($) = payable function
 # = non-constant function
 Int = Internal
 Ext = External
 Pub = Public

 +  Initializable 
    - [Prv] isConstructor

 +  Context (Initializable)
    - [Int] __Context_init #
       - modifiers: initializer
    - [Int] __Context_init_unchained #
       - modifiers: initializer
    - [Int] _msgSender
    - [Int] _msgData

 +  Ownable (Initializable, Context)
    - [Int] __Ownable_init #
       - modifiers: initializer
    - [Int] __Ownable_init_unchained #
       - modifiers: initializer
    - [Pub] owner
    - [Pub] renounceOwnership #
       - modifiers: onlyOwner
    - [Pub] transferOwnership #
       - modifiers: onlyOwner

 + [Int] IERC20 
    - [Ext] totalSupply
    - [Ext] balanceOf
    - [Ext] transfer #
    - [Ext] allowance
    - [Ext] approve #
    - [Ext] transferFrom #

 + [Lib] SafeMath 
    - [Int] add
    - [Int] sub
    - [Int] sub
    - [Int] mul
    - [Int] div
    - [Int] div
    - [Int] mod
    - [Int] mod

 +  ERC20 (Initializable, Context, Ownable, IERC20)
    - [Int] __ERC20_init #
       - modifiers: initializer
    - [Int] __ERC20_init_unchained #
       - modifiers: initializer
    - [Pub] name
    - [Pub] symbol
    - [Pub] decimals
    - [Pub] totalSupply
    - [Pub] balanceOf
    - [Pub] transfer #
    - [Pub] allowance
    - [Pub] approve #
    - [Pub] transferFrom #
    - [Pub] increaseAllowance #
    - [Pub] decreaseAllowance #
    - [Int] _transfer #
    - [Int] _mint #
    - [Int] _burn #
    - [Int] _approve #
    - [Int] _setupDecimals #
    - [Ext] _setBot #
       - modifiers: onlyOwner
    - [Int] _beforeTokenTransfer

 + [Lib] SafeERC20 
    - [Int] _safeApprove #
    - [Int] safeApprove #
    - [Int] safeTransfer #
    - [Int] safeTransferFrom #
    - [Int] safeTransferETH #

 +  TokenVesting 
    - [Pub]  #
    - [Pub] release #
    - [Pub] releasableAmount
    - [Pub] vestedAmount

 +  Token (ERC20)
    - [Pub] initialize #
       - modifiers: initializer
    - [Ext] mintToFarm #
       - modifiers: onlyOwner
    - [Ext] delegates
    - [Ext] delegate #
    - [Ext] delegateBySig #
    - [Ext] getCurrentVotes
    - [Ext] getPriorVotes
    - [Int] _delegate #
    - [Int] _moveDelegates #
    - [Int] _writeCheckpoint #
    - [Int] safe32
    - [Int] getChainId

About Solidity Finance

Solidity Finance was founded in 2020 and quickly grew to have one of the most experienced and well-equipped smart contract auditing teams in the industry. Our team has conducted 1000+ solidity smart contract audits covering all major project types and protocols, securing a total of over $50 billion U.S. dollars in on-chain value across 1500 projects!.
Our firm is well-reputed in the community and is trusted as a top smart contract auditing company for the review of solidity code, no matter how complex. Our team of experienced solidity smart contract auditors performs audits for tokens, NFTs, crowdsales, marketplaces, gambling games, financial protocols, and more!

Contact us today to get a free quote for a smart contract audit of your project!

What is a Solidity Audit?

Typically, a smart contract audit is a comprehensive review process designed to discover logical errors, security vulnerabilities, and optimization opportunities within code. A Solidity Audit takes this a step further by verifying economic logic to ensure the stability of smart contracts and highlighting privileged functionality to create a report that is easy to understand for developers and community members alike.

How Do I Interpret the Findings?

Each of our Findings will be labeled with a Severity level. We always recommend the team resolve High, Medium, and Low severity findings prior to deploying the code to the mainnet. Here is a breakdown on what each Severity level means for the project:

  • High severity indicates that the issue puts a large number of users' funds at risk and has a high probability of exploitation, or the smart contract contains serious logical issues which can prevent the code from operating as intended.
  • Medium severity issues are those which place at least some users' funds at risk and has a medium to high probability of exploitation.
  • Low severity issues have a relatively minor risk association; these issues have a low probability of occurring or may have a minimal impact.
  • Informational issues pose no immediate risk, but inform the project team of opportunities for gas optimizations and following smart contract security best practices.