@gridexprotocol/core-examples

1.0.1 • Public • Published

Core Example Contracts

Example projects that demonstrate how to interact with the core smart contracts.

Example Contracts

ExampleMakerOrder

Place a maker order for WETH9

function placeMakerOrderForWETH9(uint128 amount) external returns (uint256 orderId);

Place a maker order for USDC

function placeMakerOrderForUSDC(uint128 amount) external returns (uint256 orderId);

ExampleSwap

Single-Hop-Swaps a specified amount of USDC for as much as possible of WETH9

function exactInputSingle(uint256 amountIn, uint256 amountOutMinimum) external returns (uint256 amountOut);

Single-Hop-Swaps as little as possible of WETH9 for a specified amount of USDC

function exactOutputSingle(uint256 amountOut, uint256 amountInMaximum) external returns (uint256 amountIn);

Multi-Hop-Swaps a specified amount of USDC for as much as possible of WETH9

function exactInput(uint256 amountIn, uint256 amountOutMinimum) external returns (uint256 amountOut);

Multi-Hop-Swaps as little as possible of WETH9 for a specified amount of USDC

function exactOutput(uint256 amountOut, uint256 amountInMaximum) external returns (uint256 amountIn);

Installation

npm install

Compile

npx hardhat compile

Try running some of the following tasks:

npx hardhat help
npx hardhat test
REPORT_GAS=true npx hardhat test
npx hardhat node
npx hardhat run scripts/deploy.ts

/@gridexprotocol/core-examples/

    Package Sidebar

    Install

    npm i @gridexprotocol/core-examples

    Homepage

    gdx.org

    Weekly Downloads

    0

    Version

    1.0.1

    License

    GPL-2.0-or-later

    Unpacked Size

    100 kB

    Total Files

    15

    Last publish

    Collaborators

    • gridexdeveloper