Contract deploy and init

Two questions:

  1. Is it possible for one contract to deploy another contract, and if possible what is the Sophia syntax?
  2. Is it possible to pass arguments to the contract init function, and what would be the JS SDK syntax?


  1. Not possible yet - here is the task to do it…

  2. Yes this is certainly possible - just like passing arguments to a function in a contract call. Exactly how it is done in JS SDK I am afraid I don’t know, I’ll leave that part to the JS SDK experts!


Hey @CryptoTask,
you can use Contract ACI syntax Contract ACI syntax for that.

const contractObject = await sdkInstance.getContractInstance(contractSource)
// Init function: `entrypoint init (n: int, s: string): state => n`
await contractObject.deploy([1, 'Hello']) // Array of init arguments
// or
await contractObject.methods.init(1, 'Hello') // Here the arguments order is the same as in sophia spurce