编译器
0.8.23+commit.f704f362
文件 1 的 10:Deployyyyer.sol
pragma solidity ^0.8.23;
import { LibDiamond } from "./libraries/LibDiamond.sol";
import { IDiamondCut } from "./interfaces/IDiamondCut.sol";
import "./libraries/LibDiamond.sol";
import "./interfaces/IDiamondLoupe.sol";
import "./interfaces/IDiamondCut.sol";
import "./interfaces/IERC173.sol";
import "./interfaces/IERC165.sol";
import "./interfaces/IERC20.sol";
import { INewToken, IUniswapV2Router02 } from "./interfaces/INewToken.sol";
import "./libraries/LibAppStorage.sol";
contract Deployyyyer {
AppStorage internal s;
event Transfer(address indexed from, address indexed to, uint256 value);
event FactoryBuilt(string name, string symbol, uint256 supply);
event TeamSet(INewToken.TeamParams tparams);
event LaunchCostChanged(uint256 ethCost, uint256 deployyyyerCost);
event PromoCostChanged(uint256 ethCost, uint256 deployyyyerCost);
event MinLiquidityChanged(uint256 minLiq);
event IncreasedLimits(uint256 maxWallet, uint256 maxTx);
struct ConstructorArgs {
bool createToken;
address taxwallet;
address stakingFacet;
address presaleFacet;
address tokenFacet;
address v2router;
address team1;
address team2;
address team3;
address marketing;
address treasury;
uint256 ethCost;
uint256 deployyyyerCost;
uint256 promoCostEth;
uint256 promoCostDeployyyyer;
uint256 minLiq;
address uniswapRouter;
address sushiswapRouter;
address pancakeswapRouter;
}
constructor(IDiamondCut.FacetCut[] memory _diamondCut, ConstructorArgs memory _args) {
if(_args.createToken) {
emit FactoryBuilt("Deployyyyer", "DEPLOY", 1000000000);
} else {
emit FactoryBuilt("Deployyyyer", "DEPLOY", 0);
}
LibDiamond.diamondCut(_diamondCut, address(0), new bytes(0));
LibDiamond.setContractOwner(msg.sender);
LibDiamond.DiamondStorage storage ds = LibDiamond.diamondStorage();
ds.supportedInterfaces[type(IERC165).interfaceId] = true;
ds.supportedInterfaces[type(IDiamondLoupe).interfaceId] = true;
ds.supportedInterfaces[type(IERC173).interfaceId] = true;
ds.supportedInterfaces[type(IERC20).interfaceId] = true;
s.stakingFacet = _args.stakingFacet;
s.presaleFacet = _args.presaleFacet;
s.isParent = true;
s.decimals = 18;
s.ethCost = _args.ethCost;
s.deployyyyerCost = _args.deployyyyerCost;
s.promoCostEth = _args.promoCostEth;
s.promoCostDeployyyyer = _args.promoCostDeployyyyer;
s.minLiq = _args.minLiq;
emit LaunchCostChanged(s.ethCost, s.deployyyyerCost);
emit PromoCostChanged(s.promoCostEth, s.promoCostDeployyyyer);
emit MinLiquidityChanged(s.minLiq);
s.isFreeTier = false;
s.taxWallet = payable(_args.taxwallet);
s.deployyyyerCa = payable(address(this));
s.tokenFacet = _args.tokenFacet;
s.validRouters[_args.v2router] = true;
s.validRouters[_args.uniswapRouter] = true;
s.validRouters[_args.sushiswapRouter] = true;
s.validRouters[_args.pancakeswapRouter] = true;
if(_args.createToken) {
s.maxBuyTax = 10;
s.minBuyTax = 2;
s.taxBuy = s.maxBuyTax;
s.maxSellTax = 10;
s.minSellTax = 2;
s.taxSell = s.maxSellTax;
s.initTaxType = 1;
s.initInterval = 0;
s.countInterval = 20;
s.buyCount = 0;
s.name = "Deployyyyer";
s.symbol = "DEPLOY";
s.tTotal = 1000000000 * 10**s.decimals;
s.taxSwapThreshold = s.tTotal * 1 / 1000;
s.maxTaxSwap = s.tTotal * 1 / 100;
s.preventSwap = 20;
s.maxWallet = s.tTotal * 2 / 100;
s.maxTx = s.tTotal * 2 / 100;
s.walletLimited = true;
s.balances[address(this)] = s.tTotal;
emit IncreasedLimits(2, 2);
emit Transfer(address(0), address(this), s.tTotal);
s.cliffPeriod = 0;
s.vestingPeriod = 0;
s.teamShare[_args.team1] = s.tTotal * 4 / 100;
s.teamShare[_args.team2] = s.tTotal * 3 / 100;
s.teamShare[_args.team3] = s.tTotal * 3 / 100;
s.teamShare[_args.marketing] = s.tTotal * 5 / 100;
s.teamShare[_args.treasury] = s.tTotal * 5 / 100;
s.isExTxLimit[_args.marketing] = true;
s.isExWaLimit[_args.marketing] = true;
s.isExTxLimit[_args.treasury] = true;
s.isExWaLimit[_args.treasury] = true;
s.isExTxLimit[_args.team1] = true;
s.isExWaLimit[_args.team1] = true;
s.isExTxLimit[_args.team2] = true;
s.isExWaLimit[_args.team2] = true;
s.isExTxLimit[_args.team3] = true;
s.isExWaLimit[_args.team3] = true;
emit TeamSet(INewToken.TeamParams(_args.team1, 4, s.cliffPeriod, s.vestingPeriod, true));
emit TeamSet(INewToken.TeamParams(_args.team2, 3, s.cliffPeriod, s.vestingPeriod, true));
emit TeamSet(INewToken.TeamParams(_args.team3, 3, s.cliffPeriod, s.vestingPeriod, true));
emit TeamSet(INewToken.TeamParams(_args.marketing, 5, s.cliffPeriod, s.vestingPeriod, true));
emit TeamSet(INewToken.TeamParams(_args.treasury, 5, s.cliffPeriod, s.vestingPeriod, true));
s.teamBalance = s.tTotal * 20 / 100;
s.uniswapV2Router = IUniswapV2Router02(_args.v2router);
s.allowances[address(this)][address(s.uniswapV2Router)] = s.tTotal;
s.launchedTokens[address(this)] = msg.sender;
}
}
fallback() external payable {
LibDiamond.DiamondStorage storage ds;
bytes32 position = LibDiamond.DIAMOND_STORAGE_POSITION;
assembly {
ds.slot := position
}
address facet = address(bytes20(ds.facets[msg.sig]));
require(facet != address(0), "S1");
assembly {
calldatacopy(0, 0, calldatasize())
let result := delegatecall(gas(), facet, 0, calldatasize(), 0, 0)
returndatacopy(0, 0, returndatasize())
switch result
case 0 {
revert(0, returndatasize())
}
default {
return(0, returndatasize())
}
}
}
receive() external payable {}
}
文件 2 的 10:IDiamondCut.sol
pragma solidity ^0.8.23;
interface IDiamondCut {
enum FacetCutAction {Add, Replace, Remove}
struct FacetCut {
address facetAddress;
FacetCutAction action;
bytes4[] functionSelectors;
}
function diamondCut(
FacetCut[] calldata _diamondCut,
address _init,
bytes calldata _calldata
) external;
event DiamondCut(FacetCut[] _diamondCut, address _init, bytes _calldata);
}
文件 3 的 10:IDiamondLoupe.sol
pragma solidity ^0.8.23;
interface IDiamondLoupe {
struct Facet {
address facetAddress;
bytes4[] functionSelectors;
}
function facets() external view returns (Facet[] memory facets_);
function facetFunctionSelectors(address _facet) external view returns (bytes4[] memory facetFunctionSelectors_);
function facetAddresses() external view returns (address[] memory facetAddresses_);
function facetAddress(bytes4 _functionSelector) external view returns (address facetAddress_);
}
文件 4 的 10:IERC165.sol
pragma solidity ^0.8.23;
interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
文件 5 的 10:IERC173.sol
pragma solidity ^0.8.23;
interface IERC173 {
function owner() external view returns (address owner_);
function transferOwnership(address _newOwner) external;
}
文件 6 的 10:IERC20.sol
pragma solidity ^0.8.23;
interface IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
function totalSupply() external view returns (uint256);
function balanceOf(address _owner) external view returns (uint256 balance);
function transferFrom(
address _from,
address _to,
uint256 _value
) external returns (bool success);
function transfer(address _to, uint256 _value) external returns (bool success);
function approve(address _spender, uint256 _value) external returns (bool success);
function allowance(address _owner, address _spender) external view returns (uint256 remaining);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
文件 7 的 10:INewToken.sol
pragma solidity ^0.8.23;
import { IPresale} from "./IPresale.sol";
interface INewToken {
struct InitParams {
address owner;
address taxWallet;
address stakingFacet;
address v2router;
bool isFreeTier;
uint256 minLiq;
uint256 supply;
uint256 initTaxType;
uint256 initInterval;
uint256 countInterval;
uint256 maxBuyTax;
uint256 minBuyTax;
uint256 maxSellTax;
uint256 minSellTax;
uint256 lpTax;
uint256 maxWallet;
uint256 maxTx;
uint256 preventSwap;
uint256 maxSwap;
uint256 taxSwapThreshold;
string name;
string symbol;
}
struct TeamParams {
address team1;
uint256 team1p;
uint256 cliffPeriod;
uint256 vestingPeriod;
bool isAdd;
}
function rescueERC20(address _address) external;
function increaseLimits(uint256 maxwallet, uint256 maxtx) external;
function startTrading(uint256 lockPeriod, bool shouldBurn, address router) external;
function addPresale(address presale, uint256 percent, IPresale.PresaleParams memory newdetails) external;
function finPresale() external;
function refPresale() external;
function addTeam(TeamParams memory params) external;
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
文件 8 的 10:IPresale.sol
pragma solidity ^0.8.23;
interface IPresale {
struct PresaleParams {
address owner;
address token;
uint256 softcap;
uint256 hardcap;
uint256 startTs;
uint256 finishTs;
uint256 duration;
uint256 liqPercent;
uint256 cliffPeriod;
uint256 vestingPeriod;
uint256 status;
uint256 sold;
uint256 maxEth;
uint256 maxBag;
uint256 fee;
}
function transferOwnership(address _newOwner) external;
function owner() external view returns (address);
function rescueERC20(address _address) external;
function setupPresale(PresaleParams memory params) external;
function buyTokens(uint256 _amount) external payable;
function claimTokens() external;
function getRefund() external;
function getPresaleDetails() external view returns(PresaleParams memory);
function finishPresale() external;
function claimEth() external;
function getClaimableTokens(address user) external view returns(uint256,uint256,uint256,uint256);
function refundPresale() external;
}
文件 9 的 10:LibAppStorage.sol
pragma solidity ^0.8.23;
import {LibDiamond} from "./LibDiamond.sol";
import {IUniswapV2Factory, IUniswapV2Router02} from "../interfaces/INewToken.sol";
struct AppStorage {
mapping(address => bool) validRouters;
mapping(address => bool) allowedTokens;
mapping(address => address) launchedTokens;
mapping(address => address) launchedPresale;
uint256 ethCost;
uint256 deployyyyerCost;
uint256 promoCostEth;
uint256 promoCostDeployyyyer;
address bridge;
mapping(address => uint256) myScore;
uint256 cScore;
bool isParent;
uint256 minLiq;
mapping(address => uint256) teamShare;
mapping(address => uint256) teamClaim;
uint256 teamBalance;
uint256 cliffPeriod;
uint256 vestingPeriod;
mapping(address => bool) isExTxLimit;
mapping(address => bool) isExWaLimit;
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowances;
address payable taxWallet;
address payable deployyyyerCa;
address payable stakingContract;
address stakingFacet;
address presaleFacet;
address tokenFacet;
uint256 stakingShare;
uint256 buyCount;
uint256 initTaxType;
uint256 initInterval;
uint256 countInterval;
uint256 taxBuy;
uint256 maxBuyTax;
uint256 minBuyTax;
uint256 taxSell;
uint256 maxSellTax;
uint256 minSellTax;
uint256 tradingOpened;
uint8 decimals;
uint256 tTotal;
string name;
string symbol;
uint256 preventSwap;
uint256 taxSwapThreshold;
uint256 maxTaxSwap;
uint256 maxWallet;
uint256 maxTx;
IUniswapV2Router02 uniswapV2Router;
address uniswapV2Pair;
bool tradingOpen;
bool inSwap;
bool walletLimited;
bool isFreeTier;
bool isBurnt;
bool isRetrieved;
uint256 lockPeriod;
uint256 lpTax;
uint256 halfLp;
uint256 lastSwap;
uint256 presaleTs;
uint256 presaleSt;
address presale;
}
contract Modifiers {
AppStorage internal s;
modifier onlyOwner() {
LibDiamond.enforceIsContractOwner();
_;
}
}
文件 10 的 10:LibDiamond.sol
pragma solidity ^0.8.23;
import { IDiamondCut } from "../interfaces/IDiamondCut.sol";
library LibDiamond {
bytes32 constant DIAMOND_STORAGE_POSITION = keccak256("diamond.standard.diamond.storage");
struct DiamondStorage {
mapping(bytes4 => bytes32) facets;
mapping(uint256 => bytes32) selectorSlots;
uint16 selectorCount;
mapping(bytes4 => bool) supportedInterfaces;
address contractOwner;
}
function diamondStorage() internal pure returns (DiamondStorage storage ds) {
bytes32 position = DIAMOND_STORAGE_POSITION;
assembly {
ds.slot := position
}
}
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
function setContractOwner(address _newOwner) internal {
DiamondStorage storage ds = diamondStorage();
address previousOwner = ds.contractOwner;
ds.contractOwner = _newOwner;
emit OwnershipTransferred(previousOwner, _newOwner);
}
function contractOwner() internal view returns (address contractOwner_) {
contractOwner_ = diamondStorage().contractOwner;
}
function enforceIsContractOwner() internal view {
require(msg.sender == diamondStorage().contractOwner, "l0");
}
bytes32 constant CLEAR_SELECTOR_MASK = bytes32(uint256(0xffffffff << 224));
function diamondCut(
IDiamondCut.FacetCut[] memory _diamondCut,
address _init,
bytes memory _calldata
) internal {
DiamondStorage storage ds = diamondStorage();
uint256 originalSelectorCount = ds.selectorCount;
uint256 selectorCount = originalSelectorCount;
bytes32 selectorSlot;
if (selectorCount & 7 > 0) {
selectorSlot = ds.selectorSlots[selectorCount >> 3];
}
for (uint256 facetIndex; facetIndex < _diamondCut.length; facetIndex++) {
(selectorCount, selectorSlot) = addReplaceRemoveFacetSelectors(
selectorCount,
selectorSlot,
_diamondCut[facetIndex].facetAddress,
_diamondCut[facetIndex].action,
_diamondCut[facetIndex].functionSelectors
);
}
if (selectorCount != originalSelectorCount) {
ds.selectorCount = uint16(selectorCount);
}
if (selectorCount & 7 > 0) {
ds.selectorSlots[selectorCount >> 3] = selectorSlot;
}
require(_init == address(0), "l1");
require(_calldata.length == 0, "l2");
}
function addReplaceRemoveFacetSelectors(
uint256 _selectorCount,
bytes32 _selectorSlot,
address _newFacetAddress,
IDiamondCut.FacetCutAction _action,
bytes4[] memory _selectors
) internal returns (uint256, bytes32) {
DiamondStorage storage ds = diamondStorage();
require(_selectors.length > 0, "l3");
if (_action == IDiamondCut.FacetCutAction.Add) {
enforceHasContractCode(_newFacetAddress, "l4");
for (uint256 selectorIndex; selectorIndex < _selectors.length; selectorIndex++) {
bytes4 selector = _selectors[selectorIndex];
bytes32 oldFacet = ds.facets[selector];
require(address(bytes20(oldFacet)) == address(0), "l5");
ds.facets[selector] = bytes20(_newFacetAddress) | bytes32(_selectorCount);
uint256 selectorInSlotPosition = (_selectorCount & 7) << 5;
_selectorSlot = (_selectorSlot & ~(CLEAR_SELECTOR_MASK >> selectorInSlotPosition)) | (bytes32(selector) >> selectorInSlotPosition);
if (selectorInSlotPosition == 224) {
ds.selectorSlots[_selectorCount >> 3] = _selectorSlot;
_selectorSlot = 0;
}
_selectorCount++;
}
}
else {
revert("l6");
}
return (_selectorCount, _selectorSlot);
}
function enforceHasContractCode(address _contract, string memory _errorMessage) internal view {
uint256 contractSize;
assembly {
contractSize := extcodesize(_contract)
}
require(contractSize > 0, _errorMessage);
}
}
{
"compilationTarget": {
"contracts/Deployyyyer.sol": "Deployyyyer"
},
"evmVersion": "paris",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": []
}
[{"inputs":[{"components":[{"internalType":"address","name":"facetAddress","type":"address"},{"internalType":"enum IDiamondCut.FacetCutAction","name":"action","type":"uint8"},{"internalType":"bytes4[]","name":"functionSelectors","type":"bytes4[]"}],"internalType":"struct IDiamondCut.FacetCut[]","name":"_diamondCut","type":"tuple[]"},{"components":[{"internalType":"bool","name":"createToken","type":"bool"},{"internalType":"address","name":"taxwallet","type":"address"},{"internalType":"address","name":"stakingFacet","type":"address"},{"internalType":"address","name":"presaleFacet","type":"address"},{"internalType":"address","name":"tokenFacet","type":"address"},{"internalType":"address","name":"v2router","type":"address"},{"internalType":"address","name":"team1","type":"address"},{"internalType":"address","name":"team2","type":"address"},{"internalType":"address","name":"team3","type":"address"},{"internalType":"address","name":"marketing","type":"address"},{"internalType":"address","name":"treasury","type":"address"},{"internalType":"uint256","name":"ethCost","type":"uint256"},{"internalType":"uint256","name":"deployyyyerCost","type":"uint256"},{"internalType":"uint256","name":"promoCostEth","type":"uint256"},{"internalType":"uint256","name":"promoCostDeployyyyer","type":"uint256"},{"internalType":"uint256","name":"minLiq","type":"uint256"},{"internalType":"address","name":"uniswapRouter","type":"address"},{"internalType":"address","name":"sushiswapRouter","type":"address"},{"internalType":"address","name":"pancakeswapRouter","type":"address"}],"internalType":"struct Deployyyyer.ConstructorArgs","name":"_args","type":"tuple"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"name","type":"string"},{"indexed":false,"internalType":"string","name":"symbol","type":"string"},{"indexed":false,"internalType":"uint256","name":"supply","type":"uint256"}],"name":"FactoryBuilt","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"maxWallet","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"maxTx","type":"uint256"}],"name":"IncreasedLimits","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"ethCost","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"deployyyyerCost","type":"uint256"}],"name":"LaunchCostChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"minLiq","type":"uint256"}],"name":"MinLiquidityChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"ethCost","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"deployyyyerCost","type":"uint256"}],"name":"PromoCostChanged","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"address","name":"team1","type":"address"},{"internalType":"uint256","name":"team1p","type":"uint256"},{"internalType":"uint256","name":"cliffPeriod","type":"uint256"},{"internalType":"uint256","name":"vestingPeriod","type":"uint256"},{"internalType":"bool","name":"isAdd","type":"bool"}],"indexed":false,"internalType":"struct INewToken.TeamParams","name":"tparams","type":"tuple"}],"name":"TeamSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"stateMutability":"payable","type":"fallback"},{"stateMutability":"payable","type":"receive"}]