Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

demo: add evm chain bridge and faucet #319

Merged
merged 18 commits into from
Feb 22, 2023

Conversation

imotai
Copy link
Contributor

@imotai imotai commented Feb 16, 2023

Smart Contract

  • db3 erc20 token contract
  • deposit db3 to rollup contract
  • faucet

Bridge Node

  • watch the deposit events from rollup contract
  • add mint credit mutation
  • process message and submit mint mutation
  • fund faucet

Demo

step1 start all network

cd tools && bash start_localnet.sh
tendermint: no process found
BUILD MODE: debug
tendermint exist
db3: no process found
ganache: no process found
start db3 node...
start tendermint node...
start evm chain network...
deploy rollup contract to evm chain
rollup address 0xe2dDD568DB4d28bD79787D0a3e50d0E10E461EA4
erc20 address 0x7b68E10c80474DD93bD8C1ad53D4463c60a3AB7c
start db3 bridge node ...
start db3 faucet node ...
start local development done!

step2 fund the faucet

cd tools && cat faucet.log
023-02-22T13:07:37.818160Z  INFO db3_node::command: 
2023-02-22T13:07:37.828325Z  INFO db3_faucet::faucet_node_impl: new faucet node  with config FaucetNodeConfig { erc20_address: "0x7b68E10c80474DD93bD8C1ad53D4463c60a3AB7c", node_list: ["ws://127.0.0.1:8545"], amount: 1000000000 } and faucet evm address 0x90167babec369a1e1b62107da9a99a50db2351a2

/target/debug/db3 fund-faucet  --evm-chain-ws ws://127.0.0.1:8545 --private-key ad689d9b7751da07b0fb39c5091672cbfe50f59131db015f8a0e76c9790a6fcc --faucet-address 0x90167babec369a1e1b62107da9a99a50db2351a2 --erc20-address 0x7b68E10c80474DD93bD8C1ad53D4463c60a3AB7c

step3 request the faucet

./target/debug/db3 console
db3>-$ faucet
 message 
----------------------------------
 send faucet request successfully 
db3>-$ show-evm-account --evm-chain-ws ws://127.0.0.1:8545 --token-address 0x7b68E10c80474DD93bD8C1ad53D4463c60a3AB7c --contract-address 0xe2dDD568DB4d28bD79787D0a3e50d0E10E461EA4
 name           | value 
----------------+--------------------------------------------
 address        | 0xd710618058b35da3ffd5c57e1bb29c9f90522479 
 locked balance | 0.000000 db3 
 balance        | 1.000000 db3 
 locked balance | 0.000000 db3

you will get 1 $db3

step4 deposit to db3 rollup contract

deposit --evm-chain-ws ws://127.0.0.1:8545 --token-address 0x7b68E10c80474DD93bD8C1ad53D4463c60a3AB7c --contract-address 0xe2dDD568DB4d28bD79787D0a3e50d0E10E461EA4 --amount 0.5
 message 
-------------------------------------------
 deposit fund to db3 contract successfully 
db3>-$ show-account
 name           | value 
----------------+--------------------------------------------
 db3 address    | 0x539a6192e4fcd61f53772a3284c7734bc0f6f1d6 
 evm address    | 0xd710618058b35da3ffd5c57e1bb29c9f90522479 
 bills          | 0.000000 db3 
 credits        | 0.500000 db3 
 storage used   | 0.00  
 mutation count | 0 
 session count  | 0 
 nonce          | 0 

Now you can see 0.5 $db3 credits in the db3 network and you can be free to store and query documents

Some Best Practice

@imotai imotai linked an issue Feb 16, 2023 that may be closed by this pull request
2 tasks
@db3fans
Copy link
Collaborator

db3fans commented Feb 16, 2023

This PR exceeds the recommended size of 1200 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

@imotai imotai changed the title feat: add solidity template feat: add evm chain bridge Feb 16, 2023
@db3fans
Copy link
Collaborator

db3fans commented Feb 16, 2023

This PR exceeds the recommended size of 1200 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

@db3fans
Copy link
Collaborator

db3fans commented Feb 17, 2023

This PR exceeds the recommended size of 1200 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

@codecov-commenter
Copy link

codecov-commenter commented Feb 17, 2023

Codecov Report

Merging #319 (bb40a85) into main (bd3d80f) will not change coverage.
The diff coverage is n/a.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@           Coverage Diff           @@
##             main     #319   +/-   ##
=======================================
  Coverage   63.26%   63.26%           
=======================================
  Files          55       55           
  Lines        6016     6016           
=======================================
  Hits         3806     3806           
  Misses       2210     2210           
Flag Coverage Δ
rust 63.26% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@db3fans
Copy link
Collaborator

db3fans commented Feb 17, 2023

This PR exceeds the recommended size of 1200 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

@db3fans
Copy link
Collaborator

db3fans commented Feb 18, 2023

This PR exceeds the recommended size of 1200 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

@db3fans
Copy link
Collaborator

db3fans commented Feb 18, 2023

This PR exceeds the recommended size of 1200 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

@db3fans
Copy link
Collaborator

db3fans commented Feb 18, 2023

This PR exceeds the recommended size of 1200 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

@db3fans
Copy link
Collaborator

db3fans commented Feb 21, 2023

This PR exceeds the recommended size of 1200 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

@github-actions github-actions bot added the S-kv label Feb 21, 2023
@db3fans
Copy link
Collaborator

db3fans commented Feb 21, 2023

This PR exceeds the recommended size of 1200 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

@db3fans
Copy link
Collaborator

db3fans commented Feb 21, 2023

This PR exceeds the recommended size of 1200 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

@db3fans
Copy link
Collaborator

db3fans commented Feb 22, 2023

This PR exceeds the recommended size of 1200 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

@db3fans
Copy link
Collaborator

db3fans commented Feb 22, 2023

This PR exceeds the recommended size of 1200 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

@db3fans
Copy link
Collaborator

db3fans commented Feb 22, 2023

This PR exceeds the recommended size of 1200 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

@db3fans
Copy link
Collaborator

db3fans commented Feb 22, 2023

This PR exceeds the recommended size of 1200 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

@imotai imotai changed the title feat: add evm chain bridge feat: add evm chain bridge and facuet Feb 22, 2023
@imotai imotai changed the title feat: add evm chain bridge and facuet demo: add evm chain bridge and facuet Feb 22, 2023
@imotai imotai merged commit 7027402 into main Feb 22, 2023
@imotai imotai changed the title demo: add evm chain bridge and facuet demo: add evm chain bridge and faucet Feb 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants