diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/mocks/MockHttpGetI64.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/mocks/MockHttpGetI64.sol new file mode 100644 index 0000000000..52994ddc5c --- /dev/null +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/mocks/MockHttpGetI64.sol @@ -0,0 +1,63 @@ +// Copyright 2020-2024 Trust Computing GmbH. +// This file is part of Litentry. +// +// Litentry is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Litentry is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Litentry. If not, see . + +// SPDX-License-Identifier: GPL-3.0-or-later + +pragma solidity ^0.8.8; + +import "@openzeppelin/contracts/utils/Strings.sol"; +import { HttpHeader } from "../libraries/Http.sol"; + +import "hardhat/console.sol"; + +contract MockHttpGetI64 { + receive() external payable {} + + fallback() external payable { + (string memory url, string memory jsonPointer, ) = abi.decode( + msg.data, + (string, string, HttpHeader[]) + ); + + bool success = true; + uint256 value = 0; + + if ( + Strings.equal( + url, + "https://blockchain.info/multiaddr?active=bc1pg6qjsrxwg9cvqx0gxstl0t74ynhs2528t7rp0u7acl6etwn5t6vswxrzpa&n=0" + ) + ) { + // 0.1(decimal is 8) + value = 10000000; + } else if ( + Strings.equal( + url, + "https://blockchain.info/multiaddr?active=bc1pqdk57wus42wuh989k3v700n6w584andwg7pvxnrd69ag3rs94cfq40qx2y&n=0" + ) + ) { + value = 0; + } + + console.log("http_get_i64>", url, jsonPointer, value); + + bytes memory encodedResult = abi.encode(success, value); + + assembly { + return(add(encodedResult, 0x20), mload(encodedResult)) + } + } +} diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/BlockchainInfoClient.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/BlockchainInfoClient.sol index 24cb1d734c..fc6ba04b1f 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/BlockchainInfoClient.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/BlockchainInfoClient.sol @@ -20,12 +20,13 @@ pragma solidity ^0.8.8; import "../libraries/Http.sol"; import "../libraries/Utils.sol"; +import "../libraries/Identities.sol"; library BlockchainInfoClient { function getMultiAddress( - string memory url, string[] memory accounts ) internal returns (bool, int64) { + string memory url = "https://blockchain.info/multiaddr"; string memory activeQueryParam = ""; for (uint256 i = 0; i < accounts.length; i++) { @@ -46,4 +47,25 @@ library BlockchainInfoClient { HttpHeader[] memory headers = new HttpHeader[](0); return Http.GetI64(url, "/wallet/final_balance", headers); } + + function isSupportedNetwork(uint32 network) internal pure returns (bool) { + return + network == Web3Networks.BitcoinP2tr || + network == Web3Networks.BitcoinP2pkh || + network == Web3Networks.BitcoinP2sh || + network == Web3Networks.BitcoinP2wpkh || + network == Web3Networks.BitcoinP2wsh; + } + + function getTokenBalance( + string[] memory accounts + ) internal returns (uint256) { + (bool balanceSuccess, int64 balance) = BlockchainInfoClient + .getMultiAddress(accounts); + if (balanceSuccess) { + return uint256(uint64(balance)); + } else { + return 0; + } + } } diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/Btc.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/Btc.sol new file mode 100644 index 0000000000..10325c605c --- /dev/null +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/Btc.sol @@ -0,0 +1,58 @@ +// Copyright 2020-2024 Trust Computing GmbH. +// This file is part of Litentry. +// +// Litentry is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Litentry is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Litentry. If not, see . + +// SPDX-License-Identifier: GPL-3.0-or-later + +pragma solidity ^0.8.8; +import "./Constants.sol"; +import { BRC20 } from "./brc20/BRC20.sol"; +library Btc { + function getTokenRanges() internal pure returns (uint256[] memory) { + // [0.0, 0.001, 0.1, 0.3, 0.6, 1.0, 2.0, 5.0, 10.0, 15.0, 25.0, 30.0, 40.0, 50.0]; + // all ranges multiplied by decimals_factor(1000). + uint256[] memory ranges = new uint256[](14); + ranges[0] = 0; + ranges[1] = 1; + ranges[2] = 100; + ranges[3] = 300; + ranges[4] = 600; + ranges[5] = 1000; + ranges[6] = 2000; + ranges[7] = 5000; + ranges[8] = 10000; + ranges[9] = 15000; + ranges[10] = 25000; + ranges[11] = 30000; + ranges[12] = 40000; + ranges[13] = 50000; + return ranges; + } + + function getTokenInfo() internal pure returns (TokenInfo[] memory) { + uint32[] memory networks = BRC20.getDefaultTokenNetworks(); + TokenInfo[] memory tokenInfoList = new TokenInfo[](networks.length); + for (uint i = 0; i < networks.length; i++) { + tokenInfoList[i] = TokenInfo( + networks[i], + "", + DataProviderTypes.BlockchainInfoClient, + 8 + ); + } + + return tokenInfoList; + } +} diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/Constants.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/Constants.sol index f99bc650a5..bd8164a1ac 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/Constants.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/Constants.sol @@ -18,10 +18,21 @@ pragma solidity ^0.8.8; -library Constants { - uint256 constant decimals_factor = 1000; -} struct TokenInfo { uint32 network; string tokenAddress; + uint8 dataprovierType; + uint8 decimals; +} + +library Constants { + uint256 constant decimals_factor = 1000; +} + +library DataProviderTypes { + uint8 public constant AchainableClient = 0; + uint8 public constant BlockchainInfoClient = 1; + uint8 public constant GeniidataClient = 2; + uint8 public constant MoralisClient = 3; + uint8 public constant NoderealClient = 4; } diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/MoralisClient.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/MoralisClient.sol index 1f2fa5b963..b54e145e9a 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/MoralisClient.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/MoralisClient.sol @@ -22,7 +22,7 @@ import "@openzeppelin/contracts/utils/Strings.sol"; import "../libraries/Http.sol"; import "../libraries/Json.sol"; import "../libraries/Identities.sol"; - +import "../libraries/Utils.sol"; struct SolanaTokenBalance { string mint; string amount; @@ -220,4 +220,55 @@ library MoralisClient { url = "https://deep-index.moralis.io/api/v2.2"; } } + + function getTokenBalance( + uint32 network, + string memory apiKey, + string memory account, + string memory tokenContractAddress, + uint8 tokenDecimals + ) internal returns (uint256) { + if (Strings.equal(tokenContractAddress, "Native Token")) { + (bool success, string memory solanaTokenBalance) = MoralisClient + .getSolanaNativeBalance(network, apiKey, account); + + if (success) { + (bool parsedStatus, uint256 parsedAmount) = Utils.parseDecimal( + solanaTokenBalance, + tokenDecimals + ); + if (parsedStatus) { + return parsedAmount; + } + return 0; + } + } else { + ( + bool success, + SolanaTokenBalance[] memory solanaTokenBalance + ) = MoralisClient.getSolanaTokensBalance(network, apiKey, account); + + if (success) { + for (uint i = 0; i < solanaTokenBalance.length; i++) { + if ( + Strings.equal( + solanaTokenBalance[i].mint, + tokenContractAddress + ) + ) { + (bool parsedStatus, uint256 parsedAmount) = Utils + .parseDecimal( + solanaTokenBalance[i].amount, + tokenDecimals + ); + if (parsedStatus) { + return parsedAmount; + } + return 0; + } + } + } + } + return 0; + } } diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/TokenHoldingAmount.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/TokenHoldingAmount.sol index 9479a50985..0369cd2f5a 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/TokenHoldingAmount.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/TokenHoldingAmount.sol @@ -106,7 +106,7 @@ abstract contract TokenHoldingAmount is DynamicAssertion { function calculateRange( uint256 balance, uint256[] memory ranges - ) private pure returns (uint256, uint256, int256) { + ) private view returns (uint256, uint256, int256) { uint256 index = ranges.length - 1; uint256 min = 0; int256 max = 0; @@ -128,7 +128,6 @@ abstract contract TokenHoldingAmount is DynamicAssertion { min = ranges[index]; max = int256(ranges[index + 1]); } - return (index, min, max); } @@ -176,7 +175,7 @@ abstract contract TokenHoldingAmount is DynamicAssertion { return assertions; } - function getTokenDecimals() internal pure virtual returns (uint8); + function getTokenDecimals() internal view virtual returns (uint8); function isSupportedNetwork( string memory tokenName, diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/TokenMapping.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/TokenMapping.sol index c609484df8..4dc19bbfe9 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/TokenMapping.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/TokenMapping.sol @@ -71,6 +71,9 @@ import { Usdt } from "./erc20/Usdt.sol"; import { Wbtc } from "./erc20//Wbtc.sol"; import { Cvx } from "./erc20/Cvx.sol"; import { Usdd } from "./erc20/Usdd.sol"; + +// btc +import { Btc } from "./Btc.sol"; contract TokenMapping is TokenQueryLogic { constructor() { // btcs @@ -115,6 +118,12 @@ contract TokenMapping is TokenQueryLogic { tokenInfo["sats"].push(BRC20.getBrc20TokenInfo()[i]); } + // Btc + tokenRanges["btc"] = Btc.getTokenRanges(); + for (uint8 i = 0; i < Btc.getTokenInfo().length; i++) { + tokenInfo["btc"].push(Btc.getTokenInfo()[i]); + } + // ada tokenRanges["ada"] = Ada.getTokenRanges(); for (uint8 i = 0; i < Ada.getTokenInfo().length; i++) { diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/TokenQueryLogic.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/TokenQueryLogic.sol index 60eaa89e06..5c3a446ca2 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/TokenQueryLogic.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/TokenQueryLogic.sol @@ -24,15 +24,16 @@ import "../libraries/Utils.sol"; import { TokenHoldingAmount } from "./TokenHoldingAmount.sol"; import { NoderealClient } from "./NoderealClient.sol"; import { GeniidataClient } from "./GeniidataClient.sol"; +import { BlockchainInfoClient } from "./BlockchainInfoClient.sol"; import "./MoralisClient.sol"; import "./Constants.sol"; abstract contract TokenQueryLogic is TokenHoldingAmount { mapping(string => TokenInfo[]) internal tokenInfo; + uint8 tokenDecimals; - // TODO fix it for erc20 token, same token for different networks has different decimals. - function getTokenDecimals() internal pure override returns (uint8) { - return 18; + function getTokenDecimals() internal view override returns (uint8) { + return tokenDecimals; } function queryBalance( @@ -47,20 +48,29 @@ abstract contract TokenQueryLogic is TokenHoldingAmount { if (identityToStringSuccess) { uint256 totalBalance = 0; - string memory tokenContractAddress = getTokenAddress( - tokenName, - network - ); + ( + string memory tokenContractAddress, + uint8 dataproviderType, + uint8 decimals + ) = getTokenInfo(tokenName, network); + tokenDecimals = decimals; - if (GeniidataClient.isSupportedNetwork(network)) { + if ( + dataproviderType == DataProviderTypes.GeniidataClient && + GeniidataClient.isSupportedNetwork(network) + ) { uint256 balance = GeniidataClient.getTokenBalance( secrets[0], identityString, tokenName, getTokenDecimals() ); + totalBalance += balance; - } else if (NoderealClient.isSupportedNetwork(network)) { + } else if ( + dataproviderType == DataProviderTypes.NoderealClient && + NoderealClient.isSupportedNetwork(network) + ) { (bool success, uint256 balance) = NoderealClient .getTokenBalance( network, @@ -71,59 +81,28 @@ abstract contract TokenQueryLogic is TokenHoldingAmount { if (success) { totalBalance += balance; } - } else if (MoralisClient.isSupportedNetwork(network)) { - if (Strings.equal(tokenContractAddress, "Native Token")) { - ( - bool success, - string memory solanaTokenBalance - ) = MoralisClient.getSolanaNativeBalance( - network, - secrets[2], - identityString - ); - - if (success) { - (bool parsedStatus, uint256 parsedAmount) = Utils - .parseDecimal( - solanaTokenBalance, - getTokenDecimals() - ); - if (parsedStatus) { - totalBalance += parsedAmount; - } - } - } else { - ( - bool success, - SolanaTokenBalance[] memory solanaTokenBalance - ) = MoralisClient.getSolanaTokensBalance( - network, - secrets[2], - identityString - ); - - if (success) { - for (uint i = 0; i < solanaTokenBalance.length; i++) { - if ( - Strings.equal( - solanaTokenBalance[i].mint, - tokenContractAddress - ) - ) { - ( - bool parsedStatus, - uint256 parsedAmount - ) = Utils.parseDecimal( - solanaTokenBalance[i].amount, - getTokenDecimals() - ); - if (parsedStatus) { - totalBalance += parsedAmount; - } - } - } - } - } + } else if ( + dataproviderType == DataProviderTypes.MoralisClient && + MoralisClient.isSupportedNetwork(network) + ) { + uint256 balance = MoralisClient.getTokenBalance( + network, + secrets[2], + identityString, + tokenContractAddress, + getTokenDecimals() + ); + totalBalance += balance; + } else if ( + dataproviderType == DataProviderTypes.BlockchainInfoClient && + BlockchainInfoClient.isSupportedNetwork(network) + ) { + string[] memory accounts = new string[](1); + accounts[0] = identityString; + uint256 balance = BlockchainInfoClient.getTokenBalance( + accounts + ); + totalBalance += balance; } return totalBalance; } @@ -143,15 +122,21 @@ abstract contract TokenQueryLogic is TokenHoldingAmount { return false; } - function getTokenAddress( + function getTokenInfo( string memory tokenName, uint32 network - ) internal view returns (string memory) { + ) internal view returns (string memory, uint8, uint8) { + string memory tokenAddress; + uint8 dataProviderType; + uint8 decimals; for (uint i = 0; i < tokenInfo[tokenName].length; i++) { if (tokenInfo[tokenName][i].network == network) { - return tokenInfo[tokenName][i].tokenAddress; + tokenAddress = tokenInfo[tokenName][i].tokenAddress; + dataProviderType = tokenInfo[tokenName][i].dataprovierType; + decimals = tokenInfo[tokenName][i].decimals; + return (tokenAddress, dataProviderType, decimals); } } - revert("Token address not found for the specified network"); + revert("TokenInfo not found"); } } diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/brc20/BRC20.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/brc20/BRC20.sol index 6c85ddb3bb..9d9515539b 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/brc20/BRC20.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/brc20/BRC20.sol @@ -35,7 +35,12 @@ library BRC20 { uint32[] memory networks = BRC20.getDefaultTokenNetworks(); TokenInfo[] memory tokenInfoList = new TokenInfo[](networks.length); for (uint i = 0; i < networks.length; i++) { - tokenInfoList[i] = TokenInfo(networks[i], ""); + tokenInfoList[i] = TokenInfo( + networks[i], + "", + DataProviderTypes.GeniidataClient, + 18 + ); } return tokenInfoList; diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Ada.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Ada.sol index d9bb2c3305..227b9b9408 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Ada.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Ada.sol @@ -34,11 +34,13 @@ library Ada { return ranges; } function getTokenInfo() internal pure returns (TokenInfo[] memory) { - TokenInfo[] memory networks = new TokenInfo[](1); - networks[0] = TokenInfo( + TokenInfo[] memory tokenInfoList = new TokenInfo[](1); + tokenInfoList[0] = TokenInfo( Web3Networks.Bsc, - "0x3EE2200Efb3400fAbB9AacF31297cBdD1d435D47" + "0x3EE2200Efb3400fAbB9AacF31297cBdD1d435D47", + DataProviderTypes.NoderealClient, + 18 ); - return networks; + return tokenInfoList; } } diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Amp.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Amp.sol index 0b4a0b6fda..86e8604d24 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Amp.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Amp.sol @@ -38,11 +38,13 @@ library Amp { } function getTokenInfo() internal pure returns (TokenInfo[] memory) { - TokenInfo[] memory networks = new TokenInfo[](1); - networks[0] = TokenInfo( + TokenInfo[] memory tokenInfoList = new TokenInfo[](1); + tokenInfoList[0] = TokenInfo( Web3Networks.Ethereum, - "0xff20817765cb7f73d4bde2e66e067e58d11095c2" + "0xff20817765cb7f73d4bde2e66e067e58d11095c2", + DataProviderTypes.NoderealClient, + 18 ); - return networks; + return tokenInfoList; } } diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Atom.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Atom.sol index b1acf309e0..83d48d01e6 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Atom.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Atom.sol @@ -35,15 +35,19 @@ library Atom { } function getTokenInfo() internal pure returns (TokenInfo[] memory) { - TokenInfo[] memory networks = new TokenInfo[](2); - networks[0] = TokenInfo( + TokenInfo[] memory tokenInfoList = new TokenInfo[](2); + tokenInfoList[0] = TokenInfo( Web3Networks.Ethereum, - "0x8D983cb9388EaC77af0474fA441C4815500Cb7BB" + "0x8D983cb9388EaC77af0474fA441C4815500Cb7BB", + DataProviderTypes.NoderealClient, + 18 ); - networks[1] = TokenInfo( + tokenInfoList[1] = TokenInfo( Web3Networks.Bsc, - "0x0eb3a705fc54725037cc9e008bdede697f62f335" + "0x0eb3a705fc54725037cc9e008bdede697f62f335", + DataProviderTypes.NoderealClient, + 18 ); - return networks; + return tokenInfoList; } } diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Bch.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Bch.sol index 921fdb33c7..daf90ca88e 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Bch.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Bch.sol @@ -37,19 +37,15 @@ library Bch { return ranges; } - function getTokenNetworks() internal pure returns (uint32[] memory) { - uint32[] memory networks = new uint32[](1); - networks[0] = Web3Networks.Bsc; - - return networks; - } function getTokenInfo() internal pure returns (TokenInfo[] memory) { - TokenInfo[] memory networks = new TokenInfo[](1); - networks[0] = TokenInfo( + TokenInfo[] memory tokenInfoList = new TokenInfo[](1); + tokenInfoList[0] = TokenInfo( Web3Networks.Bsc, - "0x8fF795a6F4D97E7887C79beA79aba5cc76444aDf" + "0x8fF795a6F4D97E7887C79beA79aba5cc76444aDf", + DataProviderTypes.NoderealClient, + 18 ); - return networks; + return tokenInfoList; } } diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Bean.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Bean.sol index a12ce177ae..108a4276a4 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Bean.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Bean.sol @@ -20,7 +20,10 @@ pragma solidity ^0.8.8; import "../../libraries/Identities.sol"; import "../Constants.sol"; - +struct TokenNetwork { + uint32 id; + string tokenAddress; +} library Bean { function getTokenRanges() internal pure returns (uint256[] memory) { uint256[] memory ranges = new uint256[](5); @@ -34,15 +37,19 @@ library Bean { } function getTokenInfo() internal pure returns (TokenInfo[] memory) { - TokenInfo[] memory networks = new TokenInfo[](2); - networks[0] = TokenInfo( + TokenInfo[] memory tokenInfoList = new TokenInfo[](2); + tokenInfoList[0] = TokenInfo( Web3Networks.Bsc, - "0x07da81e9a684ab87fad7206b3bc8d0866f48cc7c" + "0x07da81e9a684ab87fad7206b3bc8d0866f48cc7c", + DataProviderTypes.NoderealClient, + 18 ); - networks[1] = TokenInfo( + tokenInfoList[1] = TokenInfo( Web3Networks.Ethereum, - "0xba7b9936a965fac23bb7a8190364fa60622b3cff" + "0xba7b9936a965fac23bb7a8190364fa60622b3cff", + DataProviderTypes.NoderealClient, + 18 ); - return networks; + return tokenInfoList; } } diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Bnb.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Bnb.sol index e067b51071..cf6977ac21 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Bnb.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Bnb.sol @@ -39,12 +39,19 @@ library Bnb { } function getTokenInfo() internal pure returns (TokenInfo[] memory) { - TokenInfo[] memory networks = new TokenInfo[](2); - networks[0] = TokenInfo(Web3Networks.Bsc, "Native Token"); - networks[1] = TokenInfo( + TokenInfo[] memory tokenInfoList = new TokenInfo[](2); + tokenInfoList[0] = TokenInfo( + Web3Networks.Bsc, + "Native Token", + DataProviderTypes.NoderealClient, + 18 + ); + tokenInfoList[1] = TokenInfo( Web3Networks.Ethereum, - "0xb8c77482e45f1f44de1745f52c74426c631bdd52" + "0xb8c77482e45f1f44de1745f52c74426c631bdd52", + DataProviderTypes.NoderealClient, + 18 ); - return networks; + return tokenInfoList; } } diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Comp.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Comp.sol index a6b62066ed..2a8f1dbc3c 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Comp.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Comp.sol @@ -42,7 +42,9 @@ library Comp { TokenInfo[] memory tokenInfoList = new TokenInfo[](1); tokenInfoList[0] = TokenInfo( Web3Networks.Ethereum, - "0xc00e94cb662c3520282e6f5717214004a7f26888" + "0xc00e94cb662c3520282e6f5717214004a7f26888", + DataProviderTypes.NoderealClient, + 18 ); return tokenInfoList; diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Cro.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Cro.sol index 91672a0102..6a61ab29ad 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Cro.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Cro.sol @@ -36,15 +36,19 @@ library Cro { } function getTokenInfo() internal pure returns (TokenInfo[] memory) { - TokenInfo[] memory networks = new TokenInfo[](2); - networks[0] = TokenInfo( + TokenInfo[] memory tokenInfoList = new TokenInfo[](2); + tokenInfoList[0] = TokenInfo( Web3Networks.Ethereum, - "0xa0b73e1ff0b80914ab6fe0444e65848c4c34450b" + "0xa0b73e1ff0b80914ab6fe0444e65848c4c34450b", + DataProviderTypes.NoderealClient, + 18 ); - networks[1] = TokenInfo( + tokenInfoList[1] = TokenInfo( Web3Networks.Solana, - "DvjMYMVeXgKxaixGKpzQThLoG98nc7HSU7eanzsdCboA" + "DvjMYMVeXgKxaixGKpzQThLoG98nc7HSU7eanzsdCboA", + DataProviderTypes.MoralisClient, + 18 ); - return networks; + return tokenInfoList; } } diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Crv.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Crv.sol index 2d21decee1..3ed3b7a5cf 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Crv.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Crv.sol @@ -42,7 +42,9 @@ library Crv { TokenInfo[] memory tokenInfoList = new TokenInfo[](1); tokenInfoList[0] = TokenInfo( Web3Networks.Ethereum, - "0xdac17f958d2ee523a2206206994597c13d831ec7" + "0xdac17f958d2ee523a2206206994597c13d831ec7", + DataProviderTypes.NoderealClient, + 18 ); return tokenInfoList; diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Cvx.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Cvx.sol index 207e75ac86..276b4b9374 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Cvx.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Cvx.sol @@ -42,7 +42,9 @@ library Cvx { TokenInfo[] memory tokenInfoList = new TokenInfo[](1); tokenInfoList[0] = TokenInfo( Web3Networks.Ethereum, - "0x4e3fbd56cd56c3e72c1403e103b45db9da5b9d2b" + "0x4e3fbd56cd56c3e72c1403e103b45db9da5b9d2b", + DataProviderTypes.NoderealClient, + 18 ); return tokenInfoList; diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Dai.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Dai.sol index 5e2ec43808..5104bd7e3b 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Dai.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Dai.sol @@ -41,15 +41,21 @@ library Dai { TokenInfo[] memory tokenInfoList = new TokenInfo[](3); tokenInfoList[0] = TokenInfo( Web3Networks.Ethereum, - "0x6b175474e89094c44da98b954eedeac495271d0f" + "0x6b175474e89094c44da98b954eedeac495271d0f", + DataProviderTypes.NoderealClient, + 18 ); tokenInfoList[1] = TokenInfo( Web3Networks.Bsc, - "0x1af3f329e8be154074d8769d1ffa4ee058b1dbc3" + "0x1af3f329e8be154074d8769d1ffa4ee058b1dbc3", + DataProviderTypes.NoderealClient, + 18 ); tokenInfoList[2] = TokenInfo( Web3Networks.Solana, - "EjmyN6qEC1Tf1JxiG1ae7UTJhUxSwk1TCWNWqxWV4J6o" + "EjmyN6qEC1Tf1JxiG1ae7UTJhUxSwk1TCWNWqxWV4J6o", + DataProviderTypes.MoralisClient, + 18 ); return tokenInfoList; diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Doge.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Doge.sol index 36f5fee460..03597f24af 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Doge.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Doge.sol @@ -35,11 +35,13 @@ library Doge { } function getTokenInfo() internal pure returns (TokenInfo[] memory) { - TokenInfo[] memory networks = new TokenInfo[](1); - networks[0] = TokenInfo( + TokenInfo[] memory tokenInfoList = new TokenInfo[](1); + tokenInfoList[0] = TokenInfo( Web3Networks.Bsc, - "0xba2ae424d960c26247dd6c32edc70b295c744c43" + "0xba2ae424d960c26247dd6c32edc70b295c744c43", + DataProviderTypes.NoderealClient, + 18 ); - return networks; + return tokenInfoList; } } diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Dydx.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Dydx.sol index e729cb29e0..287ae96b46 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Dydx.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Dydx.sol @@ -42,7 +42,9 @@ library Dydx { TokenInfo[] memory tokenInfoList = new TokenInfo[](1); tokenInfoList[0] = TokenInfo( Web3Networks.Ethereum, - "0x92d6c1e31e14520e676a687f0a93788b716beff5" + "0x92d6c1e31e14520e676a687f0a93788b716beff5", + DataProviderTypes.NoderealClient, + 18 ); return tokenInfoList; diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Etc.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Etc.sol index b229725706..622da18f12 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Etc.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Etc.sol @@ -38,7 +38,9 @@ library Etc { TokenInfo[] memory tokenInfoList = new TokenInfo[](1); tokenInfoList[0] = TokenInfo( Web3Networks.Bsc, - "0x3d6545b08693dae087e957cb1180ee38b9e3c25e" + "0x3d6545b08693dae087e957cb1180ee38b9e3c25e", + DataProviderTypes.NoderealClient, + 18 ); return tokenInfoList; } diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Eth.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Eth.sol index 58e56039ab..dd00315578 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Eth.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Eth.sol @@ -42,10 +42,17 @@ library Eth { function getTokenInfo() internal pure returns (TokenInfo[] memory) { TokenInfo[] memory tokenInfoList = new TokenInfo[](2); - tokenInfoList[0] = TokenInfo(Web3Networks.Ethereum, "Native Token"); + tokenInfoList[0] = TokenInfo( + Web3Networks.Ethereum, + "Native Token", + DataProviderTypes.NoderealClient, + 18 + ); tokenInfoList[1] = TokenInfo( Web3Networks.Bsc, - "0x2170ed0880ac9a755fd29b2688956bd959f933f8" + "0x2170ed0880ac9a755fd29b2688956bd959f933f8", + DataProviderTypes.NoderealClient, + 18 ); return tokenInfoList; diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Fil.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Fil.sol index c409cd7946..132401d3b2 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Fil.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Fil.sol @@ -38,7 +38,9 @@ library Fil { TokenInfo[] memory tokenInfoList = new TokenInfo[](1); tokenInfoList[0] = TokenInfo( Web3Networks.Bsc, - "0x0d8ce2a99bb6e3b7db580ed848240e4a0f9ae153" + "0x0d8ce2a99bb6e3b7db580ed848240e4a0f9ae153", + DataProviderTypes.NoderealClient, + 18 ); return tokenInfoList; diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Grt.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Grt.sol index 6908a473b6..07c5c92a63 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Grt.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Grt.sol @@ -41,11 +41,15 @@ library Grt { TokenInfo[] memory tokenInfoList = new TokenInfo[](2); tokenInfoList[0] = TokenInfo( Web3Networks.Ethereum, - "0xc944e90c64b2c07662a292be6244bdf05cda44a7" + "0xc944e90c64b2c07662a292be6244bdf05cda44a7", + DataProviderTypes.NoderealClient, + 18 ); tokenInfoList[1] = TokenInfo( Web3Networks.Bsc, - "0x52ce071bd9b1c4b00a0b92d298c512478cad67e8" + "0x52ce071bd9b1c4b00a0b92d298c512478cad67e8", + DataProviderTypes.NoderealClient, + 18 ); return tokenInfoList; diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Gtc.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Gtc.sol index 7bc827c84c..69a8d5ab1a 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Gtc.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Gtc.sol @@ -42,7 +42,9 @@ library Gtc { TokenInfo[] memory tokenInfoList = new TokenInfo[](1); tokenInfoList[0] = TokenInfo( Web3Networks.Ethereum, - "0xde30da39c46104798bb5aa3fe8b9e0e1f348163f" + "0xde30da39c46104798bb5aa3fe8b9e0e1f348163f", + DataProviderTypes.NoderealClient, + 18 ); return tokenInfoList; diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Gusd.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Gusd.sol index 97e617ff54..821b741188 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Gusd.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Gusd.sol @@ -42,7 +42,9 @@ library Gusd { TokenInfo[] memory tokenInfoList = new TokenInfo[](1); tokenInfoList[0] = TokenInfo( Web3Networks.Ethereum, - "0x056fd409e1d7a124bd7017459dfea2f387b6d5cd" + "0x056fd409e1d7a124bd7017459dfea2f387b6d5cd", + DataProviderTypes.NoderealClient, + 18 ); return tokenInfoList; diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Imx.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Imx.sol index bdb78a4709..0172d9a2df 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Imx.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Imx.sol @@ -40,7 +40,9 @@ library Imx { TokenInfo[] memory tokenInfoList = new TokenInfo[](1); tokenInfoList[0] = TokenInfo( Web3Networks.Ethereum, - "0xf57e7e7c23978c3caec3c3548e3d615c346e79ff" + "0xf57e7e7c23978c3caec3c3548e3d615c346e79ff", + DataProviderTypes.NoderealClient, + 18 ); return tokenInfoList; diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Inj.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Inj.sol index 6b58e208d5..81d90b2bb5 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Inj.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Inj.sol @@ -38,7 +38,9 @@ library Inj { TokenInfo[] memory tokenInfoList = new TokenInfo[](1); tokenInfoList[0] = TokenInfo( Web3Networks.Ethereum, - "0xa0b73e1ff0b80914ab6fe0444e65848c4c34450b" + "0xa0b73e1ff0b80914ab6fe0444e65848c4c34450b", + DataProviderTypes.NoderealClient, + 18 ); return tokenInfoList; diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Leo.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Leo.sol index f45148c4f6..4896ca7104 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Leo.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Leo.sol @@ -38,7 +38,9 @@ library Leo { TokenInfo[] memory tokenInfoList = new TokenInfo[](1); tokenInfoList[0] = TokenInfo( Web3Networks.Ethereum, - "0x2af5d2ad76741191d15dfe7bf6ac92d4bd912ca3" + "0x2af5d2ad76741191d15dfe7bf6ac92d4bd912ca3", + DataProviderTypes.NoderealClient, + 18 ); return tokenInfoList; } diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Link.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Link.sol index fefc0d32df..b25cf56a3e 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Link.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Link.sol @@ -42,11 +42,15 @@ library Link { TokenInfo[] memory tokenInfoList = new TokenInfo[](2); tokenInfoList[0] = TokenInfo( Web3Networks.Bsc, - "0xf8a0bf9cf54bb92f17374d9e9a321e6a111a51bd" + "0xf8a0bf9cf54bb92f17374d9e9a321e6a111a51bd", + DataProviderTypes.NoderealClient, + 18 ); tokenInfoList[1] = TokenInfo( Web3Networks.Ethereum, - "0x514910771af9ca656af840dff83e8264ecf986ca" + "0x514910771af9ca656af840dff83e8264ecf986ca", + DataProviderTypes.NoderealClient, + 18 ); return tokenInfoList; } diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Lit.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Lit.sol index a61f152876..3514d26bb9 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Lit.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Lit.sol @@ -42,11 +42,15 @@ library Lit { TokenInfo[] memory tokenInfoList = new TokenInfo[](2); tokenInfoList[0] = TokenInfo( Web3Networks.Bsc, - "0xb59490ab09a0f526cc7305822ac65f2ab12f9723" + "0xb59490ab09a0f526cc7305822ac65f2ab12f9723", + DataProviderTypes.NoderealClient, + 18 ); tokenInfoList[1] = TokenInfo( Web3Networks.Ethereum, - "0xb59490ab09a0f526cc7305822ac65f2ab12f9723" + "0xb59490ab09a0f526cc7305822ac65f2ab12f9723", + DataProviderTypes.NoderealClient, + 18 ); return tokenInfoList; diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Matic.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Matic.sol index 78393a1714..fbc38817cc 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Matic.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Matic.sol @@ -42,11 +42,15 @@ library Matic { TokenInfo[] memory tokenInfoList = new TokenInfo[](2); tokenInfoList[0] = TokenInfo( Web3Networks.Bsc, - "0xcc42724c6683b7e57334c4e856f4c9965ed682bd" + "0xcc42724c6683b7e57334c4e856f4c9965ed682bd", + DataProviderTypes.NoderealClient, + 18 ); tokenInfoList[1] = TokenInfo( Web3Networks.Ethereum, - "0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0" + "0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0", + DataProviderTypes.NoderealClient, + 18 ); return tokenInfoList; diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Mcrt.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Mcrt.sol index 57b655f51f..4ddedc55f0 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Mcrt.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Mcrt.sol @@ -35,19 +35,25 @@ library Mcrt { } function getTokenInfo() internal pure returns (TokenInfo[] memory) { - TokenInfo[] memory networks = new TokenInfo[](3); - networks[0] = TokenInfo( + TokenInfo[] memory tokenInfoList = new TokenInfo[](3); + tokenInfoList[0] = TokenInfo( Web3Networks.Ethereum, - "0xde16ce60804a881e9f8c4ebb3824646edecd478d" + "0xde16ce60804a881e9f8c4ebb3824646edecd478d", + DataProviderTypes.NoderealClient, + 18 ); - networks[1] = TokenInfo( + tokenInfoList[1] = TokenInfo( Web3Networks.Bsc, - "0x4b8285aB433D8f69CB48d5Ad62b415ed1a221e4f" + "0x4b8285aB433D8f69CB48d5Ad62b415ed1a221e4f", + DataProviderTypes.NoderealClient, + 18 ); - networks[2] = TokenInfo( + tokenInfoList[2] = TokenInfo( Web3Networks.Solana, - "FADm4QuSUF1K526LvTjvbJjKzeeipP6bj5bSzp3r6ipq" + "FADm4QuSUF1K526LvTjvbJjKzeeipP6bj5bSzp3r6ipq", + DataProviderTypes.MoralisClient, + 18 ); - return networks; + return tokenInfoList; } } diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Nfp.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Nfp.sol index 06418a2208..cad423d5b3 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Nfp.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Nfp.sol @@ -42,7 +42,9 @@ library Nfp { TokenInfo[] memory tokenInfoList = new TokenInfo[](1); tokenInfoList[0] = TokenInfo( Web3Networks.Bsc, - "0x75e8ddb518bb757b4282cd5b83bb70d4101d12fb" + "0x75e8ddb518bb757b4282cd5b83bb70d4101d12fb", + DataProviderTypes.NoderealClient, + 18 ); return tokenInfoList; diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/People.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/People.sol index 92bee2991d..bd9b3a35b8 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/People.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/People.sol @@ -42,7 +42,9 @@ library People { TokenInfo[] memory tokenInfoList = new TokenInfo[](1); tokenInfoList[0] = TokenInfo( Web3Networks.Ethereum, - "0x7a58c0be72be218b41c608b7fe7c5bb630736c71" + "0x7a58c0be72be218b41c608b7fe7c5bb630736c71", + DataProviderTypes.NoderealClient, + 18 ); return tokenInfoList; diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Shib.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Shib.sol index 316e3bab26..e58e8d03f7 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Shib.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Shib.sol @@ -40,7 +40,9 @@ library Shib { TokenInfo[] memory tokenInfoList = new TokenInfo[](1); tokenInfoList[0] = TokenInfo( Web3Networks.Ethereum, - "0x95ad61b0a150d79219dcf64e1e6cc01f0b64c4ce" + "0x95ad61b0a150d79219dcf64e1e6cc01f0b64c4ce", + DataProviderTypes.NoderealClient, + 18 ); return tokenInfoList; } diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Sol.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Sol.sol index a03330fe37..0feb8d9acc 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Sol.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Sol.sol @@ -42,13 +42,22 @@ library Sol { TokenInfo[] memory tokenInfoList = new TokenInfo[](3); tokenInfoList[0] = TokenInfo( Web3Networks.Ethereum, - "0x5288738df1aeb0894713de903e1d0c001eeb7644" + "0x5288738df1aeb0894713de903e1d0c001eeb7644", + DataProviderTypes.NoderealClient, + 18 ); tokenInfoList[1] = TokenInfo( Web3Networks.Bsc, - "0x570a5d26f7765ecb712c0924e4de545b89fd43df" + "0x570a5d26f7765ecb712c0924e4de545b89fd43df", + DataProviderTypes.NoderealClient, + 18 + ); + tokenInfoList[2] = TokenInfo( + Web3Networks.Solana, + "Native Token", + DataProviderTypes.MoralisClient, + 18 ); - tokenInfoList[2] = TokenInfo(Web3Networks.Solana, "Native Token"); return tokenInfoList; } } diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/SpaceId.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/SpaceId.sol index b5cfda46ad..27e9a6f3e7 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/SpaceId.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/SpaceId.sol @@ -42,11 +42,15 @@ library SpaceId { TokenInfo[] memory tokenInfoList = new TokenInfo[](2); tokenInfoList[0] = TokenInfo( Web3Networks.Ethereum, - "0x2dff88a56767223a5529ea5960da7a3f5f766406" + "0x2dff88a56767223a5529ea5960da7a3f5f766406", + DataProviderTypes.NoderealClient, + 18 ); tokenInfoList[1] = TokenInfo( Web3Networks.Bsc, - "0x2dff88a56767223a5529ea5960da7a3f5f766406" + "0x2dff88a56767223a5529ea5960da7a3f5f766406", + DataProviderTypes.NoderealClient, + 18 ); return tokenInfoList; } diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Ton.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Ton.sol index cbd775bc88..952a834eee 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Ton.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Ton.sol @@ -42,11 +42,15 @@ library Ton { TokenInfo[] memory tokenInfoList = new TokenInfo[](2); tokenInfoList[0] = TokenInfo( Web3Networks.Ethereum, - "0x582d872a1b094fc48f5de31d3b73f2d9be47def1" + "0x582d872a1b094fc48f5de31d3b73f2d9be47def1", + DataProviderTypes.NoderealClient, + 18 ); tokenInfoList[1] = TokenInfo( Web3Networks.Bsc, - "0x76a797a59ba2c17726896976b7b3747bfd1d220f" + "0x76a797a59ba2c17726896976b7b3747bfd1d220f", + DataProviderTypes.NoderealClient, + 18 ); return tokenInfoList; } diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Trx.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Trx.sol index 0e6334693e..b0b8928fe4 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Trx.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Trx.sol @@ -42,11 +42,15 @@ library Trx { TokenInfo[] memory tokenInfoList = new TokenInfo[](2); tokenInfoList[0] = TokenInfo( Web3Networks.Ethereum, - "0x50327c6c5a14dcade707abad2e27eb517df87ab5" + "0x50327c6c5a14dcade707abad2e27eb517df87ab5", + DataProviderTypes.NoderealClient, + 18 ); tokenInfoList[1] = TokenInfo( Web3Networks.Bsc, - "0xCE7de646e7208a4Ef112cb6ed5038FA6cC6b12e3" + "0xCE7de646e7208a4Ef112cb6ed5038FA6cC6b12e3", + DataProviderTypes.NoderealClient, + 18 ); return tokenInfoList; } diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Tusd.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Tusd.sol index 072bff8359..9cc54d73af 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Tusd.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Tusd.sol @@ -42,11 +42,15 @@ library Tusd { TokenInfo[] memory tokenInfoList = new TokenInfo[](2); tokenInfoList[0] = TokenInfo( Web3Networks.Ethereum, - "0x0000000000085d4780b73119b644ae5ecd22b376" + "0x0000000000085d4780b73119b644ae5ecd22b376", + DataProviderTypes.NoderealClient, + 18 ); tokenInfoList[1] = TokenInfo( Web3Networks.Bsc, - "0x40af3827F39D0EAcBF4A168f8D4ee67c121D11c9" + "0x40af3827F39D0EAcBF4A168f8D4ee67c121D11c9", + DataProviderTypes.NoderealClient, + 18 ); return tokenInfoList; diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Uni.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Uni.sol index d8c35f933a..94aa3efe40 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Uni.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Uni.sol @@ -41,15 +41,21 @@ library Uni { TokenInfo[] memory tokenInfoList = new TokenInfo[](3); tokenInfoList[0] = TokenInfo( Web3Networks.Ethereum, - "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984" + "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984", + DataProviderTypes.NoderealClient, + 18 ); tokenInfoList[1] = TokenInfo( Web3Networks.Bsc, - "0xbf5140a22578168fd562dccf235e5d43a02ce9b1" + "0xbf5140a22578168fd562dccf235e5d43a02ce9b1", + DataProviderTypes.NoderealClient, + 18 ); tokenInfoList[2] = TokenInfo( Web3Networks.Solana, - "8FU95xFJhUUkyyCLU13HSzDLs7oC4QZdXQHL6SCeab36" + "8FU95xFJhUUkyyCLU13HSzDLs7oC4QZdXQHL6SCeab36", + DataProviderTypes.MoralisClient, + 18 ); return tokenInfoList; diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Usdc.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Usdc.sol index fbde010ba0..628fbe0fe1 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Usdc.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Usdc.sol @@ -25,15 +25,21 @@ library Usdc { TokenInfo[] memory tokenInfoList = new TokenInfo[](3); tokenInfoList[0] = TokenInfo( Web3Networks.Ethereum, - "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" + "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", + DataProviderTypes.NoderealClient, + 18 ); tokenInfoList[1] = TokenInfo( Web3Networks.Bsc, - "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d" + "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d", + DataProviderTypes.NoderealClient, + 18 ); tokenInfoList[2] = TokenInfo( Web3Networks.Solana, - "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" + "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", + DataProviderTypes.MoralisClient, + 18 ); return tokenInfoList; diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Usdd.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Usdd.sol index 13a5078d7f..cf003c6141 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Usdd.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Usdd.sol @@ -42,11 +42,15 @@ library Usdd { TokenInfo[] memory tokenInfoList = new TokenInfo[](2); tokenInfoList[0] = TokenInfo( Web3Networks.Ethereum, - "0x0c10bf8fcb7bf5412187a595ab97a3609160b5c6" + "0x0c10bf8fcb7bf5412187a595ab97a3609160b5c6", + DataProviderTypes.NoderealClient, + 18 ); tokenInfoList[1] = TokenInfo( Web3Networks.Bsc, - "0xd17479997f34dd9156deef8f95a52d81d265be9c" + "0xd17479997f34dd9156deef8f95a52d81d265be9c", + DataProviderTypes.NoderealClient, + 18 ); return tokenInfoList; diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Usdt.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Usdt.sol index 1900c687d2..00688ef2b7 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Usdt.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Usdt.sol @@ -42,11 +42,15 @@ library Usdt { TokenInfo[] memory tokenInfoList = new TokenInfo[](2); tokenInfoList[0] = TokenInfo( Web3Networks.Ethereum, - "0xdac17f958d2ee523a2206206994597c13d831ec7" + "0xdac17f958d2ee523a2206206994597c13d831ec7", + DataProviderTypes.NoderealClient, + 18 ); tokenInfoList[1] = TokenInfo( Web3Networks.Bsc, - "0x55d398326f99059ff775485246999027b3197955" + "0x55d398326f99059ff775485246999027b3197955", + DataProviderTypes.NoderealClient, + 18 ); return tokenInfoList; diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Wbtc.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Wbtc.sol index 20a46e5ce4..e34c3933fd 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Wbtc.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/erc20/Wbtc.sol @@ -48,7 +48,9 @@ library Wbtc { TokenInfo[] memory tokenInfoList = new TokenInfo[](1); tokenInfoList[0] = TokenInfo( Web3Networks.Ethereum, - "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599" + "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599", + DataProviderTypes.NoderealClient, + 18 ); return tokenInfoList; diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/hardhat.config.ts b/tee-worker/litentry/core/assertion-build/src/dynamic/hardhat.config.ts index 190950b402..b9be3e1297 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/hardhat.config.ts +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/hardhat.config.ts @@ -1,6 +1,5 @@ import { HardhatUserConfig } from 'hardhat/config' import '@nomicfoundation/hardhat-toolbox' - const config: HardhatUserConfig = { solidity: '0.8.11', paths: { @@ -12,6 +11,7 @@ const config: HardhatUserConfig = { accounts: { accountsBalance: '1000000000000000000000', }, + blockGasLimit: 1000000000, }, }, } diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/pnpm-lock.yaml b/tee-worker/litentry/core/assertion-build/src/dynamic/pnpm-lock.yaml index ffeb2e738d..17fd0cc1f9 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/pnpm-lock.yaml +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/pnpm-lock.yaml @@ -1821,6 +1821,7 @@ packages: /ethereum-bloom-filters@1.1.0: resolution: {integrity: sha512-J1gDRkLpuGNvWYzWslBQR9cDV4nd4kfvVTE/Wy4Kkm4yb3EYRSlyi0eB/inTsSTTVyA0+HyzHgbr95Fn/Z1fSw==} + deprecated: do not use this package use package versions above as this can miss some topics dependencies: '@noble/hashes': 1.4.0 dev: true diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/tests/token-holding-amount.ts b/tee-worker/litentry/core/assertion-build/src/dynamic/tests/token-holding-amount.ts index 43d99e9304..d422acbc9f 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/tests/token-holding-amount.ts +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/tests/token-holding-amount.ts @@ -14,6 +14,7 @@ import { describe('TokenHoldingAmount', () => { const deployFixture = async () => { await deployMockContract('MockHttpGetString') + await deployMockContract('MockHttpGetI64') await deployMockContract('MockIdentityToString') await deployMockContract('MockParseDecimal') return await deployContract('TokenMapping') @@ -339,4 +340,94 @@ describe('TokenHoldingAmount', () => { ) }) }) + + describe('Btc', () => { + const secrets = ['0x12345', '0x12345'] + it('should return result false when amount = 0', async () => { + const { TokenMapping } = await loadFixture(deployFixture) + const val = TokenMapping.execute( + // identities + [ + { + identity_type: IdentityType.Bitcoin, + value: ethers.toUtf8Bytes( + 'bc1pqdk57wus42wuh989k3v700n6w584andwg7pvxnrd69ag3rs94cfq40qx2y' + ), + networks: [Web3Network.BitcoinP2wpkh], + }, + ], + // secrets + secrets, + // params + generateParams('btc') + ) + expectResult( + TokenMapping, + val, + { + and: [ + { + src: '$token', + op: Op.EQ, + dst: 'btc', + }, + { + src: '$holding_amount', + op: Op.GTE, + dst: '0', + }, + { + src: '$holding_amount', + op: Op.LT, + dst: '0.001', + }, + ], + }, + false + ) + }) + it('should return result true when amount < 0.3', async () => { + const { TokenMapping } = await loadFixture(deployFixture) + const val = TokenMapping.execute( + // identities + [ + { + identity_type: IdentityType.Bitcoin, + value: ethers.toUtf8Bytes( + 'bc1pg6qjsrxwg9cvqx0gxstl0t74ynhs2528t7rp0u7acl6etwn5t6vswxrzpa' + ), + networks: [Web3Network.BitcoinP2wpkh], + }, + ], + // secrets + secrets, + // params + generateParams('btc') + ) + await expectResult( + TokenMapping, + val, + { + and: [ + { + src: '$token', + op: Op.EQ, + dst: 'btc', + }, + { + src: '$holding_amount', + op: Op.GTE, + dst: '0.1', + }, + { + src: '$holding_amount', + op: Op.LT, + dst: '0.3', + }, + ], + }, + true + ) + }) + }) }) diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/tests/utils/helper.ts b/tee-worker/litentry/core/assertion-build/src/dynamic/tests/utils/helper.ts index 95250ec850..7fd51e8f0b 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/tests/utils/helper.ts +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/tests/utils/helper.ts @@ -55,10 +55,12 @@ export enum PrecompileAddresses { HTTP_GET_STRING = '0x00000000000000000000000000000000000003EA', IDENTITY_TO_STRING = '0x000000000000000000000000000000000000041C', PARSE_DECIMAL = '0x000000000000000000000000000000000000041E', + HTTP_GET_I64 = '0x00000000000000000000000000000000000003E8', } const mockContractAddressMapping: { [key: string]: string } = { MockHttpGetString: PrecompileAddresses.HTTP_GET_STRING, + MockHttpGetI64: PrecompileAddresses.HTTP_GET_I64, MockIdentityToString: PrecompileAddresses.IDENTITY_TO_STRING, MockParseDecimal: PrecompileAddresses.PARSE_DECIMAL, }