ERC20UniswapPCVController
A PCV Controller for reweighting ERC20/RUSD Uniswap prices
A contract for moving reweighting Uniswap prices to the peg from a Uniswap PCV Deposit. ERC20 specific implementation.
Reweights are used to return the Uniswap spot price of an associated PCV Deposit to the peg. The algorithm is as follows:
- 1.withdraw 99% of the ERC20 from the UniswapPCVDeposit
- 2.execute a trade with held ERC20 to bring the spot price back up to peg
- 3.deposit remaining ERC20 balance back into the Uniswap PCV Deposit
- 4.burn excess held RUSD
Only 99% is withdrawn because if there are no other LPs there could be rounding errors against dust
The reweight is open to a keeper when both of the following conditions are met:
- the distance from the peg is at least the minimum (initially 1%)
Governor⚖️and Guardian🛡contracts can force a reweight at any time, or update the minimum distance requirement.
Reweight executions are incentivized with 500 RUSD if the controller is appointed as a Minter💰. Governance can adjust this incentive amount.
- Minter💰
- PCV Controller⚙️
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 RUSD reward for reweighting
type | param | description |
uint256 | _amount | RUSD 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). |
function pcvDeposit() external returns (IPCVDeposit);
Returns the PCV Deposit address this controller focuses on reweighting.
function reweightIncentiveAmount() external returns (uint256);
Returns the amount of RUSD received by any keeper who successfully executes a reweight.
function reweightWithdrawBPs() external returns (uint256);
Returns the amount of PCV withdrawn during a reweight in basis points terms.
function reweightEligible() external view returns (bool);
Returns true when the distance from the peg is at least the minimum (initially 1%) and it is more than 4 hours since last reweight, otherwise false.
function minDistanceForReweight()
external
view
returns (Decimal.D256 memory);
Returns the minimum percent distance from the peg needed for keepers to reweight the peg.
function reweight() external;
Executes a reweight if
reweightEligible.
Rewards the caller with 500 RUSD.
function forceReweight() external;
Forces a reweight execution. No RUSD incentive for doing this. Fails if the Uniswap spot price is already at or above the peg.
function setReweightMinDistance(uint256 basisPoints) external;
Sets the minimum distance from the peg for a reweight to be eligible to
basisPoints
, measured in basis points (i.e. 1/10000).emits
ReweightMinDistanceUpdate
function setReweightWithdrawBPs(uint256 _reweightWithdrawBPs) external;
Sets the percentage of the PCV withdrawn when executing a reweight in terms of basis points
emits
ReweightWithdrawBPsUpdate
function setPCVDeposit(address _pcvDeposit) external;
Sets the target PCV Deposit contract for reweight to
_pcvDeposit
emits
PCVDepositUpdate
function setReweightIncentive(uint256 amount) external;
Sets the keeper incentive for executing a reweight to
amount
of RUSDemits
ReweightIncentiveUpdate
erc20uniswappcvcontroller.json
9KB
Code
erc20UniswapPCVController ABI
iuniswappcvcontroller.json
4KB
Code
UniswapPCVController Interface ABI
Last modified 2yr ago