Skip to content
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

Remove transfer of balance from SmartWallet to ownerEOA #179

Open
raullaprida opened this issue Dec 1, 2021 · 1 comment
Open

Remove transfer of balance from SmartWallet to ownerEOA #179

raullaprida opened this issue Dec 1, 2021 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@raullaprida
Copy link
Collaborator

As it has been discussed during UX meetings. It would be more consistent (simpler, in UX terms) to leave the native cryptocurrency balance in the SmartWallet instead of transferring it to the ownerEOA after each execution.

That involves removing the following piece of code:

//If any balance has been added then trasfer it to the owner EOA
uint256 balanceToTransfer = address(this).balance;
if ( balanceToTransfer > 0) {
//can't fail: req.from signed (off-chain) the request, so it must be an EOA...
payable(req.from).transfer(balanceToTransfer);
}

And also modify the directExecute function so that it uses the SmartWallet's balance (if value needs to be sent to the destination contract) instead of expecting a sufficient msg.value in the transaction

For example:

function directExecute(address to, uint256 value, bytes calldata data) external override payable returns (
bool success, bytes memory ret)
{
_verifyOwner();
(success, ret) = to.call{value: value}(data);
}

It is the same logic, but the actual numeric value to send is received as a parameter, and it is expected to be available in the SmartWallet's balance. (The current implementation uses msg.value)

The directExecute can remain payable anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants