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

Emit Approval event on allowance change #65

Merged
merged 2 commits into from
Apr 17, 2020
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
7,131 changes: 3,643 additions & 3,488 deletions build/Combined-Json.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions build/ERC20.json

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions build/UniswapV2ERC20.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions build/UniswapV2Factory.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions build/UniswapV2Pair.json

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion contracts/UniswapV2ERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ contract UniswapV2ERC20 is IUniswapV2ERC20 {

function transferFrom(address from, address to, uint value) external returns (bool) {
if (allowance[from][msg.sender] != uint(-1)) {
allowance[from][msg.sender] = allowance[from][msg.sender].sub(value);
uint remaining = allowance[from][msg.sender].sub(value);
allowance[from][msg.sender] = remaining;
emit Approval(from, msg.sender, remaining);
}
_transfer(from, to, value);
return true;
Expand Down
2 changes: 1 addition & 1 deletion test/UniswapV2Factory.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ describe('UniswapV2Factory', () => {
it('createPair:gas', async () => {
const tx = await factory.createPair(...TEST_ADDRESSES)
const receipt = await tx.wait()
expect(receipt.gasUsed).to.eq(2512920)
expect(receipt.gasUsed).to.eq(2524962)
})

it('setFeeTo', async () => {
Expand Down