@@ -68,10 +68,10 @@ export function buildConfidentialFungible(opts: ConfidentialFungibleOptions): Co
68
68
// addMintable(c);
69
69
// }
70
70
71
- // if (allOpts.votes) {
72
- // const clockMode = allOpts.votes === true ? clockModeDefault : allOpts.votes;
73
- // addVotes(c, clockMode);
74
- // }
71
+ if ( allOpts . votes ) {
72
+ const clockMode = allOpts . votes === true ? clockModeDefault : allOpts . votes ;
73
+ addVotes ( c , allOpts . name , clockMode ) ;
74
+ }
75
75
76
76
setInfo ( c , info ) ;
77
77
@@ -163,7 +163,13 @@ function checkPotentialPremintOverflow(baseUnits: bigint, decimalPlace: number)
163
163
// c.addFunctionCode('_mint(to, amount);', functions.mint);
164
164
// }
165
165
166
- function addVotes ( c : ContractBuilder , clockMode : ClockMode ) {
166
+ function addVotes ( c : ContractBuilder , name : string , clockMode : ClockMode ) {
167
+ const EIP712 = {
168
+ name : 'EIP712' ,
169
+ path : '@openzeppelin/contracts/utils/cryptography/EIP712.sol' ,
170
+ } ;
171
+ c . addParent ( EIP712 , [ name , '1' ] ) ;
172
+
167
173
const ConfidentialFungibleTokenVotes = {
168
174
name : 'ConfidentialFungibleTokenVotes' ,
169
175
path : '@openzeppelin/confidential-contracts/token/extensions/ConfidentialFungibleTokenVotes.sol' ,
@@ -172,6 +178,10 @@ function addVotes(c: ContractBuilder, clockMode: ClockMode) {
172
178
c . addOverride ( ConfidentialFungibleTokenVotes , functions . _update ) ;
173
179
c . addOverride ( ConfidentialFungibleTokenVotes , functions . confidentialTotalSupply ) ;
174
180
181
+ // TODO Should this have some functional default implementation?
182
+ c . addModifier ( 'override' , functions . _validateHandleAllowance ) ;
183
+ c . addFunctionCode ( '// TODO' , functions . _validateHandleAllowance ) ;
184
+
175
185
setClockMode ( c , ConfidentialFungibleTokenVotes , clockMode ) ;
176
186
}
177
187
@@ -183,11 +193,19 @@ export const functions = defineFunctions({
183
193
{ name : 'to' , type : 'address' } ,
184
194
{ name : 'amount' , type : 'euint64' } ,
185
195
] ,
196
+ returns : [ 'euint64 transferred' ] ,
186
197
} ,
187
198
confidentialTotalSupply : {
188
199
kind : 'public' as const ,
189
200
mutability : 'view' ,
190
201
args : [ ] ,
191
202
returns : [ 'euint64' ] ,
192
203
} ,
204
+ _validateHandleAllowance : {
205
+ kind : 'internal' as const ,
206
+ mutability : 'view' as const ,
207
+ args : [
208
+ { name : 'handle' , type : 'bytes32' } ,
209
+ ] ,
210
+ }
193
211
} ) ;
0 commit comments