npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ape.swap/erc-5725

v1.0.1

Published

ERC-5725: Transferrable Vesting NFT - Reference Implementation.

Downloads

39

Readme

ERC-5725: Transferrable Vesting NFT - Reference Implementation

lint & test Docs License

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

EIP-5725

"A Non-Fungible Token (NFT) standard used to vest ERC-20 over a vesting release curve."

Find the official EIP located here.

Examples

The ethers example can be run quickly with yarn example.

This solidity reference shows how to extend ERC5725.sol to quickly create a transferrable vesting NFT.

@ape.swap/erc-5725 Package Usage

Installation

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

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

Usage with Solidity Smart Contracts

Extend ERC5725.sol to quickly create a transferrable Vesting NFT contract implementation.

// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;

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

contract LinearVestingNFT is ERC5725 { ... }

Usage with Frontend/Backend Node Applications

Quickly interact with an ERC5725 contract by providing an ethers provider.

Quickly Read ERC-5725 Values

By simply passing an RPC provider URL, state from an ERC-5725 contract can be read quickly.

// Import ERC-5725 contract helper function
import { getERC5725Contract, IERC5725_Artifact } from '@ape.swap/erc-5725'
const IERC5725_ABI = IERC5725_Artifact.abi
import { ethers } from 'ethers'
// Very quickly send txs to/read from type safe ERC-5725 contract
const provider = await ethers.getDefaultProvider('https://bscrpc.com')
// Obtain a type safe ERC-7525 contract
const erc5725Contract = getERC5725Contract('<erc-5725-address>', provider)
// Read vestingPeriod 
const { vestingStart, vestingEnd } = await erc5725Contract.vestingPeriod('<token-id>') 

MetaMask Integration

By simply passing an RPC provider URL, state from an ERC-5725 contract can be read quickly.

// Import ERC-5725 contract helper function
import { getERC5725Contract, IERC5725_Artifact } from '@ape.swap/erc-5725'
const IERC5725_ABI = IERC5725_Artifact.abi
import { ethers } from 'ethers'
// Pull out the injected ethereum provider from MetaMask in browser
const { ethereum } = window
const provider = new ethers.providers.Web3Provider(ethereum)
const signer = provider.getSigner()
// Setup ERC-5725 instance with a signer
const erc5725Contract = getERC5725Contract('<erc-5725-address>', signer)
// Claim payoutTokens
const tx = await erc5725Contract.claim('<token-id>')
await tx.wait()

Usage via Clone

  • git clone [email protected]:ApeSwapFinance/eip-5725-vesting-nft-implementation.git
  • cd eip-5725-vesting-nft-implementation
  • yarn
  • Copy .env.example and rename to .env
    • Provide the necessary env variables before deployment/verification
    • MAINNET_MNEMONIC/TESTNET_MNEMONIC for deployments
    • <explorer>_API_KEY for verifications
  • hardhat.config.ts: Can be configured with additional networks if needed

Deployment and Verification

This project uses special tasks, adapted from Balancer protocol, to deploy and verify contracts which provides methods for saving custom outputs and easily verifying contracts as well as compartmentalizing different types of deployments.

Default (yarn script) Deployment and Verification

Deploy 20230212-vesting-nft task to the network of your choice
yarn deploy <network-name>

Verify 20230212-vesting-nft on the network of your choice
yarn verify <network-name> --name <LinearVestingNFT|VestingNFT>

Hardhat Deployment and Verification

Deploy using hardhat tasks
npx hardhat deploy --id 20230212-vesting-nft --network <network-name>

Verify using hardhat tasks
npx hardhat verify-contract --id 20230212-vesting-nft --network <network-name> --name <LinearVestingNFT|VestingNFT>

Linting

This project uses Prettier, an opinionated code formatter, to keep code styles consistent. This project has additional plugins for Solidity support as well.

Linting Solidity Code

  • prettier.config.js: Provide config settings for Solidity under overrides.

  • .solhint.json: Provide config settings for solhint.

  • yarn lint: Lint Solidity & TS/JS files

  • yarn lint:fix: Fix Solidity & TS/JS files