Skip to content

Commit

Permalink
add: ubipool subgraph
Browse files Browse the repository at this point in the history
  • Loading branch information
sirpy committed Jul 31, 2024
1 parent 265ca32 commit a1fabe0
Show file tree
Hide file tree
Showing 12 changed files with 6,841 additions and 6,544 deletions.
11 changes: 10 additions & 1 deletion packages/contracts/contracts/UBI/UBIPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ contract UBIPool is AccessControlUpgradeable, GoodCollectiveSuperApp, UUPSUpgrad
registry = _registry;
settings = _settings;
ubiSettings = _ubiSettings;
_verifyPoolSettings(_settings);
_verifyUBISettings(_ubiSettings);
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
_setupRole(MANAGER_ROLE, _settings.manager);
Expand Down Expand Up @@ -321,7 +322,7 @@ contract UBIPool is AccessControlUpgradeable, GoodCollectiveSuperApp, UUPSUpgrad
* @param _settings The new pool settings.
*/
function setPoolSettings(PoolSettings memory _settings) public onlyRole(MANAGER_ROLE) {
if (_settings.manager == address(0)) revert EMPTY_MANAGER();
_verifyPoolSettings(_settings);

if (_settings.manager != settings.manager) {
_revokeRole(MANAGER_ROLE, settings.manager);
Expand All @@ -331,6 +332,14 @@ contract UBIPool is AccessControlUpgradeable, GoodCollectiveSuperApp, UUPSUpgrad
emit PoolSettingsChanged(_settings);
}

function _verifyPoolSettings(PoolSettings memory _poolSettings) internal pure {
if (
_poolSettings.manager == address(0) ||
address(_poolSettings.uniquenessValidator) == address(0) ||
address(_poolSettings.rewardToken) == address(0)
) revert INVALID_0_VALUE();
}

function estimateNextDailyUBI() public view returns (uint256) {
uint256 currentBalance = settings.rewardToken.balanceOf(address(this));
//start early cycle if we can increase the daily UBI pool
Expand Down
Loading

0 comments on commit a1fabe0

Please sign in to comment.