[General] <withdraw contract's balance> #131
-
EnvironmentMainnet Provide a brief description of the functionality you're trying to implement.I have defined the withdraw function using the following method, and now that the contract is deployed, I've noticed it's not working correctly on zksync. How can I withdraw the balance from the contract? What is the specific issue or error you're encountering?nothing, here is the failed withdraw transaction:https://explorer.zksync.io/tx/0x96b5058c00712b3aef2beb97449c4c8f118f5f0cdc941e76b8c3e468218f9bc5 Can you share the error messages or logs you're receiving, if any?{ Have you made any recent changes to the contract before encountering this issue?no Are there any external libraries or contracts that your contract interacts with?yes,my contract is extend openzeppelin's ERC20 and Ownable, but I think it isn't the point. Can you provide the relevant portions of your contract code where the issue is occurring?
Have you tried to isolate the problem, and if so, what were the results?not work. What steps have you already taken to try to resolve the issue?no idea. Repo Link (Optional)No response Additional DetailsNo response |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Hi @FireLoveInIce, your transaction has failed because of the following error:
only the owner is allowed to withdraw. |
Beta Was this translation helpful? Give feedback.
To my knowledge, native transfers are supported (yet not recommended) but with the gas limit specified for the transaction. Please, let me know if that works for you.
Here is a good blog post about why
transfer()
should not be used: Stop Using Solidity's transfer() Now. Please, also check our zkSync Era Security and best practices page where we also have a section for this.