solang icon indicating copy to clipboard operation
solang copied to clipboard

create contract requires a new account

Open stanta opened this issue 3 years ago • 1 comments

Trying to deploy new contract from Solang to Solana with code like:

contract adult { function test() public { hatchling h = new hatchling("luna"); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ } }

But got from deployer:

'Program log: create contract requires a new account', ... 'Program GFfuNq2g55YDtWFZeaQ7Pgrrk4nKNsbNuDVCjPVhVkbQ failed: Failed to serialize or deserialize account data: Unknown'

How can it be solved from Solang? Or I have to deploy this contract separately from new account, anyway?

stanta avatar Aug 29 '22 15:08 stanta

A new account is needed to make this work. There is an example here:

https://github.com/hyperledger/solang/blob/main/integration/solana/create_contract.spec.ts

seanyoung avatar Sep 01 '22 09:09 seanyoung