Contract IMVDFunctionalitiesManager

  • Path: contracts/IMVDFunctionalitiesManager.sol
  • Version: 1
  • Title: Interface for the Functionalities Manager

Functionalities Manager is the one that keeps track of all the Microservices of a DFO. It also contains all the logic to set/unset Microservices after a Proposal.

Methods

addFunctionality(string,address,uint256,address,bool,string,string,bool,bool)

Add a functionality to the Functionalities Manager

Params

  • codeName: ID of the microservice, to be called by the user through Proxy.
  • isInternal: Boolean flag controlling wether the microservice can be called from anyone (false) or can be called only by other microservices (true)
  • location: Address of the functionality/microservice to call
  • methodSignature: Name of the method of the microservice you want to call
  • needsSender: All microservices calls are made by the Proxy, with this boolean flag you can forward the address that called the Proxy in the first place
  • returnAbiParametersArray: Array of return values obtained from the called microservice's method
  • sourceLocation: Location of the source code, saved in concatenated Base64 data chunks
  • sourceLocationId: Base64 data chunk id of the corresponding Microservice
  • submittable: Boolean flag controlling wether the microservice writes data to the chain

addFunctionality(string,address,uint256,address,bool,string,string,bool,bool,uint256)

Replace a Functionality in the Functionalities Manager

Params

  • codeName: ID of the microservice, to be called by the user through Proxy.
  • isInternal: Boolean flag controlling wether the microservice can be called from anyone (false) or can be called only by other microservices (true)
  • location: Address of the functionality/microservice to call
  • methodSignature: Name of the method of the microservice you want to call
  • needsSender: All microservices calls are made py the Proxy, with this boolean flag you can forward the address that called the Proxy in the first place
  • position: Position of the Functionality to replace
  • returnAbiParametersArray: Array of return values obtained from the called microservice's method
  • sourceLocation: Location of the source code, saved in concatenated Base64 data chunks
  • sourceLocationId: Base64 data chunk id of the corresponding Microservice
  • submittable: Boolean flag controlling wether the microservice writes data to the chain

clearCallingContext()

This method can be called only by the Proxy. Clears the context at the end of the Microservice execution

functionalitiesToJSON()

For frontend purposes. Gives back the info about functionalities using the JSON Array format

functionalitiesToJSON(uint256,uint256)

For frontend purposes. Gives back the info about functionalities using the JSON Array format

Params

  • l: the array offset
  • start: the start position of the array

functionalityNames()

GET all Functionalities Names (IDs)

functionalityNames(uint256,uint256)

GET all Functionalities Names (IDs) in a portion of the array

functionalityToJSON(string)

Given a Functionality ID return its JSON encoded version

getFunctionalitiesAmount()

GET the amount of functionalities present in the Functionalities Manager

getFunctionalityData(string)

Utility method to retrieve all important stuff to call a Microservice

Params

  • codeName: the codeName of the Microservice you need info

Returns

  • _0: the address of the contract including the logic of the Microservice, the method signature of the Microservice, the position in the Functionalities array, the location of the source code, saved in byte64 concatenated data chunks, the locationId of the source code.

getProxy()

GET the Proxy

hasFunctionality(string)

Check that the FunctionalitiesManager has a specific Functionality

Params

  • codeName: ID of the Functionality to be checked

Returns

  • output: Boolean flag indicating wether the Functionalities Manager has the given Functionality.

init(address,uint256,address,uint256,address,uint256,address,uint256,address)

Initializer logic used during the constructor call

Params

  • checkVoteResultFunctionalityAddress: Address for the Functionality that controls the check for determining if a Proposal was successful or it failed
  • checkVoteResultSourceLocationId: Base64 data chunk id of the corresponding Microservice
  • getEmergencyMinimumBlockNumberFunctionalityAddress: Address for the Functionality that controls the block duration of emergency proposals
  • getEmergencyMinimumBlockNumberSourceLocationId: Base64 data chunk id of the corresponding Microservice
  • getEmergencySurveyStakingFunctionalityAddress: Address for the Functionality that controls the minimum amount of vote to be staked in order to start an Emergency Proposal
  • getEmergencySurveyStakingSourceLocationId: Base64 data chunk id of the corresponding Microservice
  • getMinimumBlockNumberFunctionalityAddress: Address of the Functionality that controls the block duration of regular proposals
  • getMinimumBlockNumberSourceLocationId: Base64 data chunk id of the corresponding Microservice
  • sourceLocation: Location of the source code, saved in concatenated Base64 data chunks

isAuthorizedFunctionality(address)

Check that the Functionality is an authorized one

Params

  • functionality: Functionality to be checked

Returns

  • success: Boolean flag indicating the authorization status of the Functionality

isValidFunctionality(address)

Check that the Functionality is a valid one

Params

  • functionality: Functionality to be checked

Returns

  • valid: Boolean flag indicating the validity of the Functionality

preConditionCheck(string,bytes,uint8,address,uint256)

Method called by the Proxy when someone calls a Microservice. It has a double function: checks if you are in the correct context (e.g. are you trying to call a non-submitable Microservice through the correct "read" function of the Proxy?) and gives back the address of the Microservice and the correct payload that the proxy will use to execute a .call() method.

Params

  • codeName: the Microservice to be called
  • data: the payload to be used within the Microservice (ABI encoded)
  • sender: the original msg.sender of the Proxy read/submit call, to be used if the Microservice has the needsSender flag set to true
  • submittable: 1 true, 0 false
  • value: the original msg.value of the Proxy submit call, to be used if the Microservice is submitable and has the needsSender flag set to true

removeFunctionality(string)

Remove a Functionality from the Functionalities Manager

Params

  • codeName: ID of the Functionality to remove

Returns

  • position: Position of the removed functionality
  • removed: Boolean flag representing the success status of the operation

setCallingContext(address)

This method can be called only by the Proxy. When a new submitable Microservice is called, this method is used to let other DFO Delegates (e.g. StateHolder) to be fully operative. If you call a Microservice directly, bypassing the Proxy, the context will be blank and Delegates cannot allow you to do any operation.

Params

  • location: The address of the currently running Microservice

Returns

  • changed: True if the calling context is correctly set, false if the context was already set (this happens, for example, when someone calls a Microservice including a logic to call another Microservice through the Proxy).

setProxy()

SET the Proxy

setupFunctionality(address)

callable by the Proxy only. Sets up the new Microservice add/replace/remove action, grabbing the data from the MVDFunctionalityProposal at the given address

Params

  • proposalAddress: the address of the Proposal to be set