Maple
Search…
Chainlink Oracle
ChainlinkOracle is a wrapper contract for Chainlink oracle price feeds that allows for manual price feed overrides.

Constructor

Creates a new Chainlink based oracle.
1
constructor(
2
address _aggregator,
3
address _assetAddress,
4
address _owner
5
)
Copied!

Parameters:

Index
Name
Type
Internal Type
Description
0
_aggregator
address
address
Address of Chainlink aggregator.
1
_assetAddress
address
address
Address of currency (0x0 for ETH).
2
_owner
address
address
Address of the owner of the contract.

Functions

assetAddress (state variable)

The address of the asset token contract.
1
function assetAddress(
2
) view returns (
3
address
4
)
Copied!

Return Values:

Index
Name
Type
Internal Type
Description
0
address
address

changeAggregator

Updates the aggregator address to `aggregator`. Only the contract Owner can call this function. It emits a `ChangeAggregatorFeed` event.
1
function changeAggregator(
2
address aggregator
3
) nonpayable
Copied!

Parameters:

Index
Name
Type
Internal Type
Description
0
aggregator
address
address
The address of a Chainlink aggregator.

getAssetAddress

1
function getAssetAddress(
2
) view returns (
3
address
4
)
Copied!

Return Values:

Index
Name
Type
Internal Type
Description
0
address
address
The address of the oracled currency (0x0 for ETH).

getDenomination

1
function getDenomination(
2
) pure returns (
3
bytes32
4
)
Copied!

Return Values:

Index
Name
Type
Internal Type
Description
0
bytes32
bytes32
The denomination of the price.

getLatestPrice

1
function getLatestPrice(
2
) view returns (
3
int256
4
)
Copied!

Return Values:

Index
Name
Type
Internal Type
Description
0
int256
int256
The latest price.

globals (state variable)

The MapleGlobals.
1
function globals(
2
) view returns (
3
address
4
)
Copied!

Return Values:

Index
Name
Type
Internal Type
Description
0
address
contract IMapleGlobals

manualOverride (state variable)

Whether the price is manually overridden.
1
function manualOverride(
2
) view returns (
3
bool
4
)
Copied!

Return Values:

Index
Name
Type
Internal Type
Description
0
bool
bool

manualPrice (state variable)

The manually overridden price.
1
function manualPrice(
2
) view returns (
3
int256
4
)
Copied!

Return Values:

Index
Name
Type
Internal Type
Description
0
int256
int256

owner

Returns the address of the current owner.
1
function owner(
2
) view returns (
3
address
4
)
Copied!

Return Values:

Index
Name
Type
Internal Type
Description
0
address
address

priceFeed (state variable)

The Chainlink Aggregator V3 price feed.
1
function priceFeed(
2
) view returns (
3
address
4
)
Copied!

Return Values:

Index
Name
Type
Internal Type
Description
0
address
contract IChainlinkAggregatorV3

renounceOwnership

Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.
1
function renounceOwnership(
2
) nonpayable
Copied!

setManualOverride

Sets manual override, allowing for manual price setting. Only the contract Owner can call this function. It emits a `SetManualOverride` event.
1
function setManualOverride(
2
bool _override
3
) nonpayable
Copied!

Parameters:

Index
Name
Type
Internal Type
Description
0
_override
bool
bool
Whether manual override price should be used.

setManualPrice

Sets a manual price. Only the contract Owner can call this function. This can only be used if manualOverride == true. It emits a `SetManualPrice` event.
1
function setManualPrice(
2
int256 _price
3
) nonpayable
Copied!

Parameters:

Index
Name
Type
Internal Type
Description
0
_price
int256
int256
Price to set.

transferOwnership

Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.
1
function transferOwnership(
2
address newOwner
3
) nonpayable
Copied!

Parameters:

Index
Name
Type
Internal Type
Description
0
newOwner
address
address

Events

ChangeAggregatorFeed

Emits an event indicating that the price feed aggregator has changed from `_oldMedianizer` to `_newMedianizer`.
1
event ChangeAggregatorFeed(
2
address _newMedianizer,
3
address _oldMedianizer
4
)
Copied!

Parameters:

Index
Name
Type
Internal Type
Description
0
_newMedianizer
address
address
The new price feed aggregator.
1
_oldMedianizer
address
address
The old price feed aggregator.

OwnershipTransferred

1
event OwnershipTransferred(
2
address previousOwner,
3
address newOwner
4
)
Copied!

Parameters:

Index
Name
Type
Internal Type
Description
0
previousOwner
address
address
1
newOwner
address
address

SetManualOverride

Emits an event indicating whether manual price overriding is enabled.
1
event SetManualOverride(
2
bool _override
3
)
Copied!

Parameters:

Index
Name
Type
Internal Type
Description
0
_override
bool
bool
The state of manual price overriding.

SetManualPrice

Emits an event indicating that the price has been updated manually from `_oldPrice` to `_newPrice`.
1
event SetManualPrice(
2
int256 _oldPrice,
3
int256 _newPrice
4
)
Copied!

Parameters:

Index
Name
Type
Internal Type
Description
0
_oldPrice
int256
int256
The old price.
1
_newPrice
int256
int256
The new price.
Last modified 3mo ago