VictorLink Price Service


Smart contracts often need to respond to real-world token asset prices, especially in the DeFi space, where asset prices must be highly correlated to real-world prices, otherwise users and developers may suffer losses from contract arbitrage or attacks.
VictorLink price service focuses on digital currency price pairs, providing DApps with accurate and stable information on external world digital currency prices.
VictorLink officially provides a solution to aggregate price data from multiple VictorLink prediction machine nodes to get a stable price service, called Price Feed Contract.

This document describes how to use and deploy VictorLink price service contracts.

Get the latest prices

You need to introduce the AggregatorInterface to get the latest price data in a consumer contract, which defines the interface provided by the feeding service to the public.

pragma solidity ^0.5.0;

interface AggregatorInterface {
    function latestAnswer() external view returns (int256);
    function latestTimestamp() external view returns (uint256);
    function latestRound() external view returns (uint256);
    function getAnswer(uint256 roundId) external view returns (int256);
    function getTimestamp(uint256 roundId) external view returns (uint256);

contract PriceConsumer {
    AggregatorInterface internal priceFeed;

     * Price Aggregator Address: Vxxxxxxxxxxxx
    constructor() public {
        priceFeed = AggregatorInterface(0xxxxxxxxxxxaaaaa);

     * Returns the latest price
    function getLatestPrice() public view returns (int) {
        // If the round is not complete yet, timestamp is 0
        require(priceFeed.latestTimestamp() > 0, "Round not complete");
        return priceFeed.latestAnswer();

Price History

The list of AggregatorInterface interface functions and it’s obtained through the historical price information via getAnswer(uint256 roundId). The corresponding timestamp is obtained by getTimestamp(uint256 roundId).

Feeder Contracts

Test Network


Please contact the official staff to apply for a new trading pair.

Service of Price Deployment

Developers can deploy their own price service with custom price sources and a minimum number of responsive oracles.
In a production environment, you should need multiple oracle nodes to feed prices and then get a final price by aggregation. But in the test flow, we set up only one node to feed prices for now. Simplify the test presentation process.

Deploy Feeder Contracts

The VisionUser contract is the official VictorLink aggregated price service contract template, which implements the AggregatorInterface interface and can be used directly by developers.
The contract code is located at VisionUser.sol(
Deploying the VisionUser contract requires the VCT token address and the VictorMid contract address to be provided in the constructor. For example, in the Vpioneer test network, you need to provide (Vxxxxxxx, Vyyyyyyy)

Adding Oracle Nodes and Job IDs

Once the VisionUser contract is deployed, the contract owner needs to set up a list of prophecy machine services for the aggregated requests. Use the following interface.
function updateRequestDetails(uint128 _paymentAmount, uint128 _minimumResponses, address[] _oracles, bytes32[] _jobIds)

Where _paymentAmount indicates the number of tokens paid for each update call.
_oracles and _jobIds are a pair of equal length lists, each group corresponds to a VictorLink oracle job unique identifier.
_minimumResponses indicates the minimum number of response prophets required, which must be greater than or equal to the length of _oracles. For example, it can be set to require at least 5/10 oracles to respond before the updated value will be valid.
Example call updateRequestDetails(10, 1, ["Vxxxxxxxssssaa"], ["db22ccf4b4a14d0cae2a0757632e425d"]).

Transferring VCT Tokens for Contracts

The VisionUser contract needs to call the Oracle contract using transferAndCall, so the contract account needs to have enough VCT tokens. You can transfer a number of VCT tokens to the contract by transferring or testing the web tap.

Calling The Feed Contract

  1. Update the price requestRateUpdate
    Use the following interface to request the VictorLink Predictor node to get the latest price from an external data source.
function requestRateUpdate() returns (bytes32)

The interface returns the requestID. The requestID allows you to cancel the price update request.
2. Get the latest price latestAnswer
Use the latestAnswer() call in the AggregatorInterface to get the latest price.
TronScan's contract information page can call this method directly to get the latest value.