⬅️ Contracts

TribeReserveStabilizer

implementation for a TRIBE Reserve Stabilizer

Author: Fei Protocol

Mainnet implementations

Name Address
tribeReserveStabilizer 0xE1A468418f4D8D3F070A06d49b3575A9562b6CfD

Core, CompositeOracle, TribeMinter, CollateralizationOracleWrapper, Tribe

Events

BackupOracleUpdate

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

CollateralizationOracleUpdate

event CollateralizationOracleUpdate(address,address)
Params
Param Type Notes
oldCollateralizationOracle address indexed
newCollateralizationOracle address indexed

CollateralizationThresholdUpdate

event CollateralizationThresholdUpdate(uint256,uint256)
Params
Param Type Notes
oldCollateralizationThresholdBasisPoints uint256
newCollateralizationThresholdBasisPoints uint256

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

DurationUpdate

event DurationUpdate(uint256,uint256)
Params
Param Type Notes
oldDuration uint256
newDuration uint256

FeiExchange

event FeiExchange(address,uint256,uint256)
Params
Param Type Notes
to address indexed
feiAmountIn uint256
amountOut uint256

InvertUpdate

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

OracleUpdate

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

Paused

event Paused(address)
Params
Param Type Notes
account address

TimerReset

event TimerReset(uint256)
Params
Param Type Notes
startTime uint256

Unpaused

event Unpaused(address)
Params
Param Type Notes
account address

UsdPerFeiRateUpdate

event UsdPerFeiRateUpdate(uint256,uint256)
Params
Param Type Notes
oldUsdPerFeiBasisPoints uint256
newUsdPerFeiBasisPoints uint256

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 the amount of the held ERC-20

Returns
Param Type Notes
uint256

balanceReportedIn

function balanceReportedIn() view returns(address)

display the related token of the balance reported

Returns
Param Type Notes
address

collateralizationOracle

function collateralizationOracle() view returns(address)

a collateralization oracle

Returns
Param Type Notes
address

collateralizationThreshold

function collateralizationThreshold() view returns(tuple)

the collateralization threshold below which exchanging becomes active

Returns
Param Type Notes
tuple

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

new PCV deposited to the stabilizer

no-op because the token transfer already happened

doInvert

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

duration

function duration() view returns(uint256)

the duration of the timed period

Returns
Param Type Notes
uint256

exchangeFei

function exchangeFei(uint256) nonpayable returns(uint256)

exchange FEI for minted TRIBE

the timer counts down from first time below threshold and opens after window

Params
Param Type Notes
feiAmount uint256
Returns
Param Type Notes
uint256

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

getAmountOut

function getAmountOut(uint256) view returns(uint256)

returns the amount out of tokens from the reserves for a given amount of FEI

Params
Param Type Notes
amountFeiIn uint256 the amount of FEI in
Returns
Param Type Notes
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

isCollateralizationBelowThreshold

function isCollateralizationBelowThreshold() view returns(bool)

check whether collateralization ratio is below the threshold set

returns false if the oracle is invalid

Returns
Param Type Notes
bool

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

isTimeEnded

function isTimeEnded() view returns(bool)

return true if time period has ended

Returns
Param Type Notes
bool

isTimeStarted

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

oracle

function oracle() view returns(address)

the oracle reference by the 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

remainingTime

function remainingTime() view returns(uint256)

number of seconds remaining until time is up

Returns
Param Type Notes
uint256 remaining

resetOracleDelayCountdown

function resetOracleDelayCountdown() nonpayable

reset the opening of the TribeReserveStabilizer oracle delay as soon as above CR target

resistantBalanceAndFei

function resistantBalanceAndFei() view returns(uint256,uint256)

gets the resistant token balance and protocol owned fei of this deposit

Returns
Param Type Notes
uint256
uint256

setBackupOracle

function setBackupOracle(address) nonpayable

sets the referenced backup oracle

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

setCollateralizationOracle

function setCollateralizationOracle(address) nonpayable

set the Collateralization oracle

Params
Param Type Notes
newCollateralizationOracle address

setCollateralizationThreshold

function setCollateralizationThreshold(uint256) nonpayable

set the collateralization threshold below which exchanging becomes active

Params
Param Type Notes
newCollateralizationThresholdBasisPoints uint256

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

setOracle

function setOracle(address) nonpayable

sets the referenced oracle

Params
Param Type Notes
newOracle address the new oracle to reference

setUsdPerFeiRate

function setUsdPerFeiRate(uint256) nonpayable

sets the USD per FEI exchange rate rate

Params
Param Type Notes
newUsdPerFeiBasisPoints uint256 the USD per FEI exchange rate denominated in basis points (1/10000)

startOracleDelayCountdown

function startOracleDelayCountdown() nonpayable

delay the opening of the TribeReserveStabilizer until oracle delay duration is met

startTime

function startTime() view returns(uint256)

the start timestamp of the timed period

Returns
Param Type Notes
uint256

timeSinceStart

function timeSinceStart() view returns(uint256)

number of seconds since contract was initialized

will be less than or equal to duration

Returns
Param Type Notes
uint256 timestamp

token

function token() view returns(address)

the ERC20 token exchanged on this stablizer

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

tribeMinter

function tribeMinter() view returns(address)

the TRIBE minter address

Returns
Param Type Notes
address

unpause

function unpause() nonpayable

set pausable methods to unpaused

updateOracle

function updateOracle() nonpayable

updates the referenced oracle

usdPerFeiBasisPoints

function usdPerFeiBasisPoints() view returns(uint256)

the USD per FEI exchange rate denominated in basis points (1/10000)

Returns
Param Type Notes
uint256

withdraw

function withdraw(address,uint256) pure

reverts. Held TRIBE should only be released by exchangeFei or mint

Params
Param Type Notes
address
uint256

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