@@ -10,6 +10,8 @@ import { getAccounts, randomHexBytes, Account, toGRT } from './lib/testHelpers'
10
10
import { NetworkFixture } from './lib/fixtures'
11
11
import { toBN , formatGRT } from './lib/testHelpers'
12
12
13
+ const { AddressZero } = ethers . constants
14
+
13
15
// Entities
14
16
interface PublishSubgraph {
15
17
subgraphDeploymentID : string
@@ -490,6 +492,47 @@ describe('GNS', () => {
490
492
await fixture . tearDown ( )
491
493
} )
492
494
495
+ describe ( 'Configuration' , async function ( ) {
496
+ describe ( 'setOwnerTaxPercentage' , function ( ) {
497
+ const newValue = 10
498
+
499
+ it ( 'should set `ownerTaxPercentage`' , async function ( ) {
500
+ // Can set if allowed
501
+ await gns . connect ( governor . signer ) . setOwnerTaxPercentage ( newValue )
502
+ expect ( await gns . ownerTaxPercentage ( ) ) . eq ( newValue )
503
+ } )
504
+
505
+ it ( 'reject set `ownerTaxPercentage` if out of bounds' , async function ( ) {
506
+ const tx = gns . connect ( governor . signer ) . setOwnerTaxPercentage ( 1000001 )
507
+ await expect ( tx ) . revertedWith ( 'Owner tax must be MAX_PPM or less' )
508
+ } )
509
+
510
+ it ( 'reject set `ownerTaxPercentage` if not allowed' , async function ( ) {
511
+ const tx = gns . connect ( me . signer ) . setOwnerTaxPercentage ( newValue )
512
+ await expect ( tx ) . revertedWith ( 'Caller must be Controller governor' )
513
+ } )
514
+ } )
515
+
516
+ describe ( 'setTokenDescriptor' , function ( ) {
517
+ it ( 'should set `tokenDescriptor`' , async function ( ) {
518
+ const newTokenDescriptor = gns . address // I just use any contract address
519
+ const tx = gns . connect ( governor . signer ) . setTokenDescriptor ( newTokenDescriptor )
520
+ await expect ( tx ) . emit ( gns , 'TokenDescriptorUpdated' ) . withArgs ( newTokenDescriptor )
521
+ expect ( await gns . tokenDescriptor ( ) ) . eq ( newTokenDescriptor )
522
+ } )
523
+
524
+ it ( 'revert set to empty address' , async function ( ) {
525
+ const tx = gns . connect ( governor . signer ) . setTokenDescriptor ( AddressZero )
526
+ await expect ( tx ) . revertedWith ( 'NFT: Invalid token descriptor' )
527
+ } )
528
+
529
+ it ( 'revert set to non-contract' , async function ( ) {
530
+ const tx = gns . connect ( governor . signer ) . setTokenDescriptor ( randomHexBytes ( 20 ) )
531
+ await expect ( tx ) . revertedWith ( 'NFT: Invalid token descriptor' )
532
+ } )
533
+ } )
534
+ } )
535
+
493
536
describe ( 'Publishing names and versions' , function ( ) {
494
537
describe ( 'setDefaultName' , function ( ) {
495
538
it ( 'setDefaultName emits the event' , async function ( ) {
@@ -865,26 +908,6 @@ describe('GNS', () => {
865
908
await mintSignal ( me , subgraph . id , tokensToDeposit )
866
909
}
867
910
} )
868
-
869
- describe ( 'setOwnerTaxPercentage' , function ( ) {
870
- const newValue = 10
871
-
872
- it ( 'should set `ownerTaxPercentage`' , async function ( ) {
873
- // Can set if allowed
874
- await gns . connect ( governor . signer ) . setOwnerTaxPercentage ( newValue )
875
- expect ( await gns . ownerTaxPercentage ( ) ) . eq ( newValue )
876
- } )
877
-
878
- it ( 'reject set `ownerTaxPercentage` if out of bounds' , async function ( ) {
879
- const tx = gns . connect ( governor . signer ) . setOwnerTaxPercentage ( 1000001 )
880
- await expect ( tx ) . revertedWith ( 'Owner tax must be MAX_PPM or less' )
881
- } )
882
-
883
- it ( 'reject set `ownerTaxPercentage` if not allowed' , async function ( ) {
884
- const tx = gns . connect ( me . signer ) . setOwnerTaxPercentage ( newValue )
885
- await expect ( tx ) . revertedWith ( 'Caller must be Controller governor' )
886
- } )
887
- } )
888
911
} )
889
912
} )
890
913
@@ -938,7 +961,7 @@ describe('GNS', () => {
938
961
939
962
it ( 'should revert if batching a call to initialize' , async function ( ) {
940
963
// Call a forbidden function
941
- const tx1 = await gns . populateTransaction . initialize ( me . address , me . address )
964
+ const tx1 = await gns . populateTransaction . initialize ( me . address , me . address , me . address )
942
965
943
966
// Create a subgraph
944
967
const tx2 = await gns . populateTransaction . publishNewSubgraph (
0 commit comments