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

@bluejayfinance/contracts

v0.14.0

Published

The repo contains all the smart contracts used for Bluejay Finance.

Downloads

64

Readme

@bluejayfinance/contracts

The repo contains all the smart contracts used for Bluejay Finance.

Testing

hh test

Environment Variables

BLUEJAY_API_KEY - API key of deployed functions API to be used for fetching the latest merkle tree.

ETHERSCAN_API_KEY - API key of Etherscan pro API to be used for fetching list of holders of certain ERC20 tokens.

POAP_API_KEY - API key of POAP to be used for getting information about the POAPs.

PUBLIC_RPC_ENDPOINT - RPC endpoint used by Hardhat when performing operations

Merkle Tree Distributor

To generate the merkle tree for distribution for either PreBluejayToken, WhitelistSalePublic or WhitelistSalePrivate, you will need a balance map. See an example at examples/balance-map.json.

To generate the merkle tree, use the script at scripts/generateMerkleRoot.ts.

To verify the merkle tree, use the script at scripts/verifyMerkleRoot.ts.

External dependencies

Remove from dependencies field in generateNetworks so that hh will deploy the contract for us.

Deployment Validation

To validate that roles and mint/withdrawal limits are set correctly for a deployment, simply run the deployment validation script.

DEBUG=bluejay:* hh validate --network local --deployment-export src/deployments/hardhatDeployment/local.json --multisig-wallet 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --deployer-wallet 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --keeper-wallet 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266

To validate development deployment:

DEBUG=bluejay:* hh validate --network development --deployment-export src/deployments/hardhatDeployment/development.json --multisig-wallet 0x410159FB9EA1222b27eb0edA2f4d416Ce5ccdBaE --deployer-wallet 0x410159FB9EA1222b27eb0edA2f4d416Ce5ccdBaE --keeper-wallet 0x410159FB9EA1222b27eb0edA2f4d416Ce5ccdBaE

To validate testnet deployment:

DEBUG=bluejay:* hh validate --network testnet --deployment-export src/deployments/hardhatDeployment/testnet.json --multisig-wallet 0x410159FB9EA1222b27eb0edA2f4d416Ce5ccdBaE --deployer-wallet 0x410159FB9EA1222b27eb0edA2f4d416Ce5ccdBaE --keeper-wallet 0x410159FB9EA1222b27eb0edA2f4d416Ce5ccdBaE

To validate staging deployment:

DEBUG=bluejay:* hh validate --network staging --deployment-export src/deployments/hardhatDeployment/staging.json --multisig-wallet 0xD6A722e6811Bfc0b2bDbDd4C6124f14Ef2fdbe95 --deployer-wallet 0x09b63C4a7D33853dB70FcB6500117aBFceb50c96 --keeper-wallet 0x3c4DC9F4B6573a9b2Bd5B727cb94436c6f2F6BFB

To test on local machine, you may use the command to deploy to a specific stage:

# For full deployment
npm run deploy:local:override

# For specific stage
npm run deploy:local:override -- --tags BASE

Deploy to a specific stage

If you open anyscripts in the deploy folder, you will find tags at the bottom of the files. For instance:

deploymentScript.tags = ["BluejayToken", "BASE"];

With the help of the tags we can control what we want to deploy on the blockchain. Follow the instructions below to deploy to a specific state:

  • clean the deployment folder: rm -rf ./deployments/local
  • start hardhat node: npx hardhat node --no-deploy
  • deploy to a specific stage: npx hardhat deploy --network local --tags TAGS where TAGS can be
    • BASE
    • PREMINT
    • WHITELIST_SALE
    • BLU_LAUNCH
    • SGD_LAUNCH
    • PSM
    • LENDING_POOL

Export the contracts file

In order to get the file containing the contracts address and ABIs, we can export it from hardhat. For instance, the following command will export all the information into a file called local.json from the local network

npx hardhat export --export local.json --network local

Take note that you will have to delete the files from previous deployment in the folder deployments/<network> and deployments/transactions/<network> to allow the script to re-run from start as presence of those file may cause a contract deployment or transaction to be skipped as we are using deterministic deployment (ie each action will only run once).

Also, take note that for the export command to work, you will need to enable the saveDeployments flag in the config file for the specific network.

Validating Smart Contracts

To validate the smart contract, you will need to use the hardhat-etherscan plugin. You can call the verify task with the network, contract address and deployment arguments.

Example of verifying the ContributorTokenStreamable contract on the development network:

npx hardhat verify --network development 0xc7919AaD1fD977136CEab12e634B8DA3B548Fa7b 0x787f7893474191847c7DDF3a9040509f225Dd820 10000000000000000000000000 true true

Analysis

Get balance of addresses

To get balance of a list of accounts, prepare a list of addresses in a text file, one address per line. The script will export the balance into balances.json

ts-node scripts/analyzeBalances.ts -i <file> -o balances.json

Get list of whitelisted addresses

To get the whitelisted addresses in a list for the first call:

ts-node scripts/fetchWhitelistedAddresses.ts -k <key> -o whitelistedAddresses.txt

Tips & Tricks

To run specific test on watch mode while writing test and code:

nodemon --watch test --watch contracts -e ts,sol --exec "hh test test/ContributorToken.test.ts"