IGLOO Staking

Smart Contract Audit Report

Audit Summary

IGLOO Staking Audit Report IGLOO Staking is building a new platform where users can deposit tokens and earn yield.

For this audit, we reviewed the following contracts on the Avalanche Mainnet:

We previously reviewed the project team's token contract here.

Audit Findings

Please ensure trust in the team prior to investing as they have some control in the ecosystem.
Date: February 28th, 2022.
Updated: March 2nd, 2022 to reflect the mainnet addresses of the contracts.

Finding #1 - Igloo Staking - Informational

Description: Several functions are declared public, but are never called internally.
RegularStaking.getDeposits, RegularStaking.pause, RegularStaking.unpause, Staking3Months.getDeposits, Staking3Months.pause, Staking3Months.unpause
Recommendation: These functions should be declared external for additional gas savings on each call.

Finding #2 - Igloo Staking - Informational

Description: Although the SafeMath library is utilized, the contract is implemented with Solidity v0.8.x which has built-in overflow checks.
Recommendation: SafeMath could be safely removed to reduce contract size and deployment costs.

Finding #3 - Igloo Staking - Informational

Description: The _before() and _after modifiers() are never utilized in the contracts.
Recommendation: These two modifiers above can be removed to reduce contract size and deployment costs.

Finding #4 - Igloo Staking - Informational

Description: The whenNotPaused() modifier and depositEnabled require statement are both utilized in the stake() function but enforce the same logic.
function stake(uint256 amount) external whenNotPaused {
	require(depositEnabled, "Deposits not enabled");
Recommendation: The Pausable contract, pause() and unpause() functions, and whenNotPaused() modifier can be removed to reduce contract size, deployment costs, and for additional gas savings on each stake() function call.

Contracts Overview

  • As the contracts are implemented with Solidity v0.8.x, they are safe from any possible overflows/underflows.
  • The team must exercise caution when assigning the staking token to avoid using a fee-on-transfer or an ERC-777 compliant token.
RegularStaking Contracts:
  • The first RegularStaking contract allows any user to stake USDT in order to earn rewards over time.
  • The second RegularStaking contract allows any user to stake USDC in order to earn rewards over time.
  • Upon deployment, the owner will specify the reward address that is used to fund rewards.
  • Users must grant the reward address an allowance for the number of tokens they are attempting to deposit in order for a deposit to be successful.
  • The number of tokens being deposited and the time that they were deposited is recorded on all deposits.
  • If a user has deposited tokens multiple different times, they must enter in the sequential number of which deposit instance they would like to withdraw from when withdrawing tokens.
  • During withdraws, the amount of rewards a user will receive is based on how many days have passed since depositing their tokens and the amount of tokens deposited. After having staked tokens for 1 year, a user will receive about ~9.5% of their deposited tokens (~0.026% per day) in rewards.
  • The reward address must grant the staking contract a sufficient enough allowance in order for rewards to be transferred to users on withdraws.
  • The reward address must hold a sufficient enough balance in order to fund rewards for users.
  • There is no fee associated with depositing or withdrawing tokens.
  • The owner can update the reward token address to any address at any time.
  • The owner can enable/disable any user's ability to stake tokens at any time.
Staking3Months Contracts:
  • The first Staking3Months contract allows any user to stake USDT in order to earn rewards over time.
  • The second RegularStaking contract allows any user to stake USDC in order to earn rewards over time.
  • Upon deployment, the owner will specify the reward address that is used to fund rewards.
  • Users must grant the reward address an allowance for the number of tokens they are attempting to deposit in order for a deposit to be successful.
  • The number of tokens being deposited and the time that they were deposited is recorded on all deposits.
  • If a user has deposited tokens multiple different times, they must enter in the sequential number of which deposit instance they would like to withdraw from when withdrawing tokens.
  • The deposit time of 90 days must have passed before a user can withdraw tokens and collect rewards.
  • During withdraws, the number of reward tokens a user will receive is based on how many days have passed since depositing their tokens and the number of tokens deposited. After having staked tokens for 1 year, a user will receive about ~14% of their deposited tokens (~0.038% per day) in rewards.
  • The reward token contract must grant the staking contract a sufficient enough allowance in order for rewards to be transferred to users on withdraws.
  • The reward address must hold a sufficient enough balance in order to fund rewards for users.
  • There is no fee associated with depositing or withdrawing tokens.
  • The owner can update the reward token address to any address at any time.
  • The owner can enable/disable any user's ability to stake tokens at any time.

Audit Results

Vulnerability CategoryNotesResult
Arbitrary Jump/Storage WriteN/APASS
Centralization of ControlThe owner can update the reward address 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
ReentrancyN/APASS
Signature IssuesN/APASS
Unbounded LoopsN/APASS
Unused Code
  • The _before() and _after() modifiers are unused.
  • The whenNotPaused() modifier is redundant causing the Pausable contract to be deemed unnecessary.
  • PASS
    Overall Contract Safety PASS

    RegularStaking Contract

    Smart Contract Audit - Inheritance

    Smart Contract Audit - Graph

    
     ($) = payable function
     # = non-constant function
     
     Int = Internal
     Ext = External
     Pub = Public
     
     +  Context 
        - [Int] _msgSender
        - [Int] _msgData
    
     + [Int] IERC20 
        - [Ext] totalSupply
        - [Ext] balanceOf
        - [Ext] transfer #
        - [Ext] allowance
        - [Ext] approve #
        - [Ext] transferFrom #
    
     + [Lib] Address 
        - [Int] isContract
        - [Int] sendValue #
        - [Int] functionCall #
        - [Int] functionCall #
        - [Int] functionCallWithValue #
        - [Int] functionCallWithValue #
        - [Int] functionStaticCall
        - [Int] functionStaticCall
        - [Int] functionDelegateCall #
        - [Int] functionDelegateCall #
        - [Int] verifyCallResult
    
     + [Lib] SafeERC20 
        - [Int] safeTransfer #
        - [Int] safeTransferFrom #
        - [Int] safeApprove #
        - [Int] safeIncreaseAllowance #
        - [Int] safeDecreaseAllowance #
        - [Prv] _callOptionalReturn #
    
     +  Ownable (Context)
        - [Pub]  #
        - [Pub] owner
        - [Pub] renounceOwnership #
           - modifiers: onlyOwner
        - [Pub] transferOwnership #
           - modifiers: onlyOwner
        - [Int] _transferOwnership #
    
     +  Pausable (Context)
        - [Pub]  #
        - [Pub] paused
        - [Int] _pause #
           - modifiers: whenNotPaused
        - [Int] _unpause #
           - modifiers: whenPaused
    
     + [Lib] SafeMath 
        - [Int] tryAdd
        - [Int] trySub
        - [Int] tryMul
        - [Int] tryDiv
        - [Int] tryMod
        - [Int] add
        - [Int] sub
        - [Int] mul
        - [Int] div
        - [Int] mod
        - [Int] sub
        - [Int] div
        - [Int] mod
    
     +  RegularStaking (Ownable, Pausable)
        - [Pub]  #
        - [Pub] getDeposits
        - [Ext] withdraw #
        - [Prv] _compound
        - [Prv] _withdrawAfterClose #
        - [Ext] getAllowance
        - [Ext] stake #
           - modifiers: whenNotPaused
        - [Ext] toggleDeposit #
           - modifiers: onlyOwner
        - [Ext] changeRewardAddress #
           - modifiers: onlyOwner
        - [Pub] pause #
           - modifiers: onlyOwner
        - [Pub] unpause #
           - modifiers: onlyOwner

    Staking3Months Contract

    Smart Contract Audit - Inheritance

    Smart Contract Audit - Graph

    
     ($) = payable function
     # = non-constant function
     
     Int = Internal
     Ext = External
     Pub = Public
     
     +  Context 
        - [Int] _msgSender
        - [Int] _msgData
    
     + [Int] IERC20 
        - [Ext] totalSupply
        - [Ext] balanceOf
        - [Ext] transfer #
        - [Ext] allowance
        - [Ext] approve #
        - [Ext] transferFrom #
    
     + [Lib] Address 
        - [Int] isContract
        - [Int] sendValue #
        - [Int] functionCall #
        - [Int] functionCall #
        - [Int] functionCallWithValue #
        - [Int] functionCallWithValue #
        - [Int] functionStaticCall
        - [Int] functionStaticCall
        - [Int] functionDelegateCall #
        - [Int] functionDelegateCall #
        - [Int] verifyCallResult
    
     + [Lib] SafeERC20 
        - [Int] safeTransfer #
        - [Int] safeTransferFrom #
        - [Int] safeApprove #
        - [Int] safeIncreaseAllowance #
        - [Int] safeDecreaseAllowance #
        - [Prv] _callOptionalReturn #
    
     +  Ownable (Context)
        - [Pub]  #
        - [Pub] owner
        - [Pub] renounceOwnership #
           - modifiers: onlyOwner
        - [Pub] transferOwnership #
           - modifiers: onlyOwner
        - [Int] _transferOwnership #
    
     +  Pausable (Context)
        - [Pub]  #
        - [Pub] paused
        - [Int] _pause #
           - modifiers: whenNotPaused
        - [Int] _unpause #
           - modifiers: whenPaused
    
     + [Lib] SafeMath 
        - [Int] tryAdd
        - [Int] trySub
        - [Int] tryMul
        - [Int] tryDiv
        - [Int] tryMod
        - [Int] add
        - [Int] sub
        - [Int] mul
        - [Int] div
        - [Int] mod
        - [Int] sub
        - [Int] div
        - [Int] mod
    
     +  Staking3Months (Ownable, Pausable)
        - [Pub]  #
        - [Pub] getDeposits
        - [Ext] withdraw #
        - [Prv] _compound
        - [Prv] _withdrawAfterClose #
        - [Ext] stake #
           - modifiers: whenNotPaused
        - [Ext] toggleDeposit #
           - modifiers: onlyOwner
        - [Ext] changeRewardAddress #
           - modifiers: onlyOwner
        - [Pub] pause #
           - modifiers: onlyOwner
        - [Pub] unpause #
           - modifiers: onlyOwner

    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 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 occuring 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.