@@ -3,13 +3,12 @@ import {
33 getFollowerAddresses ,
44 getFollowerDAOs ,
55 getFollowerFids ,
6- getProposalFromPropdate ,
6+ getProposalFromId ,
77 getUserFid ,
88} from '@/commands'
99import { logger } from '@/logger'
1010import { addToQueue } from '@/queue'
11- import { getAttestations } from '@/services/builder/get-propdate-attestations'
12- import { shortenAddress } from '@/utils'
11+ import { getPropdateAttestations } from '@/services/eas/get-propdate-attestations'
1312import { filter , pipe } from 'remeda'
1413import { JsonValue } from 'type-fest'
1514
@@ -20,9 +19,9 @@ import { JsonValue } from 'type-fest'
2019 */
2120async function handleProposalUpdates ( ) {
2221 try {
23- logger . info ( 'Fetching new updates ...' )
24- const { propdates } = await getAttestations ( )
25- logger . info ( { propdates } , 'New updates retrieved.' )
22+ logger . info ( 'Fetching new propdates ...' )
23+ const { propdates } = await getPropdateAttestations ( )
24+ logger . info ( { propdates } , 'New propdates retrieved.' )
2625
2726 const userFid = await getUserFid ( )
2827 logger . debug ( { userFid } , 'User FID retrieved.' )
@@ -89,27 +88,26 @@ async function handleProposalUpdates() {
8988 for ( const propdate of propdates ) {
9089 logger . debug (
9190 {
92- proposalId : shortenAddress ( propdate . proposalId ) ,
93- propdateId : shortenAddress ( propdate . id ) ,
91+ propdateId : propdate . id ,
92+ proposalId : propdate . proposalId ,
9493 } ,
9594 'Processing proposal update for follower.' ,
9695 )
9796
98- // get dao and proposal data from dao treasury address
99- const proposal = await getProposalFromPropdate (
97+ // get proposal data from proposal id
98+ const proposal = await getProposalFromId (
10099 propdate . chain ,
101- propdate . id ,
102100 propdate . proposalId ,
103101 )
104102
105- if ( proposal === null || propdate . proposalId === '0x' ) {
103+ if ( ! proposal ) {
106104 // skip if proposal doesn't exist or Json parsing error
107105 logger . debug (
108106 {
109- proposalId : shortenAddress ( propdate . proposalId ) ,
110- propdateId : shortenAddress ( propdate . id ) ,
107+ propdateId : propdate . id ,
108+ proposalId : propdate . proposalId ,
111109 } ,
112- 'proposal update for skipped .' ,
110+ 'Proposal not found, skipping .' ,
113111 )
114112 continue
115113 }
@@ -118,8 +116,8 @@ async function handleProposalUpdates() {
118116 if ( ! daos . includes ( proposal . dao . id ) ) {
119117 logger . debug (
120118 {
121- proposalId : shortenAddress ( propdate . proposalId ) ,
122- propdateId : shortenAddress ( propdate . id ) ,
119+ propdateId : propdate . id ,
120+ proposalId : propdate . proposalId ,
123121 follower,
124122 } ,
125123 'Proposal DAO ID not associated with follower, skipping.' ,
@@ -131,8 +129,8 @@ async function handleProposalUpdates() {
131129 if ( notifiedUpdatesSet . has ( propdate . id ) ) {
132130 logger . debug (
133131 {
134- proposalId : shortenAddress ( propdate . proposalId ) ,
135- propdateId : shortenAddress ( propdate . id ) ,
132+ propdateId : propdate . id ,
133+ proposalId : propdate . proposalId ,
136134 follower,
137135 } ,
138136 'Proposal update already notified, skipping.' ,
@@ -143,8 +141,8 @@ async function handleProposalUpdates() {
143141 // Add the proposal to the queue for notifications
144142 logger . info (
145143 {
146- proposalId : shortenAddress ( propdate . proposalId ) ,
147- propdateId : shortenAddress ( propdate . id ) ,
144+ propdateId : propdate . id ,
145+ proposalId : propdate . proposalId ,
148146 follower,
149147 } ,
150148 'Adding proposal update to notification queue.' ,
@@ -160,8 +158,8 @@ async function handleProposalUpdates() {
160158 notifiedUpdatesSet . add ( propdate . id )
161159 logger . debug (
162160 {
163- proposalId : shortenAddress ( propdate . proposalId ) ,
164- propdateId : shortenAddress ( propdate . id ) ,
161+ propdateId : propdate . id ,
162+ proposalId : propdate . proposalId ,
165163 follower,
166164 } ,
167165 'Proposal Update marked as notified.' ,
0 commit comments