Assessment reports>Awaken Swap>Discussion>Virtual addresses are not actually used

Virtual addresses are not actually used

The AElf protocol allows contracts to call other contracts as any of their virtual addresses, in order for a contract to more easily hold tokens on behalf of a separate agent.

The AwakenSwap contract uses virtual addresses to represent pools, but it does not actually hold assets using these virtual addresses, preferring instead to internally record which assets belong to which pool using the state variable PoolBalanceMap.

Since they will not be used as callers, it would save contract processing time to not have to hash and calculate the virtual addresses for the pools. Alternatively, to better utilize the underlying protocol, and to create a more user-friendly way of viewing what assets are in what pools, it would be better to use the virtual addresses to store pool assets and actually transfer the assets between virtual addresses when swapping.

Zellic © 2024Back to top ↑