Skip to content

Commit

Permalink
feat: remove reentrancy guards from mint functions
Browse files Browse the repository at this point in the history
they didn't add any value as the mint functions
only interact with trusted contracts and tokens
  • Loading branch information
chapati23 committed Oct 15, 2024
1 parent 3409a44 commit 99bd07c
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions contracts/goodDollar/GoodDollarExpansionController.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { IERC20 } from "openzeppelin-contracts-next/contracts/token/ERC20/IERC20
import { IGoodDollar } from "contracts/goodDollar/interfaces/IGoodProtocol.sol";
import { IDistributionHelper } from "contracts/goodDollar/interfaces/IGoodProtocol.sol";

import { ReentrancyGuard } from "openzeppelin-contracts-next/contracts/security/ReentrancyGuard.sol";
import { PausableUpgradeable } from "openzeppelin-contracts-upgradeable/contracts/security/PausableUpgradeable.sol";
import { OwnableUpgradeable } from "openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol";
import { unwrap, wrap, powu } from "prb/math/UD60x18.sol";
Expand All @@ -17,12 +16,7 @@ import { unwrap, wrap, powu } from "prb/math/UD60x18.sol";
* @title GoodDollarExpansionController
* @notice Provides functionality to expand the supply of GoodDollars.
*/
contract GoodDollarExpansionController is
IGoodDollarExpansionController,
PausableUpgradeable,
OwnableUpgradeable,
ReentrancyGuard
{
contract GoodDollarExpansionController is IGoodDollarExpansionController, PausableUpgradeable, OwnableUpgradeable {
/* ==================== State Variables ==================== */

// MAX_WEIGHT is the max rate that can be assigned to an exchange
Expand Down Expand Up @@ -163,7 +157,7 @@ contract GoodDollarExpansionController is
* @param exchangeId The id of the exchange to mint UBI for.
* @param reserveInterest The amount of reserve tokens collected from interest.
*/
function mintUBIFromInterest(bytes32 exchangeId, uint256 reserveInterest) external nonReentrant {
function mintUBIFromInterest(bytes32 exchangeId, uint256 reserveInterest) external {
require(reserveInterest > 0, "reserveInterest must be greater than 0");
IBancorExchangeProvider.PoolExchange memory exchange = IBancorExchangeProvider(address(goodDollarExchangeProvider))
.getPoolExchange(exchangeId);
Expand All @@ -180,7 +174,7 @@ contract GoodDollarExpansionController is
* @param exchangeId The id of the exchange to mint UBI for.
* @return amountMinted The amount of UBI tokens minted.
*/
function mintUBIFromReserveBalance(bytes32 exchangeId) external nonReentrant returns (uint256 amountMinted) {
function mintUBIFromReserveBalance(bytes32 exchangeId) external returns (uint256 amountMinted) {
IBancorExchangeProvider.PoolExchange memory exchange = IBancorExchangeProvider(address(goodDollarExchangeProvider))
.getPoolExchange(exchangeId);

Expand All @@ -199,7 +193,7 @@ contract GoodDollarExpansionController is
* @param exchangeId The id of the exchange to mint UBI for.
* @return amountMinted The amount of UBI tokens minted.
*/
function mintUBIFromExpansion(bytes32 exchangeId) external nonReentrant returns (uint256 amountMinted) {
function mintUBIFromExpansion(bytes32 exchangeId) external returns (uint256 amountMinted) {
ExchangeExpansionConfig memory config = getExpansionConfig(exchangeId);
IBancorExchangeProvider.PoolExchange memory exchange = IBancorExchangeProvider(address(goodDollarExchangeProvider))
.getPoolExchange(exchangeId);
Expand Down Expand Up @@ -233,7 +227,7 @@ contract GoodDollarExpansionController is
* @param to The address of the recipient.
* @param amount The amount of tokens to mint.
*/
function mintRewardFromRR(bytes32 exchangeId, address to, uint256 amount) external onlyAvatar nonReentrant {
function mintRewardFromRR(bytes32 exchangeId, address to, uint256 amount) external onlyAvatar {
require(to != address(0), "Invalid to address");
require(amount > 0, "Amount must be greater than 0");
IBancorExchangeProvider.PoolExchange memory exchange = IBancorExchangeProvider(address(goodDollarExchangeProvider))
Expand Down

0 comments on commit 99bd07c

Please sign in to comment.