数组的坚固功能给出溢出错误

发布于 2025-01-27 20:34:48 字数 1243 浏览 3 评论 0原文

我没有数组的相同代码,而且它只是可行的。 但是,在此中,如果我输入的量超过0.001,则会出现溢出错误。 我尝试了该函数在该功能中,该功能带有错误的值,但它们没有错误。

CheckPairValue()和CheckSellPrice()有效。

中查看我的钱包的价值

代码是在pancakeswap idk 。 任何帮助都是申请的。

同样在BSCSCAN上验证了合同。 https://www.bscscan.com/address/0xbd29c833bf3a5186df62abbcdb8542f6066a3d8f#code”

function GetSellValue(address[] memory TokenAddress, uint[] memory Amount)public view returns(uint256[] memory){
        uint[] memory Value = new uint[](TokenAddress.length);
        for(uint i = 0; i < TokenAddress.length; i++){
            address Pair = CheckPairValue(TokenAddress[i], Amount[i] * 2);
            address[] memory path;
            if(Pair != PairAddresses[0]){
                path = new address[](3);
                path[0] = TokenAddress[i];
                path[1] = Pair;
                path[2] = PairAddresses[0];
            }
            else
            {
                path = new address[](2);
                path[0] = TokenAddress[i];
                path[1] = PairAddresses[0];
            }
            Value[i] = CheckSellPrice(Amount[i],path);
        }
        return Value;
    }

0.001以太输入作品,任何更高的东西都没有

I have the same code without an array and it just works.
But In this one if i enter amount anything more than 0.001 ether it gives an overflow error.
I tried Other functions called in this one with errored values and they don't give an error.

CheckPairValue() and CheckSellPrice() works.

Code is to check my Wallet's worth in pancakeswap

Idk what's wrong.
Any help is appretiated.

Also Contract is verified on bscscan.
Contract

function GetSellValue(address[] memory TokenAddress, uint[] memory Amount)public view returns(uint256[] memory){
        uint[] memory Value = new uint[](TokenAddress.length);
        for(uint i = 0; i < TokenAddress.length; i++){
            address Pair = CheckPairValue(TokenAddress[i], Amount[i] * 2);
            address[] memory path;
            if(Pair != PairAddresses[0]){
                path = new address[](3);
                path[0] = TokenAddress[i];
                path[1] = Pair;
                path[2] = PairAddresses[0];
            }
            else
            {
                path = new address[](2);
                path[0] = TokenAddress[i];
                path[1] = PairAddresses[0];
            }
            Value[i] = CheckSellPrice(Amount[i],path);
        }
        return Value;
    }

0.001 ether input works , anything higher doesn't

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦里南柯 2025-02-03 20:34:48

我仍然不知道为什么混音会这样错误。
但是我写了一个JS代码来调用合同,并且有效。

I still don't know why remix errored like this.
But i've written a js code to call the contract and it works.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文