Fei Protocol
Search…
UniswapPCVController
A PCV Controller for reweighting FEI Uniswap prices

Contract

Description

A contract for moving reweighting Uniswap prices to the peg from a Uniswap PCV Deposit.

Reweight

Reweights are used to return the Uniswap spot price of an associated PCV Deposit to the peg. The algorithm is as follows:
  1. 1.
    withdraw 99% of the ETH from the UniswapPCVDeposit
  2. 2.
    execute a trade with held ETH to bring the spot price back up to peg
  3. 3.
    deposit remaining ETH balance back into the Uniswap PCV Deposit
  4. 4.
    burn excess held FEI
Only 99% is withdrawn because if there are no other LPs there could be rounding errors against dust

Reweight eligibility

The reweight is open to a keeper when both of the following conditions are met:
  • the distance below the peg is at least the minimum (currently 0.5%)
  • The frequency window has passed (currently 4h)
Governor⚖️and Guardian🛡contracts can force a reweight at any time
Governor⚖️ contracts can also update the minimum distance and frequency.

Reweight incentives

Reweight executions are incentivized with 200 FEI if the controller is appointed as a Minter💰. Governance can adjust this incentive amount.
  • Minter💰
  • PCV Controller⚙️

Events

Reweight
PCVDepositUpdate
ReweightIncentiveUpdate
ReweightMinDistanceUpdate
ReweightWithdrawBPsUpdate
A Uniswap Reweight event
type
param
description
address indexed
_caller
the address triggering the reweight
Change the PCV Deposit contract
type
param
description
address indexed
_pcvDeposit
new pcv deposit contract
Change the FEI reward for reweighting
type
param
description
uint256
_amount
FEI reward amount
Change the min distance for a reweight
type
param
description
uint256
_basisPoints
Minimum reweight amount in basis points (i.e. 1/10000)
Change the amount of PCV withdrawn during a reweight
type
param
description
uint256
_reweightWithdrawBPs
amount of PCV withdrawn for a reweight in basis point terms (1/10000).

Read-Only Functions

pcvDeposit

1
function pcvDeposit() external returns (IPCVDeposit);
Copied!
Returns the PCV Deposit address this controller focuses on reweighting.

incentiveContract

1
function incentiveContract() external returns (IUniswapIncentive);
Copied!
Returns the UniswapIncentive contract used to determine reweight eligibility.

reweightIncentiveAmount

1
function reweightIncentiveAmount() external returns (uint256);
Copied!
Returns the amount of FEI received by any keeper who successfully executes a reweight.

reweightWithdrawBPs

1
function reweightWithdrawBPs() external returns (uint256);
Copied!
Returns the amount of PCV withdrawn during a reweight in basis points terms.

reweightEligible

1
function reweightEligible() external view returns (bool);
Copied!
Returns true when the distance from the peg is at least the minimum and the reweight frequency has passed.

minDistanceForReweight

1
function minDistanceForReweight()
2
external
3
view
4
returns (Decimal.D256 memory);
Copied!
Returns the minimum percent distance below the peg needed for keepers to reweight the peg. If the peg is above then the reweight won't occur.

EOA-Only 👤 State-Changing Functions

reweight

1
function reweight() external;
Copied!
Executes a reweight if reweightEligible.
Rewards the caller with 200 FEI.
This method is pausable

Governor- Or Guardian-Only⚖️🛡 State-Changing Functions

forceReweight

1
function forceReweight() external;
Copied!
Forces a reweight execution. No FEI incentive for doing this. Fails if the Uniswap spot price is already at or above the peg.

Governor-Only⚖️ State-Changing Functions

setReweightMinDistance

1
function setReweightMinDistance(uint256 basisPoints) external;
Copied!
Sets the minimum distance below the peg for a reweight to be eligible to basisPoints, measured in basis points (i.e. 1/10000). This distance must be below the peg, above does not trigger a reweight.
emits ReweightMinDistanceUpdate

setReweightWithdrawBPs

1
function setReweightWithdrawBPs(uint256 _reweightWithdrawBPs) external;
Copied!
Sets the percentage of the PCV withdrawn when executing a reweight in terms of basis points
emits ReweightWithdrawBPsUpdate

setPCVDeposit

1
function setPCVDeposit(address _pcvDeposit) external;
Copied!
Sets the target PCV Deposit contract for reweight to _pcvDeposit
emits PCVDepositUpdate

setReweightIncentive

1
function setReweightIncentive(uint256 amount) external;
Copied!
Sets the keeper incentive for executing a reweight to amount of FEI
emits ReweightIncentiveUpdate

ABIs

EthUniswapPCVController.json
7KB
Code
EthUniswapPCVController ABI
IUniswapPCVController.json
3KB
Code
UniswapPCVController Interface ABI
Last modified 5mo ago