Skip to content

A global way to get token info in gateway#408

Merged
boyuan-chen merged 5 commits intodevelopfrom
global-way-to-get-token-info
Oct 18, 2022
Merged

A global way to get token info in gateway#408
boyuan-chen merged 5 commits intodevelopfrom
global-way-to-get-token-info

Conversation

@boyuan-chen
Copy link
Copy Markdown
Contributor

📋 Add associated issues, tickets, docs URL here. https://github.com/bobanetwork/boba/issues/404

Overview

Describe what your Pull Request is about in a few sentences.

Some tokens are not ERC20 compatible, which means that our standard ABI doesn't work for those tokens.

In order to solve the problem, we store token information in one separate file. In our gateway, it can load token information instead of sending PRC calls. This should improve the speed too.

Changes

Describe your changes and implementation choices. More details make PRs easier to review.

  • Add token information files
  • Load name, symbol and decimal from the information file

Testing

Describe how to test your new feature/bug fix and if possible, a step by step guide on how to demo this.

Comment thread packages/boba/gateway/src/services/networkService.js Outdated
@@ -0,0 +1,276 @@
{
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you intend to use this on alt-l1s - perhaps it makes sense to name the files by chainid?
-mainnet.json
-testnet.json

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For alt-l1s, I will use tokenInfo[L1_NAME][MAINNET or TESTNET]. It's hard to remember 10 chain Ids.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well... you can make a mapping of chains, chainids as well. Better this way than having different implementations across the stack

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and you get the chainid with rpc and immediately know what to load

Copy link
Copy Markdown
Contributor Author

@boyuan-chen boyuan-chen Oct 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean adding all token information with chain Ids in the tokenInfoMainnet file? Like this:

{
  chain_id_1: {},
  chain_id_2: {}
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and you get the chainid with rpc and immediately know what to load

The loading process is before connecting to the RPC endpoint. I need to double check if you want to automatically load the file.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah that would work too, tokenInfo.json as chainid doesn't tell you if it's testnet or not

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. Now, we only need to add token information to tokenInfo.json for alt l1s. The gateway automatically fetches the right information based on the chain Id.

@boyuan-chen boyuan-chen marked this pull request as ready for review October 17, 2022 23:58
Copy link
Copy Markdown
Contributor

@InoMurko InoMurko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙌

@boyuan-chen boyuan-chen merged commit 48ce0f6 into develop Oct 18, 2022
@boyuan-chen boyuan-chen deleted the global-way-to-get-token-info branch October 18, 2022 19:41
InoMurko pushed a commit that referenced this pull request Oct 24, 2022
* A global way to get token info in gateway

* Rename file name and move tokenInfo outside

* Use a single file to store token info

(cherry picked from commit 48ce0f6)
InoMurko added a commit that referenced this pull request Oct 24, 2022
* Fix Layer Zero monitor (#359)

* Fix database typo

* Fix the env

* Fix Layer Zero monitor

* Reduce logs

* Fix typo

Co-authored-by: Ino Murko <ino.murko.github@protonmail.com>

Co-authored-by: Ino Murko <ino.murko.github@protonmail.com>
(cherry picked from commit c1c144b)

* 1. fix blank page on unknown routes (#379)

2. move routes path to const and ref in menuitem, route)
3. fix caniuse-lite terminal warnigng.

(cherry picked from commit f53ae8c)

* Add links to Boba multi-chains in the gateway (#384)

* Links to Boba multi-chains

* updated costant

* Add Boba Eth and Boba Fantom

Co-authored-by: Sahil Kashetwar <sahil@enya.ai>
(cherry picked from commit de21c96)

* Fix ABI and length of result for Layer Zero monitor (#376)

* Fix ABI and length

* Add layer zero contracts

* Fix bridge tag

* Update MySQL query

(cherry picked from commit 8b14503)

* rm bedrock - use v3-repos instead (#389)

(cherry picked from commit 0eac030)

* Gateway : Bridge to Alt L1s (#297)

* change:
 1. added tab in history for bridge between l1 & update history page.
 2. added action button to token list l1 layer bridge to alt l1
 3. inputStepMultiChain popup for bridging to alt l1s.

* updated the button style and remove tooltip.

* added networkservice func for multi chain deposit

* 1.Added abi, Deposit function.

* added bridge trnsfer from l1 to alt l1

* Add multichain bridge addresses (#310)

* change:
 - added loader when initiate briding
 - disabling bridge button in case of false conditions
 - commented unused contract initiation from depositErc20 to alt L1.
 - using the address added into the chainRinkeby.

* change:
 - Added actions, reducer, state to get the estimated
 - Showing estimated fees on UI for briding boba to alt l1.

* change:
 cleanup

* Clean the gateway for supporting multi-chains (#314)

* Support bridge between Eth and Moonbeam in gateway (#315)

* Support bridge between Eth and Moonbeam

* Remove console.log

* Fix contract address

* change:
1. fix for the failing import for rinkebny
2. updated get transaction to load the data for bridge between l1's
3. representation tx details on history page.
4. warning fix for coinImage breakstatement.
5. removed consoles.

* fix for warning

* change:
1. added boba to amount
2. showing destination chain & EventType on UI

* fix for the amout to be show on UI for txs.

* Update L0 contract addresses

Co-authored-by: Boyuan-Chen <46272347+Boyuan-Chen@users.noreply.github.com>
Co-authored-by: cby3149 <cby3149@gmail.com>
(cherry picked from commit 4640621)

* Fix Layer Zero fee and deploy API endpoint (#401)

* Fix Layer Zero fee and deploy API endpoint

* Disable button if warning is true

(cherry picked from commit 78b450c)

* Have verifier node sync in parallel with dtl to save time. (#394)

(cherry picked from commit 0ffde99)

* Edit beamer ecosystem entry (#411)

* Update project.list.js

We want to update the link to lead directly to the Beamer app now that we're live on Mainnet.

* Add files via upload

Replacement of Beamer Logo

(cherry picked from commit aa22ec3)

* Gateway : Vote & Dao Page. (#292)

Dao Page:
Create proposal with the option to select the Lock Boba (vBoba)
Show proposal list
Voting on proposal (abstain / against/ for)

Vote Page:
Showing available balance of vBoba.
Listing pools and available (vBoba) tokens
Way to vote on pools w.r.to. selected (vBoba) tokens.
updated contracts along with redux state/ actions / selectors

(cherry picked from commit dfb71a0)

* changes: (#410)

- updated the gas poll interval to 30000
 - moved fetchGasPrice calls to gasSwitcher component
 - removed unused gasReducer, gasSelector
 - updated readme

(cherry picked from commit 2dbe326)

* Enable whitelist for message relayer (#416)

(cherry picked from commit a06c58a)

* A global way to get token info in gateway (#408)

* A global way to get token info in gateway

* Rename file name and move tokenInfo outside

* Use a single file to store token info

(cherry picked from commit 48ce0f6)

* fix: revert nft for failing mint (#419)

* revert nft for failing mint

* update tests

* update README

* add timeout

* Apply suggestions from code review

Co-authored-by: Ino Murko <ino.murko.github@protonmail.com>

* fix: flaky test

Co-authored-by: Ino Murko <ino.murko.github@protonmail.com>
(cherry picked from commit 5f1d0f2)

* Add Sushiswap link (#430)

(cherry picked from commit 784c364)

* Add L2StandardTokenFactory address (#427)

(cherry picked from commit 33f6a50)

Co-authored-by: Boyuan-Chen <46272347+Boyuan-Chen@users.noreply.github.com>
Co-authored-by: Sahil K <86316370+sk-enya@users.noreply.github.com>
Co-authored-by: Riedl Kevin, Bsc <kevin.riedl@wavect.io>
Co-authored-by: DBecane <85872820+DBecane@users.noreply.github.com>
Co-authored-by: Souradeep Das <dsouradeep2@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants