This data comes from stakePool.nonMyopicMemberRewards
, which comes from stakePools
, which comes from staking
, which comes from the store. This is in the delegation center page code around line 81. So effectively this all happens at the API endpoint where the data that Daedalus uses comes from. The calculation doesn't happen in the Daedalus wallet code.
Here is the call to get the stake pools https://github.com/input-output-hk/daedalus/blob/0c4944dbd650f51d18d4f15add0001bac9f2445c/source/renderer/app/api/staking/requests/getStakePools.ts
The actual ranking appears to be here: https://github.com/input-output-hk/cardano-wallet/blob/4a3aff30f8a6f755115e8492ed0a6909f7bf8b65/lib/wallet/src/Cardano/Wallet/Pools.hs#L346https://github.com/input-output-hk/cardano-wallet/blob/4a3aff30f8a6f755115e8492ed0a6909f7bf8b65/lib/wallet/src/Cardano/Pool/Rank.hs#L299
This also might be helpful: https://gist.github.com/ilap/ad088d31e542f73685a3a245b3ad6c50