From a555845a918cf4ba55d6afef0127785c2ed38763 Mon Sep 17 00:00:00 2001 From: Kresh Date: Mon, 3 Jun 2024 13:42:28 +0400 Subject: [PATCH] remove redundant mock --- examples/DelayedRepayCollateral.sol | 3 +- examples/InstantRepayCollateral.sol | 3 +- test/mocks/SimpleCollateral.sol | 97 ----------------------------- 3 files changed, 4 insertions(+), 99 deletions(-) delete mode 100644 test/mocks/SimpleCollateral.sol diff --git a/examples/DelayedRepayCollateral.sol b/examples/DelayedRepayCollateral.sol index cd1ceba..3468dd1 100644 --- a/examples/DelayedRepayCollateral.sol +++ b/examples/DelayedRepayCollateral.sol @@ -8,6 +8,7 @@ import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; +// WARNING: NOT FOR PRODUCTION USE contract DelayedRepayCollateral is ERC20, Ownable, ICollateral { using SafeERC20 for IERC20; @@ -59,7 +60,7 @@ contract DelayedRepayCollateral is ERC20, Ownable, ICollateral { mapping(address issuer => mapping(address recipient => uint256 amount)) public debt; constructor(address asset_) - ERC20(string.concat("DefaultCollateral_", ERC20(asset_).name()), string.concat("DB_", ERC20(asset_).symbol())) + ERC20(string.concat("DelayedRepayCollateral_", ERC20(asset_).name()), string.concat("DRC_", ERC20(asset_).symbol())) Ownable(msg.sender) { asset = asset_; diff --git a/examples/InstantRepayCollateral.sol b/examples/InstantRepayCollateral.sol index 900971a..f3efc66 100644 --- a/examples/InstantRepayCollateral.sol +++ b/examples/InstantRepayCollateral.sol @@ -7,6 +7,7 @@ import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; +// WARNING: NOT FOR PRODUCTION USE contract InstantRepayCollateral is ERC20, ICollateral { using SafeERC20 for IERC20; @@ -58,7 +59,7 @@ contract InstantRepayCollateral is ERC20, ICollateral { mapping(address issuer => mapping(address recipient => uint256 amount)) public debt; constructor(address asset_) - ERC20(string.concat("DefaultCollateral_", ERC20(asset_).name()), string.concat("DB_", ERC20(asset_).symbol())) + ERC20(string.concat("InstantRepayCollateral_", ERC20(asset_).name()), string.concat("IRC_", ERC20(asset_).symbol())) { asset = asset_; diff --git a/test/mocks/SimpleCollateral.sol b/test/mocks/SimpleCollateral.sol deleted file mode 100644 index 0c7e68a..0000000 --- a/test/mocks/SimpleCollateral.sol +++ /dev/null @@ -1,97 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity 0.8.25; - -import {ICollateral} from "src/interfaces/ICollateral.sol"; - -import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; -import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; -import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; - -contract SimpleCollateral is ERC20, ICollateral { - using SafeERC20 for IERC20; - - uint8 private immutable DECIMALS; - - /** - * @inheritdoc ICollateral - */ - address public asset; - - /** - * @inheritdoc ICollateral - */ - uint256 public totalRepaidDebt; - - /** - * @inheritdoc ICollateral - */ - mapping(address issuer => uint256 amount) public issuerRepaidDebt; - - /** - * @inheritdoc ICollateral - */ - mapping(address recipient => uint256 amount) public recipientRepaidDebt; - - /** - * @inheritdoc ICollateral - */ - mapping(address issuer => mapping(address recipient => uint256 amount)) public repaidDebt; - - /** - * @inheritdoc ICollateral - */ - uint256 public totalDebt; - - /** - * @inheritdoc ICollateral - */ - mapping(address issuer => uint256 amount) public issuerDebt; - - /** - * @inheritdoc ICollateral - */ - mapping(address recipient => uint256 amount) public recipientDebt; - - /** - * @inheritdoc ICollateral - */ - mapping(address issuer => mapping(address recipient => uint256 amount)) public debt; - - constructor(address asset_) - ERC20(string.concat("DefaultCollateral_", ERC20(asset_).name()), string.concat("DB_", ERC20(asset_).symbol())) - { - asset = asset_; - - DECIMALS = ERC20(asset).decimals(); - } - - function decimals() public view override returns (uint8) { - return DECIMALS; - } - - function mint(uint256 amount) public { - if (amount == 0) { - revert(); - } - - _mint(msg.sender, amount); - } - - /** - * @inheritdoc ICollateral - */ - function issueDebt(address recipient, uint256 amount) external override { - if (amount == 0) { - revert(); - } - - _burn(msg.sender, amount); - - totalDebt += amount; - issuerDebt[msg.sender] += amount; - recipientDebt[recipient] += amount; - debt[msg.sender][recipient] += amount; - - emit IssueDebt(msg.sender, recipient, amount); - } -}