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

@topos-protocol/topos-smart-contracts

v3.4.0

Published

Topos Smart Contracts

Downloads

22

Readme

analyze build docker-build format lint sequencer-e2e test npm release

Description

This repository contains Solidity smart contracts to be used with the Topos Protocol in the Topos ecosystem. The contract compilation/deployment and testing methods are taken care by the Hardhat development framework.

Installation

To install the project along with all the dependencies run:

$ npm install

Dependencies

This project contains some smart contracts which inherit from OpenZeppelin contracts. This should be installed automatically.

Build

To build:

$ npm run build

Tests

To run the tests:

$ npm run test

Coverage

To see the test coverage:

npm run coverage

Linting

For formatting this project uses prettier with the prettier-plugin-solidity plugin. For general style guide and security checks this project uses Solhint.

To run linter:

$ npm run lint

To fix the format:

$ npm run lint:fix

Deployment

Deployment of a single contract with CREATE2

A NodeJS script is made available to deploy contracts with CREATE2, i.e., with constant addresses. The script is to be used with a deployed instance of ConstAddressDeployer. See an example below:

$ npm run deploy http://myChainRPCEndpoint myCompiledContract.json MySecretSalt ACustomGasLimit|null MyConstructorArg AnotherConstructorArg

E.g.
$ npm run deploy http://127.0.0.1:8545 artifacts/contracts/topos-core/ToposCore.sol/ToposCore.json $TOPOS_CORE_SALT 2000000 0xF121424e3F7d73fCD79DcBCA67E8F10BeBE67b00 0x3100000000000000000000000000000000000000000000000000000000000000

Deployment of the full Topos Messaging Protocol

To deploy the full Topos Messaging Protocol, another deploy:topos-msg-protocol npm script is available. This scripts deploys the following contracts:

  • TokenDeployer with constant address
  • ToposCore with constant address
  • ToposCoreProxy with constant address
  • ToposMessaging with constant address
$ npm run deploy:topos-msg-protocol http://myChainRPCEndpoint pathToSequencerPrivateKey

E.g.
$ npm run deploy:topos-msg-protocol http://127.0.0.1:8545 /data/node-1/consensus/validator.key

This script requires a few environment variables to be set:

  • TOKEN_DEPLOYER_SALT: salt for the TokenDeployer contract
  • TOPOS_CORE_SALT: salt for the ToposCore contract
  • TOPOS_CORE_PROXY_SALT: salt for the ToposCoreProxy contract
  • TOPOS_MESSAGING_SALT: salt for the ToposMessaging contract
  • PRIVATE_KEY: the private key of the account to be used to deploy contracts

Deployment of the contracts on dynamic addresses

To deploy the full Topos Messaging Protocol on dynamic contract addresses (could be any Ethereum compatible network, not just Polygon Edge network with predeployed const address deployer contract), deploy:topos-msg-protocol-dynamic npm script is available. This script is intended for usage primarily during development. It deploys the following contracts:

  • TokenDeployer
  • ToposCore
  • ToposCoreProxy
  • ToposMessaging
$ npm run deploy:topos-msg-protocol-dynamic http://myChainRPCEndpoint sequencerPrivateKey

E.g.
$ npm run deploy:topos-msg-protocol-dynamic http://127.0.0.1:8545 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80

This script requires a few environment variables to be set:

  • PRIVATE_KEY: the private key of the account to be used to deploy contracts

Docker

Some of the above commands can be run in docker.

$ docker build . --t target [build|test|lint]

License

This project is released under the terms of the MIT license.