You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This hip suggests that a smart contract should have an implicit crypto account. The contract ID and account ID should be the same.
Motivation
Just like a crypto account, a contract can hold cryptos (Hbar), and tokens. It should be able to to send, receive cryptos and tokens just like a crypto account. However this is not possible because a contract is not a crypto account.
Currently a ContractInfo has contractId, accountId, and contractAccountId. The first two are the same '0.0.xxxx' number, the contractAccountId is int256 equivalent of xxxx contract number. But the crypto account does not exist. If you use a contractId as an accountId, you will get an error, such as 'invalid account'.
Rationale
A user should be able to send Hbars or tokens to a contract from his/her wallet/account, without calling any contract functions.
A contract with receive() or fallback() functions should invoke these functions when it received crypto from another account, or another contract.
Currently to invoke these functions, one uses setPayableAmount with ContractExecuteTransaction. This is not acceptable approach in various application.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Abstract
This hip suggests that a smart contract should have an implicit crypto account. The contract ID and account ID should be the same.
Motivation
Just like a crypto account, a contract can hold cryptos (Hbar), and tokens. It should be able to to send, receive cryptos and tokens just like a crypto account. However this is not possible because a contract is not a crypto account.
Currently a ContractInfo has contractId, accountId, and contractAccountId. The first two are the same '0.0.xxxx' number, the contractAccountId is int256 equivalent of xxxx contract number. But the crypto account does not exist. If you use a contractId as an accountId, you will get an error, such as 'invalid account'.
Rationale
A user should be able to send Hbars or tokens to a contract from his/her wallet/account, without calling any contract functions.
A contract with
receive()
orfallback()
functions should invoke these functions when it received crypto from another account, or another contract.Currently to invoke these functions, one uses setPayableAmount with ContractExecuteTransaction. This is not acceptable approach in various application.
Beta Was this translation helpful? Give feedback.
All reactions