Please, take a look at this functiondeployeLptoken it uses CREATE opcode to deploy a new contract at the instance of sdexBeaconProxy contract. In the security aspect, I feel there can be reOrgs attacks due to creating a deployment of address with a deterministic nonce.
However is it possible for me to deploy my own Beacon proxy or the Beaconproxy here will be mine as soon as I make a deployment?
function deployLpToken(address base, address quote, uint256 poolIdx, address sdex) external returns(address) {
address lpTokenAddress = address(new SdexBeaconProxy(lpTokenBeaconAddress, abi.encodeWithSignature(
"initialize(address,address,uint256,address)",
base,
quote,
poolIdx,
sdex
)));
emit LpTokenCreated(base, quote, poolIdx, sdex, lpTokenAddress);
return lpTokenAddress;
}
While the contract logic may be identical, the control of the contract address matters significantly. The key issue is not about the contract logic but who controls the contract at the expected address.
The argument is that even if Bob deploys the LP token contract after a reorg, the contract will still be a valid SdexBeaconProxy contract with the same logic as intended by Alice. is this true?
My issue now is who controls the valid Sdexbeacon proxy?
Wont it be the person who deploys the toke when the original contract is pending before it get re-included in the block to a new address and an increment in a nonce?