CRYPTO NEWS

How Do You Send Ether to Another Contract’s Payable Function?

I am trying to send pay a dividend token contract Ether from another contract using the deposit() function in the contract below. I have found conflicting answers based on different compiler versions.

Below is the token contract that accepts deposits which are paid out as dividends:

pragma solidity ^0.4.19;  contract RobustDividendToken {      string public name = "Robust Dividend Token";     string public symbol = "DIV";     uint8 public decimals = 18;      uint256 public totalSupply = 1000000 * (uint256(10) ** decimals);      mapping(address => uint256) public balanceOf;      function RobustDividendToken() public {         // Initially assign all tokens to the contract's creator.         balanceOf[msg.sender] = totalSupply;         Transfer(address(0), msg.sender, totalSupply);     }      uint256 public scaling = uint256(10) ** 8;      mapping(address => uint256) public scaledDividendBalanceOf;      uint256 public scaledDividendPerToken;      mapping(address => uint256) public scaledDividendCreditedTo;      function update(address account) internal {         uint256 owed =             scaledDividendPerToken - scaledDividendCreditedTo[account];         scaledDividendBalanceOf[account] += balanceOf[account] * owed;         scaledDividendCreditedTo[account] = scaledDividendPerToken;     }      event Transfer(address indexed from, address indexed to, uint256 value);     event Approval(address indexed owner, address indexed spender, uint256 value);      mapping(address => mapping(address => uint256)) public allowance;      function transfer(address to, uint256 value) public returns (bool success) {         require(balanceOf[msg.sender] >= value);          update(msg.sender);         update(to);          balanceOf[msg.sender] -= value;         balanceOf[to] += value;          Transfer(msg.sender, to, value);         return true;     }      function transferFrom(address from, address to, uint256 value)         public         returns (bool success)     {         require(value <= balanceOf[from]);         require(value <= allowance[from][msg.sender]);          update(from);         update(to);          balanceOf[from] -= value;         balanceOf[to] += value;         allowance[from][msg.sender] -= value;         Transfer(from, to, value);         return true;     }      uint256 public scaledRemainder = 0;      function deposit() public payable {         // scale the deposit and add the previous remainder         uint256 available = (msg.value * scaling) + scaledRemainder;          scaledDividendPerToken += available / totalSupply;          // compute the new remainder         scaledRemainder = available % totalSupply;     }      function withdraw() public {         update(msg.sender);         uint256 amount = scaledDividendBalanceOf[msg.sender] / scaling;         scaledDividendBalanceOf[msg.sender] %= scaling;  // retain the remainder         msg.sender.transfer(amount);     }      function approve(address spender, uint256 value)         public         returns (bool success)     {         allowance[msg.sender][spender] = value;         Approval(msg.sender, spender, value);         return true;     }  } 

My contract works except for this operation. If I were to simple send a random address with: randomaddr.transfer(this.balance); then we have no problems.

However, when I try TokenContractAddress.call.value(this.balance)(); or I try TokenContractAddress.deposit.value(this.balance)(); the Tx fails.

I have tried importing the contract and some other syntax too, but I get the same error. What is the best way to make it work?

414PunchGod

#414PunchGod #TheSupremeTeam Artist Name: 414PunchGod Who are you? I would say I'm just a fun, talented artist who likes to try every type of song genre in order to showcase my versatility as a rapper. I'm only 16 at the end of the day so I'm playing sports for my school and trying to get::Listen

#414PunchGod #TheSupremeTeam
Artist Name: 414PunchGod

Who are you?

I would say I'm just a fun, talented artist who likes to try every type of song genre in order to showcase my versatility as a rapper. I'm only 16 at the end of the day so I'm playing sports for my school and trying to get my assignments in by 11:59 but when I have time, I like to sit down and write catchy verses that get people singing, dancing, and having a good time. I think my bars are complex in the sense that some of them may go over your head the first time but if you listen close enough, you'll pick up on the play-on-word essence of a lot of my songs.

Where are you from?

SHOUTOUT 414 – I'm from Milwaukee where the music scene is constantly changing and midwest rap in general is being influenced a lot by rappers such as Babytron, Certified Trapper and RioDaYoungOG. Beats like the Detroit slapper type beats are being used more and more as the rap game continues to be influenced by these guys. The lyrical structure of the songs puts more of an emphasis on the play-on-word type bars that deliver a more raised approach and a deeper-level of thinking rather than a more melodic sing-along type refrain, verse, and chorus setup that is used elsewhere by guys like Drake and Ye. Overall, the 414 has some really talented rappers out there who simply need the exposure in order to get heard.

How can we follow you?

insta: https://www.instagram.com/cole_ortwein/?hl=en
soundcloud: https://soundcloud.com/user-180572799

Song Title: GET PAPER (ProdByFredo)

Listen to 414PunchGod:

Source: https://supremepr.us/

How Do You Send Ether to Another Contract’s Payable Function?

Shopping cart
There are no products in the cart!
Continue shopping
0