|
13 | 13 | </p>
|
14 | 14 |
|
15 | 15 | # set.js
|
| 16 | + |
16 | 17 | `set.js` is a library for interacting with Set Protocol V2 smart contracts.
|
17 |
| -This library enables you to create, issue, redeem, and trade for Sets |
| 18 | +This library enables you to create, issue, redeem, and trade for Sets. |
| 19 | + |
| 20 | +## Getting Started |
| 21 | + |
| 22 | +1. Add this package to your project: `yarn install set.js` |
| 23 | +2. Configure your Set.js instance to read from & write to [Ethereum, Polygon, or Optimism contracts](https://docs.tokensets.com/developers/contracts/deployed/protocol). |
| 24 | + Your configuration for Ethereum Mainnet (Production) might look like this: |
| 25 | + |
| 26 | +``` |
| 27 | +const SetJsEthereumMainnetAddresses = { |
| 28 | + controllerAddress: "0xF1B12A7b1f0AF744ED21eEC7d3E891C48Fd3c329", |
| 29 | + setTokenCreatorAddress: "0x026d25C2B70Ddbb8D759f1f38d6fD6e23b60B6DF", |
| 30 | + basicIssuanceModuleAddress: "0x508910aA6fF3D029Dc358dD0f775877A355BA35B", |
| 31 | + debtIssuanceModuleAddress: "0x338BEf3f37794dd199d6910E6109125D3eCa6048", |
| 32 | + debtIssuanceModuleV2Address: "0x3C0CC7624B1c408cF2cF11b3961301949f2F7820", |
| 33 | + streamingFeeModuleAddress: "0x3D8d14b7eFb8e342189ee14c3d40dCe005EB901B", |
| 34 | + tradeModuleAddress: "0x45D67b9dbEA9bd51ED2B67832addEAF839628fAa", |
| 35 | + navIssuanceModuleAddress: "0x33f6184b1695a8Fe344Ea6b7De11aA35A74Ec300", |
| 36 | + protocolViewerAddress: "0x15D860670b7DC211714282f1583CF591Cc3A945E" |
| 37 | +} |
| 38 | +``` |
| 39 | + |
| 40 | +3. Pass in an ethereum provider to your Set.js instance (either an [ethers.js](https://docs.ethers.io/v5/) or [web3.js](https://web3js.readthedocs.io/en/v1.7.0/) will work). Your Set.js initialization might look like this: |
| 41 | + |
| 42 | +``` |
| 43 | +const SetJsConfig = { |
| 44 | + ethersProvider: new ethers.providers.Web3Provider(myProvider), |
| 45 | + ...SetJsEthereumMainnetAddresses, |
| 46 | +}; |
| 47 | +
|
| 48 | +const SetJsInstance = new SetJs(setJsConfig); |
| 49 | +``` |
| 50 | + |
| 51 | +4. Begin using the Set Protocol. Try this command to see if your instance has been set up correctly (for ethereum production mainnet): |
| 52 | + |
| 53 | +``` |
| 54 | +mySetJsInstance |
| 55 | + .setToken |
| 56 | + .fetchSetDetailsAsync( |
| 57 | + "0x1494CA1F11D487c2bBe4543E90080AeBa4BA3C2b", // DeFi Pulse Index Set Token |
| 58 | + ["0xd8EF3cACe8b4907117a45B0b125c68560532F94D"], // Basic Issuance Module |
| 59 | + myAccount |
| 60 | + ) |
| 61 | +``` |
18 | 62 |
|
19 |
| -#### Take a look at our [developer portal](https://docs.tokensets.com/) for the fastest way to get up and running. |
| 63 | +#### Take a look at our [developer portal](https://docs.tokensets.com/) for more information on Set Protocol. |
0 commit comments