IGLOO Staking
Smart Contract Audit Report
Audit Summary
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:
- RegularStaking contract at 0xa6f48439e96aADE7F879ca478bDDD275b4A014fd.
- RegularStaking contract at 0x5bdA5BB2664C9043Cd7bD8Fa0a72a18eD8066428.
- Staking3Months contract at 0xeB11D912Ff592645862F96106d7F2dF6859AE0e5.
- Staking3Months contract at 0xEdc2173D4c1b4225385bA2079F927337ABB90dc0.
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.Recommendation: These functions should be declared external for additional gas savings on each call.RegularStaking.getDeposits, RegularStaking.pause, RegularStaking.unpause, Staking3Months.getDeposits, Staking3Months.pause, Staking3Months.unpause
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.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.function stake(uint256 amount) external whenNotPaused { require(depositEnabled, "Deposits not enabled");
Contracts Overview
RegularStaking Contracts:
- 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.
Staking3Months 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.
- 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 Category | Notes | Result |
---|---|---|
Arbitrary Jump/Storage Write | N/A | PASS |
Centralization of Control | The owner can update the reward address at any time. | WARNING |
Compiler Issues | N/A | PASS |
Delegate Call to Untrusted Contract | N/A | PASS |
Dependence on Predictable Variables | N/A | PASS |
Ether/Token Theft | N/A | PASS |
Flash Loans | N/A | PASS |
Front Running | N/A | PASS |
Improper Events | N/A | PASS |
Improper Authorization Scheme | N/A | PASS |
Integer Over/Underflow | N/A | PASS |
Logical Issues | N/A | PASS |
Oracle Issues | N/A | PASS |
Outdated Compiler Version | N/A | PASS |
Race Conditions | N/A | PASS |
Reentrancy | N/A | PASS |
Signature Issues | N/A | PASS |
Unbounded Loops | N/A | PASS |
Unused Code | PASS | |
Overall Contract Safety | PASS |
RegularStaking Contract
($) = 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
($) = 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 SourceHat
SourceHat (formerly Solidity Finance - founded in 2020) has quickly grown to have one of the most experienced and well-equipped smart contract auditing teams in the industry. Our team has conducted 1700+ 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!
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 SourceHat Audit?
Typically, a smart contract audit is a comprehensive review process designed to discover logical errors, security vulnerabilities, and optimization opportunities within code. A SourceHat 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.