Ethereum 乙醚消失,根据固体百分比支付乙醚,再混合
我有一系列的合作者,我想根据他们的百分比在他们之间分配乙醚, 我尝试使用Ethereum 乙醚消失,根据固体百分比支付乙醚,再混合,ethereum,solidity,smartcontracts,remix,Ethereum,Solidity,Smartcontracts,Remix,我有一系列的合作者,我想根据他们的百分比在他们之间分配乙醚, 我尝试使用\u to.call.value方法,所有应该接收以太的地址都有应付构造函数,旁注我测试了发送以太合同和接收以太合同,它们工作正常,将在下面发布它们: contract ReciveEther { function() external payable {} function getBalance() public view returns (uint){ return address(this).b
\u to.call.value
方法,所有应该接收以太的地址都有应付构造函数,旁注我测试了发送以太合同和接收以太合同,它们工作正常,将在下面发布它们:
contract ReciveEther {
function() external payable {}
function getBalance() public view returns (uint){
return address(this).balance;
}
function getAddress() public view returns (address){
return address(this);
}
}
现在我想做的是,由于某些原因,它不起作用(我包括代码的相关部分):
函数sendViaCallWValue(应付地址,单位货币)公共应付{
(bool sent,bytes内存数据)=_to.call.value(money)(“”);
要求(已发送,“发送失败”);
}
函数payBill(uint billId,uint amt)公共应付返回(uint次){
单位数量;
单位百分比PBS;
单位股;
uint x=0;
对于(uint i=0;i
function sendViaCallWValue(address payable _to,uint money) public payable {
(bool sent, bytes memory data) = _to.call.value(money)("");
require(sent, "faild to send Ether");
}
function payBill(uint billId, uint amt) public payable returns(uint times){
uint amountTaken ;
uint percentagePbs ;
uint share;
uint x = 0;
for(uint i=0; i <= nextBillId; i++){
if(Bills[i].id == billId){
for(uint c=0; c <= nextCollabId; c++){
if(Collabs[c].songId == Bills[i].songId){
percentagePbs = Collabs[c].percentage * 100;
share = amt * percentagePbs / 10000;
amountTaken = amountTaken + share;
address payable addr = Collabs[c].ArtistAddress;
sendViaCallWValue(addr,share);
}
}
}