Clone

Git Sourcearrow-up-right

Authors: Trader Joe, Solady (https://github.com/vectorized/solady/blob/main/src/utils/Clone.sol), Adapted from clones with immutable args by zefram.eth, Saw-mon & Natalie (https://github.com/Saw-mon-and-Natalie/clones-with-immutable-args)

Class with helper read functions for clone with immutable args.

Functions

_getArgBytes

Reads an immutable arg with type bytes

function _getArgBytes(uint256 argOffset, uint256 length) internal pure returns (bytes memory arg);

Parameters

Name
Type
Description

argOffset

uint256

The offset of the arg in the immutable args

length

uint256

The length of the arg

Returns

Name
Type
Description

arg

bytes

The immutable bytes arg

_getArgAddress

Reads an immutable arg with type address

function _getArgAddress(uint256 argOffset) internal pure returns (address arg);

Parameters

Name
Type
Description

argOffset

uint256

The offset of the arg in the immutable args

Returns

Name
Type
Description

arg

address

The immutable address arg

_getArgUint256

Reads an immutable arg with type uint256

Parameters

Name
Type
Description

argOffset

uint256

The offset of the arg in the immutable args

Returns

Name
Type
Description

arg

uint256

The immutable uint256 arg

_getArgUint256Array

Reads a uint256 array stored in the immutable args.

Parameters

Name
Type
Description

argOffset

uint256

The offset of the arg in the immutable args

length

uint256

The length of the arg

Returns

Name
Type
Description

arg

uint256[]

The immutable uint256 array arg

_getArgUint64

Reads an immutable arg with type uint64

Parameters

Name
Type
Description

argOffset

uint256

The offset of the arg in the immutable args

Returns

Name
Type
Description

arg

uint64

The immutable uint64 arg

_getArgUint16

Reads an immutable arg with type uint16

Parameters

Name
Type
Description

argOffset

uint256

The offset of the arg in the immutable args

Returns

Name
Type
Description

arg

uint16

The immutable uint16 arg

_getArgUint8

Reads an immutable arg with type uint8

Parameters

Name
Type
Description

argOffset

uint256

The offset of the arg in the immutable args

Returns

Name
Type
Description

arg

uint8

The immutable uint8 arg

_getImmutableArgsOffset

Reads the offset of the packed immutable args in calldata.

Returns

Name
Type
Description

offset

uint256

The offset of the packed immutable args in calldata.

Last updated