Lets say a contract that lives on account factory.near has a create method that creates sub accounts and deploy contracts to it like the following..
const promise = ContractPromiseBatch.create(subaccount)
.create_account()
.deploy_contract(Uint8Array.wrap(changetype<ArrayBuffer>(CODE)))
.add_full_access_key(base58.decode(Context.senderPublicKey))
.function_call(
"init",
new PlaceInitArgs(Context.sender),
Context.attachedDeposit,
XCC_GAS
)
- Does the parent account that holds the factory contract automatically have full access or function call access to the sub account?
- Would all sub accounts have the same contract hash since the same WASM file is being deployed onto it?
- What would happen if the attached deposit isn't enough to stake storage? Would the account be made without the contract deployed or would both fail?
- If a subaccount is deleted, would the NEAR tokens staked as storage also be returned to the specified beneficiary in the delete function call?