VeFactory
is a smart contract designed to create new veToken
contracts. This contract generates veTokens
that provide rewards to users through token locking.
veToken
is an ERC-20 compatible token obtained by locking tokens. However, this token does not have a transfer()
function. It functions as a voting escrow token, where locked tokens are weighted based on the duration of the lock.
FeeDistributor
is a smart contract that distributes specific tokens to veToken
holders. This contract calculates rewards based on the token lock period and distributes them to users.
MultiTokenFeeDistributor
is a smart contract that distributes multiple tokens to veToken
holders. This contract calculates rewards based on the user's lock period and distributes them accordingly.
Before deploying or interacting with the contracts, ensure you have a .env
file configured with the necessary environment variables. Below is an example of the required variables:
DEPLOYER_PRIVATE_KEY= # Your private key for deploying contracts
RPC_URL= # The RPC URL of the Ethereum node
ETHERSCAN_API_KEY= # Your Etherscan API key for contract verification
CHAIN_ID= # The chain ID of the network you are deploying to
# FeeDistributor initial data
VOTING_ESCROW= # Address of the Voting Escrow contract
START_TIME= # Epoch time for fee distribution to start
TOKEN= # Address of the fee token
ADMIN= # Admin address for the contract
EMERGENCY_RETURN= # Address for emergency token return
# CreateVeToken
TOKEN_ADDRESS= # Address of the original token for veToken creation
VE_TOKEN_NAME= # Name of the veToken
VE_TOKEN_SYMBOL= # Symbol of the veToken
To build the project, use the following command:
$ forge build
To run tests, use the following command:
$ forge test
To format the code, use the following command:
$ forge fmt
To start a local Ethereum node, use the following command:
$ anvil
Deploy the proxy and implementation for VeFactory
:
$ sh script/sh/DeployVeFactory.sh
Deploy the proxy, dictionary, and implementation for FeeDistributor
:
$ sh script/sh/DeployFeeDistributor.sh
Deploy the proxy, dictionary, and implementation for MultiTokenFeeDistributor
:
$ sh script/sh/DeployMultiTokenFeeDistributor.sh
Create a veToken
using VeFactory
by executing createVeToken
:
$ sh script/sh/CreateVeToken.sh
Clone the proxy for MultiTokenFeeDistributor
:
$ sh script/sh/CloneMultiTokenFeeDistributor.sh
Verify the veToken
deployed by CreateVeToken
:
$ sh script/sh/VerifyVeToken.sh