Power Index Contracts Overview

General high-level description of Power Index smart contracts

Power Index was initially forked from the Balancer pool and uses its codebase.

The main PowerIndex pool contract is PowerIndexPool.sol, which is inherited from BPool.sol, BToken.sol, BMath.sol, BNum.sol, BConst.sol.

The contract performs the following functions:

  • store underlying token weights and dynamically change them (can call only PowerIndexPoolController.sol );

  • store underlying token balances;

  • add or remove underlying tokens (can call only PowerIndexPoolController.sol );

  • add or remove liquidity with ERC20 pool share token mint/burn ;

  • swap underlying tokens;

  • call PoolRestrictions.sol for additional checks;

  • call external contracts (key functionality that implements meta-governance, can call only PowerIndexPoolController.sol).

More details soon will be provided in PowerIndexPool.sol specification on Github.

The contract has been audited and deployed on the Ethereum Main Network.

PoolRestrictions.sol contract is designed to set additional restrictions for the pool:

  • the maximum value of the Total Supply of the ERC20 pool share tokens;

  • a list of contract addresses and signatures that other contracts can call from the pool;

  • a list of contract addresses, which can call external contracts from the pool via callVoting().

The contract can be replaced with a new one in order to update its logic.

More details soon will be provided in PoolRestrictions.sol specification on Github.

The contract has been audited and deployed on the Ethereum Main Network.

PowerIndexPoolController.sol is a contract that manages the pool. It's inherited from PowerIndexWrappedController.sol and PowerIndexAbstractController.sol.

The contract performs the following functions:

  • change dynamic weights for underlying tokens via setDynamicWeightList();

  • add new underlying tokens via bind();

  • remove underlying token with minimum weight via unbindNotActualToken();

  • replace underlying token with new one via replaceTokenWithNew()and replaceTokenWithNewFromNow();

  • replace underlying token with wrapped version via replacePoolTokenWithNewPiToken(), replacePoolTokenWithExistingPiToken();

  • call external contracts from the pool via callPool() and callVotingByPool();

  • set pool swap fee;

  • set pool community fee for swap, join and exit;

  • change PoolRestrictions.sol address;

  • change PowerIndexPoolController.sol address;

  • set PowerIndexWrapper address for the pool and enable/disable "wrapper mode".

The contract can be replaced with a new one in order to update its logic.

More details soon will be provided in PowerIndexPoolController.sol specification on Github.

The contract is under audit. At the moment, the team's multisig performs the function of the PowerIndexPoolController.sol.

WrappedPiErc20.solis an ERC20 wrapper contract for staking underlying tokens from the pool to the corresponding protocol (e.g., YFI, AAVE, Sushi, etc.). If the corresponding protocol locks its governance tokens for voting / receiving rewards in a separate contract (e.g., in Sushi Swap, one should stake Sushi to Sushi Bar contract to receive protocol rewards), PowerIndexPool.sol uses a wrapped token (e.g., piSushi) instead Sushi token. In this case, WrappedPiErc20.sol automatically stakes part of an underlying token(Sushi) into the corresponding protocol contract.

There is only one WrappedPiErc20.solfor each underlying token for all pools.

More details in specification: Underlying Protocols Integrations with Staking.

Contract is under audit. We haven't deployed it yet.

PowerIndexRouter is a contract that contains the logic of interaction with a specific protocol (voting, staking, withdrawal of awards, etc.). We are developing a PowerIndexRouter for each of the underlying tokens in the pool. Currently we have implementations for YFI(YearnPowerIndexRouter.sol) and AAVE(AavePowerIndexRouter.sol), which are inherited from PowerIndexNaiveRouter.sol and PowerIndexBasicRouter.sol.

More details in specification: Underlying Protocols Integrations with Staking.

Contracts are under audit. We haven't deployed them yet.

PowerIndexWrapper.sol is a wrapper contract for the pool and allows us to extend the standard pool methods (e.g. joinPool(), exitPool(), etc.) with additional logic.

The contract performs the following functions:

  • automatic wrap / unwrap underlying tokens to/from WrappedPiErc20.sol in methods swapExactAmountOut(), swapExactAmountIn(), joinPool(), exitPool(), joinswapExternAmountIn(), joinswapPoolAmountOut(), exitswapPoolAmountIn(), exitswapExternAmountOut().

In near future we will add to the contract the ability to use the CHI token to reduce gas costs.

More details soon will be provided inPowerIndexWrapper.sol specification on Github.

Contract is under audit. We haven't deployed it yet.

VestedLPMining.sol is a liquidity mining reward contract. Liquidity providers (Power Index, Uniswap, Balancer) can deposit LP tokens and receive a reward in CVP and as well as voting rights, based on stake of these tokens. The accrued CVP tokens have a specified vesting period.

More details soon will be provided in VestedLPMining.solspecification on Github.

The contract has been audited and deployed on the Ethereum Main Network.

Erc20PiptSwap.sol is a liquidity provision contract. User can send ETH or ERC20 to the contract, automatically swap them to the underlying pool tokens, and send tokens to the pool.

The contract has not yet passed the security audit but has been deployed and is in use.