Coder Social home page Coder Social logo

pinkdiamond1 / tibc-solidity Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bianjieai/tibc-solidity

0.0 1.0 0.0 587 KB

Solidity Implementation of Terse IBC

License: Apache License 2.0

Solidity 59.83% TypeScript 5.37% Shell 0.04% JavaScript 34.76%

tibc-solidity's Introduction

tibc-solidity

Solidity Implementation of Terse IBC

Compile

yarn & yarn compile

Test

yarn test

Deploy on Ropsten testnet

Build a Defender environment

  1. The administrator creates a defender account and invites other people to join the group. Note: Due to the limitation of the defender, you can only join the group by registering the defender account by invitation, and you cannot directly register the defender account. Otherwise, when the multi-signature is performed, the user cannot receive the notification of the signature proposal.

  2. Create a multi-signature wallet, select the network to be deployed, and the corresponding network address and multi-signature threshold.

  3. Deploy a multi-signature wallet and obtain a multi-signature wallet address.

Deploy contract

Export the environment variables for each step below.

  • Deploy libraries
yarn hardhat deployLibraries --network <ropsten>
  • Deploy AccessManager
yarn hardhat deployAcessManager --network <ropsten> --wallet <walletAddress>

The <native-chain-name> requires at least 9 characters in the cross-chain protocol.

  • Deploy ClientManager
yarn hardhat deployClientManager --network <ropsten> --chain <native-chain-name>
  • Deploy Tendermint Client When multiple light clients need to be created, multiple instances need to be deployed (Tendermint contracts)
yarn hardhat deployTendermint --network <ropsten>
  • Deploy Routing
yarn hardhat deployRouting --network <ropsten>
  • Deploy Packet
yarn hardhat deployPacket --network <ropsten>
  • Deploy ERC1155
yarn hardhat deployERC1155Bank --network <ropsten>
  • Deploy NFT Transfer
yarn hardhat deployNFTTransfer --network <ropsten>
  • Deploy MT Transfer
yarn hardhat deployMtTransfer --network <ropsten>

Transfer proxy contract ownership

For the safe upgrade of the contract, it is necessary to cooperate with the operation of the multi-signature wallet to transfer the ownership of the contract to the multi-signature wallet. Note that after the project is deployed, the proxy contract address of all contracts and the compilation information of the contract are recorded in the .openzeppelin directory. This information is needed when the contract upgrade is executed next time. Modify the following script to complete the ownership transfer. In the scripts/transfer-ownership.js file, you need to replace the gnosisSafe variable, which is the address of the multi-signature wallet. After the modification is complete, execute the following command:

npx hardhat run --network ropsten scripts/transfer-ownership.js

Import the contract to Defender(optional)

Currently, only the AccessManager contract uses multi-signature control (except for the upgrade operation). The management authority of other contracts is managed by AccessManager, so in order to facilitate the operation, you need to import the AccessManager and ClientManager contracts into the Defender, Use the console to assign permissions.

Register relayer

  1. Grant someone permission to add relayer through the Defender management interface.

  2. The authorized person can add a relayer through the ClientManager contract

yarn hardhat registerRelayer --network ropsten --relayer <relayer-address> --chain <chain-name>

But, both of the above steps can be operated by Defender.

Add data packet receiving module

Grant operator ADD_ROUTING_ROLE(1f5d5d13d11690c734f3783b436f0f33696a050aed979e5362a3c49324de4427) permission

yarn hardhat addRouting --module NFT --address <transfer-contract-address>  --network ropsten

Authorized transfer contract

Grant mint and burn permissions to the <transfer-contract-address> EOA

Create light client

DEBUG=* yarn hardhat createClient --chain irishub-testnet  --clientstate <encode-clientstate> --consensusstate <encode-consensusstate> --network <ropsten>

Upgrade contract

When you need to upgrade a contract, you need to recompile the updated code (note that the configuration in the .openzeppelin directory does not change), and then modify script, where proxyAddress It refers to the contract address that needs to be upgraded (actually the proxy contract address), and then the contract to be upgraded is specified in the getContractFactory parameter.

Another thing to note is that when using Defender to cooperate with a multi-signature wallet to upgrade the contract, the key information provided by the Defender platform (the defender configuration domain in the hardhat.config.ts file) is required to create an upgrade proposal The upgrade proposal is sent to the members of the group, and the upgrade operation will only be performed after the upgrade proposal is approved by the multi-signature strategy.

npx hardhat run --network ropsten scripts/propose-upgrade.js

tibc-solidity's People

Contributors

chengwenxi avatar dgsbl avatar mindcarver avatar yjcbert avatar zhangyelong avatar

Watchers

 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.