Doorman Contract

Maven Finance's Doorman Contract: Your Gateway to Staking Power

Serving as the staking contract in the platform, the Doorman's primary role is to manage and control the staking procedures and operations integral to Maven Finance's DeFi ecosystem.

The Doorman contract is responsible for facilitating the staking of MVN tokens, ensuring their conversion into staked MVN (sMVN), and managing their subsequent delegation to Satellites.

Furthermore, it meticulously oversees the unstaking processes, ensuring that all transactions comply with the stipulated rules.

With the Doorman contract, Maven Finance achieves a seamless, secure, and effective staking operation, thereby contributing to the robustness of its decentralized platform.

Main Entrypoints

stake

function stake(nat stakeAmount)

Stake MVN tokens for the sender

Param Name
Type
Description

stakeAmount

nat

The amount to be staked

unstake

function unstake(nat unstakeAmount)

Unstake MVN tokens for the sender

Param Name
Type
Description

unstakeAmount

nat

The amount to be unstaked

exit

function exit()

Completely unstake all MVN tokens of the sender and reset balance to zero

compound

function compound(address userAddress)

Compounds the user exit fee and satellite rewards

Param Name
Type
Description

userAddress

address

The user address on which compound will be run

farmClaim

function farmClaim(set(address userAddress, nat amount), bool forceRewardFromTransfer)

For users to claim the staked MVN rewards of a farm

Can be called only by a farm contract

Param Name
Type
Description

userAddress

address

The user address on which farmClaim will be run

amount

nat

Amount of farm rewards to be claimed

forceRewardFromTransfer

bool

if true, rewards will only be transferred from the farm treasury. If false, the farm treasury will be allowed to mint additional MVN tokens as rewards

Vault Entrypoints

onVaultDepositStake

function onVaultDepositStake(address vaultOwner, address vaultAddress, nat depositAmount)

Registers the staking of MVN from a vault owner to his vault

Can be called only by the lending controller contract

Param Name
Type
Description

vaultOwner

address

The address of the vault owner

vaultAddress

address

The address of the vault

depositAmount

nat

The amount of staked MVN to be deposited from the vault owner to the vault

onVaultWithdrawStake

function onVaultWithdrawStake(address vaultOwner, address vaultAddress, nat withdrawAmount)

Registers the unstaking of MVN from a vault address to the vault owner

Can be called only by the lending controller contract

Param Name
Type
Description

vaultOwner

address

The address of the vault owner

vaultAddress

address

The address of the vault

withdrawAmount

nat

The amount of staked MVN to be withdrawn from the vault to the vault owner

onVaultLiquidateStake

function onVaultLiquidateStake(address vaultAddress, address liquidator, nat liquidatedAmount)

Registers the liquidation of staked MVN from a given vault to the liquidator

Can be called only by the lending controller contract

Param Name
Type
Description

vaultAddress

address

The address of the vault

liquidator

address

The address of the liquidator

liquidatedAmount

nat

The amount of liquidated MVN to be deposited from the vault owner to the liquidator

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

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, doormanConfigActionType doormanConfigAction)

Updates the config variables on the Doorman 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

doormanConfigAction

doormanConfigActionType: | unit ConfigMinMvnAmount | 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

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 mvn 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) MRC-10 | (address tokenContractAddress, nat tokenId) MRC-20

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

migrateFunds

function migrateFunds(address receiverAddress)

Migrates all the MVN in the Doorman Contract to another address. All the contract entrypoints must be paused for this to work

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

Param Name
Type
Description

receiverAddress

address

The address of the new Doorman contract to received the migrated funds

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(doormanPausableEntrypointType 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

doormanPausableEntrypointType: | bool Stake | bool Unstake | bool Exit | bool Compound | bool FarmClaim | bool OnVaultDepositStake | bool OnVaultWithdrawStake | bool OnVaultLiquidateStake

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

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)

getUserStakeBalanceOpt

function getUserStakeBalanceOpt(address userAddress)

Returns a user stake balance record based on the provided address, else returns none

getUnclaimedRewards

function getUnclaimedRewards()

Returns the total unclaimed exit fee rewards

getAccumulatedFeesPerShare

function getAccumulatedFeesPerShare()

Returns the accumulated fees per share used in the exit fee rewards calculation

getStakedBalance

function getStakedBalance(address userAddress)

Returns the staked MVN balance of a given user, else returns 0

getLambdaOpt

function getLambdaOpt(string lambdaName)

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

Last updated