gpt4 book ai didi

smartcontracts - 子账户访问 key 和存储抵押

转载 作者:行者123 更新时间:2023-12-04 07:43:21 26 4
gpt4 key购买 nike

让我们说一个依赖帐户的契约(Contract) factory.near 有一个 create 方法可以创建子账户并将合约部署到它,如下所示..

    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
)
  • 持有工厂合约的父账户是否自动拥有子账户的完全访问权限或函数调用访问权限?
  • 由于相同的 WASM 文件被部署到子账户上,所有子账户是否都具有相同的合约哈希?
  • 如果附加的存款不足以抵押存储会发生什么?该帐户会在没有部署契约(Contract)的情况下创建还是都会失败?
  • 如果子账户被删除,作为存储抵押的 NEAR 代币是否也会在删除函数调用中返回给指定的受益人?
  • 最佳答案

    Does the parent account that holds the factory contract automatically have full access or function call access to the sub account?


    不,访问控制在帐户之间不起作用。说某些帐户对其他某些帐户具有完全访问权限是无效的。当且仅当您拥有该帐户的完整访问 key (私钥)时,您才能完全访问该帐户。

    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?


    是的

    关于smartcontracts - 子账户访问 key 和存储抵押,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67327382/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com