⬅️ Contracts

UniswapPCVDeposit

implementation for Uniswap LP PCV Deposit

Author: Fei Protocol

Mainnet implementations

Name Address
dpiUniswapPCVDeposit 0x902199755219A9f8209862d09F1891cfb34F59a3
uniswapPCVDeposit 0x15958381E9E6dc98bD49655e36f524D2203a28bD

Core, Fei, ChainlinkOracleWrapper

Events

BackupOracleUpdate

event BackupOracleUpdate(address,address)
Params
Param Type Notes
oldBackupOracle address indexed
newBackupOracle address indexed

ContractAdminRoleUpdate

event ContractAdminRoleUpdate(bytes32,bytes32)
Params
Param Type Notes
oldContractAdminRole bytes32 indexed
newContractAdminRole bytes32 indexed

CoreUpdate

event CoreUpdate(address,address)
Params
Param Type Notes
oldCore address indexed
newCore address indexed

DecimalsNormalizerUpdate

event DecimalsNormalizerUpdate(int256,int256)
Params
Param Type Notes
oldDecimalsNormalizer int256
newDecimalsNormalizer int256

Deposit

event Deposit(address,uint256)
Params
Param Type Notes
_from address indexed
_amount uint256

InvertUpdate

event InvertUpdate(bool,bool)
Params
Param Type Notes
oldDoInvert bool
newDoInvert bool

MaxBasisPointsFromPegLPUpdate

event MaxBasisPointsFromPegLPUpdate(uint256,uint256)
Params
Param Type Notes
oldMaxBasisPointsFromPegLP uint256
newMaxBasisPointsFromPegLP uint256

OracleUpdate

event OracleUpdate(address,address)
Params
Param Type Notes
oldOracle address indexed
newOracle address indexed

PairUpdate

event PairUpdate(address,address)
Params
Param Type Notes
oldPair address indexed
newPair address indexed

Paused

event Paused(address)
Params
Param Type Notes
account address

Unpaused

event Unpaused(address)
Params
Param Type Notes
account address

WithdrawERC20

event WithdrawERC20(address,address,address,uint256)
Params
Param Type Notes
_caller address indexed
_token address indexed
_to address indexed
_amount uint256

WithdrawETH

event WithdrawETH(address,address,uint256)
Params
Param Type Notes
_caller address indexed
_to address indexed
_amount uint256

Withdrawal

event Withdrawal(address,address,uint256)
Params
Param Type Notes
_caller address indexed
_to address indexed
_amount uint256

Methods

CONTRACT_ADMIN_ROLE

function CONTRACT_ADMIN_ROLE() view returns(bytes32)

a role used with a subset of governor permissions for this contract only

Returns
Param Type Notes
bytes32

backupOracle

function backupOracle() view returns(address)

the backup oracle reference by the contract

Returns
Param Type Notes
address

balance

function balance() view returns(uint256)

returns total balance of PCV in the Deposit excluding the FEI

Returns
Param Type Notes
uint256

balanceReportedIn

function balanceReportedIn() view returns(address)

display the related token of the balance reported

Returns
Param Type Notes
address

core

function core() view returns(address)

address of the Core contract referenced

Returns
Param Type Notes
address ICore implementation address

decimalsNormalizer

function decimalsNormalizer() view returns(int256)

number of decimals to scale oracle price by, i.e. multiplying by 10^(decimalsNormalizer)

Returns
Param Type Notes
int256

deposit

function deposit() nonpayable

deposit tokens into the PCV allocation

doInvert

function doInvert() view returns(bool)
Returns
Param Type Notes
bool

fei

function fei() view returns(address)

address of the Fei contract referenced by Core

Returns
Param Type Notes
address IFei implementation address

feiBalance

function feiBalance() view returns(uint256)

fei balance of contract

Returns
Param Type Notes
uint256 fei amount held

getReserves

function getReserves() view returns(uint256,uint256)

pair reserves with fei listed first

Returns
Param Type Notes
feiReserves uint256
tokenReserves uint256

invert

function invert((uint256)) pure returns(tuple)

invert a peg price

the inverted peg would be X per FEI

Params
Param Type Notes
price tuple the peg price to invert
Returns
Param Type Notes
tuple the inverted peg as a Decimal

isContractAdmin

function isContractAdmin(address) view returns(bool)

returns whether a given address has the admin role for this contract

Params
Param Type Notes
_admin address
Returns
Param Type Notes
bool

liquidityOwned

function liquidityOwned() view returns(uint256)

amount of pair liquidity owned by this contract

Returns
Param Type Notes
uint256 amount of LP tokens

maxBasisPointsFromPegLP

function maxBasisPointsFromPegLP() view returns(uint256)

a slippage protection parameter, deposits revert when spot price is > this % from oracle

Returns
Param Type Notes
uint256

oracle

function oracle() view returns(address)

the oracle reference by the contract

Returns
Param Type Notes
address

pair

function pair() view returns(address)

the referenced Uniswap pair contract

Returns
Param Type Notes
address

pause

function pause() nonpayable

set pausable methods to paused

paused

function paused() view returns(bool)

Returns true if the contract is paused, and false otherwise.

Returns
Param Type Notes
bool

readOracle

function readOracle() view returns(tuple)

the peg price of the referenced oracle

the peg is defined as FEI per X with X being ETH, dollars, etc

Returns
Param Type Notes
tuple the peg as a Decimal

resistantBalanceAndFei

function resistantBalanceAndFei() view returns(uint256,uint256)

get the manipulation resistant Other(example ETH) and FEI in the Uniswap pool

Returns
Param Type Notes
uint256 number of other token in pool
uint256 number of FEI in pool Derivation rETH, rFEI = resistant (ideal) ETH and FEI reserves, P = price of ETH in FEI: 1. rETH * rFEI = k 2. rETH = k / rFEI 3. rETH = (k * rETH) / (rFEI * rETH) 4. rETH ^ 2 = k / P 5. rETH = sqrt(k / P) and rFEI = k / rETH by 1. Finally scale the resistant reserves by the ratio owned by the contract

router

function router() view returns(address)

the Uniswap router contract

Returns
Param Type Notes
address

setBackupOracle

function setBackupOracle(address) nonpayable

sets the referenced backup oracle

Params
Param Type Notes
newBackupOracle address the new backup oracle to reference

setContractAdminRole

function setContractAdminRole(bytes32) nonpayable

sets a new admin role for this contract

Params
Param Type Notes
newContractAdminRole bytes32

setCore

function setCore(address) nonpayable

set new Core reference address

Params
Param Type Notes
newCore address the new core address

setDecimalsNormalizer

function setDecimalsNormalizer(int256) nonpayable

sets the new decimalsNormalizer

Params
Param Type Notes
newDecimalsNormalizer int256 the new decimalsNormalizer

setDoInvert

function setDoInvert(bool) nonpayable

sets the flag for whether to invert or not

Params
Param Type Notes
newDoInvert bool the new flag for whether to invert

setMaxBasisPointsFromPegLP

function setMaxBasisPointsFromPegLP(uint256) nonpayable

sets the new slippage parameter for depositing liquidity

Params
Param Type Notes
_maxBasisPointsFromPegLP uint256 the new distance in basis points (1/10000) from peg beyond which a liquidity provision will fail

setOracle

function setOracle(address) nonpayable

sets the referenced oracle

Params
Param Type Notes
newOracle address the new oracle to reference

setPair

function setPair(address) nonpayable

set the new pair contract

also approves the router for the new pair token and underlying token

Params
Param Type Notes
_pair address the new pair

token

function token() view returns(address)

the address of the non-fei underlying token

Returns
Param Type Notes
address

tribe

function tribe() view returns(address)

address of the Tribe contract referenced by Core

Returns
Param Type Notes
address IERC20 implementation address

tribeBalance

function tribeBalance() view returns(uint256)

tribe balance of contract

Returns
Param Type Notes
uint256 tribe amount held

unpause

function unpause() nonpayable

set pausable methods to unpaused

updateOracle

function updateOracle() nonpayable

updates the referenced oracle

withdraw

function withdraw(address,uint256) nonpayable

withdraw tokens from the PCV allocation

has rounding errors on amount to withdraw, can differ from the input "amountUnderlying"

Params
Param Type Notes
to address the address to send PCV to
amountUnderlying uint256 of tokens withdrawn

withdrawERC20

function withdrawERC20(address,address,uint256) nonpayable

withdraw ERC20 from the contract

Params
Param Type Notes
token address address of the ERC20 to send
to address address destination of the ERC20
amount uint256 quantity of ERC20 to send

withdrawETH

function withdrawETH(address,uint256) nonpayable

withdraw ETH from the contract

Params
Param Type Notes
to address address to send ETH
amountOut uint256 amount of ETH to send

⬅️ Contracts