Uniswap-TypeError:无法读取未定义的属性'sortsBefore'

时间:2020-11-04 03:54:33

标签: node.js ethereum solidity web3

我们正在构建ERC20令牌,并计划将其部署在Uniswap上。

当前,我们希望在Uniswap上获得转换率,但遇到此错误。

Reseller="CPUsernameInputField"; declare -A myAssociativeArray ; echo "==========================================" | tee -a ${Reseller}_disk_breakdown.txt ; echo "Reseller ${Reseller}'s Disk usage by account"| tee -a ${Reseller}_disk_breakdown.txt; for acct in $(sudo grep ${Reseller} /etc/trueuserowners | cut -d: -f1); do disk_usage=0; disk_usage=$(du -s /home/${acct} | grep -oE '[[:digit:]]+');  echo "$acct: $(echo $disk_usage | tail -1 | awk {'print $1'} | awk '{ total = $1 / 1024/1024 ; printf("%.2fGB\n", total) }')" | tee -a ${Reseller}_disk_breakdown.txt ; myAssociativeArray[${acct}]=${disk_usage}; done ; total=$(IFS=+; echo "$((${myAssociativeArray[*]}))"); echo "Total disk usage: $(echo $total | tail -1 | awk {'print $1'} | awk '{ total = $1 / 1024/1024 ; printf("%.2fGB\n", total) }')" | tee -a ${Reseller}_disk_breakdown.txt; unset total; unset disk_usage;echo "==========================================" | tee -a ${Reseller}_disk_breakdown.txt ; echo "Sorted by top users" | tee -a ${Reseller}_disk_breakdown.txt; for key in "${!myAssociativeArray[@]}"; do printf '%s:%s\n' "$key" "${myAssociativeArray[$key]}"; done | sort -t : -k 2rn | tee -a ${Reseller}_disk_breakdown.txt;echo "==========================================" | tee -a ${Reseller}_disk_breakdown.txt ;for key in "${!myAssociativeArray[@]}"; do USER_HOME=$(eval echo ~${key}); echo "Disk breakdown for $key" | tee -a ${Reseller}_disk_breakdown.txt ; sudo du -h ${USER_HOME} --exclude=/app --exclude=/home/virtfs| grep ^[0-9.]*[G,M]  | sort -rh|head -n20 | tee -a ${Reseller}_disk_breakdown.txt;echo "=======================================" | tee -a ${Reseller}_disk_breakdown.txt; done

这是代码:

TypeError: Cannot read property 'sortsBefore' of undefined

UNI到ETH正常运行,但我们的ERC20令牌无效。

require('rootpath')();

const {ChainId, Token, WETH, Fetcher, Route, Pair} = require('@uniswap/sdk');
const {Config} = require('config');
const Web3 = require('web3');

module.exports = class UniswapManager {

    // Docs: https://uniswap.org/docs/v2/javascript-SDK/pricing/
    static async getPrice() {
        const network = ChainId.RINKEBY;

        const HelloWorldContract = Web3.utils.toChecksumAddress(Config.Contract.token()); 
        const HWD = new Token(network, HelloWorldContract, 18);   
        const pair = new Pair(HWD, WETH[network]); > Error here
        const route = new Route([pair], WETH[network]); 

        // Logging only
        return  'HWD/ETH: ' + route.midPrice.toSignificant(6) + '\n' +
                'ETH/HWD: ' + route.midPrice.invert().toSignificant(6);
    }

}

0 个答案:

没有答案