Phoenix-Protocol-Group / phoenix-contracts

Source code of the smart contracts of the Phoenix DeFi hub DEX protocol
GNU General Public License v3.0
10 stars 6 forks source link

[V-PHX-VUL-023] Incorrect event topic when providing liquidity #182

Closed gangov closed 8 months ago

gangov commented 8 months ago

At the end of the function provide_liquidity the code publish some events:

Events published in the provide_liquidity function.

env.events()
    .publish(("provide_liquidity", "sender"), sender);
env.events()
    .publish(("provide_liquidity", "token_a"), &config.token_a);
env.events()
    .publish(("provide_liquidity", "token_a-amount"), amounts.0);
env.events()
    .publish(("provide_liquidity", "token_a"), &config.token_b);
env.events()
    .publish(("provide_liquidity", "token_b-amount"), amounts.1);

The 4th event’s topic is wrong, it should be token_b instead of token_a.

Impact

Event will be published with the wrong topic

Recommendation

Change token_a to token_b.