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

@pooltogether/configurable-reserve-contracts

v1.1.0

Published

PoolTogether Configurable Reserve contracts

Downloads

11

Readme

PoolTogether Reserve

Coverage Status

CircleCI

PoolTogether captures a portion of the yield produced by the prize pools as "reserve". The percentage of yield that is captured is called the "reserve rate".

Currently (before this implementation) there is a single, global reserve rate that is applied to all pools. However, PoolTogether governance will like to set a higher reserve rate for governance-managed pools, and do not wish to affect community pools.

The Configurable Reserve contracts outline a new Reserve interface that will allow governance to configure a reserve rate for each pool separately, as well as setting an opt-out default rate across all prize pools.

Interface

A prize pools reserve rate can be set by calling:

function setReserveRateMantissa(address[] calldata sources,  uint224[] calldata _reserveRates, bool[] calldata useCustom) external;

The useCustom boolean flag overrides the use of the default pool-wide reserve rate. Note that only the owner of the contract can call this function. In the case of PoolTogether the owner will be the governance (timelock) contract.

A prize pools reserve rate can be viewed by calling:

function reserveRateMantissa(address source) external view returns (uint256);

The default reserve rate across all prize pools can be set with:

function setDefaultReserveRateMantissa(uint224 _reserveRateMantissa) external override

Note: only the contract owner can call this function.

The concept of a withdrawStrategist allows the reserve to be withdrawn by a custom withdrawStrategist address. This can be set by calling:

function setWithdrawStrategist(address _strategist) external override onlyOwner{

Note: only the contract ower can call this function.

The actual reserve amount can be withdrawn from a prize pool by either the contract owner or the withdrawStrategist by calling:

 function withdrawReserve(address prizePool, address to) external override onlyOwnerOrWithdrawStrategist returns (uint256)

Setup

To setup repo install with: yarn

Setup environmental variables with: cp .envrc.example .envrc and fill .envrc with your own variables and api keys.

Import the environmental variables with: direnv allow

To deploy

Locally

To deploy locally for development run: yarn deploy localhost

To a network

Ensure HDWALLET_MNEMONIC is set in .envrc and run: yarn deploy <network-name>

To verify

Ensure ETHERSCAN_API_KEY is set in .envrc and run: yarn verify <network-name>

Testing

Locally

To test the contracts locally run: yarn && yarn test

Coverage

To display contract coverage run: yarn coverage

To fork test

After specifying the fork block in hardhat.networks.js, start the mainnet fork with: yarn start-fork

In another terminal window run: yarn fork-run ./scripts/setupReserve.js

Connecting the ConfigurableReserve to the Prize Pools

The prize pools lookup where the reserve rates are set at the ReserveRegistry (https://etherscan.io/address/0x3e8b9901dbfe766d3fe44b36c180a1bca2b9a295).

This Registry contract is owned by the PoolTogether governance system (specifically the timelock contract).

This Registry can now be updated to instead point at the ConfigurableReserve (https://etherscan.io/address/0xd1797D46C3E825fce5215a0259D3426a5c49455C) by the timelock calling:

function register(address _pointer) external onlyOwner