KALIDAO is an new lightweight implementation of a multi-sig wallet where signers are determined by NFTs.

For this audit, we reviewed the ClubNFT, ClubLoot, KaliClubSig, and KaliClubSigFactory contracts at commit 7a7c326a5cfcf5076944c4c3fd25018fa5672c9e on the team’s GitHub repository.

AUDIT FINDINGS

Please ensure trust in the team prior to investing.
Date: April 5th, 2022.
Updated: May 18th, 2022 to address changes from commit 24db237a4655f7cbd973cb565ac639cfadfeac73 to commit 5923a2ccd98016c288bd1e174139049bc23d531e.
Updated: May 23rd, 2022 to address changes from commit 5923a2ccd98016c288bd1e174139049bc23d531e to commit 7a7c326a5cfcf5076944c4c3fd25018fa5672c9e.

Finding #1 – ClubSig – Informational (Acknowledged)

Description: The execute() function runs until a quorum or invalid signature is reached.
Risk/Impact: This will lead to excess gas costs in specific situations.
Recommendation: The team should consider having the function initially revert if sufficient signatures are not provided.
Resolution: The team has acknowledged this behavior and chosen to not implement the recommendation.


Finding #2 – ClubSig – Informational (Resolved)

Description: The init() and govern() functions allow the quorum to be 0.
Risk/Impact: The execute() function will execute any arbitrary logic if the quorum is 0.
Recommendation: The team should consider preventing a quorum of 0.
Resolution: The team has implemented a check to prevent a quorum of 0. 

CONTRACTS OVERVIEW

  • The contracts are implemented in a highly gas efficient manner leveraging assembly and unchecked math where applicable.

KaliClubSig Contract:

  • This contract serves as an NFT based multi-sig wallet for EIP-712 and EIP-1271 signed transactions.
  • When the contract is initialized, a specified number of addresses that serve as valid signers are minted an NFT; the signers must be passed in ascending order by address or the initialization will fail.
  • A separate ClubLoot contract is used to track users’ “loot” balance.
  • A non-zero quorum amount, base URI, and “redemption start” time are also specified.
  • The contract may optionally be initialized as paused, disabling NFT transfers.
  • NFT metadata that contains information about the NFTs is stored using an off-chain URI endpoint.
  • For non-Governors to execute a transaction, a quorum of signers must provide a signed message of the proposed transaction; each signer must own an NFT to be a valid signer.
  • If the signer is a contract, the contract must return whether the signature is valid in accordance with EIP-1271.
  • The signatures must be provided in ascending order by signer address or the transaction will fail.
  • If a quorum is reached, the transaction is executed by the contract; the transaction may also optionally be executed as a delegated call.
  • Once the redemption period has passed, users may perform a “rage quit”. A rage quit will burn a user’s loot by the specified amount and provide the user with a proportional amount of all of the provided assets; the assets must be provided in ascending order by address or the transaction will fail.
  • Any Governor address may execute a transaction without requiring a quorum.
  • Any Governor or the contract itself may add or remove an address as a Governor at any time.
  • Any Governor or the contract itself may mint or burn NFTs from any address at any time; the quorum may also be updated to a non-zero value.
  • Any Governor or the contract itself may mint loot to and burn loot from any address at any time; the contract must be given the ability to mint in the ClubLoot contract or this will fail.
  • Any Governor or the contract itself may pause and unpause the contract and the ClubLoot contract at any time.
  • Any Governor or the contract itself may update the base URI and document data at any time.
  • Any Governor or the contract itself may update the redemption start at any time.

ClubLoot Contract:

  • This contract is used to track users’ loot balance in the form of a minimal implementation of an ERC20 token.
  • When the contract is initialized, a list of Club members and loot amounts are specified where each member is subsequently minted the specified amount of loot.
  • A Governor address is specified upon deployment. The contract may also optionally be paused upon deployment.
  • Any user may burn their tokens to reduce the total supply.
  • Any user may burn tokens on another user’s behalf if an allowance has been granted.
  • Each loot additionally represents votes intended to be used in a DAO where one loot 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 have the option to “permit” through the use of a signed message, allowing for a gasless approval by the user.
  • Any Governor address may mint loot to and burn loot from any address at any time.
  • Any Governor address may toggle any address as a Governor at any time.
  • Any Governor address may pause the contract, disabling transfers, at any time.

ClubSigFactory Contract:

  • Any user may use this contract to deploy clones of a master copy of the KaliClubSig and ClubLoot contracts.
  • A name, symbol, quorum, redemption start time, list of valid signers, and whether the contract is initially paused must be provided when cloning the contract.
  • The provided parameters will be used to initialize the cloned contracts.
  • If a list of “calls” are provided the KaliClubSig contract will execute the calls upon deployment.
Vulnerability Category Notes Result
Arbitrary Jump/Storage Write N/A PASS
Centralization of Control N/A PASS
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 N/A PASS
Overall Contract Safety   PASS

FUNCTION GRAPH

INHERITENCE CHART

FUNCTIONS OVERVIEW

($) = payable function
 # = non-constant function
 
 Int = Internal
 Ext = External
 Pub = Public
 
 + [Int] ERC721TokenReceiver 
    - [Ext] onERC721Received #

 +  ClubNFT 
    - [Pub] name
    - [Pub] symbol
    - [Prv] _getArgUint256
    - [Ext] supportsInterface
    - [Ext] approve ($)
    - [Ext] setApprovalForAll ($)
    - [Pub] transferFrom ($)
       - modifiers: notPaused
    - [Ext] safeTransferFrom ($)
    - [Ext] safeTransferFrom ($)
    - [Int] _safeMint #
    - [Int] _burn #
    - [Int] _setPause #

 +  Multicall 
    - [Ext] multicall ($)

 +  NFTreceiver 
    - [Ext] onERC721Received
    - [Ext] onERC1155Received
    - [Ext] onERC1155BatchReceived

 + [Int] IClub 

 + [Int] IClubLoot 
    - [Ext] balanceOf
    - [Ext] totalSupply
    - [Ext] mint #
    - [Ext] govBurn #
    - [Ext] setPause #

 + [Int] IERC1271 
    - [Ext] isValidSignature

 + [Lib] FixedPointMathLib 
    - [Int] mulDivDown

 + [Lib] SafeTransferLib 
    - [Int] _safeTransferETH #
    - [Int] _safeTransfer #

 + [Lib] ClubURIbuilder 
    - [Int] _buildTokenURI
    - [Prv] _addressToString
    - [Prv] _char
    - [Prv] _uintToString
    - [Prv] _encode

 +  KaliClubSig (ClubNFT, Multicall, IClub)
    - [Pub] DOMAIN_SEPARATOR
    - [Prv] _computeDomainSeparator
    - [Pub] loot
    - [Ext] tokenURI
    - [Ext] init ($)
    - [Pub] getDigest
    - [Ext] execute ($)
    - [Ext] govern ($)
       - modifiers: onlyClubOrGov
    - [Ext] setGovernor ($)
       - modifiers: onlyClubOrGov
    - [Ext] setRedemptionStart ($)
       - modifiers: onlyClubOrGov
    - [Ext] setLootPause ($)
       - modifiers: onlyClubOrGov
    - [Ext] setSignerPause ($)
       - modifiers: onlyClubOrGov
    - [Ext] updateDocs ($)
       - modifiers: onlyClubOrGov
    - [Ext] updateURI ($)
       - modifiers: onlyClubOrGov
    - [Ext] Fallback ($)
    - [Ext] ragequit ($)

FUNCTION GRAPH

INHERITENCE CHART

FUNCTIONS OVERVIEW

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

 +  ClubLoot (IClub)
    - [Pub] name
    - [Ext] symbol
    - [Prv] _getArgUint256
    - [Pub] DOMAIN_SEPARATOR
    - [Prv] _computeDomainSeparator
    - [Ext] init ($)
    - [Ext] approve ($)
    - [Ext] transfer ($)
       - modifiers: notPaused
    - [Ext] transferFrom ($)
       - modifiers: notPaused
    - [Ext] permit ($)
    - [Prv] _burn #
    - [Ext] burn ($)
    - [Ext] burnFrom ($)
    - [Pub] delegates
    - [Ext] getCurrentVotes
    - [Ext] delegate ($)
    - [Ext] getPriorVotes
    - [Prv] _delegate #
    - [Prv] _moveDelegates #
    - [Prv] _writeCheckpoint #
    - [Prv] _safeCastTo64
    - [Prv] _safeCastTo192
    - [Ext] mint ($)
       - modifiers: onlyGov
    - [Ext] govBurn ($)
       - modifiers: onlyGov
    - [Ext] setPause ($)
       - modifiers: onlyGov
    - [Ext] setGov ($)
       - modifiers: onlyGov

FUNCTION GRAPH

INHERITENCE CHART

FUNCTIONS OVERVIEW

 ($) = payable function
 # = non-constant function
 
 Int = Internal
 Ext = External
 Pub = Public
 
  +  Multicall 
    - [Ext] multicall ($)

 + [Int] IClub 

 + [Int] IRicardianLLC 
    - [Ext] mintLLC ($)

 + [Int] ERC721TokenReceiver 
    - [Ext] onERC721Received #

 +  ClubNFT 
    - [Pub] name
    - [Pub] symbol
    - [Prv] _getArgUint256
    - [Ext] supportsInterface
    - [Ext] approve ($)
    - [Ext] setApprovalForAll ($)
    - [Pub] transferFrom ($)
       - modifiers: notPaused
    - [Ext] safeTransferFrom ($)
    - [Ext] safeTransferFrom ($)
    - [Int] _safeMint #
    - [Int] _burn #
    - [Int] _setPause #

 +  NFTreceiver 
    - [Ext] onERC721Received
    - [Ext] onERC1155Received
    - [Ext] onERC1155BatchReceived

 + [Int] IClubLoot 
    - [Ext] balanceOf
    - [Ext] totalSupply
    - [Ext] mint #
    - [Ext] govBurn #
    - [Ext] setPause #

 + [Int] IERC1271 
    - [Ext] isValidSignature

 + [Lib] FixedPointMathLib 
    - [Int] mulDivDown

 + [Lib] SafeTransferLib 
    - [Int] _safeTransferETH #
    - [Int] _safeTransfer #

 + [Lib] ClubURIbuilder 
    - [Int] _buildTokenURI
    - [Prv] _addressToString
    - [Prv] _char
    - [Prv] _uintToString
    - [Prv] _encode

 +  KaliClubSig (ClubNFT, Multicall, IClub)
    - [Pub] DOMAIN_SEPARATOR
    - [Prv] _computeDomainSeparator
    - [Pub] loot
    - [Ext] tokenURI
    - [Ext] init ($)
    - [Pub] getDigest
    - [Ext] execute ($)
    - [Ext] govern ($)
       - modifiers: onlyClubOrGov
    - [Ext] setGovernor ($)
       - modifiers: onlyClubOrGov
    - [Ext] setRedemptionStart ($)
       - modifiers: onlyClubOrGov
    - [Ext] setLootPause ($)
       - modifiers: onlyClubOrGov
    - [Ext] setSignerPause ($)
       - modifiers: onlyClubOrGov
    - [Ext] updateDocs ($)
       - modifiers: onlyClubOrGov
    - [Ext] updateURI ($)
       - modifiers: onlyClubOrGov
    - [Ext] Fallback ($)
    - [Ext] ragequit ($)

 +  ClubLoot (IClub)
    - [Pub] name
    - [Ext] symbol
    - [Prv] _getArgUint256
    - [Pub] DOMAIN_SEPARATOR
    - [Prv] _computeDomainSeparator
    - [Ext] init ($)
    - [Ext] approve ($)
    - [Ext] transfer ($)
       - modifiers: notPaused
    - [Ext] transferFrom ($)
       - modifiers: notPaused
    - [Ext] permit ($)
    - [Prv] _burn #
    - [Ext] burn ($)
    - [Ext] burnFrom ($)
    - [Pub] delegates
    - [Ext] getCurrentVotes
    - [Ext] delegate ($)
    - [Ext] getPriorVotes
    - [Prv] _delegate #
    - [Prv] _moveDelegates #
    - [Prv] _writeCheckpoint #
    - [Prv] _safeCastTo64
    - [Prv] _safeCastTo192
    - [Ext] mint ($)
       - modifiers: onlyGov
    - [Ext] govBurn ($)
       - modifiers: onlyGov
    - [Ext] setPause ($)
       - modifiers: onlyGov
    - [Ext] setGov ($)
       - modifiers: onlyGov

 + [Lib] ClonesWithImmutableArgs 
    - [Int] clone #

 +  KaliClubSigFactory (Multicall, IClub)
    - [Pub] Constructor #
    - [Ext] deployClubSig ($)