CoinQuoter Docs
  • Introduction
    • What is CoinQuoter
    • Whitepaper
  • Getting Started
    • Wallet connection
    • Trading Session
  • Products
    • Taker
      • Advanced Mode
      • Transaction History
      • API Documentation
      • Websocket Documentation
    • Maker
      • Trade Requirements
      • Activity Blotter
      • Single Dealer Platform
    • Quoter
      • Stream Requests
      • Custom Pricing Source
      • System parameters
    • Fees and Referrals
    • Last Look Compensation
    • Roadmap
  • smart contracts
    • Quoter
      • Create Signature
    • Last Look Compensation
    • Audit
  • Others
    • Connect With Us
    • Terms of Service
    • Privacy Policy
Powered by GitBook
On this page
  • Contract info
  • Functions
  • Events
  • Models
  1. smart contracts

Quoter

PreviousRoadmapNextCreate Signature

Last updated 2 years ago

Contract info

Contract name: Quoter Protocol

Contract addresses:

Harmony Mainnet: 0xFFFD451F62bE856E0cADdAc7c9a2e60aC5842C48

Binance Smart Chain Mainnet: 0x76540F7e38dFCdF3b39A501Bb7ef77c3705f4F17

Harmony Testnet: 0x028739801886AC60E0428e918e2bC9cA5D06399E

Functions

balance

function balance(address token) external view returns (uint256)

Returns balance of a token available for use in Quoter.

Parameters:

Name
Type
Description

token

address

Token address of a token to check balance of.

Returns:

Type
Description

uint256

Balance of given token

cancelOrderRFQ

function cancelOrderRFQ(uint256 orderInfo) external override

Cancels order's quote.

Paramaters:

Name
Type
Description

orderInfo

uint256

Order info contains timestamp and order id

createOrUpdateSession

function createOrUpdateSession(address sessionKey, uint256 expirationTime)
        external
        returns (SessionStatus)

Creates or updates session that lets maker and taker to trade without signing messages through wallet.

Parameters:

Name
Type
Description

sessionKey

address

Public key of a session

expirationTime

uint256

Expiration time in unix seconds timestamp

Returns:

Type
Description

SessionStatus

One of the value from enum (created, updated) that indicates the status of session

depositToken

function depositToken(address token, uint256 amount)
        external
        returns (uint256)

Deposits given token of frontend to the Quoter smart contract and stores the balance information.

Name
Type
Description

token

address

Address of token to deposit, depositing wallet must give an allowance to the Quoter smart contract for given amount

amount

uint256

Amount of tokens to deposit

Returns:

Type
Description

uint256

The balance after depositing the tokens

endSession

function endSession() external;

Terminates active session

fillOrderRFQ

function fillOrderRFQ(
        OrderRFQ memory order,
        bytes calldata signature,
        uint256 takingAmount,
        uint256 makingAmount
    ) external returns (OrderRFQAmounts memory amounts);

Fills order's quote, fully or partially (whichever is possible)

Parameters:

Name
Type
Description

order

OrderRFQ

Order quote to fill

signature

bytes

Signature to confirm quote ownership

takingAmount

uint256

Taking amount

makingAmount

uint256

Making amount

Returns:

Type
Description

amounts

OrderRFQAmounts

Amounts - filled taking and making amounts

fillOrderRFQCallPeriphery

function fillOrderRFQCallPeriphery(
        OrderRFQ memory order,
        bytes calldata signature,
        uint256 takingAmount,
        uint256 makingAmount,
        address receiver,
        bytes calldata data
    ) external returns (OrderRFQAmounts memory amounts, bytes memory result);

Fills order's quote, fully or partially (whichever is possible) and calls external contract function

Parameters:

Name
Type
Description

order

OrderRFQ

Order quote to fill

signature

bytes

Signature to confirm quote ownership

takingAmount

uint256

Taking amount

makingAmount

uint256

Making amount

receiver

address

Address of contract that will receive the call after successful validation of RFQ order and transfer from taker to maker

data

bytes

external call data

Returns:

Type
Description

amounts

OrderRFQAmounts

Amounts - filled taking and making amounts

session

function session(address owner)
        external
        view
        returns (
            address creator,
            address sessionKey,
            uint256 expirationTime,
            uint256 txCount
        );

Returns session data

Parameters:

Name
Type
Description

owner

address

Wallet address of the session's owner

Returns:

Name
Type
Description

creator

adress

Wallet address of the session's owner

sessionKey

address

Session public key

expirationTime

uint256

Session expiration unix timestamp, might be zero if it was terminated

txCount

uint256

Number of transactions made during session

sessionExpirationTime

function sessionExpirationTime(address owner)
        external
        view
        returns (uint256 expirationTime);

Returns expiration unix timestamp of given address session

Parameters:

Name
Type
Description

owner

address

Wallet address of the session's owner

Returns:

Name
Type
Description

expirationTime

uint256

Session expiration unix timestamp, might be zero if it was terminated

setReferralBonus

function setReferralBonus(uint256 bonus) external onlyOwner;

//Opis

Parameters:

Name
Type
Description

bonus

uint256

transferOwnership

 function transferOwnership(address to)
        external
        onlyOwner
        returns (address oldOwner, address newOwner)

//Opis

Parameters:

Name
Type
Description

to

address

Address of wallet that will receive ownership

Returns:

Name
Type
Description

oldOwner

address

Address of previous owner

newOwner

address

Address of new owner

withdrawToken

function withdrawToken(address token, uint256 amount) 
        external returns (uint256);

Withdraws given token of frontend from the Quoter contract

Parameters:

Name
Type
Description

token

address

Address of a token to withdraw

amount

uint256

Amount of tokens to withdraw

Returns:

Type
Description

uint256

Balance after withdrawing the tokens

Events

OrderFilledRFQ

event OrderFilledRFQ(bytes32 orderHash, uint256 takingAmount, uint256 makingAmount);

Event emmited when RFQ order was filled.

Parameters:

Name
Type
Description

orderHash

bytes32

Hash of the order

takingAmount

uint256

Taking amount

makingAmount

uint256

Making amount

OwnershipTransfered

//opis

Parameters:

Name
Type
Description

from

address

to

address

SessionCreated

event SessionCreated(
        address indexed creator,
        address indexed sessionKey,
        uint256 expirationTime
    );

Event emmited on successful session creation

Parameters:

Name
Type
Description

creator

address

Address of wallet creating the session

sessionKey

address

Public key of the session

expirationTime

uint256

Session expiration time in unix timestamp

SessionTerminated

 event SessionTerminated(address indexed sender, address indexed sessionKey);

Event emmited on successful session termination

Parameters:

Name
Type
Description

sender

address

Address of wallet terminating the session

sessionKey

address

Public key of the session

SessionUpdated

event SessionUpdated(
        address indexed sender,
        address indexed sessionKey,
        uint256 expirationTime
    );

Event emitted on successful session update

Parameters:

Name
Type
Description

sender

address

Address of wallet updating

the session

sessionKey

address

Public key of the session

expirationTime

uint256

Session expiration time in unix timestamp

SplitTokenTransfered

event SplitTokenTransfered(
        address indexed from,
        address indexed recipient,
        address indexed splitTo,
        address token, // Due to limitations only three event's arguments can be indexed
        uint256 splitPercentage,
        uint256 amount,
        uint256 balance
    );

Event emitted on successful transfer of fee token - split between contract owner and frontend

Parameters:

Name
Type
Description

from

address

Address of wallet that transfers token

recipient

address

Address of first recipient

splitTo

address

Address of second recipient

token

address

Address of deposited token

splitPercentage

uint256

Percentage used to split amount between recipient and splitTo

amount

uint256

Desposit amount

balance

uint256

Balance after fee token transfer

TokenDeposited

event TokenDeposited(
        address indexed sender,
        address indexed token,
        uint256 amount,
        uint256 balance
    );

Event emitted on successful deposit of token

Name
Type
Description

sender

address

Address of wallet depositing the token

token

address

Address of the deposited token

amount

uint256

Deposit amount

balance

uint256

Balance after deposit

TokenTransferred

event TokenTransfered(
        address indexed from,
        address indexed recipient,
        address indexed token,
        uint256 amount,
        uint256 balance
    );

Event emitted on successful transfer of token

Parameters:

Name
Type
Description

from

address

Address of wallet transfering the token

recipient

address

Address of the token recipient

token

address

Address of the transfered token

amount

uint256

Transfer amount

balance

uint256

Balance after transfer

TokenWithdrawn

event TokenWithdrawn(
        address indexed sender,
        address indexed token,
        uint256 amount,
        uint256 balance
    );

Event emitted on successful withdrawn of token

Parameters:

Name
Type
Description

sender

address

Address of wallet withdrawing the token

token

address

Address of the withdrawn token

amount

uint256

Withdraw amount

balance

uint256

Balance after withdraw

Models

Session

struct Session {
        address creator;
        address sessionKey;
        uint256 expirationTime;
        uint256 txCount;
    }

Properties:

Name
Type
Description

creator

adress

Wallet address of the session's owner

sessionKey

address

Session public key

expirationTime

uint256

Session expiration unix timestamp, might be zero if it was terminated

txCount

uint256

Number of transactions made during session

OrderRFQ

struct OrderRFQ {
        uint256 info;
        uint256 feeAmount;
        address takerAsset;
        address makerAsset;
        address feeTokenAddress;
        address frontendAddress;
        bytes takerAssetData;
        bytes makerAssetData;
    }

Properties:

Name
Type
Description

info

uint256

feeAmount

uint256

takerAsset

address

makerAsset

address

feeTokenAddress

address

frontendAddress

address

takerAssetData

bytes

makerAssetData

bytes

OrderRQFAmounts

struct OrderRFQCallbackInfo {
        address takerAsset;
        address makerAsset;
        uint256 takingAmount;
        uint256 makingAmount;
    }

Properties:

Name
Type
Description

takerAsset

address

makerAsset

address

takingAmount

uint256

makingAmount

uint256

CoinQuoter_SmartContracts/QuoterProtocol.sol at main · CoinQuoter/CoinQuoter_SmartContractsGitHub
Logo