mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 20:29:23 +00:00
CREATE was originally intended for gas savings. While one sketch did move to CREATE2, the security concerns around address collisions (requiring all init codes not be malleable to achieve security) continue to justify this. To resolve the gas estimation concerns raised in the prior commit, the createAddress function has been made constant-gas.
14 lines
357 B
Solidity
14 lines
357 B
Solidity
// SPDX-License-Identifier: AGPL-3.0-only
|
|
pragma solidity ^0.8.26;
|
|
|
|
import "Router.sol";
|
|
|
|
// Wrap the Router with a contract which exposes the address
|
|
contract CreateAddress is Router {
|
|
constructor() Router(bytes32(uint256(1))) { }
|
|
|
|
function createAddressForSelf(uint256 nonce) external returns (address) {
|
|
return Router.createAddress(nonce);
|
|
}
|
|
}
|