mirror of https://github.com/vacp2p/minime.git
add tests destroy tokens balance and supply check
This commit is contained in:
parent
22f02cb230
commit
bb7bc3a6d7
|
@ -6,21 +6,21 @@
|
||||||
| allowance | 0 | 62 | 0 | 808 | 13 |
|
| allowance | 0 | 62 | 0 | 808 | 13 |
|
||||||
| approve | 0 | 15018 | 14715 | 31708 | 10 |
|
| approve | 0 | 15018 | 14715 | 31708 | 10 |
|
||||||
| approveAndCall | 0 | 31199 | 0 | 93597 | 3 |
|
| approveAndCall | 0 | 31199 | 0 | 93597 | 3 |
|
||||||
| balanceOf | 0 | 309 | 0 | 2753 | 47 |
|
| balanceOf | 0 | 297 | 0 | 2753 | 49 |
|
||||||
| balanceOfAt | 0 | 90 | 0 | 2363 | 26 |
|
| balanceOfAt | 0 | 90 | 0 | 2363 | 26 |
|
||||||
| changeController | 0 | 724 | 0 | 3558 | 7 |
|
| changeController | 0 | 724 | 0 | 3558 | 7 |
|
||||||
| claimTokens | 9537 | 41277 | 57148 | 57148 | 3 |
|
| claimTokens | 9537 | 41277 | 57148 | 57148 | 3 |
|
||||||
| controller | 0 | 0 | 0 | 0 | 7 |
|
| controller | 0 | 0 | 0 | 0 | 7 |
|
||||||
| createCloneToken | 0 | 919122 | 919122 | 1838245 | 2 |
|
| createCloneToken | 0 | 919122 | 919122 | 1838245 | 2 |
|
||||||
| decimals | 0 | 0 | 0 | 0 | 7 |
|
| decimals | 0 | 0 | 0 | 0 | 7 |
|
||||||
| destroyTokens | 9001 | 9001 | 9001 | 9001 | 1 |
|
| destroyTokens | 2308 | 5206 | 4310 | 9001 | 3 |
|
||||||
| enableTransfers | 0 | 0 | 0 | 0 | 3 |
|
| enableTransfers | 0 | 0 | 0 | 0 | 3 |
|
||||||
| generateTokens | 0 | 8450 | 0 | 95796 | 34 |
|
| generateTokens | 0 | 7765 | 0 | 95796 | 37 |
|
||||||
| name | 0 | 0 | 0 | 0 | 7 |
|
| name | 0 | 0 | 0 | 0 | 7 |
|
||||||
| parentSnapShotBlock | 0 | 0 | 0 | 0 | 8 |
|
| parentSnapShotBlock | 0 | 0 | 0 | 0 | 8 |
|
||||||
| parentToken | 0 | 0 | 0 | 0 | 8 |
|
| parentToken | 0 | 0 | 0 | 0 | 8 |
|
||||||
| symbol | 0 | 0 | 0 | 0 | 7 |
|
| symbol | 0 | 0 | 0 | 0 | 7 |
|
||||||
| totalSupply | 0 | 273 | 0 | 1911 | 7 |
|
| totalSupply | 0 | 212 | 0 | 1911 | 9 |
|
||||||
| totalSupplyAt | 0 | 285 | 0 | 1995 | 7 |
|
| totalSupplyAt | 0 | 285 | 0 | 1995 | 7 |
|
||||||
| transfer | 526 | 37564 | 49389 | 75187 | 17 |
|
| transfer | 526 | 37564 | 49389 | 75187 | 17 |
|
||||||
| transferFrom | 0 | 16836 | 3495 | 66590 | 7 |
|
| transferFrom | 0 | 16836 | 3495 | 66590 | 7 |
|
||||||
|
|
|
@ -15,6 +15,8 @@ CreateCloneTokenTest:testDeployment() (gas: 26550)
|
||||||
CreateCloneTokenTest:testGenerateTokens() (gas: 102067)
|
CreateCloneTokenTest:testGenerateTokens() (gas: 102067)
|
||||||
DestroyTokensTest:testDeployment() (gas: 26595)
|
DestroyTokensTest:testDeployment() (gas: 26595)
|
||||||
DestroyTokensTest:testDestroyTokens() (gas: 13501)
|
DestroyTokensTest:testDestroyTokens() (gas: 13501)
|
||||||
|
DestroyTokensTest:testDestroyTokensNotEnoughBalance() (gas: 9666)
|
||||||
|
DestroyTokensTest:testDestroyTokensNotEnoughSupply() (gas: 7997)
|
||||||
GenerateTokensTest:testDeployment() (gas: 26550)
|
GenerateTokensTest:testDeployment() (gas: 26550)
|
||||||
GenerateTokensTest:testGenerateTokens() (gas: 109506)
|
GenerateTokensTest:testGenerateTokens() (gas: 109506)
|
||||||
GenerateTokensTest:test_RevertWhen_SenderIsNotController() (gas: 14951)
|
GenerateTokensTest:test_RevertWhen_SenderIsNotController() (gas: 14951)
|
||||||
|
|
|
@ -11,6 +11,7 @@ import {
|
||||||
TransfersDisabled,
|
TransfersDisabled,
|
||||||
InvalidDestination,
|
InvalidDestination,
|
||||||
NotEnoughBalance,
|
NotEnoughBalance,
|
||||||
|
NotEnoughSupply,
|
||||||
NotEnoughAllowance,
|
NotEnoughAllowance,
|
||||||
AllowanceAlreadySet,
|
AllowanceAlreadySet,
|
||||||
ControllerRejected,
|
ControllerRejected,
|
||||||
|
@ -603,6 +604,37 @@ contract DestroyTokensTest is MiniMeTokenTest {
|
||||||
assertEq(minimeToken.balanceOf(accounts[0]), 7, "balance of account should be reduced");
|
assertEq(minimeToken.balanceOf(accounts[0]), 7, "balance of account should be reduced");
|
||||||
vm.resumeGasMetering();
|
vm.resumeGasMetering();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function testDestroyTokensNotEnoughSupply() public {
|
||||||
|
vm.pauseGasMetering();
|
||||||
|
// ensure `accounts[0]` has tokens
|
||||||
|
_generateTokens(accounts[0], 10);
|
||||||
|
|
||||||
|
vm.prank(deployer);
|
||||||
|
vm.resumeGasMetering();
|
||||||
|
vm.expectRevert(NotEnoughSupply.selector);
|
||||||
|
minimeToken.destroyTokens(accounts[0], 11);
|
||||||
|
vm.pauseGasMetering();
|
||||||
|
assertEq(minimeToken.totalSupply(), 10, "total supply should be correct");
|
||||||
|
assertEq(minimeToken.balanceOf(accounts[0]), 10, "balance of account should be reduced");
|
||||||
|
vm.resumeGasMetering();
|
||||||
|
}
|
||||||
|
|
||||||
|
function testDestroyTokensNotEnoughBalance() public {
|
||||||
|
vm.pauseGasMetering();
|
||||||
|
// ensure `accounts[0]` has tokens
|
||||||
|
_generateTokens(accounts[0], 10);
|
||||||
|
_generateTokens(accounts[1], 10);
|
||||||
|
|
||||||
|
vm.expectRevert(NotEnoughBalance.selector);
|
||||||
|
vm.prank(deployer);
|
||||||
|
vm.resumeGasMetering();
|
||||||
|
minimeToken.destroyTokens(accounts[0], 11);
|
||||||
|
vm.pauseGasMetering();
|
||||||
|
assertEq(minimeToken.totalSupply(), 20, "total supply should be correct");
|
||||||
|
assertEq(minimeToken.balanceOf(accounts[0]), 10, "balance of account should be reduced");
|
||||||
|
vm.resumeGasMetering();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
contract CreateCloneTokenTest is MiniMeTokenTest {
|
contract CreateCloneTokenTest is MiniMeTokenTest {
|
||||||
|
|
Loading…
Reference in New Issue