StableOracle.sol

View Source: contracts/oracles/StableOracle.solโ€‹

โ†— Extends: IOracle, Ownableโ€‹

StableOracle

Contract Members

Constants & Variables

contract IOracle public oracle;
uint256 public lastPrice;
uint256 public evictPercentage;
bool public manualOverride;
uint256 public manualPrice;

Events

event ChangeOracle(address _oldOracle, address _newOracle);
event ChangeEvictPercentage(uint256 _oldEvictPercentage, uint256 _newEvictPercentage);
event SetManualPrice(uint256 _oldPrice, uint256 _newPrice);
event SetManualOverride(bool _override);

Functions

Creates a new stable oracle based on existing oracle

function (address _oracle, uint256 _evictPercentage) public nonpayable

Arguments

Name

Type

Description

_oracle

address

address of underlying oracle

_evictPercentage

uint256

โ€‹

changeOracle

Updates medianizer address

function changeOracle(address _oracle) public nonpayable onlyOwner

Arguments

Name

Type

Description

_oracle

address

Address of underlying oracle

changeEvictPercentage

Updates eviction percentage

function changeEvictPercentage(uint256 _evictPercentage) public nonpayable onlyOwner

Arguments

Name

Type

Description

_evictPercentage

uint256

Percentage multiplied by 10**16

getCurrencyAddress

โคพ overrides IOracle.getCurrencyAddressโ€‹

Returns address of oracle currency (0x0 for ETH)

function getCurrencyAddress() external view
returns(address)

Arguments

Name

Type

Description

getCurrencySymbol

โคพ overrides IOracle.getCurrencySymbolโ€‹

Returns symbol of oracle currency (0x0 for ETH)

function getCurrencySymbol() external view
returns(bytes32)

Arguments

Name

Type

Description

getCurrencyDenominated

โคพ overrides IOracle.getCurrencyDenominatedโ€‹

Returns denomination of price

function getCurrencyDenominated() external view
returns(bytes32)

Arguments

Name

Type

Description

getPrice

โคพ overrides IOracle.getPriceโ€‹

Returns price - should throw if not valid

function getPrice() external nonpayable
returns(uint256)

Arguments

Name

Type

Description

_change

function _change(uint256 _newPrice, uint256 _oldPrice) internal pure
returns(uint256)

Arguments

Name

Type

Description

_newPrice

uint256

โ€‹

_oldPrice

uint256

โ€‹

setManualPrice

Set a manual price. NA - this will only be used if manualOverride == true

function setManualPrice(uint256 _price) public nonpayable onlyOwner

Arguments

Name

Type

Description

_price

uint256

Price to set

setManualOverride

Determine whether manual price is used or not

function setManualOverride(bool _override) public nonpayable onlyOwner

Arguments

Name

Type

Description

_override

bool

Whether to use the manual override price or not