Pies (PieVaults)


PieVaults are on the Diamond standard, this standard ensures contracts can grow beyond their restricted size. (extra info)

Call Managers

CallManagers are addresses which are whitelisted to trigger arbitrary calls from the ExperiPie. A whitelisted caller can be added by calling addCaller(_newCaller) on the ExperiPie from the contract owner. ⚠️ This should be used with caution as it allows any token within an ExperiPie to be pulled out ⚠️. Only trusted addresses or smart contracts should be added as callers.

Lending Manager

The lendingManager allows the owner of that instance to withdraw and deposit tokens into lending lending protocols which are whitelisted in the lendingRegistry. The owner of the lendingManager instance can move tokens between whitelisted lending protocols in the lendingRegistry.

For a lending manager to be able to manage a ExperiPie's tokens it needs to be whitelisted as a caller.

The owner of the lending manager instance can lend, unlend and bounce(hopping between protocols).

These functions have the following interface and should be called on the Lending Manager contract.

    @notice Move underlying to a lending protocol
    @param _underlying Address of the underlying token
    @param _amount Amount of underlying to lend
    @param _protocol Bytes32 protocol key to lend to
function lend(address _underlying, uint256 _amount) bytes32 _protocol) public;

    @notice Unlend wrapped token from its lending protocol
    @param _wrapped Address of the wrapped token
    @param _amount Amount of the wrapped token to unlend
function unlend(address _wrapped, uint256 _amount) public;

    @notice Unlend and immediately lend in a different protocol
    @param _wrapped Address of the wrapped token to bounce to another protocol
    @param _amount Amount of the wrapped token to bounce to the other protocol
    @param _toProtocol Protocol to deposit bounced tokens in
function bounce(address _wrapped, uint256 _amount, bytes32 _toProtocol) external;

Lending Registry

The lending registry keeps track of all lending protocols and wrapped tokens. Only tokens and protocols registered in this registry can be used by the LendingManager. Currently supported lending protocols are Compound and Aave.

Contract address: 0xB739Dcf499306B191D9D4fa5255A8f20066a6a96

With the following functions protocols and wrapped tokens can be added:

    @notice Set which protocl a wrapped token belongs to
    @param _wrapped Address of the wrapped token
    @param _protocol Bytes32 key of the protocol
function setWrappedToProtocol(address _wrapped, bytes32 _protocol) external;

    @notice Set what is the underlying for a wrapped token
    @param _wrapped Address of the wrapped token
    @param _underlying Address of the underlying token
function setWrappedToUnderlying(address _wrapped, address _underlying) external;

    @notice Set the logic contract for the protocol
    @param _protocol Bytes32 key of the procol
    @param _logic Address of the lending logic contract for that protocol
function setProtocolToLogic(bytes32 _protocol, address _logic) external;

    @notice Set the wrapped token for the underlying deposited in this protocol
    @param _underlying Address of the unerlying token
    @param _protocol Bytes32 key of the protocol
    @param _wrapped Address of the wrapped token
function setUnderlyingToProtocolWrapped(address _underlying, bytes32 _protocol, address _wrapped) external;

Lending logic contracts



















Lending logic contracts return the calls needed to lend or unlend from a protocol.

Deploying the factory

npx buidler deploy-pie-factory --network mainnet

Deploying a PieVault

  1. Create an allocation file like this one

  2. run npx buidler deploy-pie-from-factory --allocation [PATH_TO_ALLOCATION] --factory [FACTORY_ADDRESS] --network mainnet

  3. Copy the tx hash and search on Etherscan to find the address

  4. Verify the contract: npx buidler verify [PIE_ADDRESS] --constructor-args ./verify/experiPie.js --network mainnet

Last updated