Skip to content

Commit

Permalink
getTokenInfo for erc20
Browse files Browse the repository at this point in the history
  • Loading branch information
0xverin committed Jun 20, 2024
1 parent 0c5ef23 commit 3637a45
Showing 1 changed file with 260 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ import "../libraries/Identities.sol";
import "../libraries/Utils.sol";
import { TokenHoldingAmount } from "./TokenHoldingAmount.sol";
import { NoderealClient } from "./NoderealClient.sol";
import { Ada } from "./erc20/Ada.sol";
import { Amp } from "./erc20/Amp.sol";

import { ERC20TokenLibrary } from "./erc20/ERC20TokenLibrary.sol";
contract ERC20 is TokenHoldingAmount {
mapping(uint32 => string) internal networkUrls;
mapping(uint32 => bool) private queriedNetworks;
Expand Down Expand Up @@ -116,16 +114,265 @@ contract ERC20 is TokenHoldingAmount {
string memory tokenBscAddress;
string memory tokenEthereumAddress;

if (Utils.isStringsEqual(decodedParams, "Ada")) {
tokenName = Ada.getTokenName();
ranges = Ada.getTokenRanges();
tokenBscAddress = Ada.getTokenBscAddress();
tokenEthereumAddress = Ada.getTokenEthereumAddress();
} else if (Utils.isStringsEqual(decodedParams, "Amp")) {
tokenName = Amp.getTokenName();
ranges = Amp.getTokenRanges();
tokenBscAddress = Amp.getTokenBscAddress();
tokenEthereumAddress = Amp.getTokenEthereumAddress();
if (Utils.isStringsEqual(decodedParams, "ada")) {
(
tokenName,
ranges,
tokenBscAddress,
tokenEthereumAddress
) = ERC20TokenLibrary.getAdaInfo();
} else if (Utils.isStringsEqual(decodedParams, "amp")) {
(
tokenName,
ranges,
tokenBscAddress,
tokenEthereumAddress
) = ERC20TokenLibrary.getAmpInfo();
} else if (Utils.isStringsEqual(decodedParams, "atom")) {
(
tokenName,
ranges,
tokenBscAddress,
tokenEthereumAddress
) = ERC20TokenLibrary.getAtomInfo();
} else if (Utils.isStringsEqual(decodedParams, "bch")) {
(
tokenName,
ranges,
tokenBscAddress,
tokenEthereumAddress
) = ERC20TokenLibrary.getBchInfo();
} else if (Utils.isStringsEqual(decodedParams, "bean")) {
(
tokenName,
ranges,
tokenBscAddress,
tokenEthereumAddress
) = ERC20TokenLibrary.getBeanInfo();
} else if (Utils.isStringsEqual(decodedParams, "bnb")) {
(
tokenName,
ranges,
tokenBscAddress,
tokenEthereumAddress
) = ERC20TokenLibrary.getBnbInfo();
} else if (Utils.isStringsEqual(decodedParams, "comp")) {
(
tokenName,
ranges,
tokenBscAddress,
tokenEthereumAddress
) = ERC20TokenLibrary.getCompInfo();
} else if (Utils.isStringsEqual(decodedParams, "cro")) {
(
tokenName,
ranges,
tokenBscAddress,
tokenEthereumAddress
) = ERC20TokenLibrary.getCroInfo();
} else if (Utils.isStringsEqual(decodedParams, "crv")) {
(
tokenName,
ranges,
tokenBscAddress,
tokenEthereumAddress
) = ERC20TokenLibrary.getCrvInfo();
} else if (Utils.isStringsEqual(decodedParams, "dai")) {
(
tokenName,
ranges,
tokenBscAddress,
tokenEthereumAddress
) = ERC20TokenLibrary.getDaiInfo();
} else if (Utils.isStringsEqual(decodedParams, "doge")) {
(
tokenName,
ranges,
tokenBscAddress,
tokenEthereumAddress
) = ERC20TokenLibrary.getDogeInfo();
} else if (Utils.isStringsEqual(decodedParams, "dydx")) {
(
tokenName,
ranges,
tokenBscAddress,
tokenEthereumAddress
) = ERC20TokenLibrary.getDydxInfo();
} else if (Utils.isStringsEqual(decodedParams, "etc")) {
(
tokenName,
ranges,
tokenBscAddress,
tokenEthereumAddress
) = ERC20TokenLibrary.getEtcInfo();
} else if (Utils.isStringsEqual(decodedParams, "eth")) {
(
tokenName,
ranges,
tokenBscAddress,
tokenEthereumAddress
) = ERC20TokenLibrary.getEthInfo();
} else if (Utils.isStringsEqual(decodedParams, "fil")) {
(
tokenName,
ranges,
tokenBscAddress,
tokenEthereumAddress
) = ERC20TokenLibrary.getFilInfo();
} else if (Utils.isStringsEqual(decodedParams, "grt")) {
(
tokenName,
ranges,
tokenBscAddress,
tokenEthereumAddress
) = ERC20TokenLibrary.getGrtInfo();
} else if (Utils.isStringsEqual(decodedParams, "gtc")) {
(
tokenName,
ranges,
tokenBscAddress,
tokenEthereumAddress
) = ERC20TokenLibrary.getGtcInfo();
} else if (Utils.isStringsEqual(decodedParams, "gusd")) {
(
tokenName,
ranges,
tokenBscAddress,
tokenEthereumAddress
) = ERC20TokenLibrary.getGusdInfo();
} else if (Utils.isStringsEqual(decodedParams, "imx")) {
(
tokenName,
ranges,
tokenBscAddress,
tokenEthereumAddress
) = ERC20TokenLibrary.getImxInfo();
} else if (Utils.isStringsEqual(decodedParams, "inj")) {
(
tokenName,
ranges,
tokenBscAddress,
tokenEthereumAddress
) = ERC20TokenLibrary.getInjInfo();
} else if (Utils.isStringsEqual(decodedParams, "leo")) {
(
tokenName,
ranges,
tokenBscAddress,
tokenEthereumAddress
) = ERC20TokenLibrary.getLeoInfo();
} else if (Utils.isStringsEqual(decodedParams, "link")) {
(
tokenName,
ranges,
tokenBscAddress,
tokenEthereumAddress
) = ERC20TokenLibrary.getLinkInfo();
} else if (Utils.isStringsEqual(decodedParams, "lit")) {
(
tokenName,
ranges,
tokenBscAddress,
tokenEthereumAddress
) = ERC20TokenLibrary.getLitInfo();
} else if (Utils.isStringsEqual(decodedParams, "matic")) {
(
tokenName,
ranges,
tokenBscAddress,
tokenEthereumAddress
) = ERC20TokenLibrary.getMaticInfo();
} else if (Utils.isStringsEqual(decodedParams, "mcrt")) {
(
tokenName,
ranges,
tokenBscAddress,
tokenEthereumAddress
) = ERC20TokenLibrary.getMcrtInfo();
} else if (Utils.isStringsEqual(decodedParams, "nfp")) {
(
tokenName,
ranges,
tokenBscAddress,
tokenEthereumAddress
) = ERC20TokenLibrary.getNfpInfo();
} else if (Utils.isStringsEqual(decodedParams, "people")) {
(
tokenName,
ranges,
tokenBscAddress,
tokenEthereumAddress
) = ERC20TokenLibrary.getPeopleInfo();
} else if (Utils.isStringsEqual(decodedParams, "shib")) {
(
tokenName,
ranges,
tokenBscAddress,
tokenEthereumAddress
) = ERC20TokenLibrary.getShibInfo();
} else if (Utils.isStringsEqual(decodedParams, "sol")) {
(
tokenName,
ranges,
tokenBscAddress,
tokenEthereumAddress
) = ERC20TokenLibrary.getSolInfo();
} else if (Utils.isStringsEqual(decodedParams, "spaceid")) {
(
tokenName,
ranges,
tokenBscAddress,
tokenEthereumAddress
) = ERC20TokenLibrary.getSpaceIdInfo();
} else if (Utils.isStringsEqual(decodedParams, "ton")) {
(
tokenName,
ranges,
tokenBscAddress,
tokenEthereumAddress
) = ERC20TokenLibrary.getTonInfo();
} else if (Utils.isStringsEqual(decodedParams, "trx")) {
(
tokenName,
ranges,
tokenBscAddress,
tokenEthereumAddress
) = ERC20TokenLibrary.getTrxInfo();
} else if (Utils.isStringsEqual(decodedParams, "tusd")) {
(
tokenName,
ranges,
tokenBscAddress,
tokenEthereumAddress
) = ERC20TokenLibrary.getTusdInfo();
} else if (Utils.isStringsEqual(decodedParams, "uni")) {
(
tokenName,
ranges,
tokenBscAddress,
tokenEthereumAddress
) = ERC20TokenLibrary.getUniInfo();
} else if (Utils.isStringsEqual(decodedParams, "usdc")) {
(
tokenName,
ranges,
tokenBscAddress,
tokenEthereumAddress
) = ERC20TokenLibrary.getUsdcInfo();
} else if (Utils.isStringsEqual(decodedParams, "usdt")) {
(
tokenName,
ranges,
tokenBscAddress,
tokenEthereumAddress
) = ERC20TokenLibrary.getUsdtInfo();
} else if (Utils.isStringsEqual(decodedParams, "wbtc")) {
(
tokenName,
ranges,
tokenBscAddress,
tokenEthereumAddress
) = ERC20TokenLibrary.getWbtcInfo();
} else {
revert("Unsupported token");
}
Expand Down

0 comments on commit 3637a45

Please sign in to comment.