ERC20VotesComp.test.js 22 KB

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