Skip to content

Commit

Permalink
refactor: To ERC-5725 sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
DeFiFoFum committed Oct 31, 2023
1 parent 6ace4cc commit 8fefc1e
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 153 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# ERC-5725: Transferrable Vesting NFT - Reference Implementation
[![lint & test](https://github.com/ApeSwapFinance/eip-5725-vesting-nft-implementation/actions/workflows/lint-test.yml/badge.svg)](https://github.com/ApeSwapFinance/eip-5725-vesting-nft-implementation/actions/workflows/lint-test.yml)
[![lint & test](https://github.com/ERC-5725/ERC-5725-reference/actions/workflows/lint-test.yml/badge.svg)](https://github.com/ERC-5725/ERC-5725-reference/actions/workflows/lint-test.yml)
[![Docs](https://img.shields.io/badge/docs-%F0%9F%93%84-yellow)](./docs/)
[![License](https://img.shields.io/badge/License-GPLv3-green.svg)](https://www.gnu.org/licenses/gpl-3.0)

This repository serves as both a reference implementation and an sdk module for EIP-572 Transferrable Vesting NFT Standard.
This repository serves as both a reference implementation and an sdk module for ERC-5725 Transferrable Vesting NFT Standard.

## EIP-5725

Expand All @@ -17,16 +17,16 @@ The [ethers example](./examples/getVestingPeriod.ts) can be run quickly with `ya

This [solidity reference](./contracts/reference/LinearVestingNFT.sol) shows how to extend `ERC5725.sol` to quickly create a transferrable vesting NFT.

## `@ape.swap/erc-5725` Package Usage
## `@erc-5725/sdk` Package Usage

### Installation

Add the ERC-5725 module to your Solidity, Frontend and/or Backend application.

```shell
npm install @ape.swap/erc-5725
npm install @erc-5725/sdk
# OR
yarn add @ape.swap/erc-5725
yarn add @erc-5725/sdk
```

### Usage with Solidity Smart Contracts
Expand All @@ -37,7 +37,7 @@ Extend `ERC5725.sol` to quickly create a transferrable Vesting NFT contract impl
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;

import "@ape.swap/erc-5725/contracts/ERC5725.sol";
import "@erc-5725/sdk/contracts/ERC5725.sol";

contract LinearVestingNFT is ERC5725 { ... }
```
Expand All @@ -52,7 +52,7 @@ By simply passing an RPC provider URL, state from an ERC-5725 contract can be re

```ts
// Import ERC-5725 contract helper function
import { getERC5725Contract, IERC5725_Artifact } from '@ape.swap/erc-5725'
import { getERC5725Contract, IERC5725_Artifact } from '@erc-5725/sdk'
const IERC5725_ABI = IERC5725_Artifact.abi
import { ethers } from 'ethers'
// Very quickly send txs to/read from type safe ERC-5725 contract
Expand All @@ -69,7 +69,7 @@ By simply passing an RPC provider URL, state from an ERC-5725 contract can be re

```ts
// Import ERC-5725 contract helper function
import { getERC5725Contract, IERC5725_Artifact } from '@ape.swap/erc-5725'
import { getERC5725Contract, IERC5725_Artifact } from '@erc-5725/sdk'
const IERC5725_ABI = IERC5725_Artifact.abi
import { ethers } from 'ethers'
// Pull out the injected ethereum provider from MetaMask in browser
Expand All @@ -85,8 +85,8 @@ await tx.wait()

## Usage via Clone

- `git clone git@github.com:ApeSwapFinance/eip-5725-vesting-nft-implementation.git`
- `cd eip-5725-vesting-nft-implementation`
- `git clone git@github.com:ERC-5725/ERC-5725-reference.git`
- `cd ERC-5725-reference`
- `yarn`
- Copy [.env.example](./.env.example) and rename to `.env`
- Provide the necessary `env` variables before deployment/verification
Expand Down
3 changes: 2 additions & 1 deletion contracts/ERC5725.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

Check warning on line 6 in contracts/ERC5725.sol

View workflow job for this annotation

GitHub Actions / test (16.x, ubuntu-latest)

global import of path @openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol is not allowed. Specify names to import individually or bind all exports of the module into a name (import "path" as Name)
import "@openzeppelin/contracts/access/Ownable.sol";

Check warning on line 7 in contracts/ERC5725.sol

View workflow job for this annotation

GitHub Actions / test (16.x, ubuntu-latest)

global import of path @openzeppelin/contracts/access/Ownable.sol is not allowed. Specify names to import individually or bind all exports of the module into a name (import "path" as Name)
import "@openzeppelin/contracts/utils/Counters.sol";

Check warning on line 8 in contracts/ERC5725.sol

View workflow job for this annotation

GitHub Actions / test (16.x, ubuntu-latest)

global import of path @openzeppelin/contracts/utils/Counters.sol is not allowed. Specify names to import individually or bind all exports of the module into a name (import "path" as Name)
import "./IERC5725.sol";
/// @dev Official ERC-5725 interface
import "@erc-5725/interface/IERC5725.sol";

Check warning on line 10 in contracts/ERC5725.sol

View workflow job for this annotation

GitHub Actions / test (16.x, ubuntu-latest)

global import of path @erc-5725/interface/IERC5725.sol is not allowed. Specify names to import individually or bind all exports of the module into a name (import "path" as Name)

abstract contract ERC5725 is IERC5725, ERC721 {
using SafeERC20 for IERC20;
Expand Down
137 changes: 0 additions & 137 deletions contracts/IERC5725.sol

This file was deleted.

2 changes: 1 addition & 1 deletion examples/getVestingPeriod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// import { getERC5725Contract, supportsIERC5725 } from '@ape.swap/erc-5725'
// import { getERC5725Contract, supportsIERC5725 } from '@erc-5725/sdk'
import { getERC5725Contract, supportsIERC5725 } from '../src'
import { ethers } from 'ethers';

Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@ape.swap/erc-5725",
"name": "@erc-5725/sdk",
"version": "1.0.1",
"description": "ERC-5725: Transferrable Vesting NFT - Reference Implementation.",
"main": "dist/src/index.js",
Expand Down Expand Up @@ -41,15 +41,15 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/ApeSwapFinance/eip-5725-vesting-nft-implementation.git"
"url": "git+https://github.com/ERC-5725/ERC-5725-reference.git"
},
"keywords": [],
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/ApeSwapFinance/eip-5725-vesting-nft-implementation/issues"
"url": "https://github.com/ERC-5725/ERC-5725-reference/issues"
},
"homepage": "https://github.com/ApeSwapFinance/eip-5725-vesting-nft-implementation#readme",
"homepage": "https://github.com/ERC-5725/ERC-5725-reference#readme",
"resolutions": {
"got": "^11.8.5",
"node-fetch": "^2.6.7",
Expand Down Expand Up @@ -89,6 +89,7 @@
"typescript": ">=4.5.0"
},
"dependencies": {
"@erc-5725/interface": "^1.1.0",
"@openzeppelin/contracts": "^4.7.3",
"@openzeppelin/contracts-upgradeable": "^4.7.3"
}
Expand Down
12 changes: 12 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@
dependencies:
"@jridgewell/trace-mapping" "0.3.9"

"@erc-5725/interface@^1.1.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@erc-5725/interface/-/interface-1.1.0.tgz#c60519b485164eb4b89fff63fca19dce86b4d472"
integrity sha512-0ARTQEJPw+0WY127leW1qgzYU13EqJNUQHFYhrx/YrDUfQulDsVmRZ95egsgZsZOmhxYCX2oOaHxLspRdOlVhA==
dependencies:
"@openzeppelin/contracts" "^5.0.0"

"@ethereumjs/common@2.5.0":
version "2.5.0"
resolved "https://registry.yarnpkg.com/@ethereumjs/common/-/common-2.5.0.tgz#ec61551b31bef7a69d1dc634d8932468866a4268"
Expand Down Expand Up @@ -783,6 +790,11 @@
resolved "https://registry.yarnpkg.com/@openzeppelin/contracts/-/contracts-4.9.3.tgz#00d7a8cf35a475b160b3f0293a6403c511099364"
integrity sha512-He3LieZ1pP2TNt5JbkPA4PNT9WC3gOTOlDcFGJW4Le4QKqwmiNJCRt44APfxMxvq7OugU/cqYuPcSBzOw38DAg==

"@openzeppelin/contracts@^5.0.0":
version "5.0.0"
resolved "https://registry.yarnpkg.com/@openzeppelin/contracts/-/contracts-5.0.0.tgz#ee0e4b4564f101a5c4ee398cd4d73c0bd92b289c"
integrity sha512-bv2sdS6LKqVVMLI5+zqnNrNU/CA+6z6CmwFXm/MzmOPBRSO5reEJN7z0Gbzvs0/bv/MZZXNklubpwy3v2+azsw==

"@scure/base@~1.1.0":
version "1.1.2"
resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.2.tgz#ff0cf51874aaf176490c9cb46e4df807a2e581d2"
Expand Down

0 comments on commit 8fefc1e

Please sign in to comment.