Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjusted KYC link to reference service provided by blockpass. #1

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions BlockPassChainlinkAPI.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;

import '@chainlink/contracts/src/v0.8/ChainlinkClient.sol';
import '@chainlink/contracts/src/v0.8/ConfirmedOwner.sol';

/**
* Request testnet LINK and ETH here: https://faucets.chain.link/
* Find information on LINK Token Contracts and get the latest ETH and LINK faucets here: https://docs.chain.link/docs/link-token-contracts/
*/

contract APIConsumer is ChainlinkClient, ConfirmedOwner {
using Chainlink for Chainlink.Request;

string public status;
bytes32 private jobId;
uint256 private fee;

/**
* @notice Initialize the link token and target oracle
*
* Mumbai Testnet details:
* Link Token: 0x326C977E6efc84E512bB9C30f76E30c160eD06FB
* Oracle: 0xA6559758f5A599996693e766B845A9109B1389F1 (Blockpass Oracle Smart Contract on Chainlink)
* jobId: <Yet unknown and has to be provided by Blockpass>
*
*/
constructor() ConfirmedOwner(msg.sender) {
setChainlinkToken(0x326C977E6efc84E512bB9C30f76E30c160eD06FB);
setChainlinkOracle(0xA6559758f5A599996693e766B845A9109B1389F1);
jobId = '';
fee = (1 * LINK_DIVISIBILITY) / 10; // 0,1 * 10**18 (Varies by network and job)
}

/**
* Create a Chainlink request to retrieve API response, find the target data.
*/
function requestKYCData(uint _ID) public returns (bytes32 requestId) {
Chainlink.Request memory req = buildChainlinkRequest(jobId, address(this), this.fulfill.selector);

// Set the URL to perform the GET request on
req.add('get', 'THIS_WILL_BE_THE_URL_STRING_TO_BLOCKPASS_KYC_SERVICE');
// Set the path to find the desired data in the API response, where the response format is:
// {'status': 'success',
// 'data':
// {'records':
// [{'status': 'approved',
// 'recordId': '628a2005a192fc20b4faddae',
// 'submitCount': 1,
// 'blockPassID': '628a1f430ab4b3001115e57d',
// 'isArchived': False,
// 'inreviewDate': '2022-05-22T13:14:34.878Z',
// 'waitingDate': '2022-05-22T11:35:36.794Z',
// 'approvedDate': '2022-05-22T13:14:59.561Z'}],
// 'total': 1,
// 'skip': 0,
// 'limit': 5
// }
// }
// For this example we would need to provide _ID = 0 to get the status data, since there is currently
// only one registered user
req.add('path', 'data,records,_ID,status');

// Sends the request
return sendChainlinkRequest(req, fee);
}

/**
* Receive the response in the form of uint256
*/
function fulfill(bytes32 _requestId, string _status) public recordChainlinkFulfillment(_requestId) {
status = _status;
}

/**
* Allow withdraw of Link tokens from the contract
*/
function withdrawLink() public onlyOwner {
LinkTokenInterface link = LinkTokenInterface(chainlinkTokenAddress());
require(link.transfer(msg.sender, link.balanceOf(address(this))), 'Unable to transfer');
}
}
2 changes: 1 addition & 1 deletion components/Header/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ function Header(props) {
<nav className={clsx(classes.navMenu, classes.navAuth)}>
<Hidden xsDown>
<Button href={routeLink.crypto.home}>
{t('common:crypto-landing.header_login')}
{t('common:crypto-landing.kyc')}
</Button>
<Button href={routeLink.crypto.home} variant="contained" color="secondary" className={classes.button}>
{t('common:crypto-landing.header_register')}
Expand Down
3 changes: 2 additions & 1 deletion public/text/link.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ const link = {
home: './',
contact: '/contact',
login: '/login',
register: '/register'
register: '/register',
kyc: 'https://verify-with.blockpass.org/?clientId=once_kyd_db4e8&serviceName=Once%20KYD&env=prod'
}
};

Expand Down