hypha-dao / dao-contracts

Governance contracts for decentralized autonomous organizations
MIT License
10 stars 8 forks source link

Refactor peg token redeemption #367

Open Gerard097 opened 1 year ago

Gerard097 commented 1 year ago
n13 commented 1 year ago

Made one comment.

Also kinda wondering why tokens aren't in a document, so there could be an edge dao_id -> TOKEN_EDGE_NAME -> TokenDoc (pegToken, rewardToken) ... then we would not need an extra table?

Maybe too much for this PR but wondering why token info is in a separate table.

Gerard097 commented 1 year ago

Made one comment.

Also kinda wondering why tokens aren't in a document, so there could be an edge dao_id -> TOKEN_EDGE_NAME -> TokenDoc (pegToken, rewardToken) ... then we would not need an extra table?

Maybe too much for this PR but wondering why token info is in a separate table.

In a sense, we already do this as we store the tokens in the DAO's settings document i.e. dao_id -> settings -> SettingsDoc (reward_token, peg_token). The actual issue is that for transfer action we don't know the DAO ID in advance, and we need to do the lookup by the Token symbol. We could iterate over all the settings documents and search for the one that matches the token but that would be very inefficient and could lead to more timeouts

@n13

n13 commented 1 year ago

I see yeah because we don't get any info from the transfer listener other than the symbol... so we need to look up the symbol either way...