🏗️Requester.sol

How to deploy the Requester smart contract on chosen chain to fulfill on-chain Cred score requests

(In case you are deploying on the Arbitrum Goerli) You can learn how to get LINK testnet tokens in your MetaMask in the first guide of our Cred Oracle Integration series: https://credprotocol.medium.com/how-to-get-arbitrum-testnet-eth-and-other-tokens-in-5-minutes-28b6851cb4af.

Smart Contract Deployment

The Requester.sol can be deployed using the Remix IDE:

[WARNING: Repo requires manual change of the oracle and LINK token address for the deployment on proper chain. The comments in the contract should provide you the correct parameters]

https://remix.ethereum.org/#url=https://github.com/credprotocol/chainlink-request/blob/master/contracts/Requester.sol&optimize=false&runs=200&evmVersion=null&version=soljson-v0.8.7+commit.e28d00a7.js

  1. On the Compile tab, click the Compile button for Requester.sol. Remix automatically selects the compiler version and language from the pragma line in the smart contract unless you select a specific version manually.

  2. On the Deploy and Run tab, configure the following settings:

    1. Select "Injected Provider" as your Environment. The Javascript VM environment cannot access your oracle node. [WARNING: Make sure your MetaMask network is the one you want to deploy your contract on & you have the parameters set for]

    2. Select the Requester contract from the Contract menu.

  3. Click Deploy. MetaMask prompts you to confirm the transaction.

  4. After you deploy the contract, a link to Arbiscan displays at the bottom. Open that link in a new tab to keep track of the transaction.

  5. If the transaction is successful, a new address displays in the Deployed Contracts section.

Requesting Cred Score

In order to get the request fulfilled, you need to send some LINK to your smart contract. One request costs 0.1 LINK. If you try to request your Cred score and the smart contract does not have enough LINK, it will give you a gasEstimation error.

In Remix, call the requestCredScore function and sign the transaction in your MetaMask. After you see a successful transaction message in Remix, the background process have started and you should have your score on-chain soon.

(Wait for around 30 seconds from the point when the requestCredScore function was successfully called - it takes some time to pass the information to the API, wait for the response and to put that response back on chain) After waiting, click on 'currentScore' and your Cred score should be visible on-chain.

If your Cred score is 0, there are several reasons that might be causing this:

  • your wallet has 0 transactions, or

  • your Cred score has not updated yet to the chain

  • general error of our endpoint

You can check your Cred score for free at https://app.credprotocol.com/ and that can help you double check whether the value on-chain is correct.

Last updated