Delegation Contract
Maven Finance's Delegation Contract: Powering Decentralized Representation
Functioning as the Satellites contract within the ecosystem, the Delegation contract plays a pivotal role in the execution of governance and oracle responsibilities.
The Delegation contract controls the management of Satellites, facilitating their registration and tracking their overall activities. Moreover, it handles the delegation of sMVN tokens from stakeholders to Satellites, establishing a direct link between the token holders and their chosen representative.
By managing the delegation and actions of Satellites, the Delegation contract contributes to the transparent, democratic, and efficient operations within Maven Finance's decentralized platform.
Delegation Entrypoints
delegateToSatellite
function delegateToSatellite(address userAddress, address satelliteAddress)
Delegates the staked MVN of a given user address to the satellite address
userAddress
address
The user address to be delegated
satelliteAddress
address
The satellite address that the user will be delegated to
undelegateFromSatellite
function undelegateFromSatellite(address userAddress)
Undelegates the user from his satellite
userAddress
address
The user address to be undelegated from his/her satellite
Satellite Entrypoints
registerAsSatellite
function registerAsSatellite(string name, string description, string image, string website, nat satelliteFee, option(key) oraclePublicKey, option(string) oraclePeerId)
Registers the sender as a satellite with the given parameters
name
string
The name of the satellite
description
string
The description of the satellite
image
string
The link to the image url of the satellite
website
string
The link to the website of the satellite
satelliteFee
nat
The fee which the satellite will collect from delegates when rewards are distributed
oraclePublicKey
option(key)
An optional key if the satellite wishes to serve as an oracle providing data
oraclePeerId
option(string)
An optional string if the satellite wishes to serve as an oracle providing data - this string will serve as a reference to the satellite within the overall peer-to-peer network
unregisterAsSatellite
function unregisterAsSatellite(address satelliteAddress)
Unregisters the sender as a satellite
satelliteAddress
address
The satellite address that wishes to unregister
updateSatelliteRecord
function registerAsSatellite(string name, string description, string image, string website, nat satelliteFee, option(key) oraclePublicKey, option(string) oraclePeerId)
Updates a satellite's record with the given parameters
name
string
The name of the satellite
description
string
The description of the satellite
image
string
The link to the image url of the satellite
website
string
The link to the website of the satellite
satelliteFee
nat
The fee which the satellite will collect from delegates when rewards are distributed
oraclePublicKey
option(key)
An optional key if the satellite wishes to serve as an oracle providing data
oraclePeerId
option(string)
An optional string if the satellite wishes to serve as an oracle providing data - this string will serve as a reference to the satellite within the overall peer-to-peer network
distributeReward
function distributeReward(set(address) eligibleSatellites, nat totalStakedMvnReward)
Distributes the given staked MVN reward equally among all the eligible satellites
eligibleSatellites
set(address)
The set of satellite addresses which will receive the staked MVN reward in this call
totalStakedMvnReward
nat
The total staked MVN reward 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, delegationConfigActionType delegationConfigAction)
Updates the config variables on the Delegation Contract
newConfigValue
nat
The new value of the config parameter
delegationConfigAction
delegationConfigActionType: | unit ConfigMinimumStakedMvnBalance | unit ConfigDelegationRatio | unit ConfigMaxSatellites | unit ConfigSatNameMaxLength | unit ConfigSatDescMaxLength | unit ConfigSatImageMaxLength | unit ConfigSatWebsiteMaxLength
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) MRC-10 | (address tokenContractAddress, nat tokenId) MRC-20
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
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.
unpauseAll
function unpauseAll()
Unpauses all entrypoints in the contract.
togglePauseEntrypoint
function togglePauseEntrypoint(delegationPausableEntrypointType targetEntrypoint, unit empty)
Toggles the pausing of a specific entrypoint in the contract
targetEntrypoint
delegationPausableEntrypointType: | bool DelegateToSatellite | bool UndelegateFromSatellite | bool RegisterAsSatellite | bool UnregisterAsSatellite | bool UpdateSatelliteRecord | bool DistributeReward
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
Protected Entrypoints
onStakeChange
function onStakeChange(set(address userAddress, nat referenceSMvnBalance) onStakeChangeSet)
Registers a stake change event for the given users in the onStakeChange set
onStakeChangeSet
set(address userAddress, nat referenceSMvnBalance)
The set of user addresses and their reference staked MVN balance
userAddress
address
The address of a user whose staked balance has changed
referenceSMvnBalance
nat
The initial staked MVN balance of the user before any actions has been applied to it, which will be used as a reference
updateSatelliteStatus
function updateSatelliteStatus(address satelliteAddress, string newStatus)
Updates the given satellite with a new status
satelliteAddress
address
The address of a satellite whose status has changed
newStatus
string
The updated status of a satellite. Valid strings are "ACTIVE", "BANNED", or "SUSPENDED"
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
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
getBreakGlassConfig
function getBreakGlassConfig()
Returns the break glass config parameters (which shows the pause status of entrypoints)
getDelegateOpt
function getDelegateOpt(address delegateAddress)
Returns the delegate record if it exists, else returns none
getSatelliteOpt
function getSatelliteOpt(address satelliteAddress)
Returns the satellite record if it exists, else returns none
getSatelliteRewardsOpt
function getSatelliteRewardsOpt(address userAddress)
Returns the satellite rewards record if it exists, else returns none
getLambdaOpt
function getLambdaOpt(string lambdaName)
Returns a lambda in the contract for the given lambda name, else returns none
Last updated