You have two testing environments: testnet and an instance of the blockchain running locally (a solo node).
Testing your app on testnet is more straightforward since all contracts are already deployed by us and you can use our testnet dApp to add apps, interact with smart contracts, and manage reward distribution.
Testing on solo will be a bit more complicated because you will need to deploy some mocked VeBetter contracts by yourself, but we tried to make that easy as well.
Testnet
Use our testnet environment, running on vechain testnet network, to create apps, interact with smart contracts, and manage reward distribution.
Then you can navigate to https://staging.testnet.governance.vebetterdao.org/admin, start a new round by clicking "Start new round & claim allocations" (you will probably need to do it a couple of times before you begin getting b3tr from allocations)
To allow your contract to distribute the rewards, you need to click the cogs icon, enter the Settings section of your app, and add the address of your contract (which will call the distributeReward function) as a "Reward Distributor".
That's it, you are all set and can distribute rewards through your backend or smart contract.
Testing on the solo node (aka: local node running on your computer simulating VeChain blockchain) is a bit more complicated than testing on testnet, since you will need to deploy the VeBetter contracts locally and interact with them to create your app, obtain the APP_ID, start an allocation round, vote, start round again, and add the reward distributor.
We recommend following the testnet path, but if you need to do it on the solo network you will need to mock a few VeBetter contracts:
B3TR token mock: you need a fake token to distribute
X2EarnApps mock: you need a contract where to add your app, generate an APP_ID and add a reward distributor
X2EarnRewardsPool mock: you need a contract to distribute the rewards
While the X2EarnRewardsPoolMock contract can be the exact same contract deployed on mainnet and testnet, the other two can be customized in order to have only the essential logic needed for running tests.
You can take a look at the mocked contracts in the X-App-Template repository, under the contracts/mocks folder.
After you added the mock contracts to your repository you should adjust the deploy script in a way that you will deploy and configure the mocked contracts only if you are deploying to the vechain_solo network.
Your script should look something like this:
That's it, you can now deploy your contracts locally/run tests where you simulate the VeBetter contracts, your app added to the ecosystem, and tokens distribution.