8000 Remote GSM by efecarranza · Pull Request #451 · aave/gho-core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Remote GSM #451

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open

Remote GSM #451

wants to merge 16 commits into from

Conversation

efecarranza
Copy link
Contributor

Changelog

Add RemoteGSM Implementation
Abstract methods on GSM

8000
@efecarranza
Copy link
Contributor Author

@miguelmtzinf all comments have been addressed, thanks for the name suggestions, didn't know what to use!
GhoRemoteVault is a work in progress so any other feedback is more than welcome.

@@ -43,14 +44,14 @@ contract Gsm4626 is Gsm, IGsm4626 {
) external notSeized onlyRole(CONFIGURATOR_ROLE) returns (uint256) {
require(amount > 0, 'INVALID_AMOUNT');

(, uint256 ghoMinted) = IGhoToken(GHO_TOKEN).getFacilitatorBucket(address(this));
(, uint256 deficit) = _getCurrentBacking(ghoMinted);
uint256 ghoUsed = _getUsedGho();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change to usedGho for consistency


/// Map of entities and their assigned capacity and amount of GHO used
mapping(address => GhoUsage) private _ghoUsage;

Copy link
Contributor
@miguelmtzinf miguelmtzinf May 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if we should add global variables for total limit and total used. It's a bit hard to iterate over entities also, to calculate totals

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would total limit be every time we set a limit +/- to the global variable? For used it's easy to keep track

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, would be keeping global accounting every time an entity updates its usage (limit or used). Not sure it's completely needed

Comment on lines +46 to +49
GhoUsage memory usage = _ghoUsage[msg.sender];
require(usage.limit >= usage.used + amount, 'LIMIT_REACHED');

_ghoUsage[msg.sender].used += uint128(amount);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
GhoUsage memory usage = _ghoUsage[msg.sender];
require(usage.limit >= usage.used + amount, 'LIMIT_REACHED');
_ghoUsage[msg.sender].used += uint128(amount);
GhoUsage storage entity = _ghoUsage[msg.sender];
require(entity.limit >= entity.used + amount, 'LIMIT_REACHED');
entity.used += uint128(amount);

}

/// @inheritdoc IGhoReserve
function setEntityLimit(address entity, uint256 limit) external onlyOwner {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
function setEntityLimit(address entity, uint256 limit) external onlyOwner {
function setLimit(address entity, uint256 limit) external onlyOwner {

*/
interface IGhoReserve {
/**
* Struct representing GSM's maximum allowed GHO usage and amount used
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Struct representing GSM's maximum allowed GHO usage and amount used
* @dev Struct data representing GHO usage.

Comment on lines +85 to +86
* @notice Returns amount of GHO used by a specified address
* @param entity Address of the contract that withdrew GHO from reserve
Copy link
Contributor
@miguelmtzinf miguelmtzinf May 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @notice Returns amount of GHO used by a specified address
* @param entity Address of the contract that withdrew GHO from reserve
* @notice Returns the amount of GHO used by a specified entity
* @param entity The address of the entity
* @return The amount of GHO used

Comment on lines +91 to +94
* @notice Returns limit of GHO and used amount for a given entity
* @param entity Address of the contract that can use GHO from reserve
* @return Limit of GHO that can be used
* @return Used amount
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @notice Returns limit of GHO and used amount for a given entity
* @param entity Address of the contract that can use GHO from reserve
* @return Limit of GHO that can be used
* @return Used amount
* @notice Returns the usage data of a specified entity
* @param entity The address of the entity
* @return The usage limit
* @return The amount of GHO used

Comment on lines +99 to +100
* @notice Returns maximum amount of GHO that can be used by a specified address
* @param entity Address of the contract that uses GHO from reserve
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @notice Returns maximum amount of GHO that can be used by a specified address
* @param entity Address of the contract that uses GHO from reserve
* @notice Returns the usage limit of a specified entity
* @param entity The address of the entity
* @return The usage limit

* @param entity The address that can use GHO
* @param limit The maximum usage limit of the entity
*/
event EntityLimitUpdated(address indexed entity, uint256 limit);
Copy link
Contributor
@miguelmtzinf miguelmtzinf May 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feels more aligned

Suggested change
event EntityLimitUpdated(address indexed entity, uint256 limit);
event GhoLimitUpdated(address indexed entity, uint256 limit);

Comment on lines +43 to +44
* @param entity The address that can use GHO
* @param limit The maximum usage limit of the entity
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param entity The address that can use GHO
* @param limit The maximum usage limit of the entity
* @param entity The address of the entity
* @param limit The new usage limit

Comment on lines +26 to +28
_transferOwnership(initialOwner);

GHO_TOKEN = ghoAddress;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_transferOwnership(initialOwner);
GHO_TOKEN = ghoAddress;
_transferOwnership(initialOwner);
GHO_TOKEN = ghoAddress;

Comment on lines +19 to +20
* @param initialOwner Address of the initial owner of the contract
* @param ghoAddress Address of GHO token on mainnet
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param initialOwner Address of the initial owner of the contract
* @param ghoAddress Address of GHO token on mainnet
* @param initialOwner The address of the initial owner
* @param ghoAddress The address of GHO token

Comment on lines +121 to +122
uint256 ghoLevel = _getUsedGho();
uint256 ghoLimit = _getLimit();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we create an internal function _getUsage that returns both?
apart from that, let's rename Level to Used please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0