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

@pnetwork/staking-manager

v3.0.0

Published

An Aragon app that allows to lock for a customizable amount of time, a quantity of ERC20 tokens in exchange organization's tokens

Downloads

8

Readme

:crystal_ball: staking-manager

An Aragon app that allows to lock for a customizable amount of time, a quantity of ERC20 tokens in exchange for organization's tokens.

 


 

:arrow_down: How to install

dao install <DAO address> staking-manager.open.aragonpm.eth --app-init-args <token manager> <vault> <erc20 token address> <min lock time> <max locks> --env aragon:rinkeby

 


 

:clipboard: How to run locally

yarn install
yarn start

 


 

:guardsman: Test

yarn test

Result

    initialize(address _tokenManager, address _vault, address _depositToken, _uint256 _minLockTime _uint256 maxLocks) fails
      ✓ Should revert when passed non-contract address as token manager (48ms)
      ✓ Should revert when passed non-contract address as vault
      ✓ Should revert when passed non-contract address as deposit token
    initialize(address _tokenManager, address _vault, address address _depositToken, _uint256 _minLockTime, _uint256 maxLocks)
      ✓ Should set correct variables (40ms)
      ✓ Should set able to set maxLocks and minLockTime and vault (217ms)
      ✓ Should not be able to set maxLocks because of no permission (55ms)
      ✓ Should not be able to set maxLocks because of of value too high (86ms)
      ✓ Should not be able to set minLockTime because of no permission (65ms)
      ✓ Should not be able to set a new Vault because of no permission (56ms)
      stake(uint256 _amount, uint256 _lockTime, address _receiver)
        ✓ Should create wrapped tokens in exchange for DepositToken (112ms)
        ✓ Should not be able to stake without token approve (42ms)
        ✓ Should not be able to perform more stake than allowed (maxLocks) (1854ms)
        ✓ Should not be able to stake more than you have approved (49ms)
        ✓ Should not be able to stake with a lock time less than the minimun one (48ms)
        ✓ Should return a correct value when getting number of staked locks (1796ms)
        ✓ Should return a correct value when getting number of staked locks after having staked
      unstake(uint256 _amount)
        ✓ Should be able to both staking and unstaking (232ms)
        ✓ Should not be able to unstake more than you have (118ms)
        ✓ Should not be able to unstake because it needs to wait the correct time (128ms)
        ✓ Should be able to unstake (partial ok 1) (368ms)
        ✓ Should not be able to unstake because it needs to wait the correct time (partial fail 1) (256ms)
        ✓ Should be able to unstake (partial ok 2) (1062ms)
        ✓ Should not be able to unstake more than what you have wrapped (partial fail 2) (486ms)
        ✓ Should be able to unstake with different lock times (1016ms)
        ✓ Should be able to stake for a non sender address and unstake (254ms)
        ✓ Should not be able to stake for a non sender address and unstake to msg.sender (121ms)
        ✓ Should be able to insert in an empty slot (2603ms)
        ✓ Should be able to stake MAX_LOCKS times, unstake MAX_LOCKS * 2 times(unstake with amount / 2) and wrapping other MAX_LOCKS times (9768ms)
        ✓ Should be able to stake MAX_LOCKS times and unstake in two times (2408ms)
        ✓ Should not be able to stake zero tokens (45ms)
        ✓ Should return a correct value when getting number of staked locks after havin staked and unstake (4558ms)


  31 passing (53s)

 


 

:rocket: How to publish

Create an .env file with the following format

RINKEBY_PRIVATE_KEY=
MAINNET_PRIVATE_KEY=
INFURA_KEY=

Run the local IPFS node:

aragon ipfs start

and then publish.

npx buidler publish "version or patch/minor/major" --network "rinkeby or mainnet"

 


 

:white_check_mark: How to verify

Add the following field to .env file

ETHERSCAN_API_KEY=

and then verify.

npx buidler verify-contract --contract-name StakingManager --address 'deployed contract address' "constructor arguments"