0

I have this function (is a SC implementing and auction):

/// @notice Register a new participant
/// @param _preferences agent' preferences
function regAgent(uint[] memory _preferences) notOwner onlyBeforeEnd public {
    require(msg.sender.balance - fee >= 0, "You can't pay the fee.");
    require(!registered[msg.sender], "Agent is already registered.");
    Agent memory newAgent = Agent(agents.length, msg.sender, _preferences);
    agents.push(newAgent);
    registered[msg.sender] = true;
    // 1. the agent must pay the fee to participate
    // 2. owner must recieve that fee
}

But I don't know how to do the last part: a participant have to pay a fee to the owner (the entity who deployed the SC). So I'd like to transfer ether from participant' address to owner address. That's all.

Any advice is welcome.

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.