Home > Mobile >  Deploying smart contract with arrays in the constructor
Deploying smart contract with arrays in the constructor

Time:04-01

I'm quite new with solidity and, while I was checking more complex contracts, I found this type of constructor and I was wondering on how I should write the strings while deploying it.

constructor(
        address[] memory payees,
        uint256[] memory shares,
        address[] memory addresses,
        uint256 swapAmount
    ) ERC20("Token", "TOKEN") PaymentSplitter(payees, shares) {

        require(addresses.length == 5, "Count of Addresses must be 5");

        treasuryPool = addresses[0];
        distributionPool = addresses[1];
        marketingPool = addresses[2];
        expensePool = addresses[3];
        cashoutPool = addresses[4];

        for (uint256 i = 0; i < 5; i  )
            _isExcludedFromFee[addresses[i]] = true;

        require(expensePool != address(0) && distributionPool != address(0), "FUTUR & REWARD ADDRESS CANNOT BE ZERO");

I tried different things but all failed.

CodePudding user response:

The input field next to Deploy button in Remix IDE is where we put our data. Following would be a valid input to call your constructor/deploy your contract.

["0x0000000000000000000000000000000000000001"],[0,1,2],["0x0000000000000000000000000000000000000002"],3
  • Related