From 636b355e4cd03cfb0e591f97a0526ec0718b738e Mon Sep 17 00:00:00 2001 From: zhoujia6139 Date: Thu, 16 Nov 2023 15:04:25 +0800 Subject: [PATCH] chore: exclude p2p --- contracts/misc/ParaXApeCoinStakingVoting.sol | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/contracts/misc/ParaXApeCoinStakingVoting.sol b/contracts/misc/ParaXApeCoinStakingVoting.sol index 8cc472df..f53d4307 100644 --- a/contracts/misc/ParaXApeCoinStakingVoting.sol +++ b/contracts/misc/ParaXApeCoinStakingVoting.sol @@ -2,6 +2,7 @@ pragma solidity ^0.8.0; import {INToken} from "../interfaces/INToken.sol"; import "../dependencies/openzeppelin/contracts//IERC20.sol"; +import "../dependencies/openzeppelin/contracts//IERC721.sol"; import "../dependencies/yoga-labs/ApeCoinStaking.sol"; contract ParaXApeCoinStakingVoting { @@ -62,8 +63,13 @@ contract ParaXApeCoinStakingVoting { return 0; } + IERC721 underlyingNFT = IERC721(ntoken.UNDERLYING_ASSET_ADDRESS()); for (uint256 i = 0; i < balance; i++) { uint256 tokenId = ntoken.tokenOfOwnerByIndex(userAddress, i); + //ensure nToken owns the underlying asset(to exclude P2P case) + if (underlyingNFT.ownerOf(tokenId) != address(ntoken)) { + continue; + } (uint256 stakedAmount, ) = apeCoinStaking.nftPosition( poolId,