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

Update oz version v4 to v5 #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
"author": "SoraSuegami <[email protected]>",
"license": "MIT",
"dependencies": {
"@email-wallet/contracts": "https://gitpkg.now.sh/zkemail/email-wallet/packages/contracts?8ae807dfcfe617a1a3e4b5342a667f0f595b8c82",
"@openzeppelin/contracts": "^4.9.2",
"@openzeppelin/contracts-upgradeable": "^4.9.2",
"@email-wallet/contracts": "https://gitpkg.now.sh/zkemail/email-wallet/packages/contracts?211b3c796d3573df16739d7e4287956a5a191fbd",
"@openzeppelin/contracts": "^5.0.0",
"@openzeppelin/contracts-upgradeable": "^5.0.0",
"@uniswap/v3-core": "https://github.com/Uniswap/v3-core#0.8",
"@uniswap/v3-periphery": "https://github.com/Uniswap/v3-periphery.git",
"@zk-email/contracts": "^4.0.2",
"@zk-email/contracts": "^6.1.5",
"solady": "^0.0.123",
"solidity-stringutils": "https://github.com/Arachnid/solidity-stringutils.git"
},
Expand Down
1 change: 1 addition & 0 deletions remappings.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@openzeppelin/=node_modules/@openzeppelin
@openzeppelin/contracts-upgradeable/=node_modules/@openzeppelin/contracts-upgradeable
@zk-email/=node_modules/@zk-email
@uniswap/=node_modules/@uniswap
forge-std/=node_modules/forge-std/src
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/StringUtils.sol
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ library StringUtils {
* @dev Converts a `int256` to its ASCII `string` decimal representation.
*/
function toString(int256 value) internal pure returns (string memory) {
return Strings.toString(value);
return Strings.toStringSigned(value);
}

/**
Expand Down
50 changes: 25 additions & 25 deletions test/MemoExtension.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ contract MemoExtensionTest is EmailWalletCoreTestHelper {
function setUp() public override {
super.setUp();
_registerRelayer();
_registerAndInitializeAccount();
_createTestAccount();

address extensionDev = vm.addr(3);
vm.startPrank(extensionDev);
Expand All @@ -34,11 +34,11 @@ contract MemoExtensionTest is EmailWalletCoreTestHelper {
EmailOp memory emailOp = _getBaseEmailOp();
emailOp.command = Commands.INSTALL_EXTENSION;
emailOp.extensionName = memoExtension.extensionName();
emailOp.maskedSubject = string.concat(
emailOp.emailProof.maskedSubject = string.concat(
"Install extension ",
memoExtension.extensionName()
);
emailOp.emailNullifier = bytes32(uint256(93845));
emailOp.emailProof.emailNullifier = bytes32(uint256(93845));

vm.startPrank(relayer);
core.handleEmailOp(emailOp);
Expand All @@ -51,8 +51,8 @@ contract MemoExtensionTest is EmailWalletCoreTestHelper {

EmailOp memory emailOp = _getBaseEmailOp();
emailOp.command = "Memo";
emailOp.maskedSubject = subject;
emailOp.emailNullifier = bytes32(uint256(23914));
emailOp.emailProof.maskedSubject = subject;
emailOp.emailProof.emailNullifier = bytes32(uint256(23914));
emailOp.extensionParams.subjectTemplateIndex = 0;
emailOp.extensionParams.subjectParams = new bytes[](1);
emailOp.extensionParams.subjectParams[0] = abi.encode(contents);
Expand All @@ -65,12 +65,12 @@ contract MemoExtensionTest is EmailWalletCoreTestHelper {
bytes32 memoId = memoExtension.idsOfWriter(walletAddr, 0);
assertEq(
memoId,
emailOp.emailNullifier,
emailOp.emailProof.emailNullifier,
"memoIds[0] should be emailNullifier"
);
assertEq(
memoExtension.idsOfContents(contents, 0),
emailOp.emailNullifier,
emailOp.emailProof.emailNullifier,
"idsOfContents[memo] should be emailNullifier"
);
MemoExtension.Memo memory memo = memoExtension.getMemoOfId(memoId);
Expand Down Expand Up @@ -126,13 +126,13 @@ contract MemoExtensionTest is EmailWalletCoreTestHelper {

EmailOp memory emailOp = _getBaseEmailOp();
emailOp.command = "Memo";
emailOp.maskedSubject = subject;
emailOp.emailNullifier = bytes32(uint256(2391424));
emailOp.emailProof.maskedSubject = subject;
emailOp.emailProof.emailNullifier = bytes32(uint256(2391424));
emailOp.extensionParams.subjectTemplateIndex = 1;
emailOp.extensionParams.subjectParams = new bytes[](1);
emailOp.extensionParams.subjectParams[0] = abi.encode(contents);
emailOp.hasEmailRecipient = true;
emailOp.recipientEmailAddrCommit = recipientEmailAddrCommit;
emailOp.emailProof.hasEmailRecipient = true;
emailOp.emailProof.recipientEmailAddrCommit = recipientEmailAddrCommit;
emailOp.feeTokenName = "DAI";

vm.startPrank(relayer);
Expand All @@ -148,16 +148,16 @@ contract MemoExtensionTest is EmailWalletCoreTestHelper {
bytes32 memoId = memoExtension.idsOfWriter(walletAddr, 0);
assertEq(
memoId,
emailOp.emailNullifier,
emailOp.emailProof.emailNullifier,
"memoId should be emailNullifier"
);
assertEq(
memoExtension.idsOfContents(contents, 0),
emailOp.emailNullifier,
emailOp.emailProof.emailNullifier,
"idsOfContents[memo] should be emailNullifier"
);
MemoExtension.Memo memory memo = memoExtension.getMemoOfId(
emailOp.emailNullifier
emailOp.emailProof.emailNullifier
);
assertEq(memo.writer, walletAddr, "memo.writer should be walletAddr");
assertEq(memo.contents, contents, "memo.content should be memo");
Expand All @@ -179,12 +179,12 @@ contract MemoExtensionTest is EmailWalletCoreTestHelper {
vm.startPrank(relayer);
unclaimsHandler.claimUnclaimedState(
registeredUnclaimId,
emailAddrPointer,
accountSalt,
mockProof
);
vm.stopPrank();

memo = memoExtension.getMemoOfId(emailOp.emailNullifier);
memo = memoExtension.getMemoOfId(emailOp.emailProof.emailNullifier);
assertEq(memo.recipient, walletAddr, "memo.recipient should be zero");
assertEq(memo.isReceived, true, "memo.isReceived should be true");
}
Expand All @@ -200,17 +200,17 @@ contract MemoExtensionTest is EmailWalletCoreTestHelper {

EmailOp memory emailOp = _getBaseEmailOp();
emailOp.command = "Memo";
emailOp.maskedSubject = subject;
emailOp.emailNullifier = bytes32(uint256(2391424));
emailOp.emailProof.maskedSubject = subject;
emailOp.emailProof.emailNullifier = bytes32(uint256(2391424));
emailOp.extensionParams.subjectTemplateIndex = 2;
emailOp.extensionParams.subjectParams = new bytes[](2);
emailOp.extensionParams.subjectParams[0] = abi.encode(contents);
emailOp.extensionParams.subjectParams[1] = abi.encode(
1.23 ether,
"DAI"
);
emailOp.hasEmailRecipient = true;
emailOp.recipientEmailAddrCommit = recipientEmailAddrCommit;
emailOp.emailProof.hasEmailRecipient = true;
emailOp.emailProof.recipientEmailAddrCommit = recipientEmailAddrCommit;
emailOp.feeTokenName = "DAI";

vm.startPrank(relayer);
Expand All @@ -226,16 +226,16 @@ contract MemoExtensionTest is EmailWalletCoreTestHelper {
bytes32 memoId = memoExtension.idsOfWriter(walletAddr, 0);
assertEq(
memoId,
emailOp.emailNullifier,
emailOp.emailProof.emailNullifier,
"memoId should be emailNullifier"
);
assertEq(
memoExtension.idsOfContents(contents, 0),
emailOp.emailNullifier,
emailOp.emailProof.emailNullifier,
"idsOfContents[memo] should be emailNullifier"
);
MemoExtension.Memo memory memo = memoExtension.getMemoOfId(
emailOp.emailNullifier
emailOp.emailProof.emailNullifier
);
assertEq(memo.writer, walletAddr, "memo.writer should be walletAddr");
assertEq(memo.contents, contents, "memo.content should be memo");
Expand Down Expand Up @@ -265,12 +265,12 @@ contract MemoExtensionTest is EmailWalletCoreTestHelper {
vm.startPrank(relayer);
unclaimsHandler.claimUnclaimedState(
registeredUnclaimId,
emailAddrPointer,
accountSalt,
mockProof
);
vm.stopPrank();

memo = memoExtension.getMemoOfId(emailOp.emailNullifier);
memo = memoExtension.getMemoOfId(emailOp.emailProof.emailNullifier);
assertEq(memo.recipient, walletAddr, "memo.recipient should be zero");
assertEq(memo.isReceived, true, "memo.isReceived should be true");
}
Expand Down
Loading