Auto-renew inheritance for contract created tokens #772
Replies: 3 comments 4 replies
-
Thanks @littletarzan interesting proposal. Will circle back for a 2nd review but initial thoughts are that an inheritance of an autoRenew assignment would break the security model since you'd essentially be assigning the autoRenew account to be responsible for rent payments without it's permission. Notably, I agree on the limiting nature of EVM security model that lead to this. For this reason HIP 755 and HIP 756 were proposed and should address this limited scenario. |
Beta Was this translation helpful? Give feedback.
-
By the way can you share more why in your situation the contract maintains a 0 balance? If HIP 755 and 756 were implemented would transferring enough HBAR at the time of the createToken() provide a solution or is that the solution we're looking to avoid? |
Beta Was this translation helpful? Give feedback.
-
I'd be curious on your initial thought around HIP 756. Would that resolve your issue by allowing you to assign your desired shared autoRenew account to all the tokens and maintain zero balance on your contract creating the token (beyond the fee needed for creation of course) |
Beta Was this translation helpful? Give feedback.
-
Tokens created using a smart contract
TokenCreate
precompile ask for anExpiry
struct with theautoRenewAccount
:I noticed that contracts I used to be able to deploy are now reverting because the contract deployer cannot use its top-level signature to authorize
msg.sender
or an account that has signed theContractCreateTransaction
and passed as a constructor parameter as theautoRenewAccount
. For now, the only simple way to useTokenCreate
precompiles in contracts is to setautoRenewAccount
toaddress(this)
, which is very limiting. At SaucerSwap, we point all our entities to the sameautoRenewAccount
for transparency and simplicity across our many contracts. If settingaddress(this)
asautoRenewAccount
is the only simple way to create tokens, andaddress(this)
runs out of hbar, then the token eventually risks deletion.I propose creating an inheritance chain for token auto-renew created using
TokenCreate
precompile, starting withaddress(this)
. Ifaddress(this)
has no hbar, then Hedera looks at theautoRenewAccount
foraddress(this)
and charges that entity. If no hbar is in that entity, then if applicable, charges the contract that created that contract, and so on until noautoRenewAccount
is found, then schedule the token for deletion.Simple example:
Token's
autoRenewAccount
is a contract --> charge the contract rent --> if no hbar in contract, charge theautoRenewAccount
of the contract --> if no hbar in that account, schedule for deletionMore complicated example:
Contract creates a contract with a
TokenCreate
precompile in the child contract's constructor withaddress(this)
as theautoRenewAccount
.Charge child --> if no hbar, charge parent --> if no hbar charge parent's
autoRenewAccount
--> if no hbar schedule for deletionBeta Was this translation helpful? Give feedback.
All reactions