Beacon contract for broadcasting Curve-style voting escrow balances & total supply from Ethereum to other networks.
- Arbitrum
- Optimism
- Polygon
- BSC
- Gnosis chain
The VeBeacon
contract lives on Ethereum and handles broadcasting data to other networks. To broadcast the balance of a user, use:
uint256 requiredValue = beacon.getRequiredMessageValue(chainId, gasLimit, maxFeePerGas);
beacon.broadcastVeBalance{value: requiredValue}(user, chainId, gasLimit, maxFeePerGas);
requiredValue
and maxFeePerGas
may be set to 0 for networks other than Arbitrum, as currently only Arbitrum requires paying an ETH fee to pass a message.
VeRecipient
lives on non-Ethereum networks and provides other contracts on the network with the vetoken balances of users & the total supply. Simply use balanceOf()
and totalSupply()
as you would with a regular voting escrow contract. Balances & total supply have the same time-decay behavior as regular voting escrow contracts.
There are two caveats:
- If a user has updated their lock on Ethereum,
VeBeacon
must be called to broadcast the updated vetoken balance & total supply to other chains. - The total supply may diverge from the correct value if nobody broadcasts via
VeBeacon
for 8 epochs (~2 months). It can be fixed by making a broadcast.
To install with Foundry:
forge install timeless-fi/ve-beacon
This project uses Foundry as the development framework.
Please create a .env
file before testing/deploying. An example can be found in .env.example
.
forge install
forge build
forge test -f mainnet
forge script script/DeployBeacon.s.sol -f mainnet
forge script script/DeployRecipient.s.sol -f [recipient-network]
forge script script/DeployBeacon.s.sol -f mainnet --verify --broadcast
forge script script/DeployRecipient.s.sol -f [recipient-network] --verify --broadcast