0

I am trying to create a ethereum smart contract that splits the money in half and send half the money to a contract and sends the other half to a address. Below is the code I have. I would much appreciate your help!

pragma solidity ^0.4.24;

contract Forwarder {
  address admin;
  uint fee = 10;

  constructor() public {
    admin = msg.sender;
  }

  function splitFunds(address _b) public payable {
    admin.transfer(msg.value * fee / 100);
    _b.transfer(msg.value - (msg.value * fee / 100));
  }
}
  • What is your question? – Mikhail Vladimirov May 1 at 15:00
  • And how exactly is "half" reflected in your code??? – goodvibration May 1 at 15:36
  • @goodvibration I don't have the half part represented in my code. That is what I need help representing. I would appreciate your help – rg3 May 1 at 16:11
  • @MikhailVladimirov My question is what do I need to adjust in my code to meet all of the requirements of the statement. – rg3 May 1 at 16:43
  • You need to change value of fee from 10 to 50. – Mikhail Vladimirov May 1 at 16:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.