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

Small changes #8

Merged
merged 3 commits into from
May 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Merlin Egalite

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ You can customize the RPC url used in [`foundry.tml`](./foundry.toml) under the
1. Put the transaction's raw data in `signatures/tx.json`
2. Hash the transaction's raw data: `make hash`
3. To sign the data with a Ledger, run: `make sign:ledger`
4. Share the content of `signatures.txt` with the signer who will execute the transaction on the Safe.
4. Share the content of `signatures.txt` with the signer who will execute the transaction on the Safe

### Batch signatures and execute transaction

1. Make at least `threshold` signatures are available in `/signatures/signatures.txt`, each one per line
1. Make sure at least `threshold` signatures are available in `/signatures/signatures.txt`, each one per line
2. To execute the transaction on the Safe with a Ledger, run: `make exec:ledger`

## Advanced options
Expand All @@ -37,12 +37,12 @@ With `make sign` & `make exec`, one can also use any other wallet provider avail
{
"to": "0x0000000000000000000000000000000000000000",
"value": 0,
"data": "0x", // the raw tx data
"data": "0x", // The raw tx data
"operation": 0, // 0 for a call, 1 for a delegatecall
"safeTxGas": 0,
"baseGas": 0,
"gasPrice": 0,
"gasToken": "0x0000000000000000000000000000000000000000", // indicates the tx will consume the chain's default gas token (ETH on mainnet)
"refundReceiver": "0x0000000000000000000000000000000000000000" // indicates the tx's refund receiver will be the address executing the tx
"gasToken": "0x0000000000000000000000000000000000000000", // Indicates the tx will consume the chain's default gas token (ETH on mainnet)
"refundReceiver": "0x0000000000000000000000000000000000000000" // Indicates the tx's refund receiver will be the address executing the tx
}
```
2 changes: 1 addition & 1 deletion script/ExecTransaction.s.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {QuickSort} from "./libraries/QuickSort.sol";
Expand Down
4 changes: 2 additions & 2 deletions script/HashData.s.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {SafeTxDataBuilder, console2} from "./SafeTxDataBuilder.sol";
import {SafeTxDataBuilder} from "./SafeTxDataBuilder.sol";

contract HashData is SafeTxDataBuilder {
constructor() SafeTxDataBuilder(payable(vm.envAddress("SAFE"))) {}
Expand Down
14 changes: 7 additions & 7 deletions script/SafeTxDataBuilder.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {SignatureDecoder} from "safe/common/SignatureDecoder.sol";
Expand Down Expand Up @@ -28,14 +28,14 @@ contract SafeTxDataBuilder is Script, SignatureDecoder {
// "SafeTx(address to,uint256 value,bytes data,uint8 operation,uint256 safeTxGas,uint256 baseGas,uint256 gasPrice,address gasToken,address refundReceiver,uint256 nonce)"
// );
bytes32 private constant SAFE_TX_TYPEHASH = 0xbb8310d486368db6bd6f849402fdd73ad53d316b5a4b2644ad6efe0f941286d8;
bytes NEWLINE_CHAR = bytes("\n");
bytes private constant NEWLINE_CHAR = bytes("\n");

string ROOT = vm.projectRoot();
string SIGNATURES_DIR = string.concat(ROOT, "/signatures/");
string internal ROOT = vm.projectRoot();
string internal SIGNATURES_DIR = string.concat(ROOT, "/signatures/");

string TX_FILE = string.concat(SIGNATURES_DIR, "tx.json");
string HASH_DATA_FILE = string.concat(SIGNATURES_DIR, "hashData.txt");
string SIGNATURES_FILE = string.concat(SIGNATURES_DIR, "signatures.txt");
string internal TX_FILE = string.concat(SIGNATURES_DIR, "tx.json");
string internal HASH_DATA_FILE = string.concat(SIGNATURES_DIR, "hashData.txt");
string internal SIGNATURES_FILE = string.concat(SIGNATURES_DIR, "signatures.txt");

GnosisSafe immutable SAFE;

Expand Down
2 changes: 1 addition & 1 deletion script/libraries/QuickSort.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

function quickSortAddress(address[] memory arr, int256 left, int256 right) pure {
Expand Down