Skip to main content

ERC20Allocator

Methods

CONTRACT_ADMIN_ROLE

function CONTRACT_ADMIN_ROLE() external view returns (bytes32)

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

Returns

NameTypeDescription
_0bytes32undefined

MAX_RATE_LIMIT_PER_SECOND

function MAX_RATE_LIMIT_PER_SECOND() external view returns (uint256)

maximum rate limit per second governance can set for this contract

Returns

NameTypeDescription
_0uint256undefined

allPSMs

function allPSMs(address) external view returns (address token, uint248 targetBalance, int8 decimalsNormalizer)

map the psm address to the corresponding target balance information excess tokens past target balance will be pulled from the PSM if PSM has less than the target balance, tokens will be sent to the PSM

Parameters

NameTypeDescription
_0addressundefined

Returns

NameTypeDescription
tokenaddressundefined
targetBalanceuint248undefined
decimalsNormalizerint8undefined

buffer

function buffer() external view returns (uint256)

the amount of action used before hitting limit

replenishes at rateLimitPerSecond per second up to bufferCap

Returns

NameTypeDescription
_0uint256undefined

bufferCap

function bufferCap() external view returns (uint128)

the cap of the buffer that can be used at once

Returns

NameTypeDescription
_0uint128undefined

bufferStored

function bufferStored() external view returns (uint224)

the buffer at the timestamp of lastBufferUsedTime

Returns

NameTypeDescription
_0uint224undefined

checkActionAllowed

function checkActionAllowed(address pcvDeposit) external view returns (bool)

returns whether an action is allowed returns false when paused

Parameters

NameTypeDescription
pcvDepositaddressundefined

Returns

NameTypeDescription
_0boolundefined

checkDripCondition

function checkDripCondition(address pcvDeposit) external view returns (bool)

function that returns whether the amount of tokens held are below the target and funds should flow from PCV Deposit -> PSM returns false when paused

Parameters

NameTypeDescription
pcvDepositaddresspcv deposit whose corresponding peg stability module to check drip condition

Returns

NameTypeDescription
_0boolundefined

checkSkimCondition

function checkSkimCondition(address pcvDeposit) external view returns (bool)

function that returns whether the amount of tokens held are above the target and funds should flow from PSM -> PCV Deposit returns false when paused

Parameters

NameTypeDescription
pcvDepositaddressundefined

Returns

NameTypeDescription
_0boolundefined

connectDeposit

function connectDeposit(address psm, address pcvDeposit) external nonpayable

function to connect deposit to a PSM this then allows the pulling of funds between the deposit and the PSM permissionlessly as defined by the target balance set in allPSM's this function does not check if the pcvDepositToPSM has already been connected as only the governor can call and create, and overwriting with the same data (no op) is fine

Parameters

NameTypeDescription
psmaddresspeg stability module
pcvDepositaddressdeposit to connect to psm

connectPSM

function connectPSM(address psm, uint248 targetBalance, int8 decimalsNormalizer) external nonpayable

connect a new PSM

Parameters

NameTypeDescription
psmaddressPeg Stability Module to add
targetBalanceuint248target amount of tokens for the PSM to hold
decimalsNormalizerint8decimal normalizer to ensure buffer is depleted and replenished properly

core

function core() external view returns (contract ICore)

address of the Core contract referenced

Returns

NameTypeDescription
_0contract ICoreICore implementation address

deleteDeposit

function deleteDeposit(address pcvDeposit) external nonpayable

delete an existing deposit

Parameters

NameTypeDescription
pcvDepositaddressPCV Deposit to remove connection to PSM

disconnectPSM

function disconnectPSM(address psm) external nonpayable

disconnect an existing deposit from the allocator

Parameters

NameTypeDescription
psmaddressPeg Stability Module to remove from allocation

doAction

function doAction(address pcvDeposit) external nonpayable

does an action if any are available

Parameters

NameTypeDescription
pcvDepositaddresswhose corresponding peg stability module action will be run on

drip

function drip(address pcvDeposit) external nonpayable

push ERC20 tokens to PSM by pulling from a PCV deposit flow of funds: PCV Deposit -> PSM

Parameters

NameTypeDescription
pcvDepositaddressto pull funds from and send to corresponding PSM

editPSMTargetBalance

function editPSMTargetBalance(address psm, uint248 targetBalance) external nonpayable

edit an existing PSM

Parameters

NameTypeDescription
psmaddressPeg Stability Module for this deposit
targetBalanceuint248target amount of tokens for the PSM to hold cannot manually change the underlying token, as this is pulled from the PSM underlying token is immutable in both pcv deposit and

getAdjustedAmount

function getAdjustedAmount(uint256 amountToDrip, int8 decimalsNormalizer) external pure returns (uint256 adjustedAmountToDrip)

function to get the adjusted amount out

Parameters

NameTypeDescription
amountToDripuint256the amount to adjust
decimalsNormalizerint8the amount of decimals to adjust amount by

Returns

NameTypeDescription
adjustedAmountToDripuint256undefined

getDripDetails

function getDripDetails(address psm, contract PCVDeposit pcvDeposit) external view returns (uint256 amountToDrip, uint256 adjustedAmountToDrip)

return the amount that can be dripped to a given PSM

Parameters

NameTypeDescription
psmaddresspeg stability module to check drip amount on
pcvDepositcontract PCVDepositpcv deposit to drip from returns amount that can be dripped, adjusted amount to drip and target reverts if not drip eligbile

Returns

NameTypeDescription
amountToDripuint256undefined
adjustedAmountToDripuint256undefined

getSkimDetails

function getSkimDetails(address pcvDeposit) external view returns (uint256 amountToSkim, uint256 adjustedAmountToSkim)

return the amount that can be skimmed off a given PSM

Parameters

NameTypeDescription
pcvDepositaddresspcv deposit whose corresponding psm will have skim amount checked returns amount that can be skimmed, adjusted amount to skim and target to send proceeds reverts if not skim eligbile

Returns

NameTypeDescription
amountToSkimuint256undefined
adjustedAmountToSkimuint256undefined

isContractAdmin

function isContractAdmin(address _admin) external view returns (bool)

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

Parameters

NameTypeDescription
_adminaddressundefined

Returns

NameTypeDescription
_0boolundefined

lastBufferUsedTime

function lastBufferUsedTime() external view returns (uint32)

the last time the buffer was used by the contract

Returns

NameTypeDescription
_0uint32undefined

pause

function pause() external nonpayable

set pausable methods to paused

paused

function paused() external view returns (bool)

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

Returns

NameTypeDescription
_0boolundefined

pcvDepositToPSM

function pcvDepositToPSM(address) external view returns (address)

map the pcv deposit address to a peg stability module

Parameters

NameTypeDescription
_0addressundefined

Returns

NameTypeDescription
_0addressundefined

rateLimitPerSecond

function rateLimitPerSecond() external view returns (uint128)

the rate per second for this contract

Returns

NameTypeDescription
_0uint128undefined

setBufferCap

function setBufferCap(uint128 newBufferCap) external nonpayable

set the buffer cap

Parameters

NameTypeDescription
newBufferCapuint128undefined

setContractAdminRole

function setContractAdminRole(bytes32 newContractAdminRole) external nonpayable

sets a new admin role for this contract

Parameters

NameTypeDescription
newContractAdminRolebytes32undefined

setRateLimitPerSecond

function setRateLimitPerSecond(uint128 newRateLimitPerSecond) external nonpayable

set the rate limit per second

Parameters

NameTypeDescription
newRateLimitPerSeconduint128undefined

skim

function skim(address pcvDeposit) external nonpayable

pull ERC20 tokens from PSM and send to PCV Deposit if the amount of tokens held in the PSM is above the target balance.

Parameters

NameTypeDescription
pcvDepositaddressdeposit to send excess funds to

sweep

function sweep(address token, address to, uint256 amount) external nonpayable

sweep target token, this shouldn't ever be needed as this contract does not hold tokens

Parameters

NameTypeDescription
tokenaddressto sweep
toaddressrecipient
amountuint256of token to be sent

targetBalance

function targetBalance(address psm) external view returns (uint256)

returns the target balance for a given PSM

Parameters

NameTypeDescription
psmaddressundefined

Returns

NameTypeDescription
_0uint256undefined

unpause

function unpause() external nonpayable

set pausable methods to unpaused

vcon

function vcon() external view returns (contract IERC20)

address of the Tribe contract referenced by Core

Returns

NameTypeDescription
_0contract IERC20IERC20 implementation address

vconBalance

function vconBalance() external view returns (uint256)

vcon balance of contract

Returns

NameTypeDescription
_0uint256vcon amount held

volt

function volt() external view returns (contract IVolt)

address of the Fei contract referenced by Core

Returns

NameTypeDescription
_0contract IVoltIFei implementation address

voltBalance

function voltBalance() external view returns (uint256)

volt balance of contract

Returns

NameTypeDescription
_0uint256volt amount held

Events

BufferCapUpdate

event BufferCapUpdate(uint256 oldBufferCap, uint256 newBufferCap)

event emitted when buffer cap is updated

Parameters

NameTypeDescription
oldBufferCapuint256undefined
newBufferCapuint256undefined

BufferReplenished

event BufferReplenished(uint256 amountReplenished, uint256 bufferRemaining)

event emitted when buffer gets replenished

Parameters

NameTypeDescription
amountReplenisheduint256undefined
bufferRemaininguint256undefined

BufferUsed

event BufferUsed(uint256 amountUsed, uint256 bufferRemaining)

event emitted when buffer gets eaten into

Parameters

NameTypeDescription
amountUseduint256undefined
bufferRemaininguint256undefined

ContractAdminRoleUpdate

event ContractAdminRoleUpdate(bytes32 indexed oldContractAdminRole, bytes32 indexed newContractAdminRole)

Parameters

NameTypeDescription
oldContractAdminRole indexedbytes32undefined
newContractAdminRole indexedbytes32undefined

CoreUpdate

event CoreUpdate(address indexed oldCore, address indexed newCore)

Parameters

NameTypeDescription
oldCore indexedaddressundefined
newCore indexedaddressundefined

DepositConnected

event DepositConnected(address psm, address pcvDeposit)

emitted when a psm is connected to a PCV Deposit

Parameters

NameTypeDescription
psmaddressundefined
pcvDepositaddressundefined

DepositDeleted

event DepositDeleted(address deposit)

emitted when an existing deposit is deleted

Parameters

NameTypeDescription
depositaddressundefined

Dripped

event Dripped(uint256 amount, address target)

event emitted when tokens are sent to the pullTarget from the pushTarget

Parameters

NameTypeDescription
amountuint256undefined
targetaddressundefined

PSMConnected

event PSMConnected(address psm, address token, uint248 targetBalance, int8 decimalsNormalizer)

emitted when a new PSM is connected

Parameters

NameTypeDescription
psmaddressundefined
tokenaddressundefined
targetBalanceuint248undefined
decimalsNormalizerint8undefined

PSMDeleted

event PSMDeleted(address psm)

emitted when a PSM is deleted

Parameters

NameTypeDescription
psmaddressundefined

PSMTargetBalanceUpdated

event PSMTargetBalanceUpdated(address psm, uint248 targetBalance)

emitted when an existing PSM is updated

Parameters

NameTypeDescription
psmaddressundefined
targetBalanceuint248undefined

Paused

event Paused(address account)

Parameters

NameTypeDescription
accountaddressundefined

RateLimitPerSecondUpdate

event RateLimitPerSecondUpdate(uint256 oldRateLimitPerSecond, uint256 newRateLimitPerSecond)

event emitted when rate limit per second is updated

Parameters

NameTypeDescription
oldRateLimitPerSeconduint256undefined
newRateLimitPerSeconduint256undefined

Skimmed

event Skimmed(uint256 amount, address target)

event emitted when tokens are sent to the pushTarget from the pullTarget

Parameters

NameTypeDescription
amountuint256undefined
targetaddressundefined

Unpaused

event Unpaused(address account)

Parameters

NameTypeDescription
accountaddressundefined