Methods

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

Read Operations

function size() external view returns (uint256);

Retrieve the number (length) of Delegations attached to the Delegations Manager.

function list() external view returns (DelegationData[] memory);

Retrieve for each Delegation its data (DelegationData struct).

function partialList(uint256 start, uint256 offset) external view returns (DelegationData[] memory);

Pass a range position(start and offset) and returns an array containing the DelegationsData struct for each Delegation of the range.

function listByAddress(uint256[] calldata delegationAddresses) external view returns (DelegationData[] memory);

Pass an array of Delegation addresses and retrieve for each Delegation its data (DelegationsData struct).

function listByIndices(uint256[] calldata indices) external view returns (DelegationData[] memory);

Pass an array of microservices indices and retrieve for each Delegation its data (DelegationsData struct).

function exists(string calldata key) external view returns(bool result, uint256 index, address treasuryOf);

Pass a Delegation address and retrieve if it exists (true), i.e. the address corresponds to a Delegation, or not (false), its index, and its specific Treasury address corresponding to the Organization.

function treasuryOf(address delegationAddress) external view returns(address treasuryAddress);

Pass a Delegation address and retrieve its specific Treasury address corresponding to the Organization.

function get(string calldata key) external view returns(DelegationData memory);

Pass a Delegation address and retrieve its data (DelegationData struct).

function getByIndex(uint256 index) external view returns(DelegationData memory);

Pass a Delegation index and retrieve its data (DelegationData struct).

function executorRewardPercentage() external view returns(uint256);

Retrieve the executor reward set for calling the split function.

function getSplit(address executorRewardReceiver) external view returns (address[] memory receivers, uint256[] memory values);

Pass an executor reward receiver address and retrieve the addresses of the receivers (executor address and all the Delegations addresses attached ) and the values they receives.

function getSituation() external view returns(address[] memory treasuries, uint256[] memory treasuryPercentages);

Retrieve the addresses of the Delegation that receive funds from the split and the values they receives.

function factoryIsAllowed(address factoryAddress) external view returns(bool);

Pass a Factory address and retrieve if the Delegations cloned from it are allowed to attach themself to the Delegations Manager (true) or not (false).

function isBanned(address productAddress) external view returns(bool);

Pass a Delegation address and retrieve if it's banned (true) or not (false).

function isValid(address delegationAddress, address caller) external view returns(bool);

Pass a Delegation address and a caller address and retrieve if the Delegation is allowed to attach itself to the Delegations Manager (true) or not (false). Look here for more info.

function supportedToken() external view returns(address collection, uint256 objectId);

Retrieve the Collection addresses and the objectId of the supported token chosen by the Organization to which the Delegations Manager is attached.

function maxSize() external view returns(uint256);

Retrive the max number set (maxSize) of Delegations that can be attached to the Delegations Manager.

function paidFor(address delegationAddress, address retriever) external view returns(uint256 totalPaid, uint256 retrieverPaid);

Pass a delegation address and an address retriever and retrieve the total staked amount and the staked amount by the retriever address for that Delegation.

function attachInsurance() external view returns (uint256);

Retrieve the Insurance amount. If a _attachInsuranceRetriever was defined, the Insurance is retrived by the _attachInsuranceRetriever smart contract. If a _attachInsuranceRetriever was not defined, the insurance is the _attachInsurance parameter.

Write Operations

function set() external;

This function is called by a Delegation when it attaches itself to the Delegations Manager using the DelegationsManagerAttacherProposal.

function split(address executorRewardReceiver) external;

This function can be called to perform the split among the various Delegation. It takes as input the executor reward receiver address.

function setSupportedToken(address collection, uint256 tokenId) external;

This function can be used to change the supported token chosen by the Organization to which the Delegations Manager is attached. It takes as input the new Collection address and objectId. The new token replaced the old one.

function setMaxSize(uint256 newValue) external returns (uint256 oldValue);

This function can be used to change the maxSize (maximum number of delegations that can be attached) previously set. It takes as input the new maxSize value and replaces the old one.

function remove(address[] calldata delegationAddresses) external returns(DelegationData[] memory removedDelegations);

This function can be called by the Organization hosting the Delegations Manager to remove one or more Delegation address(es).

function removeAll() external;

This function can be called by the Organization to remove all the Delegations attached.

function setFactoriesAllowed(address[] memory factoryAddresses, bool[] memory allowed) external;

This function can be used to allow (true) / disallow (false) one or more Factory address(es).

function ban(address[] memory productAddresses) external;

This function can be used to ban one or more Delegation address(es).

function payFor(address delegationAddress, uint256 amount, bytes memory permitSignature, address retriever) external payable;

This function can be used to pay the insurance, i.e. stake the required amount of token.

The delegationAddress is the address of the Delegation address of the delegation for which you are staking tokens, amount represents the amount you're staking, permitSignature represents the data for the permit approval, retriever represents the address that will take back the staked tokens when the Delegation is removed from the Organization. Pass as address(0) to set the receiver as msg.sender.

function retirePayment(address delegationAddress, address receiver, bytes memory data) external;

This function can be used to give back the staked token amount. It can only be called by the previously set address retriever when the Delegation you are withdrawing for has already been removed. If the delegation has been banned, the staked tokens are automatically burned and therefore are no longer withdrawable.

The delegationAddress represents the delegation for which you are withdrawing, receiver represents the address receiving the tokens, data represents the eventual data to execute in case you're withdrawing ERC1155 (data is a parameter of the safeTransferFrom of ERC1155).

function setAttachInsurance(uint256 value) external returns (uint256 oldValue);

This function can be called by the Organization hosting the DelegationsManager to change the insurance value if the insurance was internally defined by the _attachInsurance parameter. Look here for more info.

Last updated