veBIO is a vote-escrowed token implementation that enables BIO token holders to lock their tokens for a specified duration in exchange for voting power. The contract implements a time-weighted voting system where longer lock periods grant proportionally more voting power.
- Time-locked Staking: Users can lock BIO tokens for 1 to
maxWeeks(configurable) to receive veBIO voting power - Linear Decay: Voting power decreases linearly over time unless auto-renewal is enabled
- Auto-Renewal: Optional automatic lock renewal to maintain maximum voting power
- Multiple Positions: Users can create up to 200 separate lock positions
- Early Unlock: Admin-controlled emergency unlock mechanism for all positions
- EIP-712 Support: Enables gasless voting through signed messages
-
Voting Power Calculation:
- Maximum voting power is achieved by locking for the full
maxWeeksduration - Shorter lock periods receive proportionally less voting power
- Formula:
votingPower = (amount * lockWeeks / maxWeeks)
- Maximum voting power is achieved by locking for the full
-
Lock Management:
- Create new locks with
stake(amount, numWeeks, autoRenew) - Extend existing locks with
extend(id, additionalWeeks) - Toggle auto-renewal with
toggleAutoRenew(id) - Withdraw after lock expiry with
withdraw(id)
- Create new locks with
-
Governance Integration:
- Inherits from OpenZeppelin's VotesUpgradeable for snapshot and delegation support
- Compatible with Governor contracts for on-chain governance
Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.
Foundry consists of:
- Forge: Ethereum testing framework (like Truffle, Hardhat and DappTools).
- Cast: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data.
- Anvil: Local Ethereum node, akin to Ganache, Hardhat Network.
- Chisel: Fast, utilitarian, and verbose solidity REPL.
$ forge build$ forge test$ forge fmt$ forge snapshot$ anvil$ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key>$ cast <subcommand>$ forge --help
$ anvil --help
$ cast --help