UBI v2 Testing has began!

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:

  1. Get some Kovan ETH from a faucet. Not all faucets work, but you could get 0.1 kovan ETH on this one
  2. 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 current ubiPerSecond accrual.
    Also, if you have already delegated, it should not exceed your total delegation. The current value of ubiPerSecond 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.

11 Likes

Testing. Nice instructions!

So far, so good. Was able to complete all steps above.

Now will test a bit… :slightly_smiling_face:

2 Likes

Awesome! Let me know if you have any doubts or questions!

delegation working!

2 Likes

Not sure recipient address [0x0f1D4A5378AeAd1dD7a4E6D99121aAC2D0482A98] received the NFT. How do I confirm?

The delegation is an NFT.
If you have access to that wallet, just add the contract to the wallet on the nfts section.

Adding this Address should be enough. Maybe the token ID. Check the transactions on etherscan

1 Like

Everything went OK, I did everything, delegated 100%, then deleted that (It was a little tricky to find the NFT #) and made another delegation to 50% to another address, sent UBI back and forth… deleted the last delegation… If I could do this… following the instructions, everyone can. Looks good Juanu!!

3 Likes

Pude hacer todo el proceso perfecto con la descripción.
En principio todo funciona bien. Voy a probar tranferir el NFT que lo q me falta.

3 Likes

Pude ejecutar satisfactoriamente todos los casos de prueba !

Solo me generó dudas que el método getDelegationInfo no rastrea los holders intermedios del NFT sino que muestra siempre el origen de la delegación y la address final. Más allá de eso, es correcto el status que muestra: activo o inactivo si previamente se cancelo la delegación.

En una segunda delegación el NFT se crea con un nuevo ID y se repite la casuística utilizada con el NFT de las primeras pruebas. (todo correcto)

Observación menor: Al sobrepasar el límite de delegación en el parámetro ubiPerSecond se genera un error (que es lo esperado) pero el mensaje no es correcto ya que muestra “Invalid parameters: must provide an Ethereum address”.

2 Likes

Gracias por tomarse el trabajo!

Así es. Solo se muestra la info actual. Lo bueno es que al ser todo blockchain based, uno puede rastrear el historial inspeccionando la blockchain.
Sería redundante guardar el historial onchain, cuando esa información ya existe.

Buena observación. Lo voy a revisar.
Gracias!

1 Like

Muy claras y fáciles de seguir las instrucciones, ya ejecutados todos los casos de prueba satisfactoriamente asique se puede decir que todo perfecto!

1 Like

Already testing it! let see how to use it and what can we do with!

1 Like

@juanu How do i confirm from the delegated wallet, how much ubi is flowing in the NFT?

Flowing goes to the holder of the NFT, so you can just check the UBI balanceOf of the wallet you delegated.

An updated version is aout to come (with the help of @ludovico ) but for the sace of speed, basically:

  • Go to Read Contract (on the UBIv2 conrtact)
  • Expand balanceOf
  • Enter the address of the delegated wallet
  • Click query
2 Likes

BalanceOF is giving you the amount of UBI at the time you query, right? so if you want to know the flowing amount (UBI per secod) you need to check twice in different moments to caclulate the UBI rate, am I correct?

Oh I see.
If you want to know the amount delegated, you can check on the delegator contract (in this case the FUBI). https://kovan.etherscan.io/address/0x7428d94483aBE7D8c8257E18d640FcE864B3a439#readContract

You need to know the id of the Flow, and call the function getFlow passing it the Flow ID,

This will return all the parameters of the flow. ratePerSecond will tell you how much UBI per second that flow is delegating

1 Like

@juanu cómo estás? Dos preguntitas me surgen de las pruebas:

(1)
Probé creando una delegación, cancelandola y volviendo a delegar a la misma wallet.
En Metamask veo como si tuviera dos veces el FUBI
image

Revisando en el contrato de FUBI, veo que el token 47 (el primero) no está activo y el token 48 (la segunda delegación) está activa. El NFT en sí mismo nunca se “borra” no?

(2)
Puse una expiración de POH cortita, en unos días. Asumo que lo esperado es que el flow 48 que delegué y ahora está activo, se desactive y se dejen de recibir ubis, verdad? Eso es lo que debería chequear?

Saludos
Hernán

1 Like

Hola! Gracias por ayudar a testear!

Efectivamente, los NFTs quedan, pero se desactivan.

No realmente. Esto esta atado a una conversacion activa que hay sobre el funcionamiento base de UBI y no de las delegaciones. Cuando un perfil expira, sigue recibiendo UBI hasta que alguien ejecute la funcion reportRemoval en el contrato de UBI

1 Like