Skip to content

Commit 5721b14

Browse files
authored
feat: update ABIs for SpaceRegistry, DaoSpace, and DaoFactory (#145)
Update SpaceRegistry, DaoSpace, and DaoFactory ABIs. Contract APIs now use space IDs (bytes16) instead of addresses for role management. ABI changes: - SpaceRegistry: enter() takes bytes16 space IDs; registerSpaceId() returns bytes16 - DaoSpaceFactory: createDAOSpaceProxy() takes bytes16[] for editors/members, adds initialTopicId/initialTopicData params - DaoSpace: all role functions use bytes16 space IDs; Tally field order changed Contract addresses updated: - SPACE_REGISTRY_ADDRESS: 0xB01683b2f0d38d43fcD4D9aAB980166988924132 - DAO_SPACE_FACTORY_ADDRESS: 0xE3CD5A8b4D80Bac6b1045b5Bd57262De35e2A620 Breaking change in getCreateDaoSpaceCalldata(): - initialEditors → initialEditorSpaceIds (bytes16[]) - initialMembers → initialMemberSpaceIds (bytes16[]) - Added optional initialTopicId (UUID string)
1 parent fb025a6 commit 5721b14

File tree

8 files changed

+113
-87
lines changed

8 files changed

+113
-87
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @graphprotocol/grc-20
22

3+
## 0.30.0
4+
5+
### Minor Changes
6+
7+
- 54a7b48: Update contracts and ABIs
8+
39
## 0.29.0
410

511
### Minor Changes

contracts.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ export const TESTNET = {
2525
PERSONAL_SPACE_ADMIN_PLUGIN_REPO_ADDRESS: '0xc368129A081aE3d3dbB0C6DeC408FbB097b73aE2',
2626
GOVERNANCE_PLUGIN_REPO_ADDRESS: '0x94A8FB48258E1094aa71fBc9F33196B7A9fFfb4f',
2727
DAO_FACTORY_ADDRESS: '0xb138AE700C352BB1aC75688e8ceCB98CDDaa7F09',
28-
DAO_SPACE_FACTORY_ADDRESS: '0x4612af0C74db41970158857E308dc43aD6C8f97C',
28+
DAO_SPACE_FACTORY_ADDRESS: '0xE3CD5A8b4D80Bac6b1045b5Bd57262De35e2A620',
2929
ENS_REGISTRY_ADDRESS: '0xD065A680075d0e27777bAa63CFFf17e1713a19Df',
3030
PLUGIN_SETUP_PROCESSOR_ADDRESS: '0x3C9be4b42B313318091344A261DCDCd02DCd5736',
31-
SPACE_REGISTRY_ADDRESS: '0x492BFF74b13ACF3CC249A98d079F0a6F1d07DD2f',
31+
SPACE_REGISTRY_ADDRESS: '0xB01683b2f0d38d43fcD4D9aAB980166988924132',
3232
} as const;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@graphprotocol/grc-20",
3-
"version": "0.29.0",
3+
"version": "0.30.0",
44
"license": "MIT",
55
"module": "./dist/index.js",
66
"types": "./dist/index.d.ts",

src/abis/dao-space-factory.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,14 +172,14 @@ export const abi = [
172172
type: 'tuple',
173173
},
174174
{
175-
internalType: 'address[]',
175+
internalType: 'bytes16[]',
176176
name: '_initialEditors',
177-
type: 'address[]',
177+
type: 'bytes16[]',
178178
},
179179
{
180-
internalType: 'address[]',
180+
internalType: 'bytes16[]',
181181
name: '_initialMembers',
182-
type: 'address[]',
182+
type: 'bytes16[]',
183183
},
184184
{
185185
internalType: 'bytes',
@@ -191,6 +191,16 @@ export const abi = [
191191
name: '_initialEditsMetadata',
192192
type: 'bytes',
193193
},
194+
{
195+
internalType: 'bytes16',
196+
name: '_initialTopicId',
197+
type: 'bytes16',
198+
},
199+
{
200+
internalType: 'bytes',
201+
name: '_initialTopicData',
202+
type: 'bytes',
203+
},
194204
],
195205
name: 'createDAOSpaceProxy',
196206
outputs: [

src/abis/dao-space.ts

Lines changed: 42 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@ export const abi = [
2929
name: 'InvalidAction',
3030
type: 'error',
3131
},
32-
{
33-
inputs: [],
34-
name: 'InvalidAddressForRole',
35-
type: 'error',
36-
},
3732
{
3833
inputs: [],
3934
name: 'InvalidCaller',
@@ -61,17 +56,17 @@ export const abi = [
6156
},
6257
{
6358
inputs: [],
64-
name: 'NotInitializing',
59+
name: 'InvalidSpaceIdForRole',
6560
type: 'error',
6661
},
6762
{
6863
inputs: [],
69-
name: 'OneActionForFastPath',
64+
name: 'NotInitializing',
7065
type: 'error',
7166
},
7267
{
7368
inputs: [],
74-
name: 'SpaceNotRegistered',
69+
name: 'OneActionForFastPath',
7570
type: 'error',
7671
},
7772
{
@@ -205,9 +200,9 @@ export const abi = [
205200
{
206201
inputs: [
207202
{
208-
internalType: 'address',
209-
name: '_newEditor',
210-
type: 'address',
203+
internalType: 'bytes16',
204+
name: '_newEditorSpaceId',
205+
type: 'bytes16',
211206
},
212207
],
213208
name: 'addEditor',
@@ -218,9 +213,9 @@ export const abi = [
218213
{
219214
inputs: [
220215
{
221-
internalType: 'address',
222-
name: '_newMember',
223-
type: 'address',
216+
internalType: 'bytes16',
217+
name: '_newMemberSpaceId',
218+
type: 'bytes16',
224219
},
225220
],
226221
name: 'addMember',
@@ -291,9 +286,9 @@ export const abi = [
291286
type: 'bool',
292287
},
293288
{
294-
internalType: 'address',
289+
internalType: 'bytes16',
295290
name: '_creator',
296-
type: 'address',
291+
type: 'bytes16',
297292
},
298293
{
299294
components: [
@@ -331,17 +326,17 @@ export const abi = [
331326
components: [
332327
{
333328
internalType: 'uint256',
334-
name: 'abstain',
329+
name: 'yes',
335330
type: 'uint256',
336331
},
337332
{
338333
internalType: 'uint256',
339-
name: 'yes',
334+
name: 'no',
340335
type: 'uint256',
341336
},
342337
{
343338
internalType: 'uint256',
344-
name: 'no',
339+
name: 'abstain',
345340
type: 'uint256',
346341
},
347342
],
@@ -383,9 +378,9 @@ export const abi = [
383378
type: 'bytes16',
384379
},
385380
{
386-
internalType: 'address',
387-
name: '_account',
388-
type: 'address',
381+
internalType: 'bytes16',
382+
name: '_voterSpaceId',
383+
type: 'bytes16',
389384
},
390385
],
391386
name: 'getLatestProposalVote',
@@ -420,9 +415,9 @@ export const abi = [
420415
type: 'bool',
421416
},
422417
{
423-
internalType: 'address',
418+
internalType: 'bytes16',
424419
name: '_creator',
425-
type: 'address',
420+
type: 'bytes16',
426421
},
427422
{
428423
components: [
@@ -460,17 +455,17 @@ export const abi = [
460455
components: [
461456
{
462457
internalType: 'uint256',
463-
name: 'abstain',
458+
name: 'yes',
464459
type: 'uint256',
465460
},
466461
{
467462
internalType: 'uint256',
468-
name: 'yes',
463+
name: 'no',
469464
type: 'uint256',
470465
},
471466
{
472467
internalType: 'uint256',
473-
name: 'no',
468+
name: 'abstain',
474469
type: 'uint256',
475470
},
476471
],
@@ -517,9 +512,9 @@ export const abi = [
517512
type: 'uint8',
518513
},
519514
{
520-
internalType: 'address',
521-
name: '_account',
522-
type: 'address',
515+
internalType: 'bytes16',
516+
name: '_voterSpaceId',
517+
type: 'bytes16',
523518
},
524519
],
525520
name: 'getProposalVote',
@@ -541,9 +536,9 @@ export const abi = [
541536
type: 'bytes32',
542537
},
543538
{
544-
internalType: 'address',
545-
name: '_account',
546-
type: 'address',
539+
internalType: 'bytes16',
540+
name: '_spaceId',
541+
type: 'bytes16',
547542
},
548543
],
549544
name: 'hasRole',
@@ -670,9 +665,9 @@ export const abi = [
670665
{
671666
inputs: [
672667
{
673-
internalType: 'address',
674-
name: '_oldEditor',
675-
type: 'address',
668+
internalType: 'bytes16',
669+
name: '_oldEditorSpaceId',
670+
type: 'bytes16',
676671
},
677672
],
678673
name: 'removeEditor',
@@ -683,9 +678,9 @@ export const abi = [
683678
{
684679
inputs: [
685680
{
686-
internalType: 'address',
687-
name: '_oldMember',
688-
type: 'address',
681+
internalType: 'bytes16',
682+
name: '_oldMemberSpaceId',
683+
type: 'bytes16',
689684
},
690685
],
691686
name: 'removeMember',
@@ -753,9 +748,9 @@ export const abi = [
753748
{
754749
inputs: [
755750
{
756-
internalType: 'address',
757-
name: '_space',
758-
type: 'address',
751+
internalType: 'bytes16',
752+
name: '_spaceId',
753+
type: 'bytes16',
759754
},
760755
],
761756
name: 'unrestrictSpace',
@@ -801,9 +796,9 @@ export const abi = [
801796
{
802797
inputs: [
803798
{
804-
internalType: 'address',
799+
internalType: 'bytes16',
805800
name: '',
806-
type: 'address',
801+
type: 'bytes16',
807802
},
808803
{
809804
internalType: 'bytes32',
@@ -882,9 +877,9 @@ export const abi = [
882877
{
883878
inputs: [
884879
{
885-
internalType: 'address',
886-
name: '_fromSpace',
887-
type: 'address',
880+
internalType: 'bytes16',
881+
name: '_fromSpaceId',
882+
type: 'bytes16',
888883
},
889884
{
890885
internalType: 'bytes32',

src/abis/space-registry.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -246,14 +246,14 @@ export const abi = [
246246
{
247247
inputs: [
248248
{
249-
internalType: 'address',
250-
name: '_fromSpace',
251-
type: 'address',
249+
internalType: 'bytes16',
250+
name: '_fromSpaceId',
251+
type: 'bytes16',
252252
},
253253
{
254-
internalType: 'address',
255-
name: '_toSpace',
256-
type: 'address',
254+
internalType: 'bytes16',
255+
name: '_toSpaceId',
256+
type: 'bytes16',
257257
},
258258
{
259259
internalType: 'bytes32',
@@ -403,7 +403,13 @@ export const abi = [
403403
},
404404
],
405405
name: 'registerSpaceId',
406-
outputs: [],
406+
outputs: [
407+
{
408+
internalType: 'bytes16',
409+
name: '_spaceId',
410+
type: 'bytes16',
411+
},
412+
],
407413
stateMutability: 'nonpayable',
408414
type: 'function',
409415
},

src/encodings/get-create-dao-space-calldata.test.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,12 @@ describe('getCreateDaoSpaceCalldata', () => {
140140
quorum: 1,
141141
durationInDays: 7,
142142
},
143-
initialEditors: [
144-
'0x1234567890123456789012345678901234567890',
145-
'0x2234567890123456789012345678901234567890',
146-
'0x3234567890123456789012345678901234567890',
143+
initialEditorSpaceIds: [
144+
'0x12345678901234567890123456789012' as `0x${string}`,
145+
'0x22345678901234567890123456789012' as `0x${string}`,
146+
'0x32345678901234567890123456789012' as `0x${string}`,
147147
],
148-
initialMembers: ['0xabcdefabcdefabcdefabcdefabcdefabcdefabcd'],
148+
initialMemberSpaceIds: ['0xabcdefabcdefabcdefabcdefabcdefab' as `0x${string}`],
149149
};
150150

151151
it('should generate valid calldata', () => {
@@ -155,8 +155,8 @@ describe('getCreateDaoSpaceCalldata', () => {
155155
});
156156

157157
it('should throw if no initial editors provided', () => {
158-
const args = { ...validArgs, initialEditors: [] };
159-
expect(() => getCreateDaoSpaceCalldata(args)).toThrow('At least one initial editor is required');
158+
const args = { ...validArgs, initialEditorSpaceIds: [] as `0x${string}`[] };
159+
expect(() => getCreateDaoSpaceCalldata(args)).toThrow('At least one initial editor space ID is required');
160160
});
161161

162162
it('should throw if voting settings are invalid', () => {
@@ -178,14 +178,13 @@ describe('getCreateDaoSpaceCalldata', () => {
178178
});
179179

180180
it('should accept empty initial members', () => {
181-
const args = { ...validArgs, initialMembers: [] };
181+
const args = { ...validArgs, initialMemberSpaceIds: [] as `0x${string}`[] };
182182
const calldata = getCreateDaoSpaceCalldata(args);
183183
expect(calldata).toBeTypeOf('string');
184184
expect(calldata.startsWith('0x')).toBe(true);
185185
});
186186

187-
it('should checksum addresses', () => {
188-
// Should not throw with lowercase addresses - uses validArgs which has 3 editors
187+
it('should accept space IDs', () => {
189188
const calldata = getCreateDaoSpaceCalldata(validArgs);
190189
expect(calldata).toBeTypeOf('string');
191190
});

0 commit comments

Comments
 (0)