From 98f2bc89aad3f4e2a41a22953e62add999018da1 Mon Sep 17 00:00:00 2001 From: Nicola Miotto Date: Thu, 11 Jan 2024 14:03:19 +0100 Subject: [PATCH] feat: use new pool tco2 supply method --- src/FeeCalculator.sol | 3 ++- src/interfaces/IPool.sol | 16 ++++++++++++++++ test/TestUtilities.sol | 4 ++++ 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 src/interfaces/IPool.sol diff --git a/src/FeeCalculator.sol b/src/FeeCalculator.sol index 21423aa..be322e2 100644 --- a/src/FeeCalculator.sol +++ b/src/FeeCalculator.sol @@ -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. @@ -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; } diff --git a/src/interfaces/IPool.sol b/src/interfaces/IPool.sol new file mode 100644 index 0000000..331527a --- /dev/null +++ b/src/interfaces/IPool.sol @@ -0,0 +1,16 @@ +// SPDX-FileCopyrightText: 2023 Neutral Labs Inc. +// +// SPDX-License-Identifier: UNLICENSED + +// If you encounter a vulnerability or an issue, please contact +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); +} diff --git a/test/TestUtilities.sol b/test/TestUtilities.sol index 18aa509..0fc0e9a 100644 --- a/test/TestUtilities.sol +++ b/test/TestUtilities.sol @@ -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; }