Maven Finance Docs
  • Introduction
    • Getting Started
  • Maven Finance
    • Staking
      • Benefits and Fees of Staking
      • How To Stake and Unstake
    • Satellites & Oracles
      • Delegating To Satellites
      • Satellite Registration
      • Oracle Nodes
    • Earn & Borrow
      • Lending & mTokens
      • Multi-Collateral Vaults
        • Liquidation
      • Interest Rate Model
    • Yield Farms
      • Maven Finance's Yield Farms
      • Yield Farming Dashboard
    • Governance
      • Governance Rounds
        • Proposal Round
        • Voting Round
        • Timelock Round
      • Emergency Governance
      • Financial Governance
      • Satellite Governance
    • Council
      • Management of Finances
      • Management of Vestees
    • Treasury
  • Smart Contracts
    • Smart Contracts Overview
      • Doorman Contract
      • Delegation Contract
      • Aggregator Contract
      • Aggregator Factory Contract
      • Farm Contract
      • Farm Factory Contract
      • Governance Contract
      • Governance Financial Contract
      • Governance Satellite Contract
      • Governance Proxy Contract
      • Council Contract
      • Treasury Contract
      • Treasury Factory Contract
      • Break Glass Contract
      • Emergency Governance Contract
      • Lending Controller Contract
      • Vault Contract
      • Vault Factory Contract
      • MVN Token Contract
      • mToken Contract
      • Vesting Contract
  • Glossary
    • Glossary of Terms
Powered by GitBook
On this page
  • Treasury Factory Entrypoints
  • Housekeeping Entrypoints
  • BreakGlass Entrypoints
  • View Methods
  1. Smart Contracts
  2. Smart Contracts Overview

Treasury Factory Contract

Blueprint for Financial Expansion

The Treasury Factory Contract on Maven Finance holds the blueprint for creating new Treasury Contract instances within the ecosystem. This contract provides a standardized yet flexible way to deploy new treasuries, promoting scalable growth while maintaining the overall integrity of the platform.

As Maven Finance continues to innovate and introduce new DeFi products, the Treasury Factory Contract paves the way for efficient treasury deployment, thereby enabling the efficient allocation and management of resources across the platform.

Treasury Factory Entrypoints

createTreasury

function createTreasury(option(key_hash) baker, string treasuryName, bool addToGeneralContracts, bytes metadata)

Creates a new standard treasury contract

Param Name
Type
Description

baker

option(key_hash)

Key hash of the baker

treasuryName

string

The reference name of the new treasury to be created

addToGeneralContracts

bool

If set to true, the new treasury contract will be added to the General Contracts map on the Governance Contract

metadata

bytes

The hash of the tresaury metadata

trackTreasury

function trackTreasury(address treasuryAddress)

Tracks a treasury contract and adds it to the trackedTreasuries set on the Treasury Factory Contract

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

Param Name
Type
Description

treasuryAddress

address

The contract address of the treasury to be tracked

untrackTreasury

function untrackTreasury(address treasuryAddress)

Untracks a treasury contract and removes it from the trackedTreasuries set on the Treasury Factory Contract

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

Param Name
Type
Description

treasuryAddress

address

The contract address of the treasury to be untracked

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, treasuryFactoryConfigActionType treasuryFactoryConfigAction)

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

treasuryFactoryConfigAction

treasuryFactoryConfigActionType: | unit ConfigTreasuryNameMaxLength | 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 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) 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 Treasury 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

setProductLambda

function setProductLambda(string lambdaName, bytes func_bytes)

Sets a lambda in the treasury lambda ledger 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 treasury factory contract, and also calls the pauseAll entrypoint in each tracked treasury contract

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

unpauseAll

function unpauseAll()

Unpauses all entrypoints in the treasury factory contract, and also calls the unpauseAll entrypoint in each tracked treasury contract

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

togglePauseEntrypoint

function togglePauseEntrypoint(treasuryFactoryPausableEntrypointType 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

treasuryFactoryPausableEntrypointType: | bool CreateTreasury | bool UntrackTreasury | bool TrackTreasury

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

checkTreasuryExists

function checkTreasuryExists(address treasuryContractAddress)

Returns True if the treasury contract address is found in the trackedTreasuries set

getTrackedTreasuries

function getTrackedTreasuries()

Returns the trackedTreasuries set

getLambdaOpt

function getLambdaOpt(string lambdaName)

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

getTreasuryLambdaOpt

function getTreasuryLambdaOpt(string lambdaName)

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

PreviousTreasury ContractNextBreak Glass Contract

Last updated 6 months ago