如何解决Uniswap-TypeError:无法读取未定义的属性'sortsBefore'
我们正在构建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);
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。