AggregatePool
An AggregatePool is a pool where investors can invest cryptocurrency into multiple IndividualPools and claim dividends from each. Whenever users invest into an aggregate pool, they are minted shares (ERC20 tokens).
1 share = 1 poolToken (ie 1 USDT). Therefore, do not use the aggregate pool's decimal() function in front-end views- use poolToken.decimal() instead.
Methods
ALLOCATION_MARGIN_OF_ERROR
Returns
Name | Type | Description |
---|---|---|
_0 | uint256 | undefined |
DEFAULT_ADMIN_ROLE
Returns
Name | Type | Description |
---|---|---|
_0 | bytes32 | undefined |
INVESTOR_ROLE
Returns
Name | Type | Description |
---|---|---|
_0 | bytes32 | undefined |
OWNER_ROLE
Returns
Name | Type | Description |
---|---|---|
_0 | bytes32 | undefined |
PAUSER_ROLE
Returns
Name | Type | Description |
---|---|---|
_0 | bytes32 | undefined |
PERCENTAGE_DECIMAL
Returns
Name | Type | Description |
---|---|---|
_0 | uint256 | undefined |
POOL_MANAGER_ROLE
Returns
Name | Type | Description |
---|---|---|
_0 | bytes32 | undefined |
__BasePool__init
Run only once, on initialization
Parameters
Name | Type | Description |
---|---|---|
_owner | address | The address of who should have the "OWNER_ROLE" of this contract |
_config | contract ProtocolConfig | The address of the OpenGuild ProtocolConfig contract |
_poolToken | contract IERC20Upgradeable | The ERC20 token denominating investments, withdrawals and contributions |
_poolType | enum ProtocolConfig.PoolType | The pool type of the BasePool |
__BaseUpgradeablePausable__init
Parameters
Name | Type | Description |
---|---|---|
owner | address | undefined |
__PauserPausable__init
addInvestors
Grants all addresses the INVESTOR_ROLEOnly callable by the owner
Parameters
Name | Type | Description |
---|---|---|
investors | address[] | Addresses of the new investors |
allowance
See {IERC20-allowance}.
Parameters
Name | Type | Description |
---|---|---|
owner | address | undefined |
spender | address | undefined |
Returns
Name | Type | Description |
---|---|---|
_0 | uint256 | undefined |
applyFee
Parameters
Name | Type | Description |
---|---|---|
amount | uint256 | Amount to subtract the fee from |
takeRate | uint256 | Rate to calculate the fee |
Returns
Name | Type | Description |
---|---|---|
_0 | uint256 | Tuple of OpenGuild's take + remainder |
_1 | uint256 | a tuple where the first value is the fee taken from the amount and the second is the remainder (amount without the fee) |
approve
See {IERC20-approve}. Requirements: - spender
cannot be the zero address.
Parameters
Name | Type | Description |
---|---|---|
spender | address | undefined |
amount | uint256 | undefined |
Returns
Name | Type | Description |
---|---|---|
_0 | bool | undefined |
balanceOf
See {IERC20-balanceOf}.
Parameters
Name | Type | Description |
---|---|---|
account | address | undefined |
Returns
Name | Type | Description |
---|---|---|
_0 | uint256 | undefined |
claim
Claim all unclaimed dividends from currentIndividualPoolsOnly callable by an investor
currentIndividualPools
Parameters
Name | Type | Description |
---|---|---|
_0 | uint256 | undefined |
Returns
Name | Type | Description |
---|---|---|
_0 | address | undefined |
decimals
Returns the number of decimals used to get its user representation. For example, if decimals
equals 2
, a balance of 505
tokens should be displayed to a user as 5.05
(505 / 10 ** 2
). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the value {ERC20} uses, unless this function is overridden; NOTE: This information is only used for display purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}.
Returns
Name | Type | Description |
---|---|---|
_0 | uint8 | undefined |
decreaseAllowance
Atomically decreases the allowance granted to spender
by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - spender
cannot be the zero address. - spender
must have allowance for the caller of at least subtractedValue
.
Parameters
Name | Type | Description |
---|---|---|
spender | address | undefined |
subtractedValue | uint256 | undefined |
Returns
Name | Type | Description |
---|---|---|
_0 | bool | undefined |
getCumulativeDividends
Gets the sum of all dividends returned to this aggregate pool
Returns
Name | Type | Description |
---|---|---|
_0 | uint256 | Sum of all dividends returned to this aggregate pool |
getCurrentIndividualPools
Gets the list of current individual pools in this aggregate pool
Returns
Name | Type | Description |
---|---|---|
_0 | address[] | a list of addresses of current individual pools |
getFirstWithdrawalTime
Gets the earliest withdrawal timestamp for the individual pools in the aggregate pool
Returns
Name | Type | Description |
---|---|---|
_0 | uint256 | The earliest withdrawal timestamp for the individual pools in the aggregate pool |
getInvestorClaimedDividends
Gets the total claimed dividends aggregated across currentIndividualPools for a single investor
Parameters
Name | Type | Description |
---|---|---|
investor | address | the address of the investor to get the deployed amount |
Returns
Name | Type | Description |
---|---|---|
_0 | uint256 | Claimed dividends aggregated across currentIndividualPools for a single investor |
getInvestorDeployedAmount
Gets the total deployed amount aggregated across currentIndividualPools for a single investor
Parameters
Name | Type | Description |
---|---|---|
investor | address | the address of the investor to get the deployed amount |
Returns
Name | Type | Description |
---|---|---|
_0 | uint256 | Deployed amount aggregated across currentIndividualPools for a single investor |
getInvestorUnclaimedDividends
Gets the total unclaimed dividends aggregated across currentIndividualPools for a single investor
Parameters
Name | Type | Description |
---|---|---|
investor | address | the address of the investor to get the deployed amount |
Returns
Name | Type | Description |
---|---|---|
_0 | uint256 | Deployed amount aggregated across currentIndividualPools for a single investor |
getInvestorUndeployedAmount
Gets the total undeployed amount aggregated across currentIndividualPools for a single investor
Parameters
Name | Type | Description |
---|---|---|
investor | address | the address of the investor to get the undeployed amount |
Returns
Name | Type | Description |
---|---|---|
_0 | uint256 | Undeployed amount aggregated across currentIndividualPools for a single investor |
getPoolManager
Gets the address of the pool manager
Returns
Name | Type | Description |
---|---|---|
_0 | address | Address of the pool manager |
getRoleAdmin
Returns the admin role that controls role
. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.
Parameters
Name | Type | Description |
---|---|---|
role | bytes32 | undefined |
Returns
Name | Type | Description |
---|---|---|
_0 | bytes32 | undefined |
getRoleMember
Returns one of the accounts that have role
. index
must be a value between 0 and {getRoleMemberCount}, non-inclusive. Role bearers are not sorted in any particular way, and their ordering may change at any point. WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure you perform all queries on the same block. See the following https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] for more information.
Parameters
Name | Type | Description |
---|---|---|
role | bytes32 | undefined |
index | uint256 | undefined |
Returns
Name | Type | Description |
---|---|---|
_0 | address | undefined |
getRoleMemberCount
Returns the number of accounts that have role
. Can be used together with {getRoleMember} to enumerate all bearers of a role.
Parameters
Name | Type | Description |
---|---|---|
role | bytes32 | undefined |
Returns
Name | Type | Description |
---|---|---|
_0 | uint256 | undefined |
getTotalDeployedAmount
Gets the sum of all investments deployed aggregated across currentIndividualPools
Returns
Name | Type | Description |
---|---|---|
_0 | uint256 | Sum of all investments deployed aggregated across currentIndividualPools |
getTotalUndeployedAmount
Gets the total undeployed amount aggregated across currentIndividualPools
Returns
Name | Type | Description |
---|---|---|
_0 | uint256 | Total undeployed amount aggregated across currentIndividualPools |
grantRole
Grants role
to account
. If account
had not been already granted role
, emits a {RoleGranted} event. Requirements: - the caller must have role
's admin role.
Parameters
Name | Type | Description |
---|---|---|
role | bytes32 | undefined |
account | address | undefined |
hasRole
Returns true
if account
has been granted role
.
Parameters
Name | Type | Description |
---|---|---|
role | bytes32 | undefined |
account | address | undefined |
Returns
Name | Type | Description |
---|---|---|
_0 | bool | undefined |
increaseAllowance
Atomically increases the allowance granted to spender
by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - spender
cannot be the zero address.
Parameters
Name | Type | Description |
---|---|---|
spender | address | undefined |
addedValue | uint256 | undefined |
Returns
Name | Type | Description |
---|---|---|
_0 | bool | undefined |
individualPoolAllocations
Parameters
Name | Type | Description |
---|---|---|
_0 | address | undefined |
Returns
Name | Type | Description |
---|---|---|
_0 | uint256 | undefined |
initialize
Run only once, on initialization
Parameters
Name | Type | Description |
---|---|---|
_owner | address | The address that is assigned the "OWNER_ROLE" of this contract |
_config | contract ProtocolConfig | The address of the OpenGuild ProtocolConfig contract |
_poolToken | contract IERC20Upgradeable | The ERC20 token denominating investments, withdrawals and contributions |
_currentIndividualPools | address[] | The individual pools associated with this aggregate pool |
_currentPercentages | uint256[] | The percentage allocations associated with this aggregate pool |
_poolInvestmentLimit | uint256 | The cap of investments accepted by this pool |
_investorInvestmentLimit | uint256 | The maximum investment that an investor could make in the entire pool |
invest
Invests capital into the aggregate pool and distributes investments accordingly to individualPoolAllocationsOnly callable by an investor
Parameters
Name | Type | Description |
---|---|---|
amount | uint256 | Amount to be invested |
investorInvestmentLimit
Returns
Name | Type | Description |
---|---|---|
_0 | uint256 | undefined |
isAdmin
Returns
Name | Type | Description |
---|---|---|
_0 | bool | undefined |
name
Returns the name of the token.
Returns
Name | Type | Description |
---|---|---|
_0 | string | undefined |
pause
Pauses all functions guarded by Pause See {Pausable-_pause}. Requirements: - the caller must have the PAUSER_ROLE.
paused
Returns true if the contract is paused, and false otherwise.
Returns
Name | Type | Description |
---|---|---|
_0 | bool | undefined |
poolInvestmentLimit
Returns
Name | Type | Description |
---|---|---|
_0 | uint256 | undefined |
poolToken
Returns
Name | Type | Description |
---|---|---|
_0 | contract IERC20Upgradeable | undefined |
poolType
Returns
Name | Type | Description |
---|---|---|
_0 | enum ProtocolConfig.PoolType | undefined |
removeInvestors
Removes all addresses from the INVESTOR_ROLEOnly callable by the owner
Parameters
Name | Type | Description |
---|---|---|
investors | address[] | Addresses of the removed investors |
renounceRole
Revokes role
from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked role
, emits a {RoleRevoked} event. Requirements: - the caller must be account
.
Parameters
Name | Type | Description |
---|---|---|
role | bytes32 | undefined |
account | address | undefined |
revokeRole
Revokes role
from account
. If account
had been granted role
, emits a {RoleRevoked} event. Requirements: - the caller must have role
's admin role.
Parameters
Name | Type | Description |
---|---|---|
role | bytes32 | undefined |
account | address | undefined |
setInvestorInvestmentLimit
Set a new investor investment limitOnly callable by the owner
There are no checks for the minimum newLimit because if the limit is set to an amount lower than an investor's totalInvestedAmountForInvestor, then investors won't be able to make any new investments which is the expected behavior.
Parameters
Name | Type | Description |
---|---|---|
newLimit | uint256 | New investor investment limit |
setPoolAllocations
Sets the percentage of investments that should go into each poolOnly callable by pool manager
Parameters
Name | Type | Description |
---|---|---|
newPercentages | uint256[] | Corresponding allocation percentages to the individual pool addresses |
setPoolInvestmentLimit
Set a new pool investment limitOnly callable by the owner
There are no checks for the minimum newLimit because if the limit is set to an amount lower than the exisiting capital in the pool, then investors won't be able to make any new investments which is the expected behavior.
Parameters
Name | Type | Description |
---|---|---|
newLimit | uint256 | New pool investment limit |
setPoolManager
Replace the current pool manager with a new pool managerOnly callable by the owner
Parameters
Name | Type | Description |
---|---|---|
newPoolManager | address | Address of the new pool manager |
supportsInterface
See {IERC165-supportsInterface}.
Parameters
Name | Type | Description |
---|---|---|
interfaceId | bytes4 | undefined |
Returns
Name | Type | Description |
---|---|---|
_0 | bool | undefined |
symbol
Returns the symbol of the token, usually a shorter version of the name.
Returns
Name | Type | Description |
---|---|---|
_0 | string | undefined |
totalInvestedAmountForInvestor
Parameters
Name | Type | Description |
---|---|---|
_0 | address | undefined |
Returns
Name | Type | Description |
---|---|---|
_0 | uint256 | undefined |
totalSupply
See {IERC20-totalSupply}.
Returns
Name | Type | Description |
---|---|---|
_0 | uint256 | undefined |
transfer
See {IERC20-transfer}. Requirements: - recipient
cannot be the zero address. - the caller must have a balance of at least amount
.
Parameters
Name | Type | Description |
---|---|---|
recipient | address | undefined |
amount | uint256 | undefined |
Returns
Name | Type | Description |
---|---|---|
_0 | bool | undefined |
transferFrom
See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. Requirements: - sender
and recipient
cannot be the zero address. - sender
must have a balance of at least amount
. - the caller must have allowance for sender
's tokens of at least amount
.
Parameters
Name | Type | Description |
---|---|---|
sender | address | undefined |
recipient | address | undefined |
amount | uint256 | undefined |
Returns
Name | Type | Description |
---|---|---|
_0 | bool | undefined |
unpause
Unpauses the contract See {Pausable-_unpause}. Requirements: - the caller must have the Pauser role
Events
Approval
Parameters
Name | Type | Description |
---|---|---|
owner | address | undefined |
spender | address | undefined |
value | uint256 | undefined |
Claim
Parameters
Name | Type | Description |
---|---|---|
from | address | undefined |
amount | uint256 | undefined |
Contribute
Parameters
Name | Type | Description |
---|---|---|
from | address | undefined |
amount | uint256 | undefined |
Invest
Parameters
Name | Type | Description |
---|---|---|
from | address | undefined |
amount | uint256 | undefined |
Paused
Parameters
Name | Type | Description |
---|---|---|
account | address | undefined |
RemoveUndeployedCapital
Parameters
Name | Type | Description |
---|---|---|
remover | address | undefined |
RoleAdminChanged
Parameters
Name | Type | Description |
---|---|---|
role | bytes32 | undefined |
previousAdminRole | bytes32 | undefined |
newAdminRole | bytes32 | undefined |
RoleGranted
Parameters
Name | Type | Description |
---|---|---|
role | bytes32 | undefined |
account | address | undefined |
sender | address | undefined |
RoleRevoked
Parameters
Name | Type | Description |
---|---|---|
role | bytes32 | undefined |
account | address | undefined |
sender | address | undefined |
SetPoolAllocations
Parameters
Name | Type | Description |
---|---|---|
poolAddress | address | undefined |
Transfer
Parameters
Name | Type | Description |
---|---|---|
from | address | undefined |
to | address | undefined |
value | uint256 | undefined |
Unpaused
Parameters
Name | Type | Description |
---|---|---|
account | address | undefined |
Withdraw
Parameters
Name | Type | Description |
---|---|---|
from | address | undefined |
amount | uint256 | undefined |
Last updated