VeBetter: Build X2Earn Apps
Integration (Solidity)
Learn how to integrate VeBetter reward logic into your own Solidity smart contracts by importing the X2Earn interface and calling the distributeReward function onchain.
Solidity Version
Solidity (onchain) fits fully decentralized apps where rewards must be triggered transparently and interact with other contracts.
We need to do a couple of things here.
First, we need to import the X2Earn contract into our own contract. A smooth way of doing this is by creating an interface before defining your own contract:
And then we need to include a function that calls the .distributeReward method from the x2EarnRewardsPool contract. Here is a sample:
Join our Telegram