0

I'm trying to deploy a sponsor_contract that will pay transactions fee for Wallet A, to claim token and transfer it to other wallet.

Here is my code:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract SponsorContract {
    address public sponsor;
    address public sponsoredParty;
    uint public sponsorshipAmount;
    bool public isApproved;
    
    constructor(address _sponsor, address _sponsoredParty, uint _sponsorshipAmount) {
        sponsor = _sponsor;
        sponsoredParty = _sponsoredParty;
        sponsorshipAmount = _sponsorshipAmount;
        isApproved = false;
    }
    
    function approveSponsorship() public {
        require(msg.sender == sponsoredParty, "Only the sponsored party can approve the sponsorship.");
        isApproved = true;
    }
    
    function cancelSponsorship() public {
        require(msg.sender == sponsor, "Only the sponsor can cancel the sponsorship.");
        require(!isApproved, "The sponsorship has already been approved and cannot be cancelled.");
        selfdestruct(payable(sponsor));
    }
    
    function withdrawFunds() public {
        require(msg.sender == sponsoredParty, "Only the sponsored party can withdraw funds.");
        require(isApproved, "The sponsorship has not been approved yet.");
        payable(sponsoredParty).transfer(sponsorshipAmount);
    }
}

And this is the error when I deploy:

creation of SponsorContract errored: Error encoding arguments: Error: invalid address (argument="address", value="", code=INVALID_ARGUMENT, version=address/5.5.0) (argument=null, value="", code=INVALID_ARGUMENT, version=abi/5.5.0)

Can you give me a hand. Many thanks <3

  • would you share the method that you tried to deploy the contract? it seems you didn't provide the constructor args when you deploy. – Satoshi Naoki Mar 20 '23 at 02:16

1 Answers1

1

Since the constructor has 3 parameters, you need to pass them when you deploy the contract. If you do not pass, you get that error. since you are on remix ide, next to deploy you have an input area to pass correct arguments.

enter image description here

Yilmaz
  • 35,338
  • 10
  • 157
  • 202