Aggregator Factory Contract
Reliable Data, Streamlined Deployment: The Aggregator Factory Contract
The Aggregator Factory Contract on Maven Finance is designed to streamline the creation of new Aggregator contract instances within the ecosystem.
By providing a standardized model for deploying new aggregators through Governance, the Aggregator Factory Contract promotes scalability and ensures consistency across Maven Finance's oracle network.
It plays a crucial role in Maven Finance's data infrastructure, supporting the platform's commitment to reliable and accurate data feeds.
Aggregator Factory Entrypoints
createAggregator
function createAggregator(string aggregatorName, bool addToGeneralContracts, oracleLedgerMapType oracleLedger, aggregatorConfigType aggregatorConfig, bytes metadata)
Creates a new standard aggregator contract
aggregatorName
string
The reference name of the new aggregator to be created
addToGeneralContracts
bool
If set to true, the new aggregator contract will be added to the General Contracts map on the Governance Contract
oracleLedger
oracleLedgerMapType: map(address oracleAddress, oracleInformationType oracleInformation)
Map of oracles to be added to the newly created aggregator contract
oracleAddress
address
The address of the oracle
oracleInformation
oracleInformationType: key oraclePublicKey string oraclePeerId
The information required by each oracle
oraclePublicKey
key
The public key of the oracle
oraclePeerId
string
The peerId of the oracle - providing a unique reference to the oracle within the overall peer-to-peer network
metadata
bytes
The hash of the aggregator metadata
trackAggregator
function trackAggregator(address aggregatorAddress)
Tracks an aggregator contract and adds it to the trackedAggregators set on the Aggregator Factory Contract
aggregatorAddress
address
The contract address of the aggregator to be tracked
untrackAggregator
function untrackAggregator(address aggregatorAddress)
Untracks an aggregator contract and removes it from the trackedAggregators set on the Aggregator Factory Contract
aggregatorAddress
address
The contract address of the aggregator to be untracked
Aggregator Entrypoints
distributeRewardXtz
function distributeRewardXtz(address recipient, nat reward)
Distributes rewards from the Aggregator to the oracle recipient
recipient
address
The address of the oracle to receive the rewards
reward
nat
The total amount of rewards in xtz to be distributed
distributeRewardStakedMvn
function distributeRewardStakedMvn(set(address) eligibleOracles, nat totalStakedMvnReward)
Distributes staked MVN rewards equally to each address specified in the eligibleOracles set
eligibleOracles
set(address)
A set of oracle addresses to receive rewards
reward
nat
The total amount of rewards in staked MVN to be distributed
Housekeeping Entrypoints
setAdmin
function setAdmin(address newAdminAddress)
Sets a new admin address for the contract
newAdminAddress
address
The address of the new admin
setGovernance
function setGovernance(address newGovernanceAddress)
Sets a new governance contract address
newGovernanceAddress
address
The address of the new governance contract
updateMetadata
function updateMetadata(string key, bytes hash)
Replace the hash of the contract metadata based on the provided key
key
string
The key in the metadata bigmap to be updated
hash
bytes
The hash of the metadata key
updateConfig
function updateConfig(nat newConfigValue, aggregatorFactoryConfigActionType aggregatorFactoryConfigAction)
Updates the config variables on the Aggregator Factory Contract
newConfigValue
nat
The new value of the config parameter
aggregatorFactoryConfigAction
aggregatorFactoryConfigActionType: | unit ConfigAggregatorNameMaxLength | unit Empty
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
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
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
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 Aggregator contract with the given bytes and name
lambdaName
string
The name of the lambda to be set
func_bytes
bytes
The data of the lambda in Michelson bytes format
setProductLambda
function setProductLambda(string lambdaName, bytes func_bytes)
Sets a lambda in the aggregator lambda ledger with the given bytes and name
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 aggregator factory contract, and also calls the pauseAll entrypoint in each tracked aggregator contract
unpauseAll
function unpauseAll()
Unpauses all entrypoints in the aggregator factory contract, and also calls the unpauseAll entrypoint in each tracked aggregator contract
togglePauseEntrypoint
function togglePauseEntrypoint(aggregatorFactoryPausableEntrypointType targetEntrypoint, unit empty)
Toggles the pausing of a specific entrypoint in the contract
targetEntrypoint
aggregatorFactoryPausableEntrypointType: | bool CreateAggregator | bool UntrackAggregator | bool TrackAggregator | bool DistributeRewardXtz | bool DistributeRewardStakedMvn
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
getConfig
function getConfig()
Returns the contract configuration parameters
getBreakGlassConfig
function getBreakGlassConfig()
Returns the contract configuration parameters
getWhitelistContractOpt
function getWhitelistContractOpt(address contractAddress)
Returns unit if contract address is whitelisted, else returns none
checkAggregatorExists
function checkAggregatorExists(address aggregatorContractAddress)
Returns True if the aggregator contract address is found in the trackedAggregators set
getTrackedAggregators
function getTrackedAggregators()
Returns the trackedAggregators set
getLambdaOpt
function getLambdaOpt(string lambdaName)
Returns a lambda in the contract for the given lambda name, else returns none
getAggregatorLambdaOpt
function getAggregatorLambdaOpt(string lambdaName)
Returns a lambda in the aggregator lambda ledger for the given lambda name, else returns none
Last updated