Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
strenev authored and 0xHustling committed Sep 15, 2024
0 parents commit 9c8b0d3
Show file tree
Hide file tree
Showing 16 changed files with 11,255 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Test

on: [push]

jobs:
tests:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.14.0]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Cache node_modules
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}

- run: npm install
- run: cp config.sample.ts config.ts
- run: npx hardhat compile
- run: npx hardhat test
coverage:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [ 14.14.0 ]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Cache node_modules
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}

- run: npm install
- run: cp config.sample.ts config.ts
- run: npx hardhat compile
- run: npm run coverage
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules
cache
artifacts
dist
typechain
config.ts
coverage/
coverage.json
6 changes: 6 additions & 0 deletions .solcover.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
skipFiles: [
'./mocks/MockERC20.sol',
'./mocks/MockERC721.sol'
]
};
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 0xFusion, 2022 EnterDAO, 2019 Synthetix.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
87 changes: 87 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<div align="center">

# ERC721 Staking

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

</div>

## Overview

The repository contains contracts for yield farming with any ERC721 compatible NFTs. Any specified ERC-721 can be used to farm any ERC-20 compatible tokens, by
depositing/locking them into the ERC721Staking contract that uses ERC-721 instead of the normal ERC-20 token.
The basis of the staking contract is the stripped down version of
Synthetix's [StakingRewards](https://solidity-by-example.org/defi/staking-rewards/) contract and modified version of EnterDAO's [LandWorks-YF-Contracts](https://github.com/EnterDAO/LandWorks-YF-Contracts). Credit to [EnterDAO](https://enterdao.xyz/) and [Synthetix](https://synthetix.io/).

NFT owners can stake or withdraw his/hers NFTs at any time.

## Development

**Prerequisites**

- [hardhat](https://hardhat.org/) - framework used for the development and testing of the contracts
- `node version >= 14.14.0`

1. After cloning, run:

```
cd ERC721Staking
npm install
```

2. Set up the config file by executing:

```bash
cp config.sample.ts config.ts
```

### Compilation

Before you deploy the contracts, you will need to compile them using:

```
npx hardhat compile
```

### Deployment

**Prerequisite**

Before running the deployment `npx hardhat` script, you need to create and populate the `config.ts` file. You can use
the `config.sample.ts` file and populate the following variables:

```markdown
YOUR-INFURA-API-KEY YOUR-ETHERSCAN-API-KEY
```

**ERC721 Staking**

* Deploys the `ERC721Staking` contract

```shell
npx hardhat deploy-erc721-staking \
--network <network name> \
--staking-token <address of the staking token> \
--rewards-token <address of the rewards token> \
--duration <duration of farming in seconds> \
```

### Tests

#### Unit Tests

```bash
npx hardhat test
```

#### Coverage

```bash
npm run coverage
```

or

```bash
npx hardhat coverage --solcoverjs .solcover.ts
```
Loading

0 comments on commit 9c8b0d3

Please sign in to comment.