Delegated to and from in erc20votes

I am working on a PoC and was inspired by tally.xyz.

In Tally, We can get info about - Delegation To and Received Delegation but in the contract, I get only the delegates method which shows delegation to.

How can I find delegated to and delegation from on the given address?

Hey @sachin_bisht,

The gist you provided is of an ERC20 without voting capabilities, you can see we have ERC20Votes as an extension that is compatible to use for Governor voting. Also, the delegation happens as a result of inheriting from the Votes module.

How can I find delegated to and delegation from on the given address?

You can reconstruct this information by reading the DelegateChanged and DelegateVotesChanged events the IVotes interface the ERC20Votes inherits from. I'd recommend taking a look at OpenZeppelin Subgraphs since we already have some example schemas that index this information although it might be a bit outdated.

Hope this helps