UBIv2 Testing
Hello humans, as you know, the UBI v2 development has been taking a couplke of big steps, and now we are ready to start some testing. Testing phase is critical to find issues. We need as mach people testing and validating as possible to ensure that everything works as expected. Anyone with at least a small degree of understanding of how contracts, transactions, NFTs, and tokens work, can help on this test. Even if you know nothing, you can still read this post and ask what you don’t understand. You will deffinitelly end learning.
I have deployed a version of the UBIv2 contract on Kovan. I picked Kovan mainly because I can verify the contract and allow etherscan to build the UI to interact with it. Was hoping to do it on Kiln, but thjere is not Contract Verification or UI in there.
Prerequisites:
- Get some Kovan ETH from a faucet. Not all faucets work, but you could get 0.1 kovan ETH on this one
- Register on the POH Dummy contract using the register function, passing a UNIX timestamp in the future (make sure to use a very long date in the future if you dont want your registry to expire quickly, although you can easily re-register).
NOTE: To convert a date to its UNIX timestamp representation you can use this tool. Enter the date and click on “Human date to Timestamp”
That’s all for prerequisites.
Interact with UBIv2
Most of the next steps will require you to interact with the UBIv2 contract for enabling UBI accrual, and delegating.
This is the UBIv2 contract address. Keep this URL at hand to interact with it: UBIv2 contract
1. Start UBI accrual
Before being able to delegate your UBI, you need to start receiving test UBI. To do so, navigate to the Write Contract section on UBIv2 on etherscan and execute the function startAccruing
passing the address you used to register on the POH Dummy on pre-requisites
2. Test delegation
Once you arte receiving your UBI, you can start testing delegations. There are 2 delegation implementations:
- Flow UBI (FUBI)
- Stream UBI (SUBI)
On this guid I will explain how to delegate using Flow only, because its the easiest. Stream UBI requires some extra parameters to be passed as encoded data. For that it would be much easier to have a custom UI.
To delegate your UBI to another account, execute the createDelegation
function and pass it the following parameters
-
implementation
: 0x7428d94483aBE7D8c8257E18d640FcE864B3a439 (the fubi contract) -
recipient
: The address to whom you want to delegate -
ubiPerSecond
: How many ubi per second. This value is expresed in what I call UBIwei, which is the smallest denomination of UBI. This value can’t be highers than your currentubiPerSecond
accrual.
Also, if you have already delegated, it should not exceed your total delegation. The current value ofubiPerSecond
is 280000000000000. If you want to delegate 10% of your UBI accrual, copy that value and remove 1 zero. You get the deal. -
data
: 0x0 (For now we pass this value always. We still need to test Stream UBI, so in the future, we might have some UI to help with this).
Click on Write. Once your transaction is completed, the recipient will receive an NFT that represents the Delegation, and should start receiving the UBI that you deletaged.
You can inspect the delegation NFTs on this URLs:
FUBI
https://kovan.etherscan.io/address/0x7428d94483aBE7D8c8257E18d640FcE864B3a439#readContract
SUBI
https://kovan.etherscan.io/address/0x26FF07908EbC14Fb96b7864F21925737bd82c796#readContract
3. Test and break
The previous steps allowed you to delegate UBI. Thats the asiest part. The complex part comes to actually testing the behaviour. In order to correctly test delegations we need to move a lot of stuff around, and mess a little bit with the contract.Following are some tests that you need to execute and validate:
- After delegating, do some UBI transfers from the source wallet (the human that created the delegation). Validate that the balance is correct on both sides.
- After delegating, ask the recipient of the UBI to do some transfers with the receivied UBI from delegation. Validate that the balance is correct on both sides.
- After delegating, ask the recipient of the delegation, to move the NFT to another account. This should stop the accrual on the first recipient, and start accruing on the new recipient of the NFT. Check that all balances (source human, 1st recipioent and 2nd recipient) are correct.
- Cancel a delegation. You can use the
cancelDelegation
function on the UBI contract. The parameters are as follows:- implementation: 0x7428d94483aBE7D8c8257E18d640FcE864B3a439 (the fubi contract)
- delegationId: The ID of the NFT!
4. Reporting issues or feedback
If you find any problems while testing, please, open an Issue on the UBI repository givins AS MUCH INFORMATION AS POSSIBLE on how to reproduce the issue.
This means, step by step what you did, and how you got to the issue.
Also attaching screenshots can help.
Thank you!
Thats all for now.
Feel free to contact me to any of my channels if you have any questions.
- POH Forum: This exact same place
- Lenster: juanumusic.lens
- Twitter: @juanumusic