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

@protocolink/logics

v1.8.6

Published

An SDK that build protocol logics for Protocolink

Downloads

746

Readme

@protocolink/logics

Lint Unit Test E2E Latest Block E2E Pinned Block E2E OP Pinned Block

An SDK that build protocol logics for Protocolink

How to contribute?

Initial Setup

  1. Fork this repository.
  2. Set up your development environment and install the required dependencies.

Contribution Steps

  1. Create a New Logic:
  • Add a new folder under src/logics named after the protocol (protocolId), using Hyphenation format.
  • Create a new logic file under src/logics/{protocolId}, named with the action name (logicId). Prefix it with logic. and use Hyphenation format. The file name should be logic.{logicId}.ts.
  1. Implement the Logic:
  • Implement the Logic class in the logic file using PascalCase. Append Logic to the action name.
  • Extend the core.Logic class.
  • Implement the following interfaces based on the requirements:
    • core.LogicTokenListInterface: The tokens list function.
    • core.LogicOracleInterface: The quotation function.
    • core.LogicBuilderInterface: The txdata encode function for interacting with contracts.

Example:

class LogicExampleLogic
  extends core.Logic
  implements core.LogicTokenListInterface, core.LogicOracleInterface, core.LogicBuilderInterface {
  // Your implementation here
}
  1. Reference Examples:
  1. Unit Testing:
  • Write tests that won't fail based on block number increments.
  • Test files are in the same path as the logic files, named logic.{logicId}.test.ts.
  • Write tests for functions like getTokenList() and build() as needed.
  1. Integration Testing:
  • Write tests that interact with the Router contract in real time.
  • Test files are in test/logics/{protocolId}/, named {logicId}.test.ts.
  • Utilize Logic's quotation functions to generate Logic Data for contract interactions.
  • Verify transaction success and expected changes in user asset balances.
  1. Submit a Pull Request (PR):
  • Use the PR template for PR content. Fill in the template and submit the PR.
  • Enable "Allow edits by maintainers" when creating the PR.
  • If your PR isn't merged promptly, feel free to ask for assistance on our Discord.

Get Involved and Learn More

CLI

  • Install the required dependencies

    yarn install
  • Generate protocol's abi TypeScript classes

    # - abi files: src/{protocol}/abis/*.json
    # - contracts dir: src/{protocol}/contracts
    yarn cli typechain
  • Run protocol's tests

    yarn cli test
  • Run protocol's script

    yarn cli script

Hardhat e2e testing

yarn hardhat test [test file]

Install

Install the package via npm:

npm install --save-dev @protocolink/logics

or yarn:

yarn add --dev @protocolink/logics