# Solidity API

# RequestPair

struct RequestPair {
  address addr;
  bytes20 handle;
  uint64 postId;
}

# IERC20

# transfer

function transfer(address _to, uint256 _amount) external returns (bool)

# RedditValidator

This validator handle the Reddit social network.

This contract implement the pausable trait, allowing us to pause the contract in case of emergency.

# uniqe

address uniqe

# redditOracle

address redditOracle

# feeRatio

uint256 feeRatio

# chainlinkFee

uint256 chainlinkFee

# jobId

bytes32 jobId

# iconURL

string iconURL

# requests

mapping(bytes32 => struct RequestPair) requests

# constructor

constructor(address _uniqe, address _chainlinkToken, address _oracle) public

Initialize the contract

Name Type Description
_uniqe address The Uniqe contract address
_chainlinkToken address The chainlink token address
_oracle address The oracle address

# setFeeRatio

function setFeeRatio(uint256 _feeRatio) public

Set the feeRatio of the validator.

This function is protected, only the owner can call it.

Name Type Description
_feeRatio uint256 The new feeRatio.

# getFeeRatio

function getFeeRatio() public view returns (uint256)

Get the feeRatio of the validator.

Name Type Description
[0] uint256 The feeRatio of the validator.

# setChainlinkFee

function setChainlinkFee(uint256 _fee) public

Set the chainlink fee

This function is protected, only the owner can call it.

Name Type Description
_fee uint256 The new chainlink fee

# getChainlinkFee

function getChainlinkFee() public view returns (uint256)

Get the chainlink fee

Name Type Description
[0] uint256 The chainlink fee

# requiresFee

modifier requiresFee()

# withdrawToken

function withdrawToken(address _tokenContract, uint256 _amount) public

Widthdraw any ERC20 funds that was sent to the contract.

This function is protected, only the owner can call it.

Name Type Description
_tokenContract address The ERC20 contract address
_amount uint256 The amount of tokens to withdraw

# withdrawEth

function withdrawEth(address payable _to, uint256 amount) public

Widthdraw any ETH funds that was sent to the contract.

This function is protected, only the owner can call it.

Name Type Description
_to address payable The destination address
amount uint256 The amount of ETH to withdraw

# getUniqe

function getUniqe() public view returns (address)

Get the uniqe contract address.

Name Type Description
[0] address The uniqe contract address.

# setUniqe

function setUniqe(address _uniqe) public

Set the Uniqe contract address

This function is protected, only the owner can call it.

Name Type Description
_uniqe address The new Uniqe contract address

# getRedditOracle

function getRedditOracle() public view returns (address)

Get the oracle address

Name Type Description
[0] address The oracle address

# setRedditOracle

function setRedditOracle(address _oracle) public

Set the oracle address

This function is protected, only the owner can call it.

Name Type Description
_oracle address The new oracle address

# pause

function pause() public

Pause the contract

This function is protected, only the owner can call it.

# unpause

function unpause() public

Unpause the contract

This function is protected, only the owner can call it.

# isActive

function isActive() public view returns (bool)

Check if the contract is paused.

Name Type Description
[0] bool True if the contract is paused, false otherwise.

# getHandlePrefix

function getHandlePrefix() external pure returns (string)

Get the handlePrefix of the validator.

Name Type Description
[0] string The handlePrefix of the validator.

# getHandleSuffix

function getHandleSuffix() external pure returns (string)

Get the handleSuffix of the validator.

Name Type Description
[0] string The handleSuffix of the validator.

# getId

function getId() public pure returns (string)

Get the id of the validator.

Name Type Description
[0] string The id of the validator.

# getIconURL

function getIconURL() public view returns (string)

Get the icon of a validator.

Name Type Description
[0] string The icon of the validator.

# setIconURL

function setIconURL(string url) public

Set the icon of a validator.

This function is protected, only the owner can call it.

Name Type Description
url string

# getDescription

function getDescription() public pure returns (string)

Get the description of the validator.

Name Type Description
[0] string The description of the validator.

# getURLFrom

function getURLFrom(string handle) public pure returns (string)

Get the profile URL of a social handle.

Name Type Description
handle string The social handle.
Name Type Description
[0] string The profile URL with the social handle.

# getName

function getName() public pure returns (string)

Get the name of the validator.

Name Type Description
[0] string The name of the validator.

# validateRequest

function validateRequest(struct ValidationRequest request) external payable

Send a validation request for a wallet.

This function can only be called by uniqe.

Name Type Description
request struct ValidationRequest

# getRequest

function getRequest(bytes32 _requestId) public view returns (struct RequestPair)

Fetch a saved request

Name Type Description
_requestId bytes32 The request id
Name Type Description
[0] struct RequestPair The request

# fulfill

function fulfill(bytes32 _requestId, bool success) public

Process a request fulfilled by the oracle

Name Type Description
_requestId bytes32 The request id
success bool The request was fulfilled successfully