修改一些引用路径

This commit is contained in:
cebgcontract 2022-08-10 11:57:03 +08:00
parent 77b2a1934e
commit 0a2a4c97de
5 changed files with 34 additions and 45 deletions

View File

@ -6,5 +6,6 @@ import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
interface IBEERC721 is IERC721 { interface IBEERC721 is IERC721 {
function mint(address to, uint256 tokenId) external;
function burn(address owner, uint256 tokenId) external; function burn(address owner, uint256 tokenId) external;
} }

View File

@ -3,19 +3,17 @@ pragma solidity 0.8.10;
import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "../interfaces/IBEERC721.sol";
import "../core/HasSignature.sol"; import "../core/HasSignature.sol";
// this contract will transfer ownership to BETimelockController after deployed // this contract will transfer ownership to BETimelockController after deployed
// all onlyowner method would add timelock // all onlyowner method would add timelock
interface IBurnableERC721 is IERC721 {
function burn(address owner, uint256 tokenId) external;
}
contract EvolveProxy is Ownable, Initializable, HasSignature { contract EvolveProxy is Ownable, Initializable, HasSignature {
IBurnableERC721 public hero; IBEERC721 public hero;
IBurnableERC721 public equip; IBEERC721 public equip;
IBurnableERC721 public chip; IBEERC721 public chip;
mapping(bytes => bool) public usedSignatures; mapping(bytes => bool) public usedSignatures;
@ -34,9 +32,9 @@ contract EvolveProxy is Ownable, Initializable, HasSignature {
} }
function init(address[3] calldata _erc721s) external initializer onlyOwner { function init(address[3] calldata _erc721s) external initializer onlyOwner {
hero = IBurnableERC721(_erc721s[0]); hero = IBEERC721(_erc721s[0]);
equip = IBurnableERC721(_erc721s[1]); equip = IBEERC721(_erc721s[1]);
chip = IBurnableERC721(_erc721s[2]); chip = IBEERC721(_erc721s[2]);
} }
/** /**

View File

@ -3,16 +3,14 @@ pragma solidity 0.8.10;
import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "../interfaces/IBEERC721.sol";
interface IMintableERC721 is IERC721 {
function mint(address to, uint256 tokenId) external;
}
contract MinterFactory is Ownable, Initializable { contract MinterFactory is Ownable, Initializable {
// NFT contract // NFT contract
IMintableERC721 public hero; IBEERC721 public hero;
IMintableERC721 public equip; IBEERC721 public equip;
IMintableERC721 public chip; IBEERC721 public chip;
event TokenMinted( event TokenMinted(
@ -22,9 +20,9 @@ contract MinterFactory is Ownable, Initializable {
); );
function init(address[3] calldata _erc721s) external initializer onlyOwner { function init(address[3] calldata _erc721s) external initializer onlyOwner {
hero = IMintableERC721(_erc721s[0]); hero = IBEERC721(_erc721s[0]);
equip = IMintableERC721(_erc721s[1]); equip = IBEERC721(_erc721s[1]);
chip = IMintableERC721(_erc721s[2]); chip = IBEERC721(_erc721s[2]);
} }
/** /**

View File

@ -4,18 +4,14 @@ pragma solidity 0.8.10;
import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "../interfaces/IBEERC721.sol";
import "../core/HasSignature.sol"; import "../core/HasSignature.sol";
interface IMintableERC721 is IERC721 {
function mint(address to, uint256 tokenId) external;
function burn(address owner, uint256 tokenId) external;
}
contract MysteryBoxProxy is Ownable, Initializable, HasSignature { contract MysteryBoxProxy is Ownable, Initializable, HasSignature {
IMintableERC721 public box; IBEERC721 public box;
IMintableERC721 public hero; IBEERC721 public hero;
IMintableERC721 public equip; IBEERC721 public equip;
IMintableERC721 public chip; IBEERC721 public chip;
uint8 public constant TYPE_NONE = 0; uint8 public constant TYPE_NONE = 0;
uint8 public constant TYPE_HERO = 1; uint8 public constant TYPE_HERO = 1;
@ -47,10 +43,10 @@ contract MysteryBoxProxy is Ownable, Initializable, HasSignature {
initializer initializer
onlyOwner onlyOwner
{ {
hero = IMintableERC721(_erc721s[0]); hero = IBEERC721(_erc721s[0]);
equip = IMintableERC721(_erc721s[1]); equip = IBEERC721(_erc721s[1]);
chip = IMintableERC721(_erc721s[2]); chip = IBEERC721(_erc721s[2]);
box = IMintableERC721(_erc721s[3]); box = IBEERC721(_erc721s[3]);
} }
/** /**

View File

@ -4,21 +4,17 @@ pragma solidity 0.8.10;
import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "../interfaces/IBEERC721.sol";
import "../core/HasSignature.sol"; import "../core/HasSignature.sol";
interface IMintableERC721 is IERC721 {
function mint(address to, uint256 tokenId) external;
function burn(address owner, uint256 tokenId) external;
}
contract NFTActivateProxy is Ownable, Initializable, HasSignature { contract NFTActivateProxy is Ownable, Initializable, HasSignature {
uint256 private constant MINI_GEN_NFT_ID = 1e17; uint256 private constant MINI_GEN_NFT_ID = 1e17;
uint256 private constant MAX_GAME_NFT_ID = 9 * 1e15; uint256 private constant MAX_GAME_NFT_ID = 9 * 1e15;
IMintableERC721 public hero; IBEERC721 public hero;
IMintableERC721 public equip; IBEERC721 public equip;
IMintableERC721 public chip; IBEERC721 public chip;
uint256 public constant TYPE_NONE = 0; uint256 public constant TYPE_NONE = 0;
uint256 public constant TYPE_HERO = 1; uint256 public constant TYPE_HERO = 1;
@ -39,9 +35,9 @@ contract NFTActivateProxy is Ownable, Initializable, HasSignature {
constructor() HasSignature("NFTActivateProxy", "1") {} constructor() HasSignature("NFTActivateProxy", "1") {}
function init(address[3] calldata _erc721s) external initializer onlyOwner { function init(address[3] calldata _erc721s) external initializer onlyOwner {
hero = IMintableERC721(_erc721s[0]); hero = IBEERC721(_erc721s[0]);
equip = IMintableERC721(_erc721s[1]); equip = IBEERC721(_erc721s[1]);
chip = IMintableERC721(_erc721s[2]); chip = IBEERC721(_erc721s[2]);
} }
/** /**
@ -74,7 +70,7 @@ contract NFTActivateProxy is Ownable, Initializable, HasSignature {
"NFTActivateProxy: signature used. please send another transaction with new signature" "NFTActivateProxy: signature used. please send another transaction with new signature"
); );
address owner = msg.sender; address owner = msg.sender;
IMintableERC721 nft721 = getIMintableERC721ByType(nftType); IBEERC721 nft721 = getIBEERC721ByType(nftType);
require( require(
nft721.ownerOf(nftOld) == owner, nft721.ownerOf(nftOld) == owner,
"NFTActivateProxy: only owner can activate this nft" "NFTActivateProxy: only owner can activate this nft"
@ -95,10 +91,10 @@ contract NFTActivateProxy is Ownable, Initializable, HasSignature {
emit LogNFTActivate(owner, nftOld, nftNew, nftType); emit LogNFTActivate(owner, nftOld, nftNew, nftType);
} }
function getIMintableERC721ByType(uint256 nftType) function getIBEERC721ByType(uint256 nftType)
private private
view view
returns (IMintableERC721) returns (IBEERC721)
{ {
if (nftType == TYPE_HERO) { if (nftType == TYPE_HERO) {
return hero; return hero;