Skip to content

Commit 8d5d72b

Browse files
committed
Fix compile
1 parent fa05ec3 commit 8d5d72b

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

packages/core/zama/src/confidentialFungible.ts

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ export function buildConfidentialFungible(opts: ConfidentialFungibleOptions): Co
6868
// addMintable(c);
6969
// }
7070

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+
}
7575

7676
setInfo(c, info);
7777

@@ -163,7 +163,13 @@ function checkPotentialPremintOverflow(baseUnits: bigint, decimalPlace: number)
163163
// c.addFunctionCode('_mint(to, amount);', functions.mint);
164164
// }
165165

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+
167173
const ConfidentialFungibleTokenVotes = {
168174
name: 'ConfidentialFungibleTokenVotes',
169175
path: '@openzeppelin/confidential-contracts/token/extensions/ConfidentialFungibleTokenVotes.sol',
@@ -172,6 +178,10 @@ function addVotes(c: ContractBuilder, clockMode: ClockMode) {
172178
c.addOverride(ConfidentialFungibleTokenVotes, functions._update);
173179
c.addOverride(ConfidentialFungibleTokenVotes, functions.confidentialTotalSupply);
174180

181+
// TODO Should this have some functional default implementation?
182+
c.addModifier('override', functions._validateHandleAllowance);
183+
c.addFunctionCode('// TODO', functions._validateHandleAllowance);
184+
175185
setClockMode(c, ConfidentialFungibleTokenVotes, clockMode);
176186
}
177187

@@ -183,11 +193,19 @@ export const functions = defineFunctions({
183193
{ name: 'to', type: 'address' },
184194
{ name: 'amount', type: 'euint64' },
185195
],
196+
returns: ['euint64 transferred'],
186197
},
187198
confidentialTotalSupply: {
188199
kind: 'public' as const,
189200
mutability: 'view',
190201
args: [],
191202
returns: ['euint64'],
192203
},
204+
_validateHandleAllowance: {
205+
kind: 'internal' as const,
206+
mutability: 'view' as const,
207+
args: [
208+
{ name: 'handle', type: 'bytes32' },
209+
],
210+
}
193211
});

0 commit comments

Comments
 (0)