-
Notifications
You must be signed in to change notification settings - Fork 91
feat: Develop SingleRequestProxy Smart Contracts
#1453
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
Changes from 1 commit
e2567f4
c624474
917d472
d5e4728
0543092
2bd3495
19b5e40
c1d3a77
1376582
c2f55ee
bc922e8
8aef234
0769aa7
3bd9e38
ed429ae
d9a4484
a341ce1
10974b5
2cc82a0
bee1f58
aab6711
0c68eba
796f2b9
0482f6d
b8183f3
85fdc13
9033066
cd91ec2
f944199
c77c1eb
41e43b5
01c28d2
cfba1b9
7241e0c
4abe9e9
90b413f
c493758
06e015a
c778b17
b45607a
c58dfc0
9ee661a
0141d22
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
aimensahnoun marked this conversation as resolved.
Show resolved
Hide resolved
aimensahnoun marked this conversation as resolved.
Show resolved
Hide resolved
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -76,7 +76,7 @@ describe('contract: ERC20SingleRequestProxy', () => { | |
| expect(await erc20SingleRequestProxy.erc20FeeProxy()).to.equal(erc20FeeProxy.address); | ||
| }); | ||
|
|
||
| it('should process a payment correctly', async () => { | ||
| it('should process a payment correctly via recieve', async () => { | ||
|
||
| const paymentAmount = BN.from(100).mul(BASE_DECIMAL); | ||
| const totalAmount = paymentAmount.add(feeAmount); | ||
|
|
||
|
|
@@ -114,9 +114,8 @@ describe('contract: ERC20SingleRequestProxy', () => { | |
| expect(feeRecipientBalanceAfter).to.equal(feeAmount); | ||
aimensahnoun marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }); | ||
|
|
||
| it('should process a partial payment correctly', async () => { | ||
| // Pay 10 tokens instead of 100 | ||
| const paymentAmount = BN.from(10).mul(BASE_DECIMAL); | ||
| it('should process a payment correctly via triggerERC20Payment', async () => { | ||
| const paymentAmount = BN.from(100).mul(BASE_DECIMAL); | ||
| const totalAmount = paymentAmount.add(feeAmount); | ||
|
|
||
| await testToken.connect(user1).transfer(erc20SingleRequestProxy.address, totalAmount); | ||
|
|
@@ -126,12 +125,7 @@ describe('contract: ERC20SingleRequestProxy', () => { | |
| ); | ||
| expect(erc20SingleRequestProxyBalanceBefore).to.equal(totalAmount); | ||
|
|
||
| await expect( | ||
| user1.sendTransaction({ | ||
| to: erc20SingleRequestProxy.address, | ||
| value: 0, | ||
| }), | ||
| ) | ||
| await expect(erc20SingleRequestProxy.triggerERC20Payment()) | ||
| .to.emit(erc20FeeProxy, 'TransferWithReferenceAndFee') | ||
| .withArgs( | ||
| testToken.address, | ||
|
|
@@ -153,6 +147,10 @@ describe('contract: ERC20SingleRequestProxy', () => { | |
| expect(feeRecipientBalanceAfter).to.equal(feeAmount); | ||
| }); | ||
|
|
||
| it.skip('should process a partial payment correctly', async () => { | ||
| // Smart contract does not keep track of the payment amount, it accepts any amount of tokens | ||
| }); | ||
MantisClone marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| it('should process a payment with a non-standard ERC20', async () => { | ||
| const usdtFeeAmount = BN.from(10).mul(USDT_DECIMAL); | ||
| const usdtProxy = await new ERC20SingleRequestProxy__factory(deployer).deploy( | ||
|
|
@@ -265,7 +263,7 @@ describe('contract: ERC20SingleRequestProxy', () => { | |
|
|
||
| const payeeBalanceBefore = await testToken.balanceOf(user2Addr); | ||
|
|
||
| await erc20SingleRequestProxy.rescueFunds(); | ||
| await erc20SingleRequestProxy.rescueFunds(testToken.address); | ||
|
|
||
| const contractBalanceAfter = await testToken.balanceOf(erc20SingleRequestProxy.address); | ||
| expect(contractBalanceAfter).to.equal(0); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.