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

@pollum-io/psys-token-v2

v0.0.1

Published

Pegasys ERC20 token

Downloads

65

Readme

PegasysTokenV2 Design

PegasysTokenV2 (PSYSv2) is an ERC-20 compatible wrapper token for the existing Pegasys (PSYS) token. It implements governance features that allow Pegasys holders to participate in protocol governance through a delegation system. This wrapper approach enables the addition of governance capabilities while maintaining the original PSYS token's functionality.

Overview

PegasysTokenV2 wraps the existing PSYS token and adds governance features including:

  • Voting power delegation
  • Proposition power delegation
  • Balance snapshots for governance
  • EIP-2612 permit functionality for gasless transactions

Roles

The initial PegasysTokenV2 implementation does not have any admin roles configured. The contract will be proxied using the OpenZeppelin implementation of the EIP-1967 Transparent Proxy pattern. The proxy has an Admin role, and the Admin of the proxy contract will be set upon deployment to the Pegasys governance contracts.

Features

ERC-20 Wrapper

  • Allows users to deposit PSYS and receive PSYSv2 at a 1:1 ratio
  • Enables withdrawal back to PSYS tokens at any time
  • Maintains full compatibility with ERC-20 standard

Governance Features

  • Balance snapshot system to track user balances at specific block heights
  • Separate tracking for voting and proposition power
  • Delegation system allowing users to delegate their voting and proposition powers
  • Integration with the Pegasys governance system through transfer hooks

EIP-2612 Integration

PegasysTokenV2 implements the EIP-2612 permit function, enabling:

  • Gasless transactions
  • Single-transaction approval and transfer operations
  • Meta-transactions for improved UX

Technical Implementation

Wrapper Mechanism

The wrapper system works through two main functions:

  • deposit(): Locks PSYS tokens and mints equivalent PSYSv2
  • withdraw(): Burns PSYSv2 tokens and releases the underlying PSYS

Transfer Hooks

The _beforeTokenTransfer hook is overridden to:

  1. Create snapshots of balances during transfers, mints, and burns
  2. Update delegation balances
  3. Notify the governance contract of transfers

Changes to OpenZeppelin Contracts

This implementation uses modified versions of OpenZeppelin contracts:

  • In ERC20.sol, _name and _symbol are changed from private to internal
  • Uses VersionedInitializable instead of Initializable to support future upgrades

Development and Deployment

To deploy PegasysTokenV2 to a local network:

npx hardhat node
yarn run deploy
yarn run initialize

For Rollux:

yarn run deploy:rollux
yarn run initialize:rollux

License

The contents of this repository are under the AGPLv3 license.

This implementation includes software from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-sdk/) licensed under the MIT license, and modifications of Aave Token implementation (https://github.com/aave/aave-token-v2) licensed under the AGPLv3 license.