I'm working on a project that will allow users to use our platform to auction stuff. Programatically, how would I convert this idea into a profit for me. I want to take a 3.75% fee from any won auctions. I know I shouldn't just do the following:

function withdrawWinner() public {
    beneficiary.transfer(balance * .9625);

as proactively sending is bad, so the next thing I thought would be two function modifiers:

modifier onlyMyEOA {
    require(msg.sender == address(myEOA));

modifier onlyAuctionWinner {
    require(msg.sender == address(highestBidder));

and then having two withdraw functions with logic to keep track of the funds I now own. Lastly, there is another contract called the AuctionFactory which basically does what it says, it creates the Auction contratcs. I could have the owner of all contracts be the AuctionFactory and then do an owner.transfer(balance); after sending the auction host their winnings. Any better ideas?

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.