Oh, sorry to bother you. I have test the code and give the question. Since i want to make the Test contract as a factory to new Base contract from inside of it’s “createNew” interface. But i found if one of interface has “public” or “external” access modifier, the call “createNew” will be failed in WASM.
Yes, but ther error has been resolved by your last post(sending some SBY when call the “createNew”).But it’s not the end, when added a public interface to “Base” contract,
eg,
string public name – public state field
or
function sum(uint a, uint b) public view (uint) – interface
the call “createNew” failed again.
Instead, use “private” or “internal” access modifier for state fields or functions of the “Base” contract, the call “createNew” shall be success.
So im not sure if this issue is related to the solang compiler or the substrate-wasm, even my misoperation
Hi tomasz, acctually, my goal is to make the Test contract as a factory to produce new Base contract instance as demand.
But before now, i ran into two problems, recapped as bellow:
Q1、call ‘creatNew’ to instantiate Base contract without any exposed interface (public fields or functions) will be failed
.
To solve this problem, some SBY need be sent along with calling ‘createNew’
Q2、call ‘creatNew’ to instantiate Base contract with some exposed interface (public fields or functions) will be failed.
To solve this problem, the Base contract aslo be deployed before call ‘createNew’.