@@ -10,6 +10,8 @@ import { getAccounts, randomHexBytes, Account, toGRT } from './lib/testHelpers'
1010import { NetworkFixture } from './lib/fixtures'
1111import { toBN , formatGRT } from './lib/testHelpers'
1212
13+ const { AddressZero } = ethers . constants
14+
1315// Entities
1416interface PublishSubgraph {
1517 subgraphDeploymentID : string
@@ -490,6 +492,47 @@ describe('GNS', () => {
490492 await fixture . tearDown ( )
491493 } )
492494
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+
493536 describe ( 'Publishing names and versions' , function ( ) {
494537 describe ( 'setDefaultName' , function ( ) {
495538 it ( 'setDefaultName emits the event' , async function ( ) {
@@ -865,26 +908,6 @@ describe('GNS', () => {
865908 await mintSignal ( me , subgraph . id , tokensToDeposit )
866909 }
867910 } )
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- } )
888911 } )
889912 } )
890913
@@ -938,7 +961,7 @@ describe('GNS', () => {
938961
939962 it ( 'should revert if batching a call to initialize' , async function ( ) {
940963 // 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 )
942965
943966 // Create a subgraph
944967 const tx2 = await gns . populateTransaction . publishNewSubgraph (
0 commit comments