|
1 | 1 | import { expect } from "chai"; |
2 | 2 | import hre, { deployments, ethers } from "hardhat"; |
3 | 3 | import { getMock, getSafeWithOwners } from "../utils/setup"; |
4 | | -import { buildSafeTransaction, executeContractCallWithSigners, executeTxWithSigners } from "../../src/utils/execution"; |
| 4 | +import { |
| 5 | + buildSafeTransaction, |
| 6 | + executeContractCallWithSigners, |
| 7 | + executeTx, |
| 8 | + executeTxWithSigners, |
| 9 | + safeSignTypedData, |
| 10 | +} from "../../src/utils/execution"; |
5 | 11 |
|
6 | 12 | describe("OnlyOwnersGuard", () => { |
7 | 13 | const setupTests = deployments.createFixture(async ({ deployments }) => { |
@@ -40,13 +46,15 @@ describe("OnlyOwnersGuard", () => { |
40 | 46 | const { |
41 | 47 | safe, |
42 | 48 | mock, |
43 | | - signers: [, user2], |
| 49 | + signers: [user1, user2], |
44 | 50 | } = await setupTests(); |
45 | 51 | const nonce = await safe.nonce(); |
46 | 52 | const mockAddress = await mock.getAddress(); |
47 | 53 | const safeTx = buildSafeTransaction({ to: mockAddress, data: "0xbaddad42", nonce }); |
| 54 | + const signature = await safeSignTypedData(user1, await safe.getAddress(), safeTx); |
| 55 | + const safeUser2 = await safe.connect(user2); |
48 | 56 |
|
49 | | - await expect(executeTxWithSigners(safe, safeTx, [user2])).to.be.reverted; |
| 57 | + await expect(executeTx(safeUser2, safeTx, [signature])).to.be.revertedWith("msg sender is not allowed to exec"); |
50 | 58 | }); |
51 | 59 | }); |
52 | 60 | }); |
0 commit comments