caelum0x 2b68bde5d5 Predikt: full Polymarket-style prediction market — web + mobile + on-chain + bots
Working tree is now the canonical repo. Off-chain play-money + trustless on-chain
(FPMM AMM + CLOB via UMA settlement), AI market factory, creator/social/distribution,
mobile shell + push, one-command demo + deploy-kit. Secrets excluded (see ENV-AND-KEYS.md).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-06 23:29:50 +03:00

2.9 KiB

LibCall

Library for making calls.

Note:

  • The arguments of the functions may differ from the libraries. Please read the functions carefully before use.

Custom Errors

TargetIsNotContract()

error TargetIsNotContract()

The target of the call is not a contract.

DataTooShort()

error DataTooShort()

The data is too short to contain a function selector.

Contract Call Operations

These functions will revert if called on a non-contract
(i.e. address without code).
They will bubble up the revert if the call fails.

callContract(address,uint256,bytes)

function callContract(address target, uint256 value, bytes memory data)
    internal
    returns (bytes memory result)

Makes a call to target, with data and value.

callContract(address,bytes)

function callContract(address target, bytes memory data)
    internal
    returns (bytes memory result)

Makes a call to target, with data.

staticCallContract(address,bytes)

function staticCallContract(address target, bytes memory data)
    internal
    view
    returns (bytes memory result)

Makes a static call to target, with data.

delegateCallContract(address,bytes)

function delegateCallContract(address target, bytes memory data)
    internal
    returns (bytes memory result)

Makes a delegate call to target, with data.

Try Call Operations

These functions enable gas limited calls to be performed,
with a cap on the number of return data bytes to be copied.
The can be used to ensure that the calling contract will not
run out-of-gas.

tryCall(address,uint256,uint256,uint16,bytes)

function tryCall(
    address target,
    uint256 value,
    uint256 gasStipend,
    uint16 maxCopy,
    bytes memory data
)
    internal
    returns (bool success, bool exceededMaxCopy, bytes memory result)

Makes a call to target, with data and value.
The call is given a gas limit of gasStipend,
and up to maxCopy bytes of return data can be copied.

tryStaticCall(address,uint256,uint16,bytes)

function tryStaticCall(
    address target,
    uint256 gasStipend,
    uint16 maxCopy,
    bytes memory data
)
    internal
    view
    returns (bool success, bool exceededMaxCopy, bytes memory result)

Makes a call to target, with data.
The call is given a gas limit of gasStipend,
and up to maxCopy bytes of return data can be copied.

Other Operations

bubbleUpRevert(bytes)

function bubbleUpRevert(bytes memory revertReturnData) internal pure

Bubbles up the revert.

setSelector(bytes4,bytes)

function setSelector(bytes4 newSelector, bytes memory data) internal pure

In-place replaces the function selector of encoded contract call data.