MineFun is a decentralized platform that enables users to create, mine, and trade tokenized assets with automated liquidity pool creation. The platform implements a bonding curve mechanism where tokens are mined through ETH contributions, with automated liquidity provision once funding goals are met.
- Token Creation: Users can create custom ERC20 tokens with minimal setup
- Mining Mechanism: Contributors can "mine" tokens by sending ETH
- Automated Liquidity: Once funding goals are reached, liquidity pools are automatically created
- Bonding Period: Each token has a configurable bonding period (1 minute to 7 days)
- Refund System: Contributors can get refunds if bonding goals aren't met
- Upgradeable Architecture: Contract uses UUPS proxy pattern for future upgrades
The platform is built with a modular contract structure featuring two main contracts:
- MineFun.sol - The core mining platform contract
- DepinStaking.sol - The upgradeable staking contract for DePIN tokens
src/
├── Token.sol # ERC20 token implementation
├── DepinStaking.sol # Main staking contract (upgradeable)
├── ERC6909.sol # ERC6909 multi-token standard implementation
├── MockERC20.sol # Mock ERC20 for testing
└── upgradeable/ # Core platform contracts
├── IMineFun.sol # Interface definitions
├── MineFunAdmin.sol # Admin functionality
├── MineFunCore.sol # Core business logic
├── MineFun.sol # Main implementation contract
├── MineFunStorage.sol # Storage variables and structs
└── MineFunView.sol # View functions
script/
├── DeployDepinStaking.s.sol # Deploy staking implementation + proxy
├── UpgradeDepinStakingClean.s.sol # Upgrade staking implementation
├── SetLockPeriod.s.sol # Set staking lock period
├── DeployProxy.s.sol # Deploy main platform proxy
└── RedeployImplementation.s.sol # Redeploy platform implementation
test/
└── upgradeable/
├── DepinStaking.t.sol # Staking contract tests
├── Depin.t.sol # DePIN integration tests
└── MineFun.t.sol # Main platform tests
The Token.sol contract implements a standard ERC20 token with additional features:
- Transfer restriction until bonding is complete
- Minting/burning capabilities controlled by owner
- Launch functionality to enable transfers
The platform uses an upgradeable contract architecture with distinct responsibilities:
- MineFunStorage: Defines state variables and constants
- MineFunAdmin: Provides administrative functions
- MineFunCore: Implements core business logic
- MineFunView: Offers view functions for data retrieval
- MineFun: Main contract that inherits all functionality
The DepinStaking.sol contract provides upgradeable staking functionality for DePIN tokens:
- ERC6909 Support: Handles multi-token staking using ERC6909 standard
- Configurable Lock Period: Owner can set custom lock periods (default: 7 days)
- Upgradeable: Uses Transparent proxy pattern for future upgrades
- Key Functions:
stake(token, tokenId, amount): Stake ERC6909 tokensunstake(token, tokenId, amount): Unstake after lock periodsetLockPeriod(seconds): Owner can change lock periodunlockTime(user, token, tokenId): Check when tokens can be unstaked
- Token Creation: Users create a new token by providing name, symbol, description, image URL, and bonding time
- Mining Phase: Users can mine tokens by sending ETH (0.0002 ETH per mine)
- Bonding Mechanism:
- 50% of contributions go to the team wallet
- 50% is reserved for liquidity provision
- Once 1 ETH is raised for liquidity, bonding is complete
- Liquidity Provision: When bonding completes, a Uniswap V2 liquidity pool is automatically created
- Token Launch: After successful bonding, token transfers are enabled
- Initial Supply: 500M tokens (50% of max supply)
- Maximum Supply: 1B tokens
- Tokens Per Mine: 50,000 tokens
- Maximum Per Wallet: 10M tokens
- Mining Price: 0.0002 ETH per mine
- Creation Fee: 0.0001 ETH
Create a .env file based on the provided .env.example:
PRIVATE_KEY= # Your wallet private key
RPC_URL=https://solo-testnet.rpc.caldera.xyz/http # Default RPC URL for Caldera Solo testnet
SOLO_TESTNET_BLOCKSCOUT_API_URL=https://solo-testnet.explorer.caldera.xyz/api
SOLO_TESTNET_RPC_URL=https://solo-testnet.rpc.caldera.xyz/http
# Pre-configured addresses
TEAM_WALLET
UNISWAP_V2_ROUTER_CA
UNISWAP_V2_FACTORY_CA
USDT_CA
The project uses Foundry for deployment with the following scripts:
script/
├── DeployProxy.s.sol # Deploys the upgradeable proxy system
├── RedeployImplementation.s.sol # Redeploy the implementation directly
├── Imports-factory.s.sol # Uniswap factory imports
├── Imports.router.s.sol # Uniswap router imports
└── UniswapDeployer.s.sol # Deploys Uniswap contracts for testing
script/
├── DeployDepinStaking.s.sol # Deploy staking implementation + proxy
├── UpgradeDepinStakingClean.s.sol # Upgrade staking implementation
└── SetLockPeriod.s.sol # Set staking lock period
-
Install dependencies:
forge install -
Create your
.envfile from the example:cp .env.example .env -
Add your private key and configuration to the
.envfile -
Deploy main platform to Caldera Solo testnet:
forge script script/DeployProxy.s.sol:DeployProxy --rpc-url $RPC_URL --broadcast -
Deploy staking contract:
forge script script/DeployDepinStaking.s.sol:DeployDepinStaking --rpc-url $RPC_URL --broadcast -
Set staking lock period (optional):
forge script script/SetLockPeriod.s.sol:SetLockPeriod --rpc-url $RPC_URL --broadcast -
For verification on Blockscout (optional):
forge script script/DeployProxy.s.sol:DeployProxy --rpc-url $RPC_URL --broadcast --verify --verifier blockscout --verifier-url $BLOCKSCOUT_API_URL --chain-id 8884571
To create a new token, call the createMinedToken function with the following parameters:
name: Token namesymbol: Token symbolimageUrl: URL to token imagedescription: Token descriptionbondingTime: Duration of bonding period in seconds (between 1 minute and 7 days)
The creation requires a fee of 0.0001 ETH.
To mine tokens, call the mineToken function with:
minedTokenAddress: Address of the token to mine
Mining requires sending 0.0002 ETH per mine operation and is limited to 10M tokens per wallet.
If a token fails to reach its bonding goal by the deadline, contributors can get refunds by calling:
refundContributors(minedTokenAddress)
The platform supports staking ERC6909 tokens through the DepinStaking contract:
- Stake Tokens: Call
stake(tokenAddress, tokenId, amount)to stake ERC6909 tokens - Check Lock Period: Use
unlockTime(user, token, tokenId)to see when tokens can be unstaked - Unstake Tokens: Call
unstake(tokenAddress, tokenId, amount)after the lock period expires - Admin Functions: Owner can call
setLockPeriod(seconds)to change the lock period
Note: The lock period is configurable by the contract owner and defaults to 7 days.
- The contract uses CREATE2 for deterministic token addresses
- Bonding mechanism protects contributors with refund options
- Transfer restrictions prevent trading before liquidity is established
- Upgradeable design allows for future improvements
Run tests with Foundry:
forge test
- OpenZeppelin Contracts (Access Control, ERC20, Proxy)
- Uniswap V2 (Router, Factory interfaces)
- Foundry (Development and testing)
The project is configured to deploy on Caldera Solo testnet by default:
- RPC URL: https://solo-testnet.rpc.caldera.xyz/http
- Explorer API: https://solo-testnet.explorer.caldera.xyz/api
- Chain ID: 8884571