✨ New!✨  C4 Cosmos leagueRead more »

Contest ran October 20October 22

3 day contest

Tally contest

The community owned and operated Web3 wallet.

$30,000 worth of ETH

Total Awards

Tally Contest 🐕

Meet Tally, the community owned and operated Web3 wallet. In this contest, we're looking at Tally Swap, the 0x-based DEX aggregator embedded in the wallet.

Tally Swap

Tally contest details

Useful links ⭐️

🐕 tally.cash🐦 @tallycash🤖 Discord


To build the contracts, run

yarn install
yarn build

Contract overview

Contract Name Lines of Code
Swap.sol 263
Math.sol 20
EmergencyGovernable.sol 64
EmergencyPausable.sol 26
MockZrxExchangeProxy.sol 73
MockToken.sol 9
Total 455


The main contract is Swap.sol, which executes quotes provided off-chain by the 0x API in the Tally wallet, taking swap fees for the DAO. It relies on SafeMath.sol, SafeERC20.sol, and ReentrancyGuard.sol from the OpenZeppelin contracts library.

System overview

The Tally wallet is an EOA wallet that runs as a browser extension. Though Tally isn't a "smart contract wallet", preferring to custody user funds outside smart contracts to save on gas, a number of features in the wallet require paired smart contracts. Tally Swap is one of those features.