Skip to content

Commit 9e0e825

Browse files
authored
Make smart account functions overrideable (#393)
* Make all account fns virtual * docs update * pkg update
1 parent 60f9271 commit 9e0e825

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

contracts/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@thirdweb-dev/contracts",
33
"description": "Collection of smart contracts deployable via the thirdweb SDK, dashboard and CLI",
4-
"version": "3.5.2",
4+
"version": "3.5.3",
55
"license": "Apache-2.0",
66
"repository": {
77
"type": "git",

contracts/smart-wallet/non-upgradeable/Account.sol

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ contract Account is
9999
}
100100

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

@@ -148,12 +148,16 @@ contract Account is
148148
}
149149

150150
/// @notice Deposit funds for this account in Entrypoint.
151-
function addDeposit() public payable {
151+
function addDeposit() public payable virtual {
152152
entryPoint().depositTo{ value: msg.value }(address(this));
153153
}
154154

155155
/// @notice Withdraw funds for this account from Entrypoint.
156-
function withdrawDepositTo(address payable withdrawAddress, uint256 amount) public onlyRole(DEFAULT_ADMIN_ROLE) {
156+
function withdrawDepositTo(address payable withdrawAddress, uint256 amount)
157+
public
158+
virtual
159+
onlyRole(DEFAULT_ADMIN_ROLE)
160+
{
157161
entryPoint().withdrawTo(withdrawAddress, amount);
158162
}
159163

@@ -166,7 +170,7 @@ contract Account is
166170
address _target,
167171
uint256 value,
168172
bytes memory _calldata
169-
) internal {
173+
) internal virtual {
170174
(bool success, bytes memory result) = _target.call{ value: value }(_calldata);
171175
if (!success) {
172176
assembly {

0 commit comments

Comments
 (0)