Skip to content

Commit

Permalink
Make smart account functions overrideable (#393)
Browse files Browse the repository at this point in the history
* Make all account fns virtual

* docs update

* pkg update
  • Loading branch information
nkrishang authored May 11, 2023
1 parent 60f9271 commit 9e0e825
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion contracts/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@thirdweb-dev/contracts",
"description": "Collection of smart contracts deployable via the thirdweb SDK, dashboard and CLI",
"version": "3.5.2",
"version": "3.5.3",
"license": "Apache-2.0",
"repository": {
"type": "git",
Expand Down
12 changes: 8 additions & 4 deletions contracts/smart-wallet/non-upgradeable/Account.sol
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ contract Account is
}

/// @notice Returns the balance of the account in Entrypoint.
function getDeposit() public view returns (uint256) {
function getDeposit() public view virtual returns (uint256) {
return entryPoint().balanceOf(address(this));
}

Expand Down Expand Up @@ -148,12 +148,16 @@ contract Account is
}

/// @notice Deposit funds for this account in Entrypoint.
function addDeposit() public payable {
function addDeposit() public payable virtual {
entryPoint().depositTo{ value: msg.value }(address(this));
}

/// @notice Withdraw funds for this account from Entrypoint.
function withdrawDepositTo(address payable withdrawAddress, uint256 amount) public onlyRole(DEFAULT_ADMIN_ROLE) {
function withdrawDepositTo(address payable withdrawAddress, uint256 amount)
public
virtual
onlyRole(DEFAULT_ADMIN_ROLE)
{
entryPoint().withdrawTo(withdrawAddress, amount);
}

Expand All @@ -166,7 +170,7 @@ contract Account is
address _target,
uint256 value,
bytes memory _calldata
) internal {
) internal virtual {
(bool success, bytes memory result) = _target.call{ value: value }(_calldata);
if (!success) {
assembly {
Expand Down

0 comments on commit 9e0e825

Please sign in to comment.