g8keepFactory
g8keepFactory
Inherits: IG8keepFactory, Ownable
Factory for managing deployment parameters, deploying g8keep token contracts, locking initial liquidity, and managing token fees.
State Variables
WETH
Wrapped native token contract for token deployments using native currency.
UNISWAP_V2_ROUTER
Uniswap V2 router address for the chain.
g8keepTokenVesting
Vesting contract to be used when deployer tokens are subject to vesting restrictions.
g8keepFeeWallet
Fee wallet to receive initial liquidity fees.
penaltyReceiver
Address that will receive penalty tax tokens.
g8keepFee
Fee in BPS assessed on token trades, paid to g8keep. Initial value: 1.0%
g8keepInitialLiquidityFee
Fee in BPS assessed on initial liquidity supplied. Initial value: 2.0%
maxBuyFee
Maximum buy fee in BPS assessed on token trades, paid to token deployer. Initial value: 5.0%
maxSellFee
Maximum sell fee in BPS assessed on token trades, paid to token deployer. Initial value: 5.0%
minimumDeployVestTime
Minimum time in seconds that a deployer's share of tokens must be vested over. Initial value: 1 day
minimumSnipeProtectionSeconds
Minimum time in seconds that a deployed token must have snipe protection enabled.
maximumSnipeProtectionSeconds
Maximum time in seconds that a deployed token may have snipe protection enabled.
minimumHeavySnipeProtectionSeconds
Minimum time in seconds that a deployed token must have heavy snipe protection enabled.
maximumHeavySnipeProtectionSeconds
Maximum time in seconds that a deployed token may have heavy snipe protection enabled.
minimumHeavySnipeExponent
Minimum exponent that a deployed token must have for heavy snipe penalties.
maximumHeavySnipeExponent
Maximum exponent that a deployed token may have for heavy snipe penalties.
MAX_SETTING_G8KEEP_FEE
Guardrail for g8keepFee
to prevent it from being set over 100 BPS.
MAX_SETTING_G8KEEP_INITIAL_LIQUIDITY_FEE
Guardrail for g8keepInitialLiquidityFee
to prevent it from being set over 200 BPS.
MAX_SETTING_BUY_FEE
Guardrail for maxBuyFee
to prevent it from being set over 500 BPS.
MAX_SETTING_SELL_FEE
Guardrail for maxSellFee
to prevent it from being set over 500 BPS.
MAX_SETTING_MINIMUM_DEPLOY_VEST_TIME
Guardrail for minimumDeployVestTime
to prevent it from being set over 90 days.
MAX_SETTING_MINIMUM_SNIPE_PROTECTION_SECONDS
Guardrail for minimumSnipeProtectionSeconds
to prevent it from being set over 7 days.
MAX_SETTING_MAXIMUM_SNIPE_PROTECTION_SECONDS
Guardrail for maximumSnipeProtectionSeconds
to prevent it from being set over 365 days.
MAX_SETTING_MINIMUM_HEAVY_SNIPE_PROTECTION_SECONDS
Guardrail for minimumHeavySnipeProtectionSeconds
to prevent it from being set over 1 days.
MAX_SETTING_MAXIMUM_HEAVY_SNIPE_PROTECTION_SECONDS
Guardrail for maximumHeavySnipeProtectionSeconds
to prevent it from being set over 5 days.
MIN_SETTING_MINIMUM_HEAVY_SNIPE_EXPONENT
Guardrail for minimumHeavySnipeExponent
to prevent it from being set under 2.
MAX_SETTING_MINIMUM_HEAVY_SNIPE_EXPONENT
Guardrail for minimumHeavySnipeExponent
to prevent it from being set over 20.
MAX_SETTING_MAXIMUM_HEAVY_SNIPE_EXPONENT
Guardrail for maximumHeavySnipeExponent
to prevent it from being set over 100.
BPS
Constant value for BPS.
allowedPairs
Mapping to flag a token address as an allowed pair token for g8keep token deployments.
pairedTokenMinimumLiquidity
Mapping of the minimum initial liquidity to be provided for a paired token.
lockedTokens
Mapping of tokens that are locked to prevent sale or withdrawal.
Functions
constructor
Constructs the g8keepFactory contract.
Initialization parameters are retrieved from a configuration contract so that the g8keepFactory may be deterministically deployed on EVM chains at the same
address.
Parameters
_g8keepFactoryConfiguration
address
The address of the factory configuration contract to retrieve configuration parameters.
deployToken
Deploys a g8keepToken contract, creates and funds the LP, locks initial liquidity.
Parameters must be within ranges defined by the factory settings.
Token salt value must be calculated to generate a token deployment address that is greater than the _pairedToken
address.
Parameters
_initialLiquidity
uint256
Amount of paired token to supply as liquidity in the LP.
_name
string
Name of the token being deployed.
_symbol
string
Symbol of the token being deployed.
_totalSupply
uint256
Total supply to be minted during deployment.
_treasuryWallet
address
Address that will receive deployer buy and sell fees.
_buyFee
uint16
Buy fee in BPS.
_sellFee
uint16
Sell fee in BPS.
_pairedToken
address
Address of the token to pair with in the LP.
_deployReserve
uint256
Amount of total supply in BPS to allocate to deployer.
_deployVestTime
uint256
Time in seconds to vest the deployer's allocation.
_snipeProtectionSeconds
uint256
Amount of time in seconds that snipe protection will be enabled.
_heavySnipeSeconds
uint256
Amount of time in seconds that heavy snipe penalty is enabled.
_heavySnipeExponent
uint256
Starting exponent for heavy snipe penalty.
_tokenSalt
bytes32
Salt for token deployment to generate a deterministic address.
setPairedTokenSettings
Admin function to configure a paired token.
Parameters
pairedToken
address
Address of the paired token to configure.
allowed
bool
True if the token is allowed as a paired token, false if not.
minimumLiquidity
uint256
Minimum amount of token that may be supplied as initial liquidity.
setPairedTokenSettingsWithAllowance
Admin function to configure a paired token with a specific allowance amount.
Used for certain ERC20 tokens that have unusual approval methods.
Parameters
pairedToken
address
Address of the paired token to configure.
allowed
bool
True if the token is allowed as a paired token, false if not.
minimumLiquidity
uint256
Minimum amount of token that may be supplied as initial liquidity.
allowanceAmount
uint256
Amount to set for the allowance to the Uniswap Router.
setDeploymentSettings
Admin function to configure deployment parameters.
Settings parameters must be within the constant guardrails defined.
Parameters
_maxBuyFee
uint16
Maximum buy fee in BPS.
_maxSellFee
uint16
Maximum sell fee in BPS.
_minimumDeployVestTime
uint24
Minimum time in seconds that a deployer tokens must vest over.
_minimumSnipeProtectionSeconds
uint24
Minimum time in seconds for snipe protection to be enabled.
_maximumSnipeProtectionSeconds
uint24
Maximum time in seconds for snipe protection to be enabled.
_minimumHeavySnipeProtectionSeconds
uint24
Minimum time in seconds for heavy snipe protection to be enabled.
_maximumHeavySnipeProtectionSeconds
uint24
Maximum time in seconds for heavy snipe protection to be enabled.
_minimumHeavySnipeExponent
uint8
Minimum exponent penalty during heavy snipe protection.
_maximumHeavySnipeExponent
uint8
Maximum exponent penalty during heavy snipe protection.
setG8keepFee
Admin function to set the g8keep fee that will be assessed on token trades.
Fee must be less than the constant guardrail settings.
Parameters
_g8keepFee
uint16
Fee in BPS to assess on token trades.
setG8keepInitialLiquidityFee
Admin function to set the g8keep fee that will be assessed on initial liquidity.
Fee must be less than the constant guardrail settings.
Parameters
_g8keepInitialLiquidityFee
uint16
Fee in BPS to assess on initial liquidity.
setG8keepTokenVestingAddress
Admin function to set the g8keep vesting contract address.
The vesting contract address may only be set to the zero address when minimum vesting time is set to zero.
Parameters
_g8keepTokenVesting
address
Address of the g8keep token vesting contract.
setG8keepFeeWallet
Admin function to set the g8keep fee wallet to receive initial liquidity fees.
The fee wallet cannot be set to the zero address.
Parameters
_g8keepFeeWallet
address
Address of the g8keep fee wallet.
setPenaltyReceiver
Admin function to set the penalty receiver address.
The penalty receiver cannot be set to the zero address.
Parameters
_penaltyReceiver
address
Address of the penalty receiver.
setApprovalToUniswapRouter
Admin function to update approvals to the Uniswap router.
Used to update or revoke approvals in case there is an unusual approval mechanism on a paired ERC20 token.
Parameters
tokenAddresses
address[]
Array of tokens to set approvals on.
approved
bool[]
Array specifying whether to approve or revoke approval.
approvalRevokeAmount
uint256
Amount to use when revoking approvals.
sellTokens
Admin function to sell the tokens collected as fees on the g8keep platform.
Locked tokens supplied in sellParameters
will be skipped without reverting.
Parameters
sellParameters
TokenSale[]
Array of token sale parameters to execute on the Uniswap router.
deadline
uint256
Timestamp that the transaction must execute by or revert.
withdrawToken
Admin function to withdraw a token that is held by the factory contract.
Withdrawing a locked token will revert the transaction.
Will withdraw the entire balance of the token.
Parameters
tokenAddress
address
Address of the token to withdraw.
to
address
Address to withdraw the token to.
withdrawToken
Admin function to withdraw a token that is held by the factory contract.
Withdrawing a locked token will revert the transaction.
Will withdraw the specified amount
of token.
Parameters
tokenAddress
address
Address of the token to withdraw.
to
address
Address to withdraw the token to.
amount
uint256
Amount of the token to withdraw.
withdrawETH
Admin function to withdraw native token that is held by the factory contract.
Will withdraw the entire balance.
Parameters
to
address
Address to withdraw the token to.
_setPairedTokenSettings
Internal function for setPairedTokenSettings
and setPairedTokenSettingsWithAllowance
.
Parameters
pairedToken
address
Address of the paired token to configure.
allowed
bool
True if the token is allowed as a paired token, false if not.
minimumLiquidity
uint256
Minimum amount of token that may be supplied as initial liquidity.
allowanceAmount
uint256
Amount to set for the allowance to the Uniswap Router.
Events
TokenDeployed
Emitted when a token is deployed.
DeploymentSettingsUpdated
Emitted when the g8keepFactory owner updates deployment settings.
PairedTokenSettingsUpdated
Emitted when the g8keepFactory owner updates a paired token settings.
PenaltyReceiverUpdated
Emitted when the g8keepFactory owner updates a penalty receiver.
Errors
ArrayLengthMismatch
Thrown when arrays must match in length and they do not.
DeadlinePassed
Thrown when selling tokens and the deadline for the sale has passed.
FailedToDepositWETH
Thrown when the deposit to the WETH contract for initial liquidity fails.
InvalidDeploymentParameters
Thrown when deploying a token and the parameters are not compliant with deployment settings.
InvalidSettings
Thrown when the g8keepFactory owner is updating deployment settings and they are not compliant with the constant guardrails or when setting a penalty receiver that is the current receiver.
NotEnoughInitialLiquidity
Thrown when deploying a token and the initial liquidity is less than the minimum required.
PairNotAllowed
Thrown when deploying a token with a paired token that is not allowed.
TokenLocked
Thrown when attempting to withdraw a token that is locked.
ValueNotAllowedForNonWETHPairs
Thrown when native value is sent with a token deployment that does not use wrapped native.
ValueSentNotValid
Thrown when deploying a token and the value sent exceeds the initial liquidity specified.
WithdrawalFailed
Thrown when withdrawing native token from the contract and the withdrawal fails.
ZeroAddress
Thrown when a supplied address that must be non-zero is zero.
Structs
TokenSale
Struct used for defining token sale parameters.
Last updated