Errors debugging

Hello Filip,

Here is my code with errors.

Kindly remove or review thia codes for me please.

pragma solidity 0.7.5;
pragma abicode v2;

contract MultisigWallet {
    address public owner;
    Approval[2] public cosigners;
    uint256 balance;
    
    struct Approval {
        address approver;
        uint256 maximumAmount;
        
    }
    
    modifier onlyOwner() {
        require (owner == msg.sender);
        _;
        
    }
    
    constructor (address cosigner 1, address cosigner 2) {
        owner =msg.sender;
        cosigners[0]=Approval({ approver; cosigner 1, maximum Amount: 0});
        cosigners[1]=Approval({ approver; cosigner 2, maximum Amount: 0});
    }
    
    function fund (uint256 amount) public onlyowner {
        balance += amount;
    }
    
    function getBalance() public view returns (uint256){
        return balance;
    // when the sender calls sign() it will approve a maximum transfer amount.
    // which is saved to the contract. If the transfer actually occurs, then 
    // the actual transfer amount will be subtracted from the maximum amount.
    
    }
    
    function sign (uint256 maximum Amount) public {
        //if the sender isn't one of the cosigners, bail out.
        require (msg.sender == cosigners[0], approver, msg.sender == cosigners[1], approver);
        
        else
            cosigners[1] maximum Amount = maximumAmount;
            
    }
    
    function transfer(address payable payableTo, uint256 amount) public payable{
        require (balance >= amount ++ cosigners [1],maximumAmount >= amount);
        balance == amount;
        cosigners[0].maximumAmount-= amount;
        cosigners[1].maximumAmount-= amount;
        payableTo.transfer (msg.value);
        
    }
}**strong text**
1 Like

Hey @Ako1, hope you are ok.

First error i got is here:
image
Basically you cant have a variable name with numbes that are not exactly. To fix it just use a variable name like cosigner1

Next error is here:
image
You have a ; instead of a comma between arguments.

Also that is not the way to set variables into a array with struch.
This is your struct and array for it:

Approval[2] public cosigners;
    
struct Approval {
        address approver;
        uint256 maximumAmount;        
}

You are not declaring correctly your array, because it start at position 2.
You should define it like Approval[] public corsigners.

But then, you are declaring incorrectly the parameters for the cosigners:

   constructor (address cosigner 1, address cosigner 2) {
        owner =msg.sender;
        cosigners[0]=Approval({ approver; cosigner 1, maximum Amount: 0});
        cosigners[1]=Approval({ approver; cosigner 2, maximum Amount: 0});
    }

First you dont need the {}, neither the word approver and maximum Amount.
That is not the way to specify arguments. It could be
cosigner[0] = Approval(cosigner1, 0);

There are too many syntax errors that could be long to fix all the contract. I could suggest you to rewatch the Javascript course and close attention on the programming syntax, also the Ethereum Programming 101 you should check it again, apparently you are not understanding the programming syntax, so before trying to program, you should know the fundamentals of if.

    function sign (uint256 maximum Amount) public {
        //if the sender isn't one of the cosigners, bail out.
        require (msg.sender == cosigners[0], approver, msg.sender == cosigners[1], approver);
        
        else
            cosigners[1] maximum Amount = maximumAmount;
            
    }

This does not even have sense, the require is to validate inputs, but you have like 4 without conditionals.

CarlosZ