You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

BSC部署合约Gas费过高原因及支付拆分替代方案咨询

BSC合约Gas费过高原因及支付拆分替代方案咨询

我已在BSC(币安智能链)上部署了如下合约,恳请各位指导该合约Gas费过高的原因,若有支付拆分的替代方案,也请不吝赐教。

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract BNBTest {
    
    // Function to distribute BNB to multiple recipients
    function multisend(uint256[] memory amounts, address payable[] memory receivers) public payable {
        require(amounts.length == receivers.length, "Arrays must be of equal length");
        require(receivers.length > 0, "No receivers provided");
        require(receivers.length <= 2, "Maximum of 2 receivers allowed");
        
        uint256 totalAmount = amounts[0] + amounts[1];
        require(msg.value >= totalAmount, "Insufficient funds sent");

        receivers[0].transfer(amounts[0]);
        receivers[1].transfer(amounts[1]);
    }
}

内容的提问来源于stack exchange,提问作者user919573

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.14 01:35:58