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
Name | Type | Description |
---|---|---|
|
| 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
Name | Type | Description |
---|---|---|
|
| Amount of paired token to supply as liquidity in the LP. |
|
| Name of the token being deployed. |
|
| Symbol of the token being deployed. |
|
| Total supply to be minted during deployment. |
|
| Address that will receive deployer buy and sell fees. |
|
| Buy fee in BPS. |
|
| Sell fee in BPS. |
|
| Address of the token to pair with in the LP. |
|
| Amount of total supply in BPS to allocate to deployer. |
|
| Time in seconds to vest the deployer's allocation. |
|
| Amount of time in seconds that snipe protection will be enabled. |
|
| Amount of time in seconds that heavy snipe penalty is enabled. |
|
| Starting exponent for heavy snipe penalty. |
|
| Salt for token deployment to generate a deterministic address. |
setPairedTokenSettings
Admin function to configure a paired token.
Parameters
Name | Type | Description |
---|---|---|
|
| Address of the paired token to configure. |
|
| True if the token is allowed as a paired token, false if not. |
|
| 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
Name | Type | Description |
---|---|---|
|
| Address of the paired token to configure. |
|
| True if the token is allowed as a paired token, false if not. |
|
| Minimum amount of token that may be supplied as initial liquidity. |
|
| 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
Name | Type | Description |
---|---|---|
|
| Maximum buy fee in BPS. |
|
| Maximum sell fee in BPS. |
|
| Minimum time in seconds that a deployer tokens must vest over. |
|
| Minimum time in seconds for snipe protection to be enabled. |
|
| Maximum time in seconds for snipe protection to be enabled. |
|
| Minimum time in seconds for heavy snipe protection to be enabled. |
|
| Maximum time in seconds for heavy snipe protection to be enabled. |
|
| Minimum exponent penalty during heavy snipe protection. |
|
| 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
Name | Type | Description |
---|---|---|
|
| 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
Name | Type | Description |
---|---|---|
|
| 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
Name | Type | Description |
---|---|---|
|
| 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
Name | Type | Description |
---|---|---|
|
| 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
Name | Type | Description |
---|---|---|
|
| 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
Name | Type | Description |
---|---|---|
|
| Array of tokens to set approvals on. |
|
| Array specifying whether to approve or revoke approval. |
|
| 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
Name | Type | Description |
---|---|---|
|
| Array of token sale parameters to execute on the Uniswap router. |
|
| 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
Name | Type | Description |
---|---|---|
|
| Address of the token to withdraw. |
|
| 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
Name | Type | Description |
---|---|---|
|
| Address of the token to withdraw. |
|
| Address to withdraw the token to. |
|
| 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
Name | Type | Description |
---|---|---|
|
| Address to withdraw the token to. |
_setPairedTokenSettings
Internal function for setPairedTokenSettings
and setPairedTokenSettingsWithAllowance
.
Parameters
Name | Type | Description |
---|---|---|
|
| Address of the paired token to configure. |
|
| True if the token is allowed as a paired token, false if not. |
|
| Minimum amount of token that may be supplied as initial liquidity. |
|
| 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