Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Arvolear committed Dec 19, 2023
1 parent 0813fb5 commit 4eea4dc
Show file tree
Hide file tree
Showing 25 changed files with 707 additions and 53 deletions.
23 changes: 23 additions & 0 deletions contracts/access-control/MultiOwnable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,45 @@ abstract contract MultiOwnable is IMultiOwnable, Initializable {
_addOwners(msg.sender.asSingletonArray());
}

/**
* @notice The function to add equally rightful owners to the contract
* @param newOwners_ the owners to be added
*/
function addOwners(address[] memory newOwners_) public override onlyOwner {
_addOwners(newOwners_);
}

/**
* @notice The function to remove owners from the contract
* @param oldOwners_ the owners to be removed. Note that one can remove themself
*/
function removeOwners(address[] memory oldOwners_) public override onlyOwner {
_removeOwners(oldOwners_);
}

/**
* @notice The function to remove yourself from the owners list
*
* Note: renouncing ownership may leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public override onlyOwner {
_removeOwners(msg.sender.asSingletonArray());
}

/**
* @notice The function to get the list of current owners. Be careful, O(n) complexity
* @return the list of current owners
*/
function getOwners() public view override returns (address[] memory) {
return _owners.values();
}

/**
* @notice The function to check the ownership of a user
* @param address_ the user to check
* @return true if address_ is owner, false otherwise
*/
function isOwner(address address_) public view override returns (bool) {
return _owners.contains(address_);
}
Expand Down
2 changes: 1 addition & 1 deletion contracts/access-control/RBAC.sol
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ abstract contract RBAC is IRBAC, Initializable {
}

/**
* @notice The init function
* @notice The initialization function
*/
function __RBAC_init() internal onlyInitializing {
_addPermissionsToRole(MASTER_ROLE, ALL_RESOURCE, ALL_PERMISSION.asSingletonArray(), true);
Expand Down
2 changes: 1 addition & 1 deletion contracts/access-control/extensions/RBACGroupable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ abstract contract RBACGroupable is IRBACGroupable, RBAC {
mapping(string => StringSet.Set) private _groupRoles;

/**
* @notice The init function
* @notice The initialization function
*/
function __RBACGroupable_init() internal onlyInitializing {
__RBAC_init();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ abstract contract AbstractCompoundRateKeeper is ICompoundRateKeeper, Initializab
uint256 private _currentRate;

/**
* @notice The proxy initializer function
* @notice The initialization function
*/
function __CompoundRateKeeper_init(
uint256 capitalizationRate_,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ import {AbstractCompoundRateKeeper} from "../AbstractCompoundRateKeeper.sol";
* @notice The Ownable preset of CompoundRateKeeper
*/
contract OwnableCompoundRateKeeper is AbstractCompoundRateKeeper, OwnableUpgradeable {
/**
* @notice The initialization function
* @param capitalizationRate_ the compound interest rate with 10\**25 precision
* @param capitalizationPeriod_ the compounding period in seconds
*/
function __OwnableCompoundRateKeeper_init(
uint256 capitalizationRate_,
uint64 capitalizationPeriod_
Expand All @@ -17,10 +22,18 @@ contract OwnableCompoundRateKeeper is AbstractCompoundRateKeeper, OwnableUpgrade
__CompoundRateKeeper_init(capitalizationRate_, capitalizationPeriod_);
}

/**
* The function to set the compound interest rate
* @param capitalizationRate_ new compound interest rate
*/
function setCapitalizationRate(uint256 capitalizationRate_) external onlyOwner {
_setCapitalizationRate(capitalizationRate_);
}

/**
* @notice The function to set the compounding period
* @param capitalizationPeriod_ new compounding period in seconds
*/
function setCapitalizationPeriod(uint64 capitalizationPeriod_) external onlyOwner {
_setCapitalizationPeriod(capitalizationPeriod_);
}
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts-registry/AbstractContractsRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ abstract contract AbstractContractsRegistry is Initializable {
event ContractRemoved(string name);

/**
* @notice The proxy initializer function
* @notice The initialization function
*/
function __ContractsRegistry_init() internal onlyInitializing {
_proxyUpgrader = new TransparentProxyUpgrader();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,32 @@ abstract contract MultiOwnablePoolContractsRegistry is
AbstractPoolContractsRegistry,
MultiOwnable
{
/**
* @notice The initialization function
*/
function __MultiOwnablePoolContractsRegistry_init() public initializer {
__MultiOwnable_init();
__PoolContractsRegistry_init();
}

/**
* @notice The function to set new implementation for the registered pools
* @param names_ the names of registered ProxyBeacons to upgrade
* @param newImplementations_ the addresses of new implementations to be used
*/
function setNewImplementations(
string[] calldata names_,
address[] calldata newImplementations_
) external onlyOwner {
_setNewImplementations(names_, newImplementations_);
}

/**
* @notice The function to inject dependencies to registered pools (via EIP-6224)
* @param name_ the name of ProxyBeacon to identify the pools
* @param offset_ the start index of the pools array
* @param limit_ the number of pools to inject dependencies to
*/
function injectDependenciesToExistingPools(
string calldata name_,
uint256 offset_,
Expand All @@ -31,6 +45,13 @@ abstract contract MultiOwnablePoolContractsRegistry is
_injectDependenciesToExistingPools(name_, offset_, limit_);
}

/**
* @notice The function to inject dependencies to registered pools with data (via EIP-6224)
* @param data_ the data to be passed to `setDependencies()` function
* @param name_ the name of ProxyBeacon to identify the pools
* @param offset_ the start index of the pools array
* @param limit_ the number of pools to inject dependencies to
*/
function injectDependenciesToExistingPoolsWithData(
string calldata name_,
bytes calldata data_,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,32 @@ abstract contract OwnablePoolContractsRegistry is
AbstractPoolContractsRegistry,
OwnableUpgradeable
{
/**
* @notice The initialization function
*/
function __OwnablePoolContractsRegistry_init() public initializer {
__Ownable_init();
__PoolContractsRegistry_init();
}

/**
* @notice The function to set new implementation for the registered pools
* @param names_ the names of registered ProxyBeacons to upgrade
* @param newImplementations_ the addresses of new implementations to be used
*/
function setNewImplementations(
string[] calldata names_,
address[] calldata newImplementations_
) external onlyOwner {
_setNewImplementations(names_, newImplementations_);
}

/**
* @notice The function to inject dependencies to registered pools (via EIP-6224)
* @param name_ the name of ProxyBeacon to identify the pools
* @param offset_ the start index of the pools array
* @param limit_ the number of pools to inject dependencies to
*/
function injectDependenciesToExistingPools(
string calldata name_,
uint256 offset_,
Expand All @@ -32,6 +46,13 @@ abstract contract OwnablePoolContractsRegistry is
_injectDependenciesToExistingPools(name_, offset_, limit_);
}

/**
* @notice The function to inject dependencies to registered pools with data (via EIP-6224)
* @param data_ the data to be passed to `setDependencies()` function
* @param name_ the name of ProxyBeacon to identify the pools
* @param offset_ the start index of the pools array
* @param limit_ the number of pools to inject dependencies to
*/
function injectDependenciesToExistingPoolsWithData(
string calldata name_,
bytes calldata data_,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,52 @@ import {MultiOwnable} from "../../access-control/MultiOwnable.sol";
* @notice The MultiOwnable preset of ContractsRegistry
*/
contract MultiOwnableContractsRegistry is AbstractContractsRegistry, MultiOwnable {
/**
* @notice The initialization function
*/
function __MultiOwnableContractsRegistry_init() public initializer {
__MultiOwnable_init();
__ContractsRegistry_init();
}

/**
* @notice The function to inject dependencies to the specified contract
* @param name_ the name of the contract to inject dependencies to
*/
function injectDependencies(string calldata name_) external onlyOwner {
_injectDependencies(name_);
}

/**
* @notice The function to inject dependencies with data to the specified contract
* @param name_ the name of the contract to inject dependencies to
* @param data_ the data to be passed to `setDependencies()` function
*/
function injectDependenciesWithData(
string calldata name_,
bytes calldata data_
) external onlyOwner {
_injectDependenciesWithData(name_, data_);
}

/**
* @notice The function to upgrade the specified proxy contract
* @param name_ the name of the proxy contract to upgrade
* @param newImplementation_ the new implementation
*/
function upgradeContract(
string calldata name_,
address newImplementation_
) external onlyOwner {
_upgradeContract(name_, newImplementation_);
}

/**
* @notice The function to upgrade the specified proxy contract with data
* @param name_ the name of the proxy contract to upgrade
* @param newImplementation_ the new implementation
* @param data_ the data the proxy contract will be called after the upgrade
*/
function upgradeContractAndCall(
string calldata name_,
address newImplementation_,
Expand All @@ -39,14 +62,30 @@ contract MultiOwnableContractsRegistry is AbstractContractsRegistry, MultiOwnabl
_upgradeContractAndCall(name_, newImplementation_, data_);
}

/**
* @notice The function to add the regular contract to the registry
* @param name_ the associative name of the contract
* @param contractAddress_ the address of the contract to add
*/
function addContract(string calldata name_, address contractAddress_) external onlyOwner {
_addContract(name_, contractAddress_);
}

/**
* @notice The function to add the proxy contract to the registry (deploys TransparentProxy on top)
* @param name_ the associative name of the contract
* @param contractAddress_ the address of the implementation contract to add
*/
function addProxyContract(string calldata name_, address contractAddress_) external onlyOwner {
_addProxyContract(name_, contractAddress_);
}

/**
* @notice The function to add the proxy contract to the registry with immediate call (deploys TransparentProxy on top)
* @param name_ the associative name of the contract
* @param contractAddress_ the address of the implementation contract to add
* @param data_ the data the proxy contract will be called after the addition
*/
function addProxyContractAndCall(
string calldata name_,
address contractAddress_,
Expand All @@ -55,13 +94,22 @@ contract MultiOwnableContractsRegistry is AbstractContractsRegistry, MultiOwnabl
_addProxyContractAndCall(name_, contractAddress_, data_);
}

/**
* @notice The function to add proxy contract to the registry as is
* @param name_ the associative name of the contract
* @param contractAddress_ the address of the proxy contract to add
*/
function justAddProxyContract(
string calldata name_,
address contractAddress_
) external onlyOwner {
_justAddProxyContract(name_, contractAddress_);
}

/**
* @notice The function to remove the contract from the registry
* @param name_ the the associative name of the contract to remove
*/
function removeContract(string calldata name_) external onlyOwner {
_removeContract(name_);
}
Expand Down
Loading

0 comments on commit 4eea4dc

Please sign in to comment.