Skip to content

Commit

Permalink
add onERC721Received support
Browse files Browse the repository at this point in the history
  • Loading branch information
kamescg committed Jun 28, 2021
1 parent 26a41f1 commit 1b90307
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion contracts/prize-pool/PrizePool.sol
Expand Up @@ -6,6 +6,7 @@ import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/SafeCastUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/introspection/ERC165CheckerUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/SafeERC20Upgradeable.sol";
import "@pooltogether/fixed-point/contracts/FixedPoint.sol";
Expand All @@ -23,7 +24,7 @@ import "./PrizePoolInterface.sol";
/// @title Escrows assets and deposits them into a yield source. Exposes interest to Prize Strategy. Users deposit and withdraw from this contract to participate in Prize Pool.
/// @notice Accounting is managed using Controlled Tokens, whose mint and burn functions can only be called by this contract.
/// @dev Must be inherited to provide specific yield-bearing asset control, such as Compound cTokens
abstract contract PrizePool is PrizePoolInterface, OwnableUpgradeable, ReentrancyGuardUpgradeable, TokenControllerInterface {
abstract contract PrizePool is PrizePoolInterface, OwnableUpgradeable, ReentrancyGuardUpgradeable, TokenControllerInterface, IERC721ReceiverUpgradeable {
using SafeMathUpgradeable for uint256;
using SafeCastUpgradeable for uint256;
using SafeERC20Upgradeable for IERC20Upgradeable;
Expand Down Expand Up @@ -1050,6 +1051,15 @@ abstract contract PrizePool is PrizePoolInterface, OwnableUpgradeable, Reentranc
compLike.delegate(to);
}
}

/// @notice Required for ERC721 safe token transfers from smart contracts.
/// @param operator The address that acts on behalf of the owner
/// @param from The current owner of the NFT
/// @param tokenId The NFT to transfer
/// @param data Additional data with no specified format, sent in call to `_to`.
function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external override returns (bytes4){
return this.onERC721Received.selector;
}

/// @notice The total of all controlled tokens and timelock.
/// @return The current total of all tokens and timelock.
Expand Down

0 comments on commit 1b90307

Please sign in to comment.