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

feat: add support for permit based tokens in erc20 gateway #329

Merged
merged 17 commits into from
Oct 22, 2024
Merged
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -1059,6 +1059,30 @@ export function behavesLikeErc20GatewayV4(fixture: () => Promise<Env>) {
'PermitNotAllowed()'
);
});

it('reverts when permit fails when their is no approval', async () => {
viraj124 marked this conversation as resolved.
Show resolved Hide resolved
const {
erc20Gateway,
token,
signers: [deployer, user],
} = env;

const depositAmount = parseUnits('10', 18);
const depositTo = randomBytes32();

await token.connect(deployer).mint(user, depositAmount);

const tx = erc20Gateway
.connect(user)
.depositWithPermit(depositTo, token, depositAmount, {
deadline,
v: 0,
r: '0x0000000000000000000000000000000000000000000000000000000000000000',
s: '0x0000000000000000000000000000000000000000000000000000000000000000',
});
await expect(tx).to.be.revertedWith('ERC20: insufficient allowance');
});

it('user is able to deposit without calling approve()', async () => {
const {
erc20Gateway,
Expand Down
Loading