ERC20VotesComp.test.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526
  1. /* eslint-disable */
  2. const { BN, constants, expectEvent, expectRevert, time } = require('@openzeppelin/test-helpers');
  3. const { expect } = require('chai');
  4. const { MAX_UINT256, ZERO_ADDRESS } = constants;
  5. const { fromRpcSig } = require('ethereumjs-util');
  6. const ethSigUtil = require('eth-sig-util');
  7. const Wallet = require('ethereumjs-wallet').default;
  8. const ERC20VotesComp = artifacts.require('$ERC20VotesComp');
  9. const { batchInBlock } = require('../../../helpers/txpool');
  10. const { getDomain, domainType, domainSeparator } = require('../../../helpers/eip712');
  11. const { getChainId } = require('../../../helpers/chainid');
  12. const Delegation = [
  13. { name: 'delegatee', type: 'address' },
  14. { name: 'nonce', type: 'uint256' },
  15. { name: 'expiry', type: 'uint256' },
  16. ];
  17. contract('ERC20VotesComp', function (accounts) {
  18. const [holder, recipient, holderDelegatee, other1, other2] = accounts;
  19. const name = 'My Token';
  20. const symbol = 'MTKN';
  21. const version = '1';
  22. const supply = new BN('10000000000000000000000000');
  23. beforeEach(async function () {
  24. this.chainId = await getChainId();
  25. this.token = await ERC20VotesComp.new(name, symbol, name);
  26. });
  27. it('initial nonce is 0', async function () {
  28. expect(await this.token.nonces(holder)).to.be.bignumber.equal('0');
  29. });
  30. it('domain separator', async function () {
  31. expect(await this.token.DOMAIN_SEPARATOR()).to.equal(await getDomain(this.token).then(domainSeparator));
  32. });
  33. it('minting restriction', async function () {
  34. const amount = new BN('2').pow(new BN('96'));
  35. await expectRevert(this.token.$_mint(holder, amount), 'ERC20Votes: total supply risks overflowing votes');
  36. });
  37. describe('set delegation', function () {
  38. describe('call', function () {
  39. it('delegation with balance', async function () {
  40. await this.token.$_mint(holder, supply);
  41. expect(await this.token.delegates(holder)).to.be.equal(ZERO_ADDRESS);
  42. const { receipt } = await this.token.delegate(holder, { from: holder });
  43. expectEvent(receipt, 'DelegateChanged', {
  44. delegator: holder,
  45. fromDelegate: ZERO_ADDRESS,
  46. toDelegate: holder,
  47. });
  48. expectEvent(receipt, 'DelegateVotesChanged', {
  49. delegate: holder,
  50. previousBalance: '0',
  51. newBalance: supply,
  52. });
  53. expect(await this.token.delegates(holder)).to.be.equal(holder);
  54. expect(await this.token.getCurrentVotes(holder)).to.be.bignumber.equal(supply);
  55. expect(await this.token.getPriorVotes(holder, receipt.blockNumber - 1)).to.be.bignumber.equal('0');
  56. await time.advanceBlock();
  57. expect(await this.token.getPriorVotes(holder, receipt.blockNumber)).to.be.bignumber.equal(supply);
  58. });
  59. it('delegation without balance', async function () {
  60. expect(await this.token.delegates(holder)).to.be.equal(ZERO_ADDRESS);
  61. const { receipt } = await this.token.delegate(holder, { from: holder });
  62. expectEvent(receipt, 'DelegateChanged', {
  63. delegator: holder,
  64. fromDelegate: ZERO_ADDRESS,
  65. toDelegate: holder,
  66. });
  67. expectEvent.notEmitted(receipt, 'DelegateVotesChanged');
  68. expect(await this.token.delegates(holder)).to.be.equal(holder);
  69. });
  70. });
  71. describe('with signature', function () {
  72. const delegator = Wallet.generate();
  73. const delegatorAddress = web3.utils.toChecksumAddress(delegator.getAddressString());
  74. const nonce = 0;
  75. const buildData = (contract, message) =>
  76. getDomain(contract).then(domain => ({
  77. primaryType: 'Delegation',
  78. types: { EIP712Domain: domainType(domain), Delegation },
  79. domain,
  80. message,
  81. }));
  82. beforeEach(async function () {
  83. await this.token.$_mint(delegatorAddress, supply);
  84. });
  85. it('accept signed delegation', async function () {
  86. const { v, r, s } = await buildData(this.token, {
  87. delegatee: delegatorAddress,
  88. nonce,
  89. expiry: MAX_UINT256,
  90. })
  91. .then(data => ethSigUtil.signTypedMessage(delegator.getPrivateKey(), { data }))
  92. .then(fromRpcSig);
  93. expect(await this.token.delegates(delegatorAddress)).to.be.equal(ZERO_ADDRESS);
  94. const { receipt } = await this.token.delegateBySig(delegatorAddress, nonce, MAX_UINT256, v, r, s);
  95. expectEvent(receipt, 'DelegateChanged', {
  96. delegator: delegatorAddress,
  97. fromDelegate: ZERO_ADDRESS,
  98. toDelegate: delegatorAddress,
  99. });
  100. expectEvent(receipt, 'DelegateVotesChanged', {
  101. delegate: delegatorAddress,
  102. previousBalance: '0',
  103. newBalance: supply,
  104. });
  105. expect(await this.token.delegates(delegatorAddress)).to.be.equal(delegatorAddress);
  106. expect(await this.token.getCurrentVotes(delegatorAddress)).to.be.bignumber.equal(supply);
  107. expect(await this.token.getPriorVotes(delegatorAddress, receipt.blockNumber - 1)).to.be.bignumber.equal('0');
  108. await time.advanceBlock();
  109. expect(await this.token.getPriorVotes(delegatorAddress, receipt.blockNumber)).to.be.bignumber.equal(supply);
  110. });
  111. it('rejects reused signature', async function () {
  112. const { v, r, s } = await buildData(this.token, {
  113. delegatee: delegatorAddress,
  114. nonce,
  115. expiry: MAX_UINT256,
  116. })
  117. .then(data => ethSigUtil.signTypedMessage(delegator.getPrivateKey(), { data }))
  118. .then(fromRpcSig);
  119. await this.token.delegateBySig(delegatorAddress, nonce, MAX_UINT256, v, r, s);
  120. await expectRevert(
  121. this.token.delegateBySig(delegatorAddress, nonce, MAX_UINT256, v, r, s),
  122. 'ERC20Votes: invalid nonce',
  123. );
  124. });
  125. it('rejects bad delegatee', async function () {
  126. const { v, r, s } = await buildData(this.token, {
  127. delegatee: delegatorAddress,
  128. nonce,
  129. expiry: MAX_UINT256,
  130. })
  131. .then(data => ethSigUtil.signTypedMessage(delegator.getPrivateKey(), { data }))
  132. .then(fromRpcSig);
  133. const receipt = await this.token.delegateBySig(holderDelegatee, nonce, MAX_UINT256, v, r, s);
  134. const { args } = receipt.logs.find(({ event }) => event == 'DelegateChanged');
  135. expect(args.delegator).to.not.be.equal(delegatorAddress);
  136. expect(args.fromDelegate).to.be.equal(ZERO_ADDRESS);
  137. expect(args.toDelegate).to.be.equal(holderDelegatee);
  138. });
  139. it('rejects bad nonce', async function () {
  140. const { v, r, s } = await buildData(this.token, {
  141. delegatee: delegatorAddress,
  142. nonce,
  143. expiry: MAX_UINT256,
  144. })
  145. .then(data => ethSigUtil.signTypedMessage(delegator.getPrivateKey(), { data }))
  146. .then(fromRpcSig);
  147. await expectRevert(
  148. this.token.delegateBySig(delegatorAddress, nonce + 1, MAX_UINT256, v, r, s),
  149. 'ERC20Votes: invalid nonce',
  150. );
  151. });
  152. it('rejects expired permit', async function () {
  153. const expiry = (await time.latest()) - time.duration.weeks(1);
  154. const { v, r, s } = await buildData(this.token, {
  155. delegatee: delegatorAddress,
  156. nonce,
  157. expiry,
  158. })
  159. .then(data => ethSigUtil.signTypedMessage(delegator.getPrivateKey(), { data }))
  160. .then(fromRpcSig);
  161. await expectRevert(
  162. this.token.delegateBySig(delegatorAddress, nonce, expiry, v, r, s),
  163. 'ERC20Votes: signature expired',
  164. );
  165. });
  166. });
  167. });
  168. describe('change delegation', function () {
  169. beforeEach(async function () {
  170. await this.token.$_mint(holder, supply);
  171. await this.token.delegate(holder, { from: holder });
  172. });
  173. it('call', async function () {
  174. expect(await this.token.delegates(holder)).to.be.equal(holder);
  175. const { receipt } = await this.token.delegate(holderDelegatee, { from: holder });
  176. expectEvent(receipt, 'DelegateChanged', {
  177. delegator: holder,
  178. fromDelegate: holder,
  179. toDelegate: holderDelegatee,
  180. });
  181. expectEvent(receipt, 'DelegateVotesChanged', {
  182. delegate: holder,
  183. previousBalance: supply,
  184. newBalance: '0',
  185. });
  186. expectEvent(receipt, 'DelegateVotesChanged', {
  187. delegate: holderDelegatee,
  188. previousBalance: '0',
  189. newBalance: supply,
  190. });
  191. expect(await this.token.delegates(holder)).to.be.equal(holderDelegatee);
  192. expect(await this.token.getCurrentVotes(holder)).to.be.bignumber.equal('0');
  193. expect(await this.token.getCurrentVotes(holderDelegatee)).to.be.bignumber.equal(supply);
  194. expect(await this.token.getPriorVotes(holder, receipt.blockNumber - 1)).to.be.bignumber.equal(supply);
  195. expect(await this.token.getPriorVotes(holderDelegatee, receipt.blockNumber - 1)).to.be.bignumber.equal('0');
  196. await time.advanceBlock();
  197. expect(await this.token.getPriorVotes(holder, receipt.blockNumber)).to.be.bignumber.equal('0');
  198. expect(await this.token.getPriorVotes(holderDelegatee, receipt.blockNumber)).to.be.bignumber.equal(supply);
  199. });
  200. });
  201. describe('transfers', function () {
  202. beforeEach(async function () {
  203. await this.token.$_mint(holder, supply);
  204. });
  205. it('no delegation', async function () {
  206. const { receipt } = await this.token.transfer(recipient, 1, { from: holder });
  207. expectEvent(receipt, 'Transfer', { from: holder, to: recipient, value: '1' });
  208. expectEvent.notEmitted(receipt, 'DelegateVotesChanged');
  209. this.holderVotes = '0';
  210. this.recipientVotes = '0';
  211. });
  212. it('sender delegation', async function () {
  213. await this.token.delegate(holder, { from: holder });
  214. const { receipt } = await this.token.transfer(recipient, 1, { from: holder });
  215. expectEvent(receipt, 'Transfer', { from: holder, to: recipient, value: '1' });
  216. expectEvent(receipt, 'DelegateVotesChanged', {
  217. delegate: holder,
  218. previousBalance: supply,
  219. newBalance: supply.subn(1),
  220. });
  221. this.holderVotes = supply.subn(1);
  222. this.recipientVotes = '0';
  223. });
  224. it('receiver delegation', async function () {
  225. await this.token.delegate(recipient, { from: recipient });
  226. const { receipt } = await this.token.transfer(recipient, 1, { from: holder });
  227. expectEvent(receipt, 'Transfer', { from: holder, to: recipient, value: '1' });
  228. expectEvent(receipt, 'DelegateVotesChanged', { delegate: recipient, previousBalance: '0', newBalance: '1' });
  229. this.holderVotes = '0';
  230. this.recipientVotes = '1';
  231. });
  232. it('full delegation', async function () {
  233. await this.token.delegate(holder, { from: holder });
  234. await this.token.delegate(recipient, { from: recipient });
  235. const { receipt } = await this.token.transfer(recipient, 1, { from: holder });
  236. expectEvent(receipt, 'Transfer', { from: holder, to: recipient, value: '1' });
  237. expectEvent(receipt, 'DelegateVotesChanged', {
  238. delegate: holder,
  239. previousBalance: supply,
  240. newBalance: supply.subn(1),
  241. });
  242. expectEvent(receipt, 'DelegateVotesChanged', { delegate: recipient, previousBalance: '0', newBalance: '1' });
  243. this.holderVotes = supply.subn(1);
  244. this.recipientVotes = '1';
  245. });
  246. afterEach(async function () {
  247. expect(await this.token.getCurrentVotes(holder)).to.be.bignumber.equal(this.holderVotes);
  248. expect(await this.token.getCurrentVotes(recipient)).to.be.bignumber.equal(this.recipientVotes);
  249. // need to advance 2 blocks to see the effect of a transfer on "getPriorVotes"
  250. const blockNumber = await time.latestBlock();
  251. await time.advanceBlock();
  252. expect(await this.token.getPriorVotes(holder, blockNumber)).to.be.bignumber.equal(this.holderVotes);
  253. expect(await this.token.getPriorVotes(recipient, blockNumber)).to.be.bignumber.equal(this.recipientVotes);
  254. });
  255. });
  256. // The following tests are a adaptation of https://github.com/compound-finance/compound-protocol/blob/master/tests/Governance/CompTest.js.
  257. describe('Compound test suite', function () {
  258. beforeEach(async function () {
  259. await this.token.$_mint(holder, supply);
  260. });
  261. describe('balanceOf', function () {
  262. it('grants to initial account', async function () {
  263. expect(await this.token.balanceOf(holder)).to.be.bignumber.equal('10000000000000000000000000');
  264. });
  265. });
  266. describe('numCheckpoints', function () {
  267. it('returns the number of checkpoints for a delegate', async function () {
  268. await this.token.transfer(recipient, '100', { from: holder }); //give an account a few tokens for readability
  269. expect(await this.token.numCheckpoints(other1)).to.be.bignumber.equal('0');
  270. const t1 = await this.token.delegate(other1, { from: recipient });
  271. expect(await this.token.numCheckpoints(other1)).to.be.bignumber.equal('1');
  272. const t2 = await this.token.transfer(other2, 10, { from: recipient });
  273. expect(await this.token.numCheckpoints(other1)).to.be.bignumber.equal('2');
  274. const t3 = await this.token.transfer(other2, 10, { from: recipient });
  275. expect(await this.token.numCheckpoints(other1)).to.be.bignumber.equal('3');
  276. const t4 = await this.token.transfer(recipient, 20, { from: holder });
  277. expect(await this.token.numCheckpoints(other1)).to.be.bignumber.equal('4');
  278. expect(await this.token.checkpoints(other1, 0)).to.be.deep.equal([t1.receipt.blockNumber.toString(), '100']);
  279. expect(await this.token.checkpoints(other1, 1)).to.be.deep.equal([t2.receipt.blockNumber.toString(), '90']);
  280. expect(await this.token.checkpoints(other1, 2)).to.be.deep.equal([t3.receipt.blockNumber.toString(), '80']);
  281. expect(await this.token.checkpoints(other1, 3)).to.be.deep.equal([t4.receipt.blockNumber.toString(), '100']);
  282. await time.advanceBlock();
  283. expect(await this.token.getPriorVotes(other1, t1.receipt.blockNumber)).to.be.bignumber.equal('100');
  284. expect(await this.token.getPriorVotes(other1, t2.receipt.blockNumber)).to.be.bignumber.equal('90');
  285. expect(await this.token.getPriorVotes(other1, t3.receipt.blockNumber)).to.be.bignumber.equal('80');
  286. expect(await this.token.getPriorVotes(other1, t4.receipt.blockNumber)).to.be.bignumber.equal('100');
  287. });
  288. it('does not add more than one checkpoint in a block', async function () {
  289. await this.token.transfer(recipient, '100', { from: holder });
  290. expect(await this.token.numCheckpoints(other1)).to.be.bignumber.equal('0');
  291. const [t1, t2, t3] = await batchInBlock([
  292. () => this.token.delegate(other1, { from: recipient, gas: 100000 }),
  293. () => this.token.transfer(other2, 10, { from: recipient, gas: 100000 }),
  294. () => this.token.transfer(other2, 10, { from: recipient, gas: 100000 }),
  295. ]);
  296. expect(await this.token.numCheckpoints(other1)).to.be.bignumber.equal('1');
  297. expect(await this.token.checkpoints(other1, 0)).to.be.deep.equal([t1.receipt.blockNumber.toString(), '80']);
  298. // expectReve(await this.token.checkpoints(other1, 1)).to.be.deep.equal([ '0', '0' ]); // Reverts due to array overflow check
  299. // expect(await this.token.checkpoints(other1, 2)).to.be.deep.equal([ '0', '0' ]); // Reverts due to array overflow check
  300. const t4 = await this.token.transfer(recipient, 20, { from: holder });
  301. expect(await this.token.numCheckpoints(other1)).to.be.bignumber.equal('2');
  302. expect(await this.token.checkpoints(other1, 1)).to.be.deep.equal([t4.receipt.blockNumber.toString(), '100']);
  303. });
  304. });
  305. describe('getPriorVotes', function () {
  306. it('reverts if block number >= current block', async function () {
  307. await expectRevert(this.token.getPriorVotes(other1, 5e10), 'ERC20Votes: block not yet mined');
  308. });
  309. it('returns 0 if there are no checkpoints', async function () {
  310. expect(await this.token.getPriorVotes(other1, 0)).to.be.bignumber.equal('0');
  311. });
  312. it('returns the latest block if >= last checkpoint block', async function () {
  313. const t1 = await this.token.delegate(other1, { from: holder });
  314. await time.advanceBlock();
  315. await time.advanceBlock();
  316. expect(await this.token.getPriorVotes(other1, t1.receipt.blockNumber)).to.be.bignumber.equal(
  317. '10000000000000000000000000',
  318. );
  319. expect(await this.token.getPriorVotes(other1, t1.receipt.blockNumber + 1)).to.be.bignumber.equal(
  320. '10000000000000000000000000',
  321. );
  322. });
  323. it('returns zero if < first checkpoint block', async function () {
  324. await time.advanceBlock();
  325. const t1 = await this.token.delegate(other1, { from: holder });
  326. await time.advanceBlock();
  327. await time.advanceBlock();
  328. expect(await this.token.getPriorVotes(other1, t1.receipt.blockNumber - 1)).to.be.bignumber.equal('0');
  329. expect(await this.token.getPriorVotes(other1, t1.receipt.blockNumber + 1)).to.be.bignumber.equal(
  330. '10000000000000000000000000',
  331. );
  332. });
  333. it('generally returns the voting balance at the appropriate checkpoint', async function () {
  334. const t1 = await this.token.delegate(other1, { from: holder });
  335. await time.advanceBlock();
  336. await time.advanceBlock();
  337. const t2 = await this.token.transfer(other2, 10, { from: holder });
  338. await time.advanceBlock();
  339. await time.advanceBlock();
  340. const t3 = await this.token.transfer(other2, 10, { from: holder });
  341. await time.advanceBlock();
  342. await time.advanceBlock();
  343. const t4 = await this.token.transfer(holder, 20, { from: other2 });
  344. await time.advanceBlock();
  345. await time.advanceBlock();
  346. expect(await this.token.getPriorVotes(other1, t1.receipt.blockNumber - 1)).to.be.bignumber.equal('0');
  347. expect(await this.token.getPriorVotes(other1, t1.receipt.blockNumber)).to.be.bignumber.equal(
  348. '10000000000000000000000000',
  349. );
  350. expect(await this.token.getPriorVotes(other1, t1.receipt.blockNumber + 1)).to.be.bignumber.equal(
  351. '10000000000000000000000000',
  352. );
  353. expect(await this.token.getPriorVotes(other1, t2.receipt.blockNumber)).to.be.bignumber.equal(
  354. '9999999999999999999999990',
  355. );
  356. expect(await this.token.getPriorVotes(other1, t2.receipt.blockNumber + 1)).to.be.bignumber.equal(
  357. '9999999999999999999999990',
  358. );
  359. expect(await this.token.getPriorVotes(other1, t3.receipt.blockNumber)).to.be.bignumber.equal(
  360. '9999999999999999999999980',
  361. );
  362. expect(await this.token.getPriorVotes(other1, t3.receipt.blockNumber + 1)).to.be.bignumber.equal(
  363. '9999999999999999999999980',
  364. );
  365. expect(await this.token.getPriorVotes(other1, t4.receipt.blockNumber)).to.be.bignumber.equal(
  366. '10000000000000000000000000',
  367. );
  368. expect(await this.token.getPriorVotes(other1, t4.receipt.blockNumber + 1)).to.be.bignumber.equal(
  369. '10000000000000000000000000',
  370. );
  371. });
  372. });
  373. });
  374. describe('getPastTotalSupply', function () {
  375. beforeEach(async function () {
  376. await this.token.delegate(holder, { from: holder });
  377. });
  378. it('reverts if block number >= current block', async function () {
  379. await expectRevert(this.token.getPastTotalSupply(5e10), 'ERC20Votes: block not yet mined');
  380. });
  381. it('returns 0 if there are no checkpoints', async function () {
  382. expect(await this.token.getPastTotalSupply(0)).to.be.bignumber.equal('0');
  383. });
  384. it('returns the latest block if >= last checkpoint block', async function () {
  385. t1 = await this.token.$_mint(holder, supply);
  386. await time.advanceBlock();
  387. await time.advanceBlock();
  388. expect(await this.token.getPastTotalSupply(t1.receipt.blockNumber)).to.be.bignumber.equal(supply);
  389. expect(await this.token.getPastTotalSupply(t1.receipt.blockNumber + 1)).to.be.bignumber.equal(supply);
  390. });
  391. it('returns zero if < first checkpoint block', async function () {
  392. await time.advanceBlock();
  393. const t1 = await this.token.$_mint(holder, supply);
  394. await time.advanceBlock();
  395. await time.advanceBlock();
  396. expect(await this.token.getPastTotalSupply(t1.receipt.blockNumber - 1)).to.be.bignumber.equal('0');
  397. expect(await this.token.getPastTotalSupply(t1.receipt.blockNumber + 1)).to.be.bignumber.equal(
  398. '10000000000000000000000000',
  399. );
  400. });
  401. it('generally returns the voting balance at the appropriate checkpoint', async function () {
  402. const t1 = await this.token.$_mint(holder, supply);
  403. await time.advanceBlock();
  404. await time.advanceBlock();
  405. const t2 = await this.token.$_burn(holder, 10);
  406. await time.advanceBlock();
  407. await time.advanceBlock();
  408. const t3 = await this.token.$_burn(holder, 10);
  409. await time.advanceBlock();
  410. await time.advanceBlock();
  411. const t4 = await this.token.$_mint(holder, 20);
  412. await time.advanceBlock();
  413. await time.advanceBlock();
  414. expect(await this.token.getPastTotalSupply(t1.receipt.blockNumber - 1)).to.be.bignumber.equal('0');
  415. expect(await this.token.getPastTotalSupply(t1.receipt.blockNumber)).to.be.bignumber.equal(
  416. '10000000000000000000000000',
  417. );
  418. expect(await this.token.getPastTotalSupply(t1.receipt.blockNumber + 1)).to.be.bignumber.equal(
  419. '10000000000000000000000000',
  420. );
  421. expect(await this.token.getPastTotalSupply(t2.receipt.blockNumber)).to.be.bignumber.equal(
  422. '9999999999999999999999990',
  423. );
  424. expect(await this.token.getPastTotalSupply(t2.receipt.blockNumber + 1)).to.be.bignumber.equal(
  425. '9999999999999999999999990',
  426. );
  427. expect(await this.token.getPastTotalSupply(t3.receipt.blockNumber)).to.be.bignumber.equal(
  428. '9999999999999999999999980',
  429. );
  430. expect(await this.token.getPastTotalSupply(t3.receipt.blockNumber + 1)).to.be.bignumber.equal(
  431. '9999999999999999999999980',
  432. );
  433. expect(await this.token.getPastTotalSupply(t4.receipt.blockNumber)).to.be.bignumber.equal(
  434. '10000000000000000000000000',
  435. );
  436. expect(await this.token.getPastTotalSupply(t4.receipt.blockNumber + 1)).to.be.bignumber.equal(
  437. '10000000000000000000000000',
  438. );
  439. });
  440. });
  441. });