From 8925155696a92ea0956fac55f1fb5011ea9f1ca1 Mon Sep 17 00:00:00 2001 From: rndquu Date: Mon, 14 Aug 2023 19:28:15 +0300 Subject: [PATCH 1/2] refactor: remove CreditNft mock --- .../src/dollar/mocks/MockCreditNft.sol | 69 ------------------- .../diamond/facets/BondingCurveFacet.t.sol | 6 +- .../test/diamond/facets/ChefFacet.t.sol | 16 +++-- .../facets/CreditNftManagerFacet.t.sol | 62 ++++++++++++----- .../CreditNftRedemptionCalculatorFacet.t.sol | 25 +++---- .../CreditRedemptionCalculatorFacet.t.sol | 17 +++-- .../test/diamond/facets/StakingFacet.t.sol | 16 +++-- .../diamond/facets/UbiquityPoolFacet.t.sol | 11 ++- .../test/helpers/LocalTestHelper.sol | 11 --- 9 files changed, 106 insertions(+), 127 deletions(-) delete mode 100644 packages/contracts/src/dollar/mocks/MockCreditNft.sol diff --git a/packages/contracts/src/dollar/mocks/MockCreditNft.sol b/packages/contracts/src/dollar/mocks/MockCreditNft.sol deleted file mode 100644 index 8f9535ee3..000000000 --- a/packages/contracts/src/dollar/mocks/MockCreditNft.sol +++ /dev/null @@ -1,69 +0,0 @@ -// contracts/GLDToken.sol -// SPDX-License-Identifier: MIT -pragma solidity 0.8.19; - -import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; - -contract MockCreditNft is ERC1155 { - uint256 private _totalOutstandingDebt; - uint256 public checkPoint; - mapping(address => mapping(uint256 => uint256)) _balances; - - event MintedCreditNft( - address recipient, - uint256 expiryBlock, - uint256 amount - ); - - event BurnedCreditNft( - address creditNftHolder, - uint256 expiryBlock, - uint256 amount - ); - - //@dev URI param is if we want to add an off-chain meta data uri associated with this contract - constructor(uint256 totalDebt) ERC1155("URI") { - _totalOutstandingDebt = totalDebt; - } - - function setTotalOutstandingDebt(uint256 totalDebt) public { - _totalOutstandingDebt = totalDebt; - } - - function getTotalOutstandingDebt() public view returns (uint256) { - return _totalOutstandingDebt; - } - - function updateTotalDebt() public { - checkPoint = block.number; - } - - function mintCreditNft( - address receiver, - uint256 amount, - uint256 expiryBlockNumber - ) public { - _balances[receiver][expiryBlockNumber] = - _balances[receiver][expiryBlockNumber] + - amount; - emit MintedCreditNft(receiver, expiryBlockNumber, amount); - } - - function balanceOf( - address receiver, - uint256 id - ) public view override returns (uint256) { - return _balances[receiver][id]; - } - - function burnCreditNft( - address creditNftOwner, - uint256 amount, - uint256 expiryBlockNumber - ) public { - uint256 _balance = _balances[creditNftOwner][expiryBlockNumber]; - require(_balance >= amount, "Insufficient balance"); - _balances[creditNftOwner][expiryBlockNumber] = _balance - amount; - emit BurnedCreditNft(creditNftOwner, expiryBlockNumber, amount); - } -} diff --git a/packages/contracts/test/diamond/facets/BondingCurveFacet.t.sol b/packages/contracts/test/diamond/facets/BondingCurveFacet.t.sol index f7a9cad6c..0b5ae68f6 100644 --- a/packages/contracts/test/diamond/facets/BondingCurveFacet.t.sol +++ b/packages/contracts/test/diamond/facets/BondingCurveFacet.t.sol @@ -5,7 +5,6 @@ import "../DiamondTestSetup.sol"; import "../../../src/dollar/libraries/Constants.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import {MockERC20} from "../../../src/dollar/mocks/MockERC20.sol"; -import {MockCreditNft} from "../../../src/dollar/mocks/MockCreditNft.sol"; import "forge-std/Test.sol"; contract BondingCurveFacetTest is DiamondSetup { @@ -29,7 +28,10 @@ contract BondingCurveFacetTest is DiamondSetup { super.setUp(); vm.startPrank(admin); - IAccessControl.grantRole(GOVERNANCE_TOKEN_MINTER_ROLE, address(diamond)); + IAccessControl.grantRole( + GOVERNANCE_TOKEN_MINTER_ROLE, + address(diamond) + ); vm.stopPrank(); } diff --git a/packages/contracts/test/diamond/facets/ChefFacet.t.sol b/packages/contracts/test/diamond/facets/ChefFacet.t.sol index 3db842191..157c4c934 100644 --- a/packages/contracts/test/diamond/facets/ChefFacet.t.sol +++ b/packages/contracts/test/diamond/facets/ChefFacet.t.sol @@ -10,7 +10,6 @@ import {IERC20Ubiquity} from "../../../src/dollar/interfaces/IERC20Ubiquity.sol" import {ICurveFactory} from "../../../src/dollar/interfaces/ICurveFactory.sol"; import {DollarMintCalculatorFacet} from "../../../src/dollar/facets/DollarMintCalculatorFacet.sol"; -import {MockCreditNft} from "../../../src/dollar/mocks/MockCreditNft.sol"; import {UbiquityCreditToken} from "../../../src/dollar/core/UbiquityCreditToken.sol"; import "../../../src/dollar/libraries/Constants.sol"; import {MockERC20} from "../../../src/dollar/mocks/MockERC20.sol"; @@ -127,9 +126,15 @@ contract ZeroStateChef is DiamondSetup { IAccessControl.grantRole(GOVERNANCE_TOKEN_MANAGER_ROLE, admin); IAccessControl.grantRole(CREDIT_NFT_MANAGER_ROLE, address(diamond)); - IAccessControl.grantRole(GOVERNANCE_TOKEN_MINTER_ROLE, address(diamond)); + IAccessControl.grantRole( + GOVERNANCE_TOKEN_MINTER_ROLE, + address(diamond) + ); - IAccessControl.grantRole(GOVERNANCE_TOKEN_BURNER_ROLE, address(diamond)); + IAccessControl.grantRole( + GOVERNANCE_TOKEN_BURNER_ROLE, + address(diamond) + ); UbiquityCreditToken creditToken = new UbiquityCreditToken( address(IManager) ); @@ -175,7 +180,10 @@ contract ZeroStateChef is DiamondSetup { vm.startPrank(admin); stakingShare = new StakingShare(address(diamond), uri); IManager.setStakingShareAddress(address(stakingShare)); - IAccessControl.grantRole(GOVERNANCE_TOKEN_MINTER_ROLE, address(diamond)); + IAccessControl.grantRole( + GOVERNANCE_TOKEN_MINTER_ROLE, + address(diamond) + ); IStakingFacet.setBlockCountInAWeek(420); vm.stopPrank(); diff --git a/packages/contracts/test/diamond/facets/CreditNftManagerFacet.t.sol b/packages/contracts/test/diamond/facets/CreditNftManagerFacet.t.sol index e30a7f278..1184bb866 100644 --- a/packages/contracts/test/diamond/facets/CreditNftManagerFacet.t.sol +++ b/packages/contracts/test/diamond/facets/CreditNftManagerFacet.t.sol @@ -9,11 +9,11 @@ import {DollarMintExcessFacet} from "../../../src/dollar/facets/DollarMintExcess import {TWAPOracleDollar3poolFacet} from "../../../src/dollar/facets/TWAPOracleDollar3poolFacet.sol"; import "../../../src/dollar/libraries/Constants.sol"; import {IERC20Ubiquity} from "../../../src/dollar/interfaces/IERC20Ubiquity.sol"; -import {MockCreditNft} from "../../../src/dollar/mocks/MockCreditNft.sol"; +import {CreditNft} from "../../../src/dollar/core/CreditNft.sol"; import {UbiquityCreditToken} from "../../../src/dollar/core/UbiquityCreditToken.sol"; contract CreditNftManagerFacetTest is DiamondSetup { - MockCreditNft _creditNft; + CreditNft _creditNft; address dollarManagerAddress; address dollarTokenAddress; address creditCalculatorAddress; @@ -32,7 +32,7 @@ contract CreditNftManagerFacetTest is DiamondSetup { uint256 admSupply = IDollar.balanceOf(admin); assertEq(admSupply, 10000e18); - _creditNft = new MockCreditNft(100); + _creditNft = new CreditNft(address(diamond)); vm.prank(admin); IManager.setCreditNftAddress(address(_creditNft)); @@ -54,6 +54,11 @@ contract CreditNftManagerFacetTest is DiamondSetup { vm.startPrank(admin); IAccessControl.grantRole(DOLLAR_TOKEN_MINTER_ROLE, address(this)); IAccessControl.grantRole(CREDIT_TOKEN_MINTER_ROLE, address(this)); + IAccessControl.grantRole( + GOVERNANCE_TOKEN_MINTER_ROLE, + address(diamond) + ); + IAccessControl.grantRole(CREDIT_NFT_MANAGER_ROLE, address(diamond)); vm.stopPrank(); } @@ -152,11 +157,7 @@ contract CreditNftManagerFacetTest is DiamondSetup { { address mockMessageSender = address(0x123); vm.prank(admin); - MockCreditNft(creditNftAddress).mintCreditNft( - mockMessageSender, - 100, - 500 - ); + CreditNft(creditNftAddress).mintCreditNft(mockMessageSender, 100, 500); vm.roll(1000); vm.prank(mockMessageSender); vm.expectRevert("User not enough Credit NFT"); @@ -167,7 +168,7 @@ contract CreditNftManagerFacetTest is DiamondSetup { address mockMessageSender = address(0x123); uint256 expiryBlockNumber = 500; vm.startPrank(admin); - MockCreditNft(creditNftAddress).mintCreditNft( + CreditNft(creditNftAddress).mintCreditNft( mockMessageSender, 2e18, expiryBlockNumber @@ -178,11 +179,13 @@ contract CreditNftManagerFacetTest is DiamondSetup { ); vm.stopPrank(); vm.roll(1000); - vm.prank(mockMessageSender); + vm.startPrank(mockMessageSender); + CreditNft(creditNftAddress).setApprovalForAll(address(diamond), true); ICreditNftManagerFacet.burnExpiredCreditNftForGovernance( expiryBlockNumber, 1e18 ); + vm.stopPrank(); uint256 governanceBalance = IERC20Ubiquity(governanceTokenAddress) .balanceOf(mockMessageSender); assertEq(governanceBalance, 5e17); @@ -204,7 +207,7 @@ contract CreditNftManagerFacetTest is DiamondSetup { address mockMessageSender = address(0x123); uint256 expiryBlockNumber = 500; vm.startPrank(admin); - MockCreditNft(creditNftAddress).mintCreditNft( + CreditNft(creditNftAddress).mintCreditNft( mockMessageSender, 2e18, expiryBlockNumber @@ -214,9 +217,11 @@ contract CreditNftManagerFacetTest is DiamondSetup { creditNftManagerAddress ); vm.stopPrank(); - vm.prank(mockMessageSender); + vm.startPrank(mockMessageSender); vm.warp(expiryBlockNumber - 1); + CreditNft(creditNftAddress).setApprovalForAll(address(diamond), true); ICreditNftManagerFacet.burnCreditNftForCredit(expiryBlockNumber, 1e18); + vm.stopPrank(); uint256 redeemBalance = UbiquityCreditToken(creditTokenAddress) .balanceOf(mockMessageSender); assertEq(redeemBalance, 1e18); @@ -262,10 +267,15 @@ contract CreditNftManagerFacetTest is DiamondSetup { } function test_redeemCreditNftRevertsIfNotEnoughBalance() public { + vm.startPrank(admin); + IAccessControl.grantRole(CREDIT_NFT_MANAGER_ROLE, address(this)); + IAccessControl.grantRole(GOVERNANCE_TOKEN_MINTER_ROLE, address(this)); + vm.stopPrank(); + mockTwapFuncs(2e18); address account1 = address(0x123); uint256 expiryBlockNumber = 123123; - MockCreditNft(creditNftAddress).mintCreditNft( + CreditNft(creditNftAddress).mintCreditNft( account1, 100, expiryBlockNumber @@ -277,10 +287,15 @@ contract CreditNftManagerFacetTest is DiamondSetup { } function test_redeemCreditNftRevertsIfNotEnoughDollars() public { + vm.startPrank(admin); + IAccessControl.grantRole(CREDIT_NFT_MANAGER_ROLE, address(this)); + IAccessControl.grantRole(GOVERNANCE_TOKEN_MINTER_ROLE, address(this)); + vm.stopPrank(); + mockTwapFuncs(2e18); address account1 = address(0x123); uint256 expiryBlockNumber = 123123; - MockCreditNft(creditNftAddress).mintCreditNft( + CreditNft(creditNftAddress).mintCreditNft( account1, 100, expiryBlockNumber @@ -306,11 +321,16 @@ contract CreditNftManagerFacetTest is DiamondSetup { } function test_redeemCreditNftRevertsIfZeroAmountOfDollars() public { + vm.startPrank(admin); + IAccessControl.grantRole(CREDIT_NFT_MANAGER_ROLE, address(this)); + IAccessControl.grantRole(GOVERNANCE_TOKEN_MINTER_ROLE, address(this)); + vm.stopPrank(); + mockTwapFuncs(2e18); mockDollarMintCalcFuncs(0); address account1 = address(0x123); uint256 expiryBlockNumber = 123123; - MockCreditNft(creditNftAddress).mintCreditNft( + CreditNft(creditNftAddress).mintCreditNft( account1, 100, expiryBlockNumber @@ -334,11 +354,16 @@ contract CreditNftManagerFacetTest is DiamondSetup { } function test_redeemCreditNftWorks() public { + vm.startPrank(admin); + IAccessControl.grantRole(CREDIT_NFT_MANAGER_ROLE, address(this)); + IAccessControl.grantRole(GOVERNANCE_TOKEN_MINTER_ROLE, address(this)); + vm.stopPrank(); + mockTwapFuncs(2e18); mockDollarMintCalcFuncs(20000e18); address account1 = address(0x123); uint256 expiryBlockNumber = 123123; - MockCreditNft(creditNftAddress).mintCreditNft( + CreditNft(creditNftAddress).mintCreditNft( account1, 100, expiryBlockNumber @@ -356,12 +381,15 @@ contract CreditNftManagerFacetTest is DiamondSetup { ), abi.encode() ); - vm.prank(account1); + vm.startPrank(account1); + CreditNft(creditNftAddress).setApprovalForAll(address(diamond), true); vm.roll(expiryBlockNumber - 1); uint256 unredeemedCreditNft = ICreditNftManagerFacet.redeemCreditNft( expiryBlockNumber, 99 ); + vm.stopPrank(); + assertEq(unredeemedCreditNft, 0); } diff --git a/packages/contracts/test/diamond/facets/CreditNftRedemptionCalculatorFacet.t.sol b/packages/contracts/test/diamond/facets/CreditNftRedemptionCalculatorFacet.t.sol index a8bd9f39f..a3a5a8e98 100644 --- a/packages/contracts/test/diamond/facets/CreditNftRedemptionCalculatorFacet.t.sol +++ b/packages/contracts/test/diamond/facets/CreditNftRedemptionCalculatorFacet.t.sol @@ -2,10 +2,10 @@ pragma solidity ^0.8.19; import "../DiamondTestSetup.sol"; -import {MockCreditNft} from "../../../src/dollar/mocks/MockCreditNft.sol"; +import {CreditNft} from "../../../src/dollar/core/CreditNft.sol"; contract CreditNftRedemptionCalculatorFacetTest is DiamondSetup { - MockCreditNft _creditNft; + CreditNft _creditNft; function setUp() public virtual override { super.setUp(); @@ -13,26 +13,27 @@ contract CreditNftRedemptionCalculatorFacetTest is DiamondSetup { IDollar.mint(admin, 10000e18); uint256 admSupply = IDollar.balanceOf(admin); assertEq(admSupply, 10000e18); - _creditNft = new MockCreditNft(100); - vm.prank(admin); + _creditNft = new CreditNft(address(diamond)); + + vm.startPrank(admin); IManager.setCreditNftAddress(address(_creditNft)); + IAccessControl.grantRole(CREDIT_NFT_MANAGER_ROLE, address(this)); + IAccessControl.grantRole(GOVERNANCE_TOKEN_MINTER_ROLE, address(this)); + vm.stopPrank(); } function test_getCreditNftAmount_revertsIfDebtTooHigh() public { - uint256 totalSupply = IDollar.totalSupply(); - MockCreditNft(IManager.creditNftAddress()).setTotalOutstandingDebt( - totalSupply + 1 - ); - + _creditNft.mintCreditNft(user1, 100000 ether, 1000); vm.expectRevert("CreditNft to Dollar: DEBT_TOO_HIGH"); ICreditNftRedemptionCalculationFacet.getCreditNftAmount(0); } function test_getCreditNftAmount() public { uint256 totalSupply = IDollar.totalSupply(); - MockCreditNft(IManager.creditNftAddress()).setTotalOutstandingDebt( - totalSupply / 2 + _creditNft.mintCreditNft(user1, 5000 ether, 10); + assertEq( + ICreditNftRedemptionCalculationFacet.getCreditNftAmount(10000), + 40000 ); - assertEq(ICreditNftRedemptionCalculationFacet.getCreditNftAmount(10000), 40000); } } diff --git a/packages/contracts/test/diamond/facets/CreditRedemptionCalculatorFacet.t.sol b/packages/contracts/test/diamond/facets/CreditRedemptionCalculatorFacet.t.sol index ff0db23f9..35bdffb59 100644 --- a/packages/contracts/test/diamond/facets/CreditRedemptionCalculatorFacet.t.sol +++ b/packages/contracts/test/diamond/facets/CreditRedemptionCalculatorFacet.t.sol @@ -2,11 +2,11 @@ pragma solidity ^0.8.19; import "../DiamondTestSetup.sol"; -import {MockCreditNft} from "../../../src/dollar/mocks/MockCreditNft.sol"; +import {CreditNft} from "../../../src/dollar/core/CreditNft.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; contract CreditRedemptionCalculatorFacetTest is DiamondSetup { - MockCreditNft _creditNft; + CreditNft _creditNft; function setUp() public virtual override { super.setUp(); @@ -14,9 +14,13 @@ contract CreditRedemptionCalculatorFacetTest is DiamondSetup { IDollar.mint(admin, 10000e18); uint256 admSupply = IDollar.balanceOf(admin); assertEq(admSupply, 10000e18); - _creditNft = new MockCreditNft(100); - vm.prank(admin); + + _creditNft = new CreditNft(address(diamond)); + vm.startPrank(admin); + IAccessControl.grantRole(CREDIT_NFT_MANAGER_ROLE, address(this)); + _creditNft.mintCreditNft(user1, 100, 10); IManager.setCreditNftAddress(address(_creditNft)); + vm.stopPrank(); } function testSetConstant_ShouldRevert_IfCalledNotByAdmin() public { @@ -42,7 +46,10 @@ contract CreditRedemptionCalculatorFacetTest is DiamondSetup { } function testGetCreditAmount_ShouldReturnAmount() public { - uint256 amount = ICreditRedemptionCalculationFacet.getCreditAmount(1 ether, 10); + uint256 amount = ICreditRedemptionCalculationFacet.getCreditAmount( + 1 ether, + 10 + ); assertEq(amount, 9999999999999999999); } } diff --git a/packages/contracts/test/diamond/facets/StakingFacet.t.sol b/packages/contracts/test/diamond/facets/StakingFacet.t.sol index 61476f39d..32da8f569 100644 --- a/packages/contracts/test/diamond/facets/StakingFacet.t.sol +++ b/packages/contracts/test/diamond/facets/StakingFacet.t.sol @@ -10,7 +10,6 @@ import {IERC20Ubiquity} from "../../../src/dollar/interfaces/IERC20Ubiquity.sol" import {ICurveFactory} from "../../../src/dollar/interfaces/ICurveFactory.sol"; import {DollarMintCalculatorFacet} from "../../../src/dollar/facets/DollarMintCalculatorFacet.sol"; -import {MockCreditNft} from "../../../src/dollar/mocks/MockCreditNft.sol"; import {CreditNftManagerFacet} from "../../../src/dollar/facets/CreditNftManagerFacet.sol"; import {UbiquityCreditToken} from "../../../src/dollar/core/UbiquityCreditToken.sol"; import {DollarMintExcessFacet} from "../../../src/dollar/facets/DollarMintExcessFacet.sol"; @@ -134,9 +133,15 @@ contract ZeroStateStaking is DiamondSetup { IAccessControl.grantRole(GOVERNANCE_TOKEN_MANAGER_ROLE, admin); IAccessControl.grantRole(CREDIT_NFT_MANAGER_ROLE, address(diamond)); - IAccessControl.grantRole(GOVERNANCE_TOKEN_MINTER_ROLE, address(diamond)); + IAccessControl.grantRole( + GOVERNANCE_TOKEN_MINTER_ROLE, + address(diamond) + ); - IAccessControl.grantRole(GOVERNANCE_TOKEN_BURNER_ROLE, address(diamond)); + IAccessControl.grantRole( + GOVERNANCE_TOKEN_BURNER_ROLE, + address(diamond) + ); UbiquityCreditToken creditToken = new UbiquityCreditToken( address(IManager) ); @@ -182,7 +187,10 @@ contract ZeroStateStaking is DiamondSetup { vm.startPrank(admin); stakingShare = new StakingShare(address(diamond), uri); IManager.setStakingShareAddress(address(stakingShare)); - IAccessControl.grantRole(GOVERNANCE_TOKEN_MINTER_ROLE, address(diamond)); + IAccessControl.grantRole( + GOVERNANCE_TOKEN_MINTER_ROLE, + address(diamond) + ); IStakingFacet.setBlockCountInAWeek(420); vm.stopPrank(); diff --git a/packages/contracts/test/diamond/facets/UbiquityPoolFacet.t.sol b/packages/contracts/test/diamond/facets/UbiquityPoolFacet.t.sol index 249458be6..60ebcc80b 100644 --- a/packages/contracts/test/diamond/facets/UbiquityPoolFacet.t.sol +++ b/packages/contracts/test/diamond/facets/UbiquityPoolFacet.t.sol @@ -12,7 +12,6 @@ import {IERC20Ubiquity} from "../../../src/dollar/interfaces/IERC20Ubiquity.sol" import {StakingShare} from "../../../src/dollar/core/StakingShare.sol"; import {BondingShare} from "../../../src/dollar/mocks/MockShareV1.sol"; import {DollarMintCalculatorFacet} from "../../../src/dollar/facets/DollarMintCalculatorFacet.sol"; -import {MockCreditNft} from "../../../src/dollar/mocks/MockCreditNft.sol"; import {UbiquityCreditToken} from "../../../src/dollar/core/UbiquityCreditToken.sol"; contract UbiquityPoolFacetTest is DiamondSetup { @@ -105,9 +104,15 @@ contract UbiquityPoolFacetTest is DiamondSetup { IAccessControl.grantRole(GOVERNANCE_TOKEN_MANAGER_ROLE, admin); IAccessControl.grantRole(CREDIT_NFT_MANAGER_ROLE, address(diamond)); - IAccessControl.grantRole(GOVERNANCE_TOKEN_MINTER_ROLE, address(diamond)); + IAccessControl.grantRole( + GOVERNANCE_TOKEN_MINTER_ROLE, + address(diamond) + ); - IAccessControl.grantRole(GOVERNANCE_TOKEN_BURNER_ROLE, address(diamond)); + IAccessControl.grantRole( + GOVERNANCE_TOKEN_BURNER_ROLE, + address(diamond) + ); UbiquityCreditToken creditToken = new UbiquityCreditToken( address(IManager) ); diff --git a/packages/contracts/test/helpers/LocalTestHelper.sol b/packages/contracts/test/helpers/LocalTestHelper.sol index c3d94bd75..d93734958 100644 --- a/packages/contracts/test/helpers/LocalTestHelper.sol +++ b/packages/contracts/test/helpers/LocalTestHelper.sol @@ -1,7 +1,6 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {MockCreditNft} from "../../src/dollar/mocks/MockCreditNft.sol"; import {MockTWAPOracleDollar3pool} from "../../src/dollar/mocks/MockTWAPOracleDollar3pool.sol"; import {DiamondSetup} from "../diamond/DiamondTestSetup.sol"; import {ManagerFacet} from "../../src/dollar/facets/ManagerFacet.sol"; @@ -15,16 +14,6 @@ import {UbiquityDollarToken} from "../../src/dollar/core/UbiquityDollarToken.sol import {UbiquityCreditToken} from "../../src/dollar/core/UbiquityCreditToken.sol"; import {MockMetaPool} from "../../src/dollar/mocks/MockMetaPool.sol"; -contract MockCreditNftRedemptionCalculator { - constructor() {} - - function getCreditNftAmount( - uint256 dollarsToBurn - ) external pure returns (uint256) { - return dollarsToBurn; - } -} - abstract contract LocalTestHelper is DiamondSetup { address public constant NATIVE_ASSET = address(0); address curve3CRVTokenAddress = address(0x101); From 3446e6e0916f2a9f71825c7a38a9021190a7f704 Mon Sep 17 00:00:00 2001 From: rndquu Date: Mon, 14 Aug 2023 19:34:47 +0300 Subject: [PATCH 2/2] refactor: remove unused var --- .../test/diamond/facets/CreditNftRedemptionCalculatorFacet.t.sol | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/contracts/test/diamond/facets/CreditNftRedemptionCalculatorFacet.t.sol b/packages/contracts/test/diamond/facets/CreditNftRedemptionCalculatorFacet.t.sol index a3a5a8e98..19ce7bc53 100644 --- a/packages/contracts/test/diamond/facets/CreditNftRedemptionCalculatorFacet.t.sol +++ b/packages/contracts/test/diamond/facets/CreditNftRedemptionCalculatorFacet.t.sol @@ -29,7 +29,6 @@ contract CreditNftRedemptionCalculatorFacetTest is DiamondSetup { } function test_getCreditNftAmount() public { - uint256 totalSupply = IDollar.totalSupply(); _creditNft.mintCreditNft(user1, 5000 ether, 10); assertEq( ICreditNftRedemptionCalculationFacet.getCreditNftAmount(10000),