Skip to content

Commit

Permalink
Merge pull request #33 from neutral-protocol/miotto/lila-6102-update-…
Browse files Browse the repository at this point in the history
…pools-to-keep-track-of-tco2-supply

[LILA-6102] use new TCO2 supply method from Pool
  • Loading branch information
0xmichalis authored Jan 11, 2024
2 parents 8a3ffe4 + 98f2bc8 commit 5ded2d4
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/FeeCalculator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import "@openzeppelin/contracts/access/Ownable.sol";
import {SD59x18, sd, intoUint256} from "@prb/math/src/SD59x18.sol";

import "./interfaces/IFeeCalculator.sol";
import "./interfaces/IPool.sol";

/// @title FeeCalculator
/// @author Neutral Labs Inc.
Expand Down Expand Up @@ -230,7 +231,7 @@ contract FeeCalculator is IFeeCalculator, Ownable {
/// @param pool The address of the pool.
/// @return The total supply of the pool.
function getTotalSupply(address pool) private view returns (uint256) {
uint256 totalSupply = IERC20(pool).totalSupply();
uint256 totalSupply = IPool(pool).totalTCO2Supply();
return totalSupply;
}

Expand Down
16 changes: 16 additions & 0 deletions src/interfaces/IPool.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// SPDX-FileCopyrightText: 2023 Neutral Labs Inc.
//
// SPDX-License-Identifier: UNLICENSED

// If you encounter a vulnerability or an issue, please contact <[email protected]>
pragma solidity ^0.8.13;

/// @title IPool
/// @author Neutral Labs Inc.
/// @notice This interface defines methods exposed by the Pool
interface IPool {
/// @notice Exposes the total TCO2 supply, tracked as the aggregation of deposit,
/// redemmption and bridge actions
/// @return supply Current supply
function totalTCO2Supply() external view returns (uint256 supply);
}
4 changes: 4 additions & 0 deletions test/TestUtilities.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ contract MockPool is IERC20 {
return _totalSupply;
}

function totalTCO2Supply() external view returns (uint256) {
return _totalSupply;
}

function setTotalSupply(uint256 ts) public {
_totalSupply = ts;
}
Expand Down

0 comments on commit 5ded2d4

Please sign in to comment.