Deploying and Using OpenZeppelin PaymentSplitter in Web3

I currently have a contract that is creating an “item” for a customer to purchase. I’ve managed to follow a well put together tutorial for implementing this contract into my test network using Ganache and also displaying/executing the contract via Web3 using the React framework.

My question is about using OpenZeppelin’s PaymentSplitter contract. I’ve imported into a subcontract that I created called SplitFunds:

contract SplitFunds is PaymentSplitter {
    constructor (address[] memory payees, uint256[] memory shares)
    PaymentSplitter(payees, shares)
    public payable{}

With this code I was wondering how would I call this function in my Web3 instance? I know how to call other functions in my Items contract.


Hi, welcome! :wave:

Sorry, I am not sure which function do you mean?

I have a Submit Handler event which the user inputs the address to pay to and also the cost. In that event I’ve tried to instantiate the contract as I found if you try to deploy it beforehand using truffle migrate it will ask for the parameters. I’ve searched online to see if there was a way to deploy a contract which led me to the .deploy function

This is what I currently have at the moment, I’ve imported the contracts json file at the top of my js page

I forgot to add the code that has deployed also. This is a rewrite of the image above

Hey scoot556, were you able to deploy with the .deploy function?

Hey no I wasn’t able to I’m not entirely sure why