ebtc-protocol / ebtc

GNU General Public License v3.0
56 stars 25 forks source link

Add accounting data for collSurplus allocations #730

Closed dapp-whisperer closed 11 months ago

dapp-whisperer commented 1 year ago

Accounting event tweak to solve #729 for web2 team.

Small event change involving forwarding of information, given that we're doing notable audit mitigations it seemed appropriate so fit in this request.

CollSurplusPool

collSurplusPool.increaseSurplusCollShares now forwards along CdpId for the event, and splits the collSurplus to add between two variables, collateralShares and liquidatorRewardShares

collateralShares and liquidatorRewardShares are both added to the total new claimable balance for the user.

function increaseSurplusCollShares(
        bytes32 _cdpId,
        address _account,
        uint256 _collateralShares,
        uint256 _liquidatorRewardShares
    ) external;

This is ultimately to add addition data to this event, which is also renamed to show it is only for increases.

event SurplusCollSharesAdded(
        bytes32 indexed _cdpId,
        address indexed _account,
        uint256 _claimableSurplusCollShares,
        uint256 _surplusCollSharesAddedFromCollateral,
        uint256 _surplusCollSharesAddedFromLiquidatorReward
    );

It no longer plays double-duty with the "claimed" event which was added / slightly renamed.

event SurplusCollSharesClaimed(address indexed _account, uint256 _collShares);

we emit both that and event CollSharesTransferred(address indexed _to, uint256 _amount); to fit the paradigm established by the activePool.

This is a waste of gas to duplicate so will sync with @mrbasado to determine utility.

Needs some simple tests still