ebtc-protocol / ebtc

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

Feat/governance wireup v2 #767

Closed sajanrajdev closed 9 months ago

sajanrajdev commented 10 months ago

The following changes were introduced:

NOTE: Making the fee recipient immutable means, of course, that the address used upon deployment will not be changeable. An opportunity exists for this recipient to be a proxy of some sorts instead of a multisig to allow for a certain degree of flexibility. In the same way as the multisig, any alternative contract should be owned by the Treasury. For this reason, this should be decided by the Treasury.

getrecon-bot commented 10 months ago
Job ID 7a489f4c-6a43-40a3-9ad8-d75dc5cbd7dc
Command yarn && git submodule init && git submodule update && solc-select use 0.8.17 && cd packages/contracts/ && yarn echidna --test-mode assertion --test-limit 600000
Instance ID i-0b73b64e762bbf5cf
Instance Type c5.2xlarge
Status Started
Elapsed
getrecon-bot commented 10 months ago
Job ID 7a489f4c-6a43-40a3-9ad8-d75dc5cbd7dc
Command yarn && git submodule init && git submodule update && solc-select use 0.8.17 && cd packages/contracts/ && yarn echidna --test-mode assertion --test-limit 600000
Instance ID i-0b73b64e762bbf5cf
Instance Type c5.2xlarge
Status Running
Elapsed 37 seconds
getrecon-bot commented 10 months ago
Job ID 7a489f4c-6a43-40a3-9ad8-d75dc5cbd7dc
Command yarn && git submodule init && git submodule update && solc-select use 0.8.17 && cd packages/contracts/ && yarn echidna --test-mode assertion --test-limit 600000
Instance ID i-0b73b64e762bbf5cf
Instance Type c5.2xlarge
Status Running
Elapsed 38 seconds
CodingNameKiki commented 10 months ago

Hey @sajanrajdev.

In the constructor of coll surplus pool, the feeRecipientAddress is fetched from the active pool storage.

CollSurplusPool.sol

        feeRecipientAddress = IActivePool(activePoolAddress).feeRecipientAddress();

The question is - can we refactor the constructor of active pool to fetch the fee recipient address from BorrowerOperations as well. If l understood correctly BorrowerOperations will be deployed before both pools so we can do this change instead of setting the fee recipient two times in both contracts.

Final result - borrower operations is deployed with a particular fee recipient address and both active & surplus pools use this address as fee recipient.

ActivePool.sol

    constructor(
        address _borrowerOperationsAddress,
        address _cdpManagerAddress,
        address _collTokenAddress,
        address _collSurplusAddress,
        address _feeRecipientAddress
    ) TwapWeightedObserver(0) {
        borrowerOperationsAddress = _borrowerOperationsAddress;
        cdpManagerAddress = _cdpManagerAddress;
        collateral = ICollateralToken(_collTokenAddress);
        collSurplusPoolAddress = _collSurplusAddress;
-       feeRecipientAddress = _feeRecipientAddress;
+       feeRecipientAddress = IBorrowerOperations(borrowerOperationsAddress).feeRecipientAddress();;

        // TEMP: read authority to avoid signature change
        address _authorityAddress = address(AuthNoOwner(cdpManagerAddress).authority());
        if (_authorityAddress != address(0)) {
            _initializeAuthority(_authorityAddress);
        }

        require(systemDebt == 0, "ActivePool: systemDebt should be 0 for TWAP initialization");
    }
sajanrajdev commented 9 months ago

Good call @CodingNameKiki, might as well have only one input of this variable into the system and remove the room for error at setup. Will make the change.