Platform: Code4rena
Start Date: 28/11/2022
Pot Size: $192,500 USDC
Total HM: 33
Participants: 106
Period: 11 days
Judge: LSDan
Total Solo HM: 15
Id: 186
League: ETH
Rank: 18/106
Findings: 2
Award: $1,591.05
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: IllIllI
Also found by: 0x4non, 0x52, 0xAgro, 0xNazgul, 0xSmartContract, 0xackermann, 9svR6w, Awesome, Aymen0909, B2, BRONZEDISC, Bnke0x0, Deekshith99, Deivitto, Diana, Dravee, HE1M, Jeiwan, Kaiziron, KingNFT, Lambda, Mukund, PaludoX0, RaymondFam, Rolezn, Sathish9098, Secureverse, SmartSek, __141345__, ahmedov, ayeslick, brgltd, cccz, ch0bu, chrisdior4, cryptonue, cryptostellar5, csanuragjain, datapunk, delfin454000, erictee, gz627, gzeon, helios, i_got_hacked, ignacio, imare, jadezti, jayphbee, joestakey, kankodu, ksk2345, ladboy233, martin, nadin, nicobevi, oyc_109, pashov, pavankv, pedr02b2, pzeus, rbserver, ronnyx2017, rvierdiiev, shark, unforgiven, xiaoming90, yjrwkk
103.9175 USDC - $103.92
There are 40 instances of this issue
pragma solidity 0.8.10;
File: 2022-11-paraspace/paraspace-core/contracts/misc/marketplaces/SeaportAdapter.sol function getAskOrderInfo(bytes memory params, address weth) external pure override returns (DataTypes.OrderInfo memory orderInfo) @Audit NAMED RETURN VARIABLES
File: 2022-11-paraspace/paraspace-core/contracts/misc/NFTFloorOracle.sol function getPrice(address _asset) external view override returns (uint256 price)
2022-11-paraspace/paraspace-core/contracts/misc/UniswapV3OracleWrapper.sol function getLiquidityAmount(uint256 tokenId) external view returns (uint256 token0Amount, uint256 token1Amount) function getLiquidityAmountFromPositionData( UinswapV3PositionData memory positionData ) public pure returns (uint256 token0Amount, uint256 token1Amount) { function getLpFeeAmount(uint256 tokenId) external view returns (uint256 token0Amount, uint256 token1Amount) function getLpFeeAmountFromPositionData( UinswapV3PositionData memory positionData ) public view returns (uint256 token0Amount, uint256 token1Amount) {
2022-11-paraspace/paraspace-core/contracts/protocol/libraries/logic/PoolLogic.sol function executeGetUserAccountData( address user, DataTypes.PoolStorage storage ps, address oracle ) external view returns ( uint256 totalCollateralBase, uint256 totalDebtBase, uint256 availableBorrowsBase, uint256 currentLiquidationThreshold, uint256 ltv, uint256 healthFactor, uint256 erc721HealthFactor )
File: 2022-11-paraspace/paraspace-core/contracts/protocol/tokenization/libraries/MintableERC721Logic.sol 193: external returns ( uint64 oldCollateralizedBalance, uint64 newCollateralizedBalance ) 266: external returns ( uint64 oldCollateralizedBalance, uint64 newCollateralizedBalance )
File: 2022-11-paraspace/paraspace-core/contracts/protocol/tokenization/libraries/ApeStakingLogic.sol 22: uint256 constant BAYC_POOL_ID = 1; 23: uint256 constant MAYC_POOL_ID = 2; 24: uint256 constant BAKC_POOL_ID = 3;
File: 2022-11-paraspace/paraspace-core/contracts/misc/marketplaces/SeaportAdapter.sol here length is checked with 2 without any explanations. Why checked the length is set 2 require( // NOT criteria based and must be basic order advancedOrders.length == 2
2022-11-paraspace/paraspace-core/contracts/protocol/pool/PoolStorage.sol 17: bytes32 constant POOL_STORAGE_POSITION = bytes32(uint256(keccak256("paraspace.proxy.pool.storage")) - 1);
File: 2022-11-paraspace/paraspace-core/contracts/misc/NFTFloorOracle.sol 70: bytes32 public constant UPDATER_ROLE = keccak256("UPDATER_ROLE");
2022-11-paraspace/paraspace-core/contracts/protocol/pool/PoolStorage.sol 17: bytes32 constant POOL_STORAGE_POSITION = bytes32(uint256(keccak256("paraspace.proxy.pool.storage")) - 1);
#### Consider defining in only one contract so that values cannot become out of sync when only one location is updated. A cheap way to store constants in a single location is to create an internal constant in a library. If the variable is a local cache of another contract’s value, consider making the cache variable internal or private, which will require external users to query the contract with the source of truth, so that callers don’t get out of sync. File: 2022-11-paraspace/paraspace-core/contracts/protocol/tokenization/libraries/ApeStakingLogic.sol 22: uint256 constant BAYC_POOL_ID = 1; 23: uint256 constant MAYC_POOL_ID = 2; 24: uint256 constant BAKC_POOL_ID = 3;
#0 - c4-judge
2023-01-25T10:41:09Z
dmvt marked the issue as grade-b
🌟 Selected for report: IllIllI
Also found by: B2, Deivitto, Dravee, PaludoX0, RaymondFam, Rolezn, Sathish9098, _Adam, ahmedov, c3phas, chrisdior4, cyberinn, rjs, saneryee
1487.1349 USDC - $1,487.13
As remix gas reports we can save 8 gas if we use multiple checks.
BEFORE:
SAMPLE TEST:
require(1==1&&2==2);
Using && operator the execution gas cost is 21240
AFTER :
require(1==1); require(2==2);
After modification the execution cost is 21232 . So clearly we can save 8 gas par split condition checks.
There is 24 instance of this issue:
2022-11-paraspace/paraspace-core/contracts/misc/marketplaces/SeaportAdapter.sol require( // NOT criteria based and must be basic order resolvers.length == 0 && isBasicOrder(advancedOrder), Errors.INVALID_MARKETPLACE_ORDER ); require( // NOT criteria based and must be basic order advancedOrders.length == 2 && isBasicOrder(advancedOrders[0]) && isBasicOrder(advancedOrders[1]), Errors.INVALID_MARKETPLACE_ORDER );
File: 2022-11-paraspace/paraspace-core/contracts/misc/NFTFloorOracle.sol 331: if (feederIndex >= 0 && feeders[feederIndex] == _feeder) {
File: 2022-11-paraspace/paraspace-core/contracts/misc/ParaSpaceOracle.sol 130: if (price == 0 && address(_fallbackOracle) != address(0)) {
File: 2022-11-paraspace/paraspace-core/contracts/protocol/libraries/logic/BorrowLogic.sol 151: if (params.usePTokens && params.amount == type(uint256).max) {
2022-11-paraspace/paraspace-core/contracts/protocol/libraries/logic/LiquidationLogic.sol if ( superVars.auctionEnabled && IAuctionableERC721(superVars.collateralXToken).isAuctioned( params.collateralTokenId )
2022-11-paraspace/paraspace-core/contracts/protocol/libraries/logic/MarketplaceLogic.sol 171: require( marketplaceIds.length == payloads.length && payloads.length == credits.length, Errors.INCONSISTENT_PARAMS_LENGTH ); 279: require( marketplaceIds.length == payloads.length && payloads.length == credits.length, Errors.INCONSISTENT_PARAMS_LENGTH ); 579: if ( vars.ethLeft > 0 && orderInfo.consideration[0].itemType != ItemType.NATIVE ) {
2022-11-paraspace/paraspace-core/contracts/protocol/libraries/logic/SupplyLogic.sol 474 : if (params.from != params.to && params.amount != 0) { 662: if (oldCollateralizedBalance == 0 && newCollateralizedBalance != 0) {
2022-11-paraspace/paraspace-core/contracts/protocol/libraries/logic/ValidationLogic.sol 546: require( vars.collateralReserveActive && vars.principalReserveActive, Errors.RESERVE_INACTIVE ); 550: require( !vars.collateralReservePaused && !vars.principalReservePaused, Errors.RESERVE_PAUSED ); 636: require( vars.collateralReserveActive && vars.principalReserveActive, Errors.RESERVE_INACTIVE ); 640: require( !vars.collateralReservePaused && !vars.principalReservePaused, Errors.RESERVE_PAUSED ); 672: require( params.maxLiquidationAmount >= params.actualLiquidationAmount && (msg.value == 0 || msg.value >= params.maxLiquidationAmount), Errors.LIQUIDATION_AMOUNT_NOT_ENOUGH ); 1202: require( !vars.token0IsPaused && !vars.token1IsPaused, Errors.RESERVE_PAUSED ); 1208: require( !vars.token0IsFrozen && !vars.token1IsFrozen, Errors.RESERVE_FROZEN );
2022-11-paraspace/paraspace-core/contracts/protocol/pool/PoolParameters.sol 216: require( value > MIN_AUCTION_HEALTH_FACTOR && value <= MAX_AUCTION_HEALTH_FACTOR, Errors.INVALID_AMOUNT );
File: 2022-11-paraspace/paraspace-core/contracts/protocol/tokenization/libraries/MintableERC721Logic.sol 111 : if (from != to && erc721Data.auctions[tokenId].startTime > 0) { 145: if (from != to && isUsedAsCollateral_) { 229: if ( tokenData[index].useAsCollateral && !erc721Data.isUsedAsCollateral[tokenId] )
There is 3 instance of this issue:
File: 2022-11-paraspace/paraspace-core/contracts/misc/NFTFloorOracle.sol 9: uint8 constant MIN_ORACLES_NUM = 3; 330: uint8 feederIndex = feederPositionMap[_feeder].index;
2022-11-paraspace/paraspace-core/contracts/protocol/libraries/logic/ValidationLogic.sol function verifyCreditSignature( DataTypes.Credit memory credit, address signer, uint8 v, //@AUDIT UINT256 bytes32 r, bytes32 s ) private view returns (bool) {
File: 2022-11-paraspace/paraspace-core/contracts/misc/NFTFloorOracle.sol 70: bytes32 public constant UPDATER_ROLE = keccak256("UPDATER_ROLE");
There is 11 instance of this issue:
File: 2022-11-paraspace/paraspace-core/contracts/misc/NFTFloorOracle.sol function addAssets(address[] calldata _assets) external onlyRole(DEFAULT_ADMIN_ROLE) function removeAsset(address _asset) external onlyRole(DEFAULT_ADMIN_ROLE) onlyWhenAssetExisted(_asset) function addFeeders(address[] calldata _feeders) external onlyRole(DEFAULT_ADMIN_ROLE) function removeFeeder(address _feeder) external onlyWhenFeederExisted(_feeder) function setConfig(uint128 expirationPeriod, uint128 maxPriceDeviation) external onlyRole(DEFAULT_ADMIN_ROLE) function setPause(address _asset, bool _flag) external onlyRole(DEFAULT_ADMIN_ROLE) function setPrice(address _asset, uint256 _twap) public onlyRole(UPDATER_ROLE) onlyWhenAssetExisted(_asset) whenNotPaused(_asset) function setMultiplePrices( address[] calldata _assets, uint256[] calldata _twaps ) external onlyRole(UPDATER_ROLE) {
2022-11-paraspace/paraspace-core/contracts/protocol/configuration/PoolAddressesProvider.sol function setAddressAsProxy(bytes32 id, address newImplementationAddress) external override onlyOwner function setPoolConfiguratorImpl(address newPoolConfiguratorImpl) external override onlyOwner function setWETH(address newWETH) external override onlyOwner { function setMarketplace( bytes32 id, address marketplace, address adapter, address operator, bool paused ) external override onlyOwner {
#### The unchecked keyword is new in solidity version 0.8.0, so this only applies to that version or higher, which these instances are. This saves 30-40 gas per loop
There is 49 instance of this issue:
File: 2022-11-paraspace/paraspace-core/contracts/misc/NFTFloorOracle.sol 229: for (uint256 i = 0; i < _assets.length; i++) { 291: for (uint256 i = 0; i < _assets.length; i++) { 321: for (uint256 i = 0; i < _feeders.length; i++) { 413: for (uint256 i = 0; i < feederSize; i++) { 421: validNum++; 442: while (arr[uint256(i)] < pivot) i++; 443: while (pivot < arr[uint256(j)]) j--; 449: i++; 450: j--;
File: 2022-11-paraspace/paraspace-core/contracts/misc/ParaSpaceOracle.sol 95: for (uint256 i = 0; i < assets.length; i++) { 197: for (uint256 i = 0; i < assets.length; i++) {
File: 2022-11-paraspace/paraspace-core/contracts/misc/UniswapV3OracleWrapper.sol 193: for (uint256 index = 0; index < tokenIds.length; index++) { 210 : for (uint256 index = 0; index < tokenIds.length; index++) {
File: 2022-11-paraspace/paraspace-core/contracts/protocol/libraries/logic/FlashClaimLogic.sol 38: for (i = 0; i < params.nftTokenIds.length; i++) { 56: for (i = 0; i < params.nftTokenIds.length; i++) {
File: 2022-11-paraspace/paraspace-core/contracts/protocol/libraries/logic/GenericLogic.sol 466: for (uint256 index = 0; index < totalBalance; index++) {
2022-11-paraspace/paraspace-core/contracts/protocol/libraries/logic/MarketplaceLogic.sol 177: for (uint256 i = 0; i < marketplaceIds.length; i++) { 284: for (uint256 i = 0; i < marketplaceIds.length; i++) { 382: for (uint256 i = 0; i < params.orderInfo.consideration.length; i++) { 470: for (uint256 i = 0; i < params.orderInfo.offer.length; i++) {
2022-11-paraspace/paraspace-core/contracts/protocol/libraries/logic/PoolLogic.sol 58: for (uint16 i = 0; i < params.reservesCount; i++) { 104: for (uint256 i = 0; i < assets.length; i++) {
2022-11-paraspace/paraspace-core/contracts/protocol/libraries/logic/SupplyLogic.sol 195: for (uint256 index = 0; index < params.tokenData.length; index++) {
2022-11-paraspace/paraspace-core/contracts/protocol/libraries/logic/ValidationLogic.sol 131: for (uint256 index = 0; index < amount; index++) { 212 : for (uint256 index = 0; index < tokenIds.length; index++) { 465: for (uint256 index = 0; index < tokenIds.length; index++) { 910: for (uint256 index = 0; index < tokenIds.length; index++) { 1034: for (uint256 i = 0; i < params.nftTokenIds.length; i++) {
2022-11-paraspace/paraspace-core/contracts/protocol/pool/PoolApeStaking.sol 72: for (uint256 index = 0; index < _nfts.length; index++) { 103: for (uint256 index = 0; index < _nfts.length; index++) { 138: for (uint256 index = 0; index < _nftPairs.length; index++) { 172: for (uint256 index = 0; index < actualTransferAmount; index++) { 199: for (uint256 index = 0; index < _nftPairs.length; index++) { 215: for (uint256 index = 0; index < _nftPairs.length; index++) { 279: for (uint256 index = 0; index < _nfts.length; index++) { 289: for (uint256 index = 0; index < _nftPairs.length; index++) { 305: for (uint256 index = 0; index < _nftPairs.length; index++) {
File: 2022-11-paraspace/paraspace-core/contracts/protocol/pool/PoolCore.sol 634: for (uint256 i = 0; i < reservesListCount; i++) { 638: droppedReservesCount++;
File: 2022-11-paraspace/paraspace-core/contracts/ui/WPunkGateway.sol 82: for (uint256 i = 0; i < punkIndexes.length; i++) { 109: for (uint256 i = 0; i < punkIndexes.length; i++) { 113: for (uint256 i = 0; i < punkIndexes.length; i++) { 136: for (uint256 i = 0; i < punkIndexes.length; i++) { 174: for (uint256 i = 0; i < punkIndexes.length; i++) {
File: 2022-11-paraspace/paraspace-core/contracts/protocol/tokenization/libraries/ApeStakingLogic.sol 231: for (uint256 index = 0; index < totalBalance; index++) {
File: 2022-11-paraspace/paraspace-core/contracts/protocol/tokenization/libraries/MintableERC721Logic.sol 207: for (uint256 index = 0; index < tokenData.length; index++) 280: for (uint256 index = 0; index < tokenIds.length; index++) {
2022-11-paraspace/paraspace-core/contracts/protocol/tokenization/NTokenMoonBirds.sol 51 : for (uint256 index = 0; index < tokenIds.length; index++) { 97: for (uint256 index = 0; index < tokenIds.length; index++) {
File: 2022-11-paraspace/paraspace-core/contracts/protocol/tokenization/NTokenApeStaking.sol 107: for (uint256 index = 0; index < tokenIds.length; index++) {
There is 5 instance of this issue:
File: 2022-11-paraspace/paraspace-core/contracts/misc/NFTFloorOracle.sol 175: function setConfig(uint128 expirationPeriod, uint128 maxPriceDeviation) 343: function _setConfig(uint128 _expirationPeriod, uint128 _maxPriceDeviation)
2022-11-paraspace/paraspace-core/contracts/protocol/pool/PoolCore.sol 237: function decreaseUniswapV3Liquidity( address asset, uint256 tokenId, uint128 liquidityDecrease, //@audit uint256 uint256 amount0Min, uint256 amount1Min, bool receiveEthAsWeth ) external virtual override nonReentrant {
2022-11-paraspace/paraspace-core/contracts/protocol/tokenization/NTokenUniswapV3.sol 54: uint128 liquidityDecrease, 126: uint128 liquidityDecrease,
There is 2 instance of this issue:
File: 2022-11-paraspace/paraspace-core/contracts/misc/NFTFloorOracle.sol 362: if (_priorTwap == 0 || _updatedAt == 0) {
2022-11-paraspace/paraspace-core/contracts/protocol/libraries/logic/MarketplaceLogic.sol 388: require( item.itemType == ItemType.ERC20 || (vars.isETH && item.itemType == ItemType.NATIVE), Errors.INVALID_ASSET_TYPE );
There is 20 instance of this issue:
File: 2022-11-paraspace/paraspace-core/contracts/misc/UniswapV3OracleWrapper.sol 149: token0Amount += positionData.tokensOwed0; 150: token1Amount += positionData.tokensOwed1; 211 sum += getTokenPrice(tokenIds[index]);
File: 2022-11-paraspace/paraspace-core/contracts/protocol/libraries/logic/GenericLogic.sol vars.payableDebtByERC20Assets += vars .userBalanceInBaseCurrency .percentDiv(vars.liquidationBonus); vars.totalCollateralInBaseCurrency += vars .userBalanceInBaseCurrency; vars.avgLiquidationThreshold += vars.liquidationThreshold; vars.totalDebtInBaseCurrency += _getUserDebtInBaseCurrency( params.user, currentReserve, vars.assetPrice, vars.assetUnit ); vars.avgERC721LiquidationThreshold += vars .liquidationThreshold; vars.totalERC721CollateralInBaseCurrency += vars .userBalanceInBaseCurrency; vars.totalCollateralInBaseCurrency += vars .userBalanceInBaseCurrency; vars.avgLtv += vars.ltv; vars.avgLiquidationThreshold += vars.liquidationThreshold; 479: totalValue += tokenPrice; 496: totalLTV += tmpLTV * tokenPrice; 497: totalLiquidationThreshold += tmpLiquidationThreshold * tokenPrice;
2022-11-paraspace/paraspace-core/contracts/protocol/libraries/logic/MarketplaceLogic.sol 397: price += item.startAmount;
File: 2022-11-paraspace/paraspace-core/contracts/protocol/pool/PoolApeStaking.sol 77: amountToWithdraw += _nfts[index].amount; 166: amountToWithdraw += _nftPairs[index].amount;
File: 2022-11-paraspace/paraspace-core/contracts/protocol/tokenization/libraries/ApeStakingLogic.sol 215: totalAmount += getTokenIdStakingAmount( poolId, _apeCoinStaking, tokenId ); 257: apeStakedAmount += bakcStakedAmount;
There is 1 instance of this issue:
File: 2022-11-paraspace/paraspace-core/contracts/protocol/configuration/PoolAddressesProvider.sol 22: string private _marketId;
There is 15 instance of this issue:
2022-11-paraspace/paraspace-core/contracts/protocol/libraries/logic/MarketplaceLogic.sol function executeBuyWithCredit( bytes32 marketplaceId, bytes calldata payload, DataTypes.Credit calldata credit, DataTypes.PoolStorage storage ps, IPoolAddressesProvider poolAddressProvider, uint16 referralCode //@AUDIT UINT256 ) external { 229: function executeAcceptBidWithCredit( bytes32 marketplaceId, bytes calldata payload, DataTypes.Credit calldata credit, address onBehalfOf, DataTypes.PoolStorage storage ps, IPoolAddressesProvider poolAddressProvider, uint16 referralCode //@AUDIT UINT256 267: function executeBatchAcceptBidWithCredit( bytes32[] calldata marketplaceIds, bytes[] calldata payloads, DataTypes.Credit[] calldata credits, address onBehalfOf, DataTypes.PoolStorage storage ps, IPoolAddressesProvider poolAddressProvider, uint16 referralCode //@AUDIT UINT256
2022-11-paraspace/paraspace-core/contracts/protocol/libraries/logic/PoolLogic.sol 58: for (uint16 i = 0; i < params.reservesCount; i++) { //@AUDIT UINT256
2022-11-paraspace/paraspace-core/contracts/protocol/libraries/logic/SupplyLogic.sol
function executeSupplyERC721Base( uint16 reserveId, // @AUDIT UINT256 address nTokenAddress, DataTypes.UserConfigurationMap storage userConfig, DataTypes.ExecuteSupplyERC721Params memory params ) internal {
2022-11-paraspace/paraspace-core/contracts/protocol/pool/PoolCore.sol 91: function supply( address asset, uint256 amount, address onBehalfOf, uint16 referralCode // @AUDIT UINT256 ) external virtual override nonReentrant { 156: function supplyWithPermit( address asset, uint256 amount, address onBehalfOf, uint16 referralCode, // @AUDIT UINT256 uint256 deadline, uint8 permitV, // @AUDIT UINT256 bytes32 permitR, bytes32 permitS ) external virtual override nonReentrant { function borrow( address asset, uint256 amount, uint16 referralCode, // @AUDIT UINT256 address onBehalfOf ) external virtual override nonReentrant { DataTypes.PoolStorage storage ps = poolStorage();
2022-11-paraspace/paraspace-core/contracts/protocol/pool/PoolMarketplace.sol 94: uint16 referralCode; 114: uint16 referralCode; 135: uint16 referralCode;
File: 2022-11-paraspace/paraspace-core/contracts/ui/WPunkGateway.sol 80: uint16 referralCode; 134: uint16 referralCode; 172: uint16 referralCode
There is 15 instance of this issue:
2022-11-paraspace/paraspace-core/contracts/protocol/libraries/logic/SupplyLogic.sol 144: uint64 oldCollateralizedBalance, 145: uint64 newCollateralizedBalance 356: uint64 oldCollateralizedBalance, 357: uint64 newCollateralizedBalance
File: 2022-11-paraspace/paraspace-core/contracts/protocol/tokenization/libraries/MintableERC721Logic.sol 42 : uint64 balanceLimit; 103: uint64 oldSenderBalance = erc721Data.userState[from].balance; 105: uint64 oldRecipientBalance = erc721Data.userState[to].balance; 106: uint64 newRecipientBalance = oldRecipientBalance + 1; 205: uint64 collateralizedTokens = 0; 247: uint64 newBalance = oldBalance + uint64(tokenData.length); 272: uint64 burntCollateralizedTokens = 0; 273: uint64 balanceToBurn; 405: uint64 balance; 408: uint64 balanceLimit = erc721Data.balanceLimit;
There is 3 instance of this issue:
File: 2022-11-paraspace/paraspace-core/contracts/protocol/tokenization/libraries/ApeStakingLogic.sol 185; uint256 supplyAmount = unstakedAmount - repayAmount; 260: return apeStakedAmount + apeReward; 172: unstakedAmount = unstakedAmount - incentiveAmount;
File: 2022-11-paraspace/paraspace-core/contracts/protocol/tokenization/libraries/MintableERC721Logic.sol
BEFORE :
12: struct UserState { uint64 balance; uint64 collateralizedBalance; uint128 additionalData; }
Before modification the gas cost is 77126 as per REMIX IDE
AFTER:
12: struct UserState { uint256 balance; uint256 collateralizedBalance; uint256 additionalData; }
After modification the gas cost is 77113 as per REMIX IDE
So clearly possible to save 13 gas after modifications.
There is 6 instance of this issue:
File: 2022-11-paraspace/paraspace-core/contracts/protocol/tokenization/libraries/MintableERC721Logic.sol
BEFORE :
104: erc721Data.userState[from].balance = oldSenderBalance - 1; 106: uint64 newRecipientBalance = oldRecipientBalance + 1;
BEFORE THE EXECUTION GAS COST IS 21617
AFTER:
104: erc721Data.userState[from].balance = --oldSenderBalance ; 106: uint64 newRecipientBalance = ++oldRecipientBalance;
AFTER THE EXECUTION GAS COST IS 21554
178: ? collateralizedBalance + 1 179: : collateralizedBalance - 1; 523: uint256 lastTokenIndex = userBalance - 1; 552: uint256 lastTokenIndex = length - 1;
BEFORE :
X-=1; THE GAS COST IS 26597
AFTER :
--X; THE GAS COST IS 26530
There is 2 instance of this issue:
File: 2022-11-paraspace/paraspace-core/contracts/protocol/tokenization/libraries/MintableERC721Logic.sol 146 : erc721Data.userState[from].collateralizedBalance -= 1; 318: erc721Data.userState[user].balance -= balanceToBurn;
There is 2 instance of this issue:
2022-11-paraspace/paraspace-core/contracts/protocol/tokenization/base/MintableIncentivizedERC721.sol 45: modifier onlyPoolAdmin() { IACLManager aclManager = IACLManager( _addressesProvider.getACLManager() ); require( aclManager.isPoolAdmin(msg.sender), Errors.CALLER_NOT_POOL_ADMIN ); _; } 59: modifier onlyPool() { require(_msgSender() == address(POOL), Errors.CALLER_MUST_BE_POOL); _; }
#0 - c4-judge
2023-01-25T10:40:49Z
dmvt marked the issue as grade-b
#1 - c4-judge
2023-01-26T12:13:52Z
dmvt marked the issue as grade-a