Skip to content

Commit

Permalink
estimation-no-signature (#168)
Browse files Browse the repository at this point in the history
* refactor: boltz smart wallet initialize

* chore: clarify why we check against to before calling it

* chore: update package version

---------

Co-authored-by: Antonio <antonio@iovlabs.org>
  • Loading branch information
franciscotobar and antomor authored Sep 2, 2024
1 parent d72976f commit 9a06cfb
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 12 deletions.
2 changes: 0 additions & 2 deletions contracts/factory/BoltzSmartWalletFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ contract BoltzSmartWalletFactory is
_nonces[req.from]++;

//c07adbdc => initialize(address owner,address tokenContract,address feesReceiver,uint256 tokenAmount,uint256 tokenGas,address to,uint256 value,bytes calldata data)
//a9059cbb = transfer(address _to, uint256 _value) public returns (bool success)
/* solhint-disable avoid-tx-origin */
_deploy(
getCreationBytecode(),
keccak256(
Expand Down
1 change: 0 additions & 1 deletion contracts/factory/MinimalBoltzSmartWalletFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ contract MinimalBoltzSmartWalletFactory is
_nonces[req.from]++;

// 3d326736 => initialize(address owner,address feesReceiver,uint256 tokenAmount,uint256 tokenGas,address to,bytes calldata data)
/* solhint-disable avoid-tx-origin */
_deploy(
getCreationBytecode(),
keccak256(
Expand Down
1 change: 0 additions & 1 deletion contracts/factory/SmartWalletFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ contract SmartWalletFactory is
_nonces[req.from]++;

//a6b63eb8 => initialize(address owner,address tokenAddr,address tokenRecipient,uint256 tokenAmount,uint256 tokenGas)
/* solhint-disable avoid-tx-origin */
_deploy(
getCreationBytecode(),
keccak256(
Expand Down
15 changes: 10 additions & 5 deletions contracts/smartwallet/BoltzSmartWallet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,16 @@ contract BoltzSmartWallet is BaseSmartWallet {

_setOwner(owner);

(bool success, bytes memory ret) = to.call{value: value}(data);
if (!success) {
if (ret.length == 0) revert("Unable to execute");
assembly {
revert(add(ret, 32), mload(ret))
bool success;
bytes memory ret;
// Although this check isn't strictly necessary, it's included to improve the transaction estimation
if (to != address(0)) {
(success, ret) = to.call{value: value}(data);
if (!success) {
if (ret.length == 0) revert("Unable to execute");
assembly {
revert(add(ret, 32), mload(ret))
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rsksmart/rif-relay-contracts",
"version": "2.1.1-beta.0",
"version": "2.1.1-beta.1",
"private": false,
"description": "This project contains all the contracts needed for the rif relay system.",
"license": "MIT",
Expand Down

0 comments on commit 9a06cfb

Please sign in to comment.