Methods

The operations that can be performed on the subDAO contract are listed below.

Read Operations

function keyOf(address componentAddress) external view returns(bytes32);

Pass a Component address in this function for it to retrieve its key.

function history(bytes32 key) external view returns(address[] memory componentsAddresses);

Pass a key in this function for it to retrieve the array of the Component addresses corresponding to the key's history.

function batchHistory(bytes32[] calldata keys) external view returns(address[][] memory componentsAddresses);

Pass multiple keys in this function for it to retrieve, for each key, the array of the addresses of the Components corresponding to the key's history.

function get(bytes32 key) external view returns(address componentAddress);

Pass a Component key in this function for it to retrieve the Component's address.

function list(bytes32[] calldata keys) external view returns(address[] memory componentsAddresses);

Pass multiple Component keys in this function for it to retrieve, for each key, its address.

function isActive(address subject) external view returns(bool);

Pass a Component address in this function for it to retrieve whether the address corresponds to an active Component (true) or an inactive one (false).

function keyIsActive(bytes32 key) external view returns(bool);

Pass a key in this function for it to retrieve whether the key corresponds to an active Component (true) or an inactive one (false).

function presetArrayMaxSize() external view returns(uint256);

Retrieve the presetArrayMaxSize (maximum number of Proposal Models in the subDAO) parameter set.

function proposalModels() external view returns(SubDAOProposalModel[] memory);

Retrieve all the Proposal Models set in the subDAO.

function isPersistent(bytes32 proposalId) external view returns(bool result, bool isDeprecated);

Pass a proposalId and retrieve if the Proposal exists and if it was deprecated setting new Preset Proposals using the setPresetValues function.

Write Operations

function set(Component calldata) external returns(address replacedComponentAddress);

Pass a component struct to add it to an Organization. If the key passed in the struct is already attached to a Component, that Component will be replaced with the new one.

The output function returns the address of the new Component.

function batchSet(Component[] calldata) external returns (address[] memory replacedComponentAddresses);

Pass multiple component structs to add them to an Organization. If a key passed in a struct is already attached to a Component, that Component will be replaced with the new one.

The output function returns the addresses of the new Components.

function submit(address location, bytes calldata payload, address restReceiver) external payable returns(bytes memory response);

This function allows an authorized Component to ask an Organization to call another contract (address location), passing specific parameters (payload). If the contract sends the Organization some tokens etc., a restReceiver can be specified to receive them. The Organization uses a call function to perform the interaction with the smart contract (location)

function setProposalModels(SubDAOProposalModel[] calldata newValue) external returns(SubDAOProposalModel[] memory oldValue);

This function can be used to set new Proposal Models. It deletes the old Proposal models from the subDAO.

function setInitialProposalModels(SubDAOProposalModel[] calldata newValue) external;

This function can be used to set one or more Proposal Models in the subDAO if no Models were set when the SubDAO was initialized. This function can be called only by the address that previously initialized the subDAO contract.

function setVotingRules(uint256 modelIndex, uint256 votingRulesIndex) external returns(address[] memory oldCanTerminateAddresses, address[] memory oldValidatorsAddresses);

This function can be used to change the votingRulesIndex parameter of a Proposal Model.

function setCreationAndTriggeringRules(uint256 modelIndex, address newCreationRules, address newTriggeringRules) external returns(address oldCreationRules, address oldTriggeringRules);

This function can be used to change the creationRules and triggeringRules smart contract addresses of Proposal Model.

function setPresetValues(uint256 modelIndex, bytes[] calldata newPresetValues) external returns(bytes[] memory oldPresetValues, bytes32[] memory deprecatedProposalIds);

This function can be used to change the presetValues parameter of a Proposal Model.

function finalizeInit(address firstHost) external;

This function can be used to set the subDAO host at a later time and it can only be called by a subDAO Manager. Look here for more info.

Last updated