-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create anonymousSpend fallback when spendTx to contract #358
Comments
What is the concrete use-case here? I don't think it's a good practice to have implicit functionality as this as it will lead to errors, especially the reason why a fallback is not implemented in the first place. If an aepp developer wishes to integrate this functionality, it is no extra work to do it explicitly, as he will have to implement the function in any case. What if the user wishes to do a spendtx without using the proposed fallback? What if this gets misused to author actions towards the contract that were not intended? |
Could be user-configurable in the wallet settings. |
It's a two-sided sword. I like the mentioned pro and contra arguments here, but what really tips my scale in the direction of contra is the fact that AE can get trapped in contracts very easily that way. There are countless people on the internet who - for some reason - still manage to transfer funds to wrong addresses all the time, the classic variant is sending tokens from a token contract to the contract itself. With no explicit way to get the funds out, allowing funds to be implicitly transfered to a contract is dangerous. Bad enough I had to find out today that this is possible by prefixing its address with From a dev standpoint I like this idea, but I fear the trouble this can cause is not worth the benefits 🤷♂️ |
@nikita-fuchs can you provide an example how funds can easily get trapped? |
Just forget withdraw logic I guess |
well I hope devs test their contracts basic functionality before production deployment, so it won't happen "easily" |
just discovered this and IMO this should always be handled using a regular for everything that requires additional logic we need custom contract calls anyway |
Value proposition
The general idea is users to be able to interact with a contract with just a plain wallet, without prior knowledge of the interface of the contract.
User stories
spendTx
) to a contract without knowing the interface or interacting via complicated UI.calldata
needed for acontractCallTx
(for simple use-cases e.g. betting, tipping, contribution campaigns, etc.)Status quo
spendTx
to a contract address for a value transfer.spendTx
and 180000 (180k) gas forcontractCallTx
(the latter being higher as it requires a VM to be started).Proposed implementation
In order to achieve the above functionality without changes in the protocol or complex changes in the wallet we can do the following:
Wallet
contractCallTx
instead of regularspendTx
.contractCallTx
requires a function name in order to be called we can call a_fallback()
entrypoint without any arguments.spendTx
.Contract
_fallback()
entrypoint which captures the anonymous spend-like-contractCall transaction in order for the users to be able to call it via the flow above.Example anonymous spend entrypoint
_fallback()
Known limitations
spendTx
to the contract. We should think of how to address this case - possible configurable in the wallet settings (off
by default).The text was updated successfully, but these errors were encountered: