Aggregator Contract

Maven Finance's Aggregator Contract: The Pulse of Accurate Data

The Aggregator contract acts as a central hub for the platform's oracle system, gathering and processing price feed data provided by the Satellites.

The Aggregator contract's role encompasses the collection of data from Satellites, calculation of the median value, and the final submission of these aggregated price feeds to the Maven Finance system.

With a focus on accuracy and timeliness, the Aggregator contract plays a critical part in maintaining the reliability and stability of Maven Finance's DeFi ecosystem.

Oracle Entrypoints

updateData

function updateData(oracleObservationsType oracleObservations, signaturesType signatures)

Updates the aggregator contract with new data. Called by a randomly designated oracle

Can be called only by an active Oracle in the Aggregator Contract

Param Name
Type
Description

oracleObservations

oracleObservationsType: map (address oracleAddress, oracleObservationSingleType oracleObservation)

Map of oracle addresses to their observations

oracleObservation

oracleObservationSingleType: (nat data, nat epoch, nat round, address aggregatorAddress)

Observation of a single oracle

data

nat

Observation data

epoch

nat

Current epoch

round

nat

Current round

aggregatorAddress

address

Address of the aggregator contract for the observation data

signatures

signaturesType: map(address oracleAddress, signature oracleSignature)

Map of oracle addresses to their signatures

oracleAddress

address

Oracle (Satellite) address

oracleSignature

signature

Signature of the Oracle (Satellite)

withdrawRewardMvrk

function withdrawRewardXvrk(address oracleAddress)

Withdraws any MVRK rewards that the oracle has from the aggregator contract

Can be called only by an active Oracle in the Aggregator Contract

Param Name
Type
Description

oracleAddress

address

The address of the oracle claiming rewards

withdrawRewardStakedMvn

function withdrawRewardStakedMvn(address oracleAddress)

Withdraws any staked MVN rewards that the oracle has from the aggregator contract

Can be called only by an active Oracle in the Aggregator Contract

Param Name
Type
Description

oracleAddress

address

The address of the oracle claiming rewards

Admin Oracle Entrypoints

addOracle

function addOracle(address oracleAddress)

Adds an oracle to the aggregator contract

Can be called only by the admin or the governance satellite contract address

Param Name
Type
Description

oracleAddress

address

The address of the new oracle to be added

updateOracle

function updateOracle()

Updates an oracle information such as the oraclePublicKey and oraclePeerId on the aggregator contract by fetching its data from the delegation contract

Can be called only by a registered oracle on this aggregator contract

removeOracle

function removeOracle(address oracleAddress)

Removes an oracle from the aggregator contract

Can be called only by the admin or the governance satellite contract address

Param Name
Type
Description

oracleAddress

address

The address of the oracle to be removed

Housekeeping Entrypoints

setAdmin

function setAdmin(address newAdminAddress)

Sets a new admin address for the contract

Can be called only by the admin or the governance contract address

Param Name
Type
Description

newAdminAddress

address

The address of the new admin

setGovernance

function setGovernance(address newGovernanceAddress)

Sets a new governance contract address

Can be called only by the admin or the governance contract address

Param Name
Type
Description

newGovernanceAddress

address

The address of the new governance contract

setName

function setName(string updatedContractName)

Sets a new name for the contract, and aggregator reference in the governance satellite contract

Can be called only by the admin (i.e. the governance proxy contract)

Param Name
Type
Description

updatedContractName

string

The new reference name for this aggregator contract, subject to the max length as specified in the aggregator factory config aggregatorNameMaxLength variable

updateMetadata

function updateMetadata(string key, bytes hash)

Replace the hash of the contract metadata based on the provided key

Can be called only by the admin (i.e. the governance proxy contract)

Param Name
Type
Description

key

string

The key in the metadata bigmap to be updated

hash

bytes

The hash of the metadata key

updateConfig

function updateConfig(nat newConfigValue, aggregatorConfigActionType aggregatorConfigAction)

Updates the config variables on the Aggregator Contract

Can be called only by the admin (i.e. the governance proxy contract)

Param Name
Type
Description

newConfigValue

nat

The new value of the config parameter

aggregatorConfigAction

aggregatorConfigActionType: | unit ConfigDecimals | unit ConfigAlphaPercentPerThousand | unit ConfigPercentOracleThreshold | unit ConfigHeartbeatSeconds | unit ConfigRewardAmountStakedMvn | unit ConfigRewardAmountMvrk

The variant config variable to be updated

updateWhitelistContracts

function updateWhitelistContracts(address whitelistContractAddress, updateType update)

Add, update or remove a whitelist contract in the whitelistContracts map in the storage

Can be called only by the admin (i.e. the governance proxy contract)

Param Name
Type
Description

whitelistContractAddress

address

The contract address to be updated in the whitelist contracts bigmap

updateType

updateType: | unit Update | unit Remove

Specifies whether the whitelistContractAddress should be updated or removed from the whitelist contracts bigmap

updateGeneralContracts

function updateGeneralContracts(string generalContractName, address generalContractAddress, updateType update)

Add, update or remove a general contract in the generalContracts map in the storage

Can be called only by the admin (i.e. the governance proxy contract)

Param Name
Type
Description

generalContractName

string

The identifier key to be set in the general contracts bigmap which will be the general contract name in camelcase

generalContractAddress

address

The contract address to be updated in the general contracts bigmap

updateType

updateType: | unit Update | unit Remove

Specifies whether the generalContractAddress should be updated or removed from the general contracts bigmap

mistakenTransfer

function mistakenTransfer(transferActionType transferList)

Transfers any mav or token that may have mistakenly been sent to this contract

Can be called only by the admin or the governance satellite contract

Param Name
Type
Description

transferList

transferActionType:

list(address to_, nat tokenAmount, token tokenType)

A list of transfers of tokens to recipients

to_

address

The recipient of the mistaken transfer

tokenAmount

nat

The amount of tokens to be transferred

token

tokenType: | unit Mav | (address tokenContractAddress) Fa12 | (address tokenContractAddress, nat tokenId) Fa2

The token type of the token to be transferred, corresponding to either Mav, MRC-10, or MRC-20

setLambda

function setLambda(string lambdaName, bytes func_bytes)

Sets a lambda in the contract with the given bytes and name

Can be called only by the admin (i.e. the governance proxy contract)

Param Name
Type
Description

lambdaName

string

The name of the lambda to be set

func_bytes

bytes

The data of the lambda in Michelson bytes format

BreakGlass Entrypoints

pauseAll

function pauseAll()

Pauses all entrypoints in the contract.

Can be called only by the admin or the governance contract address

unpauseAll

function unpauseAll()

Unpauses all entrypoints in the contract.

Can be called only by the admin or the governance contract address

togglePauseEntrypoint

function togglePauseEntrypoint(aggregatorPausableEntrypointType targetEntrypoint, unit empty)

Toggles the pausing of a specific entrypoint in the contract

Can be called only by the admin (i.e. the governance proxy contract)

Param Name
Type
Description

targetEntrypoint

aggregatorPausableEntrypointType: | bool UpdateData | bool WithdrawRewardMvrk | bool WithdrawRewardStakedMvn

The target entrypoint to be paused, and its corresponding pause boolean. If the boolean is set to True, the entrypoint will be paused.

empty

unit

A null param used to prettify interactions with this entrypoint on blockchain explorers such as better-call-dev

View Methods

getAdmin

function getAdmin()

Returns the contract admin

getGovernanceAddress

function getGovernanceAddress()

Returns the contract governance address

getName

function getName()

Returns the contract name

getConfig

function getConfig()

Returns the contract configuration parameters

getBreakGlassConfig

function getBreakGlassConfig()

Returns the break glass config parameters (which shows the pause status of entrypoints)

getWhitelistContractOpt

function getWhitelistContractOpt(address contractAddress)

Returns unit if contract address is whitelisted, else returns none

getGeneralContractOpt

function getGeneralContractOpt(string contractName)

Returns the contract address if the contract name is found, else returns none

getOracleLedger

function getOracleLedger()

Returns the oracle ledger in the aggregator contract

getOracleOpt

function getOracleOpt(address oracleAddress)

Returns an oracle record if found, else returns none

getOracleRewardStakedMvnOpt

function getOracleRewardStakedMvnOpt(address oracleAddress)

Returns the staked MVN rewards of a given oracle address, else returns none

getOracleRewardMvrkOpt

function getOracleRewardMvrkOpt(address oracleAddress)

Returns the mvrk rewards of a given oracle address, else returns none

getLastCompletedData

function getLastCompletedData()

Returns the last completed data record on the aggregator contract

getDecimals

function getDecimals()

Returns the number of decimals used in the aggregator contract

getLambdaOpt

function getLambdaOpt(string lambdaName)

Returns a lambda in the contract for the given lambda name, else returns none

Last updated