@@ -2,6 +2,7 @@ import { loadFixture } from "@nomicfoundation/hardhat-network-helpers";
2
2
import { expect } from "chai" ;
3
3
import { ethers } from "hardhat" ;
4
4
5
+ import { KolektivoTTD , KolektivoTTD__factory } from "../types" ;
5
6
import { deployTokenFixture } from "./token.fixture" ;
6
7
import { Signers } from "./types" ;
7
8
@@ -33,11 +34,45 @@ describe("Transfering", function () {
33
34
} ) ;
34
35
} ) ;
35
36
36
- describe ( "Paying @ Impact Partner" , function ( ) {
37
+ describe ( "When Paused" , async function ( ) {
38
+ beforeEach ( async function ( ) {
39
+ const { token } = await this . loadFixture ( deployTokenFixture ) ;
40
+ this . token = token ;
41
+ const [ _ , alice ] = await ethers . getSigners ( ) ;
42
+ await this . token . connect ( this . signers . admin ) . mint ( alice . address , 100n ) ;
43
+ await this . token . connect ( this . signers . admin ) . pause ( ) ;
44
+ } ) ;
45
+
46
+ it ( "can transfer when paused" , async function ( ) {
47
+ const transferAmount = 100n ;
48
+ const [ _ , alice , bob ] = await ethers . getSigners ( ) ;
49
+ await expect ( this . token . connect ( alice ) . transfer ( bob . address , transferAmount ) ) . to . not . be . revertedWithCustomError (
50
+ this . token ,
51
+ "EnforcedPause" ,
52
+ ) ;
53
+ } ) ;
54
+ } ) ;
55
+
56
+ describe ( "Impact Partner" , function ( ) {
37
57
beforeEach ( async function ( ) {
38
58
const { token, token_address } = await this . loadFixture ( deployTokenFixture ) ;
39
59
this . token = token ;
40
60
this . token_address = token_address ;
61
+ const [ _ , partner , customer ] = await ethers . getSigners ( ) ;
62
+ await token . connect ( this . signers . admin ) . addPartner ( partner . address ) ;
63
+ await token . connect ( this . signers . admin ) . mint ( customer . address , 100n ) ;
64
+ } ) ;
65
+
66
+ it ( "impact partners can transfer" , async function ( ) {
67
+ const { token } = this ;
68
+ const [ _ , partner , customer ] = await ethers . getSigners ( ) ;
69
+ const transferAmount = 100n ;
70
+ await token . connect ( customer ) . transfer ( partner . address , transferAmount ) ;
71
+ expect ( await token . balanceOf ( partner . address ) ) . to . equal ( transferAmount ) ;
72
+ expect ( await token . balanceOf ( customer . address ) ) . to . equal ( 0n ) ;
73
+ await token . connect ( partner ) . transfer ( customer . address , transferAmount ) ;
74
+ expect ( await token . balanceOf ( partner . address ) ) . to . equal ( 0n ) ;
75
+ expect ( await token . balanceOf ( customer . address ) ) . to . equal ( transferAmount ) ;
41
76
} ) ;
42
77
43
78
it ( "can check if a partner is valid" , async function ( ) {
@@ -52,8 +87,6 @@ describe("Transfering", function () {
52
87
const { token } = this ;
53
88
const [ _ , partner , customer ] = await ethers . getSigners ( ) ;
54
89
const transferAmount = 100n ;
55
- await token . connect ( this . signers . admin ) . addPartner ( partner . address ) ;
56
- await token . connect ( this . signers . admin ) . mint ( customer . address , transferAmount ) ;
57
90
await expect ( token . connect ( customer ) . transfer ( partner . address , transferAmount ) )
58
91
. to . emit ( token , "ImpactPartnerTransfer" )
59
92
. withArgs ( customer . address , partner . address , transferAmount ) ;
0 commit comments