@@ -8,6 +8,7 @@ import { generateERC1155Options } from './erc1155';
8
8
import { generateAccountOptions } from './account' ;
9
9
import { generateCustomOptions } from './custom' ;
10
10
import { generateGovernorOptions } from './governor' ;
11
+ import { generateVestingOptions } from './vesting' ;
11
12
import { buildGeneric , GenericOptions , KindedOptions } from '../build-generic' ;
12
13
import { printContract } from '../print' ;
13
14
import { OptionsError } from '../error' ;
@@ -54,6 +55,12 @@ export function* generateOptions(kind?: Kind): Generator<GenericOptions> {
54
55
yield { kind : 'Governor' , ...kindOpts } ;
55
56
}
56
57
}
58
+
59
+ if ( ! kind || kind === 'Vesting' ) {
60
+ for ( const kindOpts of generateVestingOptions ( ) ) {
61
+ yield { kind : 'Vesting' , ...kindOpts } ;
62
+ }
63
+ }
57
64
}
58
65
59
66
interface GeneratedContract {
@@ -92,9 +99,27 @@ function generateContractSubset(subset: Subset, kind?: Kind): GeneratedContract[
92
99
return contracts ;
93
100
} else {
94
101
const getParents = ( c : GeneratedContract ) => c . contract . components . map ( p => p . path ) ;
102
+ function filterByUpgradeableSetTo ( isUpgradeable : boolean ) {
103
+ return ( c : GeneratedContract ) => {
104
+ switch ( c . options . kind ) {
105
+ case 'Vesting' :
106
+ return isUpgradeable === false ;
107
+ case 'Account' :
108
+ case 'ERC20' :
109
+ case 'ERC721' :
110
+ case 'ERC1155' :
111
+ case 'Governor' :
112
+ case 'Custom' :
113
+ return c . options . upgradeable === isUpgradeable ;
114
+ default :
115
+ const _ : never = c . options ;
116
+ throw new Error ( 'Unknown kind' ) ;
117
+ }
118
+ }
119
+ }
95
120
return [
96
- ...findCover ( contracts . filter ( c => c . options . upgradeable ) , getParents ) ,
97
- ...findCover ( contracts . filter ( c => ! c . options . upgradeable ) , getParents ) ,
121
+ ...findCover ( contracts . filter ( filterByUpgradeableSetTo ( true ) ) , getParents ) ,
122
+ ...findCover ( contracts . filter ( filterByUpgradeableSetTo ( false ) ) , getParents ) ,
98
123
] ;
99
124
}
100
125
}
0 commit comments