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

@orcaprotocol/contracts

v5.11.6

Published

TODO

Downloads

184

Readme

Orca Protocol

Orca Protocol is a lightweight permissions and membership management protocol that can be connected to Gnosis Safe through the SafeTeller.sol safe module.

Each membership group within orca is referred to as a pod and pod memberships are represented by ERC1155 membership tokens.

Library Usage

The NPM package includes some convenience functions for fetching deployments:

import { getDeployment, getControllerByAddress } from "@orcaprotocol/contracts";

// Fetches the latest Controller from the mainnet
const controller = getDeployment("ControllerLatest", 1);
// Fetching and instantiating the MemberToken contract
const memberTokenDeployment = getDeployment("MemberToken", network);
const MemberToken = new ethers.Contract(memberTokenDeployment.address, memberTokenDeployment.abi, provider);

// You can also fetch the Controller version by the address of the deployment.
// This is useful for fetching Controllers from Pods, as different Pod versions
// have different Controllers

// The Controller address tracked on the MemberToken
const controllerAddress = await MemberToken.memberController(id);
if (controllerAddress === ethers.constants.AddressZero) {
  throw new Error("Pod ID was not registered on Controller");
}

const controllerDeployment = getControllerByAddress(controllerAddress, network);
const Controller = new ethers.Contract(controllerDeployment.address, controllerDeployment.abi, provider);

Development

Getting Started

Run npm install.

Install Foundry, then run forge install.

Testing

Run npm run test to run the test suite

Run forge test to run the test suite

Run npm run coverage to print a coverage report

Deployment

Pre-Reqs

You must create .env in the product root, and it should look like this:

// This should be your private key
PRIVATE_KEY = ""

// Optional
COINMARKETCAP_KEY= ""

// Required
INFURA_API_KEY= ""

Deploying

You can run npx hardhat --network rinkeby deploy to deploy contracts to the testnet. This will deploy all our contracts and connect them to the official Gnosis Safe contracts.

Run npx hardhat etherscan-verify to verify contracts on etherscan

Run npx hardhat tenderly-verify to verify contracts on tenderly

Architecture

The high level architecture of orca protocol is a permission wrapper around a gnosis safe that uses 1155 NFT membership to manage access.

A gnosis safe wrapped by orca is referred to as a pod.

Member Token

The MemberToken is an 1155 token contract that represents manages the memberships of all pods.

Each pod is represented by a unique 1155 token id, which correspond to its set of member NFTs.

Each pod also is tied to a version of the Controller, for future upgradeability.

On any token event the _beforeTokenTransfer hook will call the beforeTokenTransfer function of the pod's version of Controller to perform validation and manage side effects before the token is allowed to transfer.

Controller

The Controller manages the creation of pods as well as managing their membership validation and side effects.

When the MemberToken calls the beforeTokenTransfer function, the Controller will validate the action with the RuleManager to verify the membership change is permissible.

If the event is permissible the Controller will call the SafeTeller to handle the side effects of the membership change.

RuleManager

The RuleManager manages the rules for multiple pods, each rule is an arbitrary transaction that returns true or false based on a member's compliance at transfer time

SafeTeller

The SafeTeller manages the side effects for multiple pods, before a valid token transfer the SafeTeller will perform owner updates to the pod's safe