creating pool can lead to some race conditions, if two or more users will in the same block try deposit tokens which don;t have pool already.
If some people will want to drop some "low" value token the first guys will get the best price.
Such possibility of race conditions can lead to some races.
Multi creation of the same pool for token X1 can lead to errors in logic of application.
As user You will not sell your hot "bad" coin before others. You will need to race with others paying much more gas.
Your transaction will be reverted if you loose the race and some else will create the pool for this token.
or in worst case scenario , many pools will be created and your funds will be lost.
code review, slither.
Reentrancy guard or similar solution for creation of new pool
bool private locked;
modifier noReentrancy() {
require(!locked, "Reentrant call detected");
locked = true;
_;
locked = false;
}
function createPool(address tokenAddress) external noReentrancy returns (address) {
if (s_pools[tokenAddress] != address(0)) {
revert PoolFactory__PoolAlreadyExists(tokenAddress);
}
// rest of the code
}
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.