Skip to content

Commit

Permalink
Merge pull request #16 from blocto/v1.5.0
Browse files Browse the repository at this point in the history
V1.5.0
  • Loading branch information
kbehouse authored Aug 1, 2023
2 parents e8dc289 + 4130a35 commit 5b00c39
Show file tree
Hide file tree
Showing 13 changed files with 911 additions and 86 deletions.
6 changes: 2 additions & 4 deletions .solcover.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
module.exports = {
skipFiles: [
"test",
"samples/bls/lib",
//solc-coverage fails to compile our Manager module.
"samples/gnosis",
"utils/Exec.sol"
"Paymaster/VerifyingPaymaster.sol",
"TokenCallbackHandler.sol"
],
configureYulOptimizer: true,
};
2 changes: 1 addition & 1 deletion contracts/BloctoAccount.sol
Original file line number Diff line number Diff line change
Expand Up @@ -149,5 +149,5 @@ contract BloctoAccount is UUPSUpgradeable, TokenCallbackHandler, CoreWallet, Bas
}

/// @dev This empty reserved space for future versions. refer from: https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
// uint256[50] private __gap;
uint256[50] private __gap;
}
29 changes: 0 additions & 29 deletions contracts/BloctoAccountFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ contract BloctoAccountFactory is Initializable, AccessControlUpgradeable {
}

/// @notice create an account, and return its BloctoAccount.
/// returns the address even if the account is already deployed.
/// Note that during UserOperation execution, this method is called only if the account is not deployed.
/// This method returns an existing account address so that entryPoint.getSenderAddress() would work even after account creation
/// @param _authorizedAddress the initial authorized address, must not be zero!
/// @param _cosigner the initial cosigning address for `_authorizedAddress`, can be equal to `_authorizedAddress`
/// @param _recoveryAddress the initial recovery address for the wallet, can be address(0)
Expand Down Expand Up @@ -70,7 +67,6 @@ contract BloctoAccountFactory is Initializable, AccessControlUpgradeable {
}

/// @notice create an account with multiple authorized addresses, and return its BloctoAccount.
/// returns the address even if the account is already deployed.
/// @param _authorizedAddresses the initial authorized addresses, must not be zero!
/// @param _cosigner the initial cosigning address for `_authorizedAddress`, can be equal to `_authorizedAddress`
/// @param _recoveryAddress the initial recovery address for the wallet, can be address(0)
Expand Down Expand Up @@ -121,31 +117,6 @@ contract BloctoAccountFactory is Initializable, AccessControlUpgradeable {
bloctoAccountImplementation = _bloctoAccountImplementation;
}

/// @notice set the entrypoint
/// @param _entrypoint target entrypoint
function setEntrypoint(IEntryPoint _entrypoint) public {
require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "caller is not a admin");
require(address(_entrypoint) != address(0), "Invalid entrypoint address.");
entryPoint = _entrypoint;
}

/// @notice withdraw value from the deposit
/// @param withdrawAddress target to send to
/// @param amount to withdraw
function withdrawTo(address payable withdrawAddress, uint256 amount) public {
require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "caller is not a admin");
require(address(withdrawAddress) != address(0), "Invalid withdraw address.");
require(amount > 0, "Invalid withdraw amount.");
entryPoint.withdrawTo(withdrawAddress, amount);
}

/// @notice add stake in etnrypoint for this factory to avoid bundler reject
/// @param unstakeDelaySec - the unstake delay for this factory. Can only be increased.
function addStake(uint32 unstakeDelaySec) external payable {
require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "caller is not a admin");
entryPoint.addStake{value: msg.value}(unstakeDelaySec);
}

/// @dev This empty reserved space for future versions. refer from: https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
uint256[50] private __gap;
}
6 changes: 3 additions & 3 deletions contracts/Create3/Bytes32AddressLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ library Bytes32AddressLib {
return address(uint160(uint256(bytesValue)));
}

function fillLast12Bytes(address addressValue) internal pure returns (bytes32) {
return bytes32(bytes20(addressValue));
}
// function fillLast12Bytes(address addressValue) internal pure returns (bytes32) {
// return bytes32(bytes20(addressValue));
// }
}
8 changes: 8 additions & 0 deletions contracts/test/TestERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,12 @@ contract TestERC20 is ERC20, ERC20Burnable, AccessControl {
function decimals() public view virtual override returns (uint8) {
return _decimals;
}

function senderBalance() public view returns (uint256) {
return balanceOf(msg.sender);
}

function payableLookBalance() public payable returns (uint256) {
return balanceOf(msg.sender);
}
}
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
},
"devDependencies": {
"@account-abstraction/contracts": "^0.6.0",
"@nomicfoundation/hardhat-network-helpers": "^1.0.8",
"@nomiclabs/hardhat-ethers": "^2.0.2",
"@nomiclabs/hardhat-waffle": "^2.0.1",
"@openzeppelin/hardhat-upgrades": "^1.28.0",
Expand All @@ -36,6 +37,7 @@
"eslint-plugin-standard": "^5.0.0",
"ethereum-waffle": "^3.4.0",
"ethers": "^5.4.2",
"ethjs-util": "^0.1.6",
"hardhat": "^2.6.6",
"hardhat-storage-layout": "^0.1.7",
"solhint": "^3.3.7",
Expand All @@ -57,10 +59,10 @@
"ethereumjs-wallet": "^1.0.1",
"hardhat-deploy": "^0.11.23",
"hardhat-deploy-ethers": "^0.3.0-beta.11",
"solidity-coverage": "^0.8.2",
"solidity-coverage": "^0.8.4",
"source-map-support": "^0.5.19",
"table": "^6.8.0",
"typescript": "^4.3.5"
},
"license": "GPL-3.0"
}
}
Loading

0 comments on commit 5b00c39

Please sign in to comment.