@@ -66,10 +66,10 @@ export function buildERC20(opts: ERC20Options): ContractBuilder {
66
66
// addMintable(c);
67
67
// }
68
68
69
- // if (allOpts.votes) {
70
- // const clockMode = allOpts.votes === true ? clockModeDefault : allOpts.votes;
71
- // addVotes(c, clockMode);
72
- // }
69
+ if ( allOpts . votes ) {
70
+ const clockMode = allOpts . votes === true ? clockModeDefault : allOpts . votes ;
71
+ addVotes ( c , clockMode ) ;
72
+ }
73
73
74
74
setInfo ( c , info ) ;
75
75
@@ -84,7 +84,6 @@ function addBase(c: ContractBuilder, name: string, symbol: string) {
84
84
c . addParent ( ERC20 , [ name , symbol ] ) ;
85
85
86
86
c . addOverride ( ERC20 , functions . _update ) ;
87
- c . addOverride ( ERC20 , functions . _approve ) ; // allows override from stablecoin
88
87
}
89
88
90
89
export const premintPattern = / ^ ( \d * ) (?: \. ( \d + ) ) ? (?: e ( \d + ) ) ? $ / ;
@@ -147,35 +146,19 @@ function checkPotentialPremintOverflow(baseUnits: bigint, decimalPlace: number)
147
146
}
148
147
}
149
148
150
- function addMintable ( c : ContractBuilder ) { // TODO change to wrappable
151
- c . addFunctionCode ( '_mint(to, amount);' , functions . mint ) ;
152
- }
149
+ // function addMintable(c: ContractBuilder) { // TODO change to wrappable
150
+ // c.addFunctionCode('_mint(to, amount);', functions.mint);
151
+ // }
153
152
154
153
function addVotes ( c : ContractBuilder , clockMode : ClockMode ) {
155
- // TODO: Is Permit required?
156
- // if (!c.parents.some(p => p.contract.name === 'ERC20Permit')) {
157
- // throw new Error('Missing ERC20Permit requirement for ERC20Votes');
158
- // }
159
-
160
- const ERC20Votes = {
161
- name : 'ERC20Votes' ,
162
- path : '@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol' ,
154
+ const ConfidentialFungibleTokenVotes = {
155
+ name : 'ConfidentialFungibleTokenVotes' ,
156
+ path : '@openzeppelin/confidential-contracts/token/extensions/ConfidentialFungibleTokenVotes.sol' ,
163
157
} ;
164
- c . addParent ( ERC20Votes ) ;
165
- c . addOverride ( ERC20Votes , functions . _update ) ;
166
-
167
- c . addImportOnly ( {
168
- name : 'Nonces' ,
169
- path : '@openzeppelin/contracts/utils/Nonces.sol' ,
170
- } ) ;
171
- c . addOverride (
172
- {
173
- name : 'Nonces' ,
174
- } ,
175
- functions . nonces ,
176
- ) ;
177
-
178
- setClockMode ( c , ERC20Votes , clockMode ) ;
158
+ c . addParent ( ConfidentialFungibleTokenVotes ) ;
159
+ c . addOverride ( ConfidentialFungibleTokenVotes , functions . _update ) ;
160
+
161
+ setClockMode ( c , ConfidentialFungibleTokenVotes , clockMode ) ;
179
162
}
180
163
181
164
export const functions = defineFunctions ( {
@@ -184,48 +167,8 @@ export const functions = defineFunctions({
184
167
args : [
185
168
{ name : 'from' , type : 'address' } ,
186
169
{ name : 'to' , type : 'address' } ,
187
- { name : 'value' , type : 'uint256' } ,
188
- ] ,
189
- } ,
190
-
191
- _approve : {
192
- kind : 'internal' as const ,
193
- args : [
194
- { name : 'owner' , type : 'address' } ,
195
- { name : 'spender' , type : 'address' } ,
196
- { name : 'value' , type : 'uint256' } ,
197
- { name : 'emitEvent' , type : 'bool' } ,
198
- ] ,
199
- } ,
200
-
201
- mint : {
202
- kind : 'public' as const ,
203
- args : [
204
- { name : 'to' , type : 'address' } ,
205
- { name : 'amount' , type : 'uint256' } ,
170
+ { name : 'amount' , type : 'euint64' } ,
206
171
] ,
207
172
} ,
208
173
209
- pause : {
210
- kind : 'public' as const ,
211
- args : [ ] ,
212
- } ,
213
-
214
- unpause : {
215
- kind : 'public' as const ,
216
- args : [ ] ,
217
- } ,
218
-
219
- snapshot : {
220
- kind : 'public' as const ,
221
- args : [ ] ,
222
- } ,
223
-
224
- nonces : {
225
- kind : 'public' as const ,
226
- args : [ { name : 'owner' , type : 'address' } ] ,
227
- returns : [ 'uint256' ] ,
228
- mutability : 'view' as const ,
229
- } ,
230
-
231
174
} ) ;
0 commit comments