Verified contractExactMIT
DebookProxy
Address0x74c21b5477cc2e3bc1787750055fc009ba70cc7f
- Balance
0 ETH
- Transactions
14
- Compiler
solc 0.8.24
- Same code
Only this contract
Details
- Compiler
- solc 0.8.24+commit.e11b9ed9
- Language
- solidity
- Optimization
- Yes, 200 runs
- EVM version
- shanghai
- Via IR
- yes
- License
- MIT
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 19,427,759
- Creation transaction
- 0xd7984e7935…dac0b8593e
contracts/DebookProxy.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./Interfaces/IDebook.sol";
contract DebookProxy is Ownable {
// Chainlink price feeder ETH/USD
// Ethereum 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419
// Sepolia 0x694AA1769357215DE4FAC081bf1f309aDC325306
// Chainlink price feeder EUR/USD
// Ethereum 0xb49f677943BC038e9857d61E7d053CaA2C1734C1
// Sepolia 0x1a81afB8146aeFfCFc5E50e8479e826E7D55b910
AggregatorV3Interface public ETHUSDpriceFeed;
AggregatorV3Interface public EURUSDpriceFeed;
IDebook public NFTContract;
address public recipient;
uint256 public mintPriceEUR = 333 * 10**18; // 333 EUR in wei for precision
bool public proxyPublicMintEnabled = true;
constructor() Ownable(msg.sender) {}
function getNFTContractCurrentPublicSupply() public view returns (uint256) {
return NFTContract.currentPublicSupply();
}
function getNFTContractPaused() public view returns (bool) {
return NFTContract.paused();
}
function getNFTContractTotalSupply() public view returns (uint256) {
return NFTContract.totalSupply();
}
function getETHUSDPrice() public view returns(uint256) {
int price = 0;
if (address(ETHUSDpriceFeed) != address(0)) {
(, price, , , ) = ETHUSDpriceFeed.latestRoundData(); // Price of 1 ETH in USD, with 8 decimal places
} else {
// For local testing
price = 393240000000;
}
return uint256(price * 10**10);
}
function getEURUSDPrice() public view returns(uint256) {
int price = 0;
if (address(EURUSDpriceFeed) != address(0)) {
(, price, , , ) = EURUSDpriceFeed.latestRoundData(); // Price of 1 EUR in USD, with 8 decimal places
} else {
// For local testing
price = 109000000;
}
return uint256(price * 10**10);
}
function calculateETHAmount() public view returns (uint256) {
uint256 ETHUSDPrice = getETHUSDPrice();
uint256 EURUSDPrice = getEURUSDPrice();
// Convert EUR mint price to USD for ETH price calculation
uint256 mintPriceUsd = (mintPriceEUR * EURUSDPrice) / 10**18;
return (mintPriceUsd * 10**18) / ETHUSDPrice;
}
// Proxy Admin
function setProxyPublicMintEnabled(bool _state) external onlyOwner () {
proxyPublicMintEnabled = _state;
}
function setPriceFeedETHUSD(address _priceFeedAddress) external onlyOwner () {
ETHUSDpriceFeed = AggregatorV3Interface(_priceFeedAddress);
}
function setPriceFeedEURUSD(address _priceFeedAddress) external onlyOwner () {
EURUSDpriceFeed = AggregatorV3Interface(_priceFeedAddress);
}
function setMintPriceEUR(uint256 _mintPriceEUR) external onlyOwner {
mintPriceEUR = _mintPriceEUR;
}
function setNFTContract(address _contractAddress) external onlyOwner {
NFTContract = IDebook(_contractAddress);
}
function setRecipient(address newRecipient) public onlyOwner {
require(newRecipient != address(0), "Cannot be the 0 address!");
recipient = newRecipient;
}
function withdraw() external onlyOwner {
require(recipient != address(0), "Cannot be the 0 address!");
uint256 balance = address(this).balance;
bool success;
(success, ) = payable(recipient).call{value: balance}("");
require(success, "Transaction Unsuccessful");
}
// Mint
function NFTContractMintAdminPublic(address to, uint256 quantity) external payable {
require(!getNFTContractPaused(), "NFT Contract is Paused.");
require(proxyPublicMintEnabled, "Proxy Public Mint is Disabled.");
require(msg.value >= calculateETHAmount() * quantity, "Insufficient funds.");
require(getNFTContractTotalSupply() + quantity <= getNFTContractCurrentPublicSupply(), "NFT Contract Current Public Supply Exceeded.");
NFTContract.mintAdmin(to, quantity);
}
// NFT Contract Admin
function NFTContractMintAdmin(address to, uint256 quantity) external onlyOwner {
NFTContract.mintAdmin(to, quantity);
}
function NFTContractWithdraw() external onlyOwner {
NFTContract.withdraw();
}
function NFTContractTransferOwnership(address _address) external onlyOwner {
NFTContract.transferOwnership(_address);
}
function setNFTContractMaxSupply(uint256 _value) external onlyOwner {
NFTContract.setMaxSupply(_value);
}
function setNFTContractCurrentPublicSupply(uint256 _value) external onlyOwner {
NFTContract.setCurrentPublicSupply(_value);
}
function setNFTContractCurrentAllowlistSupply(uint256 _value) external onlyOwner {
NFTContract.setCurrentAllowlistSupply(_value);
}
function setNFTContractPrice(uint256 _value) external onlyOwner {
NFTContract.setPrice(_value);
}
function setNFTContractPhaseLevel(uint256 _value) external onlyOwner {
NFTContract.setPhaseLevel(_value);
}
function setNFTContractAllowlistLevelAllowances(uint256[10] calldata _array) external onlyOwner {
NFTContract.setAllowlistLevelAllowances(_array);
}
function setNFTContractMerkleRoot(uint256 _value, bytes32 _bytes) external onlyOwner {
NFTContract.setMerkleRoot(_value, _bytes);
}
function setNFTContractMerkleRoots(bytes32[10] calldata _bytes_array) external onlyOwner {
NFTContract.setMerkleRoots(_bytes_array);
}
function setNFTContractBaseURI(string memory _string) external onlyOwner {
NFTContract.setBaseURI(_string);
}
function setNFTContractUriSuffix(string memory _string) external onlyOwner {
NFTContract.setUriSuffix(_string);
}
function setNFTContractRecipient(address _address) external onlyOwner {
NFTContract.setRecipient(_address);
}
function setNFTContractAllowlistMintEnabled(bool _state) external onlyOwner {
NFTContract.setAllowlistMintEnabled(_state);
}
function setNFTContractPublicMintEnabled(bool _state) external onlyOwner {
NFTContract.setPublicMintEnabled(_state);
}
function setNFTContractPaused(bool _state) external onlyOwner {
NFTContract.setPaused(_state);
}
}@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface AggregatorV3Interface {
function decimals() external view returns (uint8);
function description() external view returns (string memory);
function version() external view returns (uint256);
function getRoundData(
uint80 _roundId
) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);
function latestRoundData()
external
view
returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);
}
@openzeppelin/contracts/access/Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* The initial owner is set to the address provided by the deployer. This can
* later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
@openzeppelin/contracts/utils/Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}
contracts/Interfaces/IDebook.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
interface IDebook {
function currentPublicSupply() external view returns (uint256);
function paused() external view returns (bool);
function totalSupply() external view returns (uint256);
function setMaxSupply(uint256 _supply) external;
function setCurrentPublicSupply(uint256 _supply) external;
function setCurrentAllowlistSupply(uint256 _supply) external;
function setPrice(uint256 _price) external;
function setPhaseLevel(uint256 _phaseLevel) external;
function setAllowlistLevelAllowances(uint256[10] calldata newAllowlistLevelAllowances) external;
function setMerkleRoot(uint256 allowlistLevel, bytes32 newMerkleRoot) external;
function setMerkleRoots(bytes32[10] calldata newMerkleRoots) external;
function setBaseURI(string memory _baseURI) external;
function setUriSuffix(string memory _uriSuffix) external;
function setRecipient(address newRecipient) external;
function setAllowlistMintEnabled(bool _state) external;
function setPublicMintEnabled(bool _state) external;
function setPaused(bool _state) external;
function transferOwnership(address _newOwner) external;
function mintAdmin(address to, uint256 quantity) external;
function withdraw() external;
}Compiler settingsShow
{
"viaIR": true,
"metadata": {
"bytecodeHash": "ipfs"
},
"libraries": {},
"optimizer": {
"runs": 200,
"enabled": true
},
"evmVersion": "shanghai",
"remappings": []
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.