How to calculate average of some numbers in the secret contract of Enigma?

Hey Hidehiro!

Super glad you posted this initially, actually helped point out a little bug that has now been resolved, so thank you :slight_smile:

There were two issues at play here:

1.) string vs. uint: In the developer guide pushed out, there was a bug where we were actually passing in an encrypted value of a string type instead of a number type for the net worth. To fix this, I made two modifications, which you can see in the guide.

The first is in the AddMillionaireDialog.js section (line 126) - I specify that the input field is of type number.

The second is in the MillionairesProblemWrapper.js section (line 58) - I pass in a BigNumber instance of the net worth.

2.) Even if you had properly passed in an int, it wasn’t being properly handled. This has now been resolved in the internal services and you can ensure you are using the latest correct code by running docker-compose build --no-cache within your network tab (the one that holds the enigma-docker-network) and relaunching with ./launch.bash -s -t

Hopefully with these two you should be good to go, but please reach out if something isn’t working still :slight_smile:

2 Likes