GithubHelp home page GithubHelp logo

louislucrypto / set.js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from setprotocol/set.js

0.0 0.0 0.0 2.03 MB

Javascript library for the Set Protocol V2

License: Apache License 2.0

Shell 0.08% JavaScript 0.23% TypeScript 99.69%

set.js's Introduction

License NPM

set.js

set.js is a library for wrapping and interacting with Set Protocol V2 smart contracts. This library enables you to create, issue, redeem, and trade for Sets.

For Set Protocol V2 smart contract function descriptions, visit our docs

Getting Started

  1. Add this package to your project: yarn install set.js
  2. Configure your Set.js instance to read from & write to Ethereum, Polygon, or Optimism contract addresses. Your configuration for Ethereum Mainnet (Production) might look like this:
const SetJsEthereumMainnetAddresses = {
  controllerAddress: "0xF1B12A7b1f0AF744ED21eEC7d3E891C48Fd3c329",
  setTokenCreatorAddress: "0x026d25C2B70Ddbb8D759f1f38d6fD6e23b60B6DF",
  basicIssuanceModuleAddress: "0x508910aA6fF3D029Dc358dD0f775877A355BA35B",
  debtIssuanceModuleAddress: "0x338BEf3f37794dd199d6910E6109125D3eCa6048",
  debtIssuanceModuleV2Address: "0x3C0CC7624B1c408cF2cF11b3961301949f2F7820",
  streamingFeeModuleAddress: "0x3D8d14b7eFb8e342189ee14c3d40dCe005EB901B",
  tradeModuleAddress: "0x45D67b9dbEA9bd51ED2B67832addEAF839628fAa",
  navIssuanceModuleAddress: "0x33f6184b1695a8Fe344Ea6b7De11aA35A74Ec300",
  protocolViewerAddress: "0x15D860670b7DC211714282f1583CF591Cc3A945E"
}
  1. Pass in an ethereum provider to your Set.js instance (either an ethers.js or web3.js will work). Your Set.js initialization might look like this:
const SetJsConfig = {
  ethersProvider: new ethers.providers.Web3Provider(myProvider),
  ...SetJsEthereumMainnetAddresses,
};

const SetJsInstance = new SetJs(SetJsConfig);
  1. Begin using the Set Protocol. Try this command to see if your instance has been set up correctly (for ethereum production mainnet):
mySetJsInstance
  .setToken
  .fetchSetDetailsAsync(
    "0x1494CA1F11D487c2bBe4543E90080AeBa4BA3C2b",   // DeFi Pulse Index Set Token
    ["0xd8EF3cACe8b4907117a45B0b125c68560532F94D"], // Basic Issuance Module
    myAccount
  )

Take a look at our developer portal for more information on Set Protocol.

set.js's People

Contributors

justinkchen avatar asoong avatar cgewecke avatar williamsfu99 avatar controtie avatar rootulp avatar inje avatar ayshptk avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.