I am facing an issue with initializing the person's address in JavaScript and passing it to a Solidity function. Unfortunately, I keep getting an error related to incorrect formatting.
Here is my JavaScript function:
$scope.myToken = accounts[0];
$scope.initProviders = function(providersAddresses,providersAmount){
alert(providersAddresses);
contract.init(providersAddresses,providersAmount,$scope.myToken).call();
};
To call this function:
<md-button ng-click="initProviders('0x199fdf564df1d18056ed46724582502fd3ce580a',1)">INIT</md-button>
And here is the Solidity code:
function init(address[] provAddrs, uint provCount,address mainAcc)
{
clientAddr = mainAcc;
for(uint i = 0;i<provCount;i++)
{
providers[i].profit = 0;
providers[i].addr = provAddrs[0];
provCount++;
}
}
However, I encounter an error stating "invalid address" after executing this code.