1.1.0 • Published 2 years ago

@upala/unique-human v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

unique-human-lib

Confirming user score on-chain

Contract

If your DApp needs on-chain proof of score, check this example

Front-end

Load uniqueness data

  • querry Graph to get user id (Graph: "Get user UpalaID by address")
  • if no id, "Error: no UpalaID found for the address".
  • querry Graph to get list of groups approved by dapp (Graph: "Get approved pool for the dapp address")
  • querry Graph to get list of delegates (Get list of delegates by Upala ID)
  • query all individual scores from DB for Upala ID and delegates among approved groups (see GET request here). Will return score, pool type and proof.
  • Get pool balance by pool address (graph)
  • Get pool base score by pool address (graph)
  • Calculate best total score among pools (baseScore * individualScore)
  • querry graph for the poolType (Graph: "Get poolType by group address")

Call

  • constuct bytes proof depending on the pool type. As we are building SignedScoresPool first, just pass signature (see db) as the proof argument.
  • call dapp contract function with appropriate proof. e.g. claimUBI(address recipient, poolAddress address, address identityID, uint8 score, bytes proof)
1.1.0

2 years ago