子账户访问密钥和存储质押

Sub account access keys and storage staking

假设一个存在于账户 factory.near 上的合约有一个创建子账户并向其部署合约的创建方法,如下所示..

    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
      )
  1. 持有工厂合约的母账户是否自动拥有子账户的完全访问权限或函数调用权限?
  2. 由于部署了同一个 WASM 文件,所有子账户是否都具有相同的合约哈希值?
  3. 如果附加押金不足以抵押存储会怎样?是否会在没有部署合约的情况下创建账户,还是两者都会失败?
  4. 如果子账户被删除,作为存储的NEAR代币是否也会在删除函数调用中返回给指定的受益人?

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?