Skip to content

Commit

Permalink
actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Turupawn committed Sep 28, 2022
1 parent 3a0ab91 commit 3a3abb9
Show file tree
Hide file tree
Showing 9 changed files with 405 additions and 131 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
RPC_URL=https://eth-mainnet.g.alchemy.com/v2/YOURAPIHERE
25 changes: 25 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Node.js CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.x]

steps:
- uses: actions/checkout@v3
- name: Waffle Unit Tests
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: export MAINNET_RPC_URL=${{ secrets.MAINNET_RPC_URL }}; npx hardhat test
12 changes: 12 additions & 0 deletions contracts/ERC20/BibliotecaInterfaces.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// SPDX-License-Identifier: MIT
// Filosofía Código Contracts based on OpenZeppelin (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;

import "./ERC20.sol";

interface IWETH is IERC20 {
function deposit() external payable;

function withdraw(uint amount) external;
}
125 changes: 125 additions & 0 deletions contracts/ERC20/UniswapV3Interfaces.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,136 @@

pragma solidity ^0.8.0;

struct ExactInputSingleParams {
address tokenIn;
address tokenOut;
uint24 fee;
address recipient;
uint deadline;
uint amountIn;
uint amountOutMinimum;
uint160 sqrtPriceLimitX96;
}

interface IUniswapV3Router {
function exactInputSingle(ExactInputSingleParams calldata params)
external
payable
returns (uint amountOut);
}

interface INonfungiblePositionManager {

function createAndInitializePoolIfNecessary(
address token0,
address token1,
uint24 fee,
uint160 sqrtPriceX96
) external payable returns (address pool);

struct MintParams {
address token0;
address token1;
uint24 fee;
int24 tickLower;
int24 tickUpper;
uint amount0Desired;
uint amount1Desired;
uint amount0Min;
uint amount1Min;
address recipient;
uint deadline;
}

function mint(MintParams calldata params)
external
payable
returns (
uint tokenId,
uint128 liquidity,
uint amount0,
uint amount1
);

struct IncreaseLiquidityParams {
uint tokenId;
uint amount0Desired;
uint amount1Desired;
uint amount0Min;
uint amount1Min;
uint deadline;
}

function increaseLiquidity(IncreaseLiquidityParams calldata params)
external
payable
returns (
uint128 liquidity,
uint amount0,
uint amount1
);

struct DecreaseLiquidityParams {
uint tokenId;
uint128 liquidity;
uint amount0Min;
uint amount1Min;
uint deadline;
}

function decreaseLiquidity(DecreaseLiquidityParams calldata params)
external
payable
returns (uint amount0, uint amount1);

struct CollectParams {
uint tokenId;
address recipient;
uint128 amount0Max;
uint128 amount1Max;
}

function collect(CollectParams calldata params)
external
payable
returns (uint amount0, uint amount1);
}

abstract contract IUniswapV3Pool
{
struct Slot0 {
// the current price
uint160 sqrtPriceX96;
// the current tick
int24 tick;
// the most-recently updated index of the observations array
uint16 observationIndex;
// the current maximum number of observations that are being stored
uint16 observationCardinality;
// the next maximum number of observations to store, triggered in observations.write
uint16 observationCardinalityNext;
// the current protocol fee as a percentage of the swap fee taken on withdrawal
// represented as an integer denominator (1/x)%
uint8 feeProtocol;
// whether the pool is locked
bool unlocked;
}
//Slot0 public slot0;

uint24 public fee;
//int24 public tickSpacing;


function slot0(
) external virtual view returns
(
uint160 sqrtPriceX96,
int24 tick,
uint16 observationIndex,
uint16 observationCardinality,
uint16 observationCardinalityNext,
uint8 feeProtocol,
bool unlocked);

function tickSpacing() external virtual view returns (int24);
}
10 changes: 9 additions & 1 deletion hardhat.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
require("@nomicfoundation/hardhat-toolbox");
require('dotenv').config()

/** @type import('hardhat/config').HardhatUserConfig */
module.exports = {
solidity: "0.8.17",
};
networks: {
hardhat: {
forking: {
url: process.env.RPC_URL,
}
}
}
};
13 changes: 9 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,8 @@
"hardhat-gas-reporter": "^1.0.9",
"solidity-coverage": "^0.8.2",
"typechain": "^8.1.0"
},
"dependencies": {
"dotenv": "^16.0.2"
}
}
126 changes: 0 additions & 126 deletions test/Lock.js

This file was deleted.

Loading

0 comments on commit 3a3abb9

Please sign in to comment.