@bosonprotocol/instances
Utility package that contains the official contract addresses and ABIs of the Boson Protocol.
Installation
npm install @bosonprotocol/instances
yarn add @bosonprotocol/instances
Usage
The package contains addresses and ABIs of multiple protocol versions and environments/chains.
Import
You can directly import from a <PROTOCOL_VERSION>
module, where the available protocol versions are listed in the src/versions
folder.
ESM
import { getContractAddresses } from "@bosonprotocol/instances/1.0.0";
import {
BosonRouterABI,
VouchersABI
} from "@bosonprotocol/instances/1.0.0/abis";
CJS
const { getContractAddresses } = require("@bosonprotocol/instances/1.0.0");
const {
BosonRouterABI,
VouchersABI
} = require("@bosonprotocol/instances/1.0.0/abis");
Contract addresses
const addressesMainnetProduction = getContractAddresses({
chainId: 1,
env: "production"
});
const addressesRopstenTesting = getContractAddresses({
chainId: 3,
env: "testing"
});
Contribution
In order to update or add addresses and ABIs of newer protocol versions or different environments/chains, checkout this repository and follow the steps below:
Install dependencies
npm install
Update or add source files
Addresses
If you want to update or add addresses run:
npm run update:addresses -- <SRC_FILE>
Note, that the <SRC_FILE>
should conform to the schema:
{
"chainId": "<CHAIN_ID>",
"env": "<ENV>",
"protocolVersion": "<PROTOCOL_VERSION>",
"<CONTRACT_NAME>": "<CONTRACT_ADDRESS>"
}
If you run the deploy
script of the bosonprotocol/contracts
repo, then the outputted addresses file can be used as the <SRC_FILE>
:
npx hardhat deploy --network rinkeby --env staging
npm run update:addresses -- <PATH_TO_CONTRACTS_REPO>/addresses/4-staging.json
ABIs
To update the ABIs you can run:
npm run update:abis -- <PROTOCOL_VERSION>
This will install the @bosonprotocol/core
package and create the respective files in the src/versions/<PROTOCOL_VERSION>/abis
folder.
Create a PR
Commit the changes to a new branch and create a PR.
Note, that we use Conventional Commits and Semantic Release to automatically publish and version the package.
Therefore, if you update addresses the commit message should look something like
fix: addresses v1.0.0 staging ropsten
If you add new addresses or ABIs the commit message should look something like
feat: addresses v1.1.0 testing ropsten