https://github.com/gridexprotocol/core-examples
Example projects that demonstrate how to interact with the core smart contracts.
https://github.com/gridexprotocol/core-examples
defi examples solidity
Last synced: about 1 year ago
JSON representation
Example projects that demonstrate how to interact with the core smart contracts.
- Host: GitHub
- URL: https://github.com/gridexprotocol/core-examples
- Owner: GridexProtocol
- License: other
- Created: 2023-02-27T05:16:58.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-03-19T10:22:42.000Z (about 3 years ago)
- Last Synced: 2025-05-07T23:05:59.339Z (about 1 year ago)
- Topics: defi, examples, solidity
- Language: Solidity
- Size: 604 KB
- Stars: 7
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Core Example Contracts
Example projects that demonstrate how to interact with the core smart contracts.
## Example Contracts
### [ExampleMakerOrder](./contracts/ExampleMakerOrder.sol)
#### Place a maker order for `WETH9`
```solidity
function placeMakerOrderForWETH9(uint128 amount) external returns (uint256 orderId);
```
#### Place a maker order for `USDC`
```solidity
function placeMakerOrderForUSDC(uint128 amount) external returns (uint256 orderId);
```
### [ExampleSwap](./contracts/ExampleSwap.sol)
#### *Single-Hop*-Swaps a specified amount of `USDC` for as much as possible of `WETH9`
```solidity
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`
```solidity
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`
```solidity
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`
```solidity
function exactOutput(uint256 amountOut, uint256 amountInMaximum) external returns (uint256 amountIn);
```
## Installation
```shell
npm install
```
## Compile
```shell
npx hardhat compile
```
Try running some of the following tasks:
```shell
npx hardhat help
npx hardhat test
REPORT_GAS=true npx hardhat test
npx hardhat node
npx hardhat run scripts/deploy.ts
```