Giter Site home page Giter Site logo

api3-token-lock-bridge's Introduction

API3 Token Lock External Bridge

A TypeScript serverless function, triggered periodically to filter the latest N blocks for Authorization events from API3TokenLockExternal.sol, each of which has data about a client whitelisting on a given side-chain. Based on the event log data, the function executes a client whitelisting transaction to a API3Authorizer.sol, which is deployed on a specific side-chain.

How to run?

Prerequisites

npm install -g serverless
  • Logged into AWS or saved AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY

Configuration

cd api3-token-lock-external-bridge
npm install

Create security.json in the default directory. The file stores the environment variables, used to run the application

{
  "BLOCKS_BEHIND": "",
  "TOKEN_LOCK_EXTERNAL_CONTRACT_ADDRESS": "",
  "TOKEN_LOCK_EXTERNAL_PROVIDER": ""
}

BLOCKS_BEHIND - How many blocks before the current block will be queried.

TOKEN_LOCK_EXTERNAL_CONTRACT_ADDRESS - The address of the API3TokenLockExternal.sol.

TOKEN_LOCK_EXTERNAL_PROVIDER - The JSON-RPC provider of the network on which API3TokenLockExternal.sol is deployed.


Populate src/config.json with the network configurations for API3Authorizer.sol on the different networks:

[
  {
    "api3Authorizer": "",
    "chainId": 0,
    "gasPrice": 0,
    "privateKey": "",
    "provider": ""
  },
  ...
]

api3Authorizer - The address of the API3Authorizer.sol.

chainId - The chain id on which API3Authorizer.sol is deployed.

gasPrice (optional) - The gas price in wei, used for whitelisting transactions.

privateKey - The private key, which is a super admin in API3Authorizer.sol.

provider - The JSON-RPC provider to the target chain.

Deployment

After configurations for security.json and config.json are set, execute:

serverless deploy --region $REGION --stage $STAGE

api3-token-lock-bridge's People

Contributors

failfmi 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.