Skip to content

Uno-Re/unore-uno-dao

Repository files navigation

Docs for UNO DAO Contracts

Vote Escrow Contract

Users deposit Uno tokens in this contract and get voting power on the basis of deposit amount and lock period. Uno token depositors in voting escrow can yield reward from VeUnoYielDistributor. Reference: https://github.com/curvefi/curve-dao-contracts/blob/master/contracts/VotingEscrow.vy

veUNO Yield Distributor

The purpose of the contract is to provide inflationary token rewards to our community members for token locks upto 4 years. The rationale behind this implementation is that the insurance premium/fees generated by the protocol is being used to buyback and burn $UNO tokens over time in regular intevals.

  • Import latest version contract from openzepplin
  • Update state, function and its parameters naming convention
  • Remove SafeMath, and update operations according to solidity pragma - - - version > 0.8.0
  • Update implementation of function where emitted_token_address variable is used
  • Use Openzepplin's SafeTransfer library for secure transfer of ERC20
  • Take _user param in notifyRewardAmount function, and update logic accordingly
  • Remove assignment of public state variables to default values
  • Update state, mapping from private to public
  • Implement Owned contract instead of using Openzepplin's Ownable library similar to Ownable2Step
  • Add checker function in Resolver to notifyAmount to yieldDistributor instead of execNotifyReward for Gelato automation

IVeUnoDaoYieldDistributor

Interface to interact with VeUnoDaoYielDistributor, add lastUpdateTime function

Resolver

Its primarily a contract which allows us to allow epoch renewals for our existing veUNO holders providing a consistent state of returns in the form of APY. Even though this APY calculation is not very straightforward due to the decay implementation its a close enough approximation.

For each contracts try to write some basic invariant conditions which needs to be held true: This can include function-level invariants that must hold with respect to the execution of the function (e.g., addition is commutative) or system-level invariants (e.g., the balance of a user cannot be greater than the total supply). We will specify the invariants in English and identify their pre-conditions (e.g., a parameter is within a given bound).

Gnosis Safe Contracts

Used as a multisig, multiple EOA account sign proposal to execute transaction Used in SSIP-SSRP to kill and pause pool, which deprecates functions. Used as timelock address in VeUnoDaoYieldDistributor contract to

  • Recover ERC20 token
  • Set yieldDuration
  • Toggle Greylist
  • Toggle RewardNotifier
  • Set pause
  • Set yield rate
  • Set time lock version of contracts >=0.7.0 <0.9.0;

Reference: doc: https://app.safe.global/welcome Github: https://github.com/safe-global/safe-contracts/tree/main/contracts

Owned contract

Implement Owned contract instead of using Openzepplin's Ownable library similar to Ownable2Step Used for security in contract to check caller is owner, change nominate new owner and accept ownership Used in VeUnoDaoYieldDistributor and Resolver contract

Running a test coverage

solidity-coverage from Hardhat external plugin is included. configuration file is ['.solcover'].solcover.js)

npx hardhat coverage

Contracts in scope (commit: 2332f79670f67530f71dbdad2f54949893c1fb0d)

Type File Logic Contracts Interfaces Lines nLines nSLOC Comment Lines Complex. Score Capabilities
📝 ./access/Owned.sol 1 **** 33 33 26 1 17 ****
📚 ./libraries/TransferHelper.sol 1 **** 28 28 19 5 26 ****
📝 ./SmartWalletChecker.sol 1 **** 13 13 10 1 9
📝 ./apps/VeUnoDaoYieldDistributor.sol 1 **** 344 324 228 46 119 ****
./misc/Helpers.sol **** **** 23 23 16 5 10 🖥
📝 ./Ownership.sol 1 **** 67 63 35 17 21 ****
📝 ./automation/Resolver.sol 1 **** 78 74 61 2 31 🧮
📝📚🔍 Totals 6 0 586 558 395 77 233 🖥💰📤👥🧮🔖Σ

Contracts not in scope for audit (commit: 2332f79670f67530f71dbdad2f54949893c1fb0d)

Type File Logic Contracts Interfaces Lines nLines nSLOC Comment Lines Complex. Score Capabilities
📝 ./VotingEscrow.sol 1 **** 855 813 514 221 211 📤Σ
📝 ./safe/GnosisSafe.sol 1 **** 422 360 201 135 189 🖥💰📤🧮🔖
📝 ./safe/base/ModuleManager.sol 1 **** 133 123 65 47 100 🖥
📝 ./safe/base/Executor.sol 1 **** 27 21 15 5 36 🖥👥
📝🔍 ./safe/base/GuardManager.sol 1 1 50 31 21 8 27 🖥
📝 ./safe/base/FallbackManager.sol 1 **** 53 53 33 14 73 🖥
📝 ./safe/base/OwnerManager.sol 1 **** 149 141 80 49 83 ****
📝 ./safe/GnosisSafeL2.sol 1 **** 86 70 42 23 15 💰
📝 ./safe/common/SecuredTokenTransfer.sol 1 **** 35 31 19 11 42 🖥
📝 ./safe/common/SelfAuthorized.sol 1 **** 16 16 10 4 4 ****
📝 ./safe/common/Singleton.sol 1 **** 11 11 4 6 2 ****
📝 ./safe/common/EtherPaymentFallback.sol 1 **** 13 13 7 4 7 💰
📝 ./safe/common/SignatureDecoder.sol 1 **** 36 28 11 16 39 🖥
📝 ./safe/common/StorageAccessible.sol 1 **** 47 47 22 22 79 🖥👥
📝 ./safe/common/Enum.sol 1 **** 8 8 4 3 1 ****
📚 ./safe/external/GnosisSafeMath.sol 1 **** 54 54 24 22 6 ****
📝 ./governance/GovernanceStrategy.sol 1 **** 93 79 30 41 22 ****
📝 ./governance/Governance.sol 1 **** 495 454 244 109 173 💰🧮🔖
📝 ./governance/ProposalValidator.sol 1 **** 192 155 70 72 42 ****
📝 ./governance/Executor.sol 1 **** 29 29 19 8 7 ****
📝 ./governance/ExecutorWithTimelock.sol 1 **** 283 245 107 83 86 💰👥🧮
📝📚🔍 Totals 21 1 3088 2782 1542 903 1244 🖥💰📤👥🧮🔖Σ

These are already audited smart contracts and we are keeping it out of scope of current audit.

Aave governance 2

Gnosis Safe

VotingEscrow