Issues Deploying PaymentSplitter on Remix

I am working with PaymentSplitter.sol on Remix although I cannot seem to deploy the contract.

I am looking for the appropo parameters for deployment. my first impression is that it is an array containing the addresses of the participants
[addr1,addr2,addr3]
followed by an array of the shares in either:
[10,12,13]
but the latter seems to be incorrect. To summarize this would be the entire deployment parameter:
[addr1,addr2,addr3], [10,12,13]
This is the constructor for reference:
constructor (address[] memory payees, uint256[] memory shares) public payable {

1 Like

Hi @pynchmeister, thanks for raising this. :slight_smile: I have dragged this in to the correct subforum and tagging @frangio to have a look and respond. Have a nice day!

2 Likes

Are you trying to deploy it in Solidity from another contract, or from the Remix interface?

The arguments are indeed arrays like the ones you mention, with the caveat that all addresses in the payees array have to be different. If there are duplicates the constructor will revert. (I’ll add this to the documentation, because it’s not documented.)

I was able to deploy one using the Remix interface with the following text in the arguments input.

["0xca35b7d915458ef540ade6068dfe2f44e8fa733c", "0x14723a09acff6d2a60dcdf7aa4aff308fddc160c", "0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"], [10, 12, 13]

If you want to create a PaymentSplitter in Solidity you’re going to run into problems with the type of the arrays, because literal arrays are of a fixed size and the constructor needs a dynamically sized array. So you’ll have to first create a dynamic array (new address[]()) and then add the items to it (addrs.push(...)).

1 Like

@pynchmeister We made the documentation for PaymentSplitter more thorough. Please take a look at it. :slight_smile: This is a preview of the new documentation site, by the way. Feedback on that in general is also appreciated!

1 Like

Hello @tharaka, thanks for your help. I can be bad about the whole tags and subforum business. With that being said I’ll do my best to improve moving forward. I hope you have a fantastic day as well!

:sunglasses:

I have been anticipating the documentation upgrade, so I will most definitely read through it. Feedback on the way…

I got it deployed with the guidance you provided @frangio. My mistake was my incorrect formatting, If I recall correctly I was missing several commas and quotation marks.

I’ll be working with the Escrow contracts a lot in the next chunk of time so I appreciate the rapid and thorough response!

Briefly looking through the preview link you sent through, it looks like a massive improvement from the legacy site. I would advocate an addition specifying the correct format for contract deployment (on Remix). Basically, just ["addr1","addr2","addr3"], [1,2,3]

Maybe it is only me with that issue that being said…:sweat_smile:

1 Like

I have not yet attempted to create a PaymentSplitter in Solidity, but it was a thought in my mind to give. try at. I will refer back to this when I do just that. Thank you for all the help @frangio

1 Like