Crypto Toffe
  • 💡Crypto Toffe
  • Introduction
    • Overview
    • Our Features
  • Crypto Toffe Coin (CTP)
    • Overview
    • Tokenomics
    • Roadmap
    • Token Distribution
      • Waitlist Round 1
      • Waitlist Round 2
      • Holder
  • Smart Contract
    • Deploy
    • Deploy (CTP)
    • API Reference
  • Legal Disclaimer
    • Legal
    • Risk Disclosure
Powered by GitBook
On this page
  • execute
  • executeBatch
  • _call
  • _canSetContractURI
  • _setupRole
  • _revokeRole
  1. Smart Contract

API Reference

PreviousDeploy (CTP)NextLegal

Last updated 1 year ago

execute

Executes a transaction (called directly from an admin, or by entryPoint)

_target

The target contract to call.

_value

The amount of native tokens to send to the target contract.

_calldata

The bytes calldata to send to the target contract.

function execute(
    address _target,
    uint256 _value,
    bytes calldata _calldata
) external virtual onlyAdminOrEntrypoint {
    _call(_target, _value, _calldata);
}

executeBatch

Executes a sequence transaction (called directly from an admin, or by entryPoint)

The target contracts to call.

The amounts of native tokens to send to the target contracts.

The bytes calldata to send to the target contracts.

function executeBatch(
    address[] calldata _target,
    uint256[] calldata _value,
    bytes[] calldata _calldata
) external virtual onlyAdminOrEntrypoint {
    require(_target.length == _calldata.length && _target.length == _value.length, "Account: wrong array lengths.");
    for (uint256 i = 0; i < _target.length; i++) {
        _call(_target[i], _value[i], _calldata[i]);
    }
}

_call

Calls a target contract and reverts if it fails.

The target contract to call.

The amount of native tokens to send to the target contract.

The bytes calldata to send to the target contract.

function _call(
    address _target,
    uint256 value,
    bytes memory _calldata
) internal {
    (bool success, bytes memory result) = _target.call{ value: value }(_calldata);
    if (!success) {
        assembly {
            revert(add(result, 32), mload(result))
        }
    }
}

_canSetContractURI

Returns whether contract metadata can be set in the given execution context.

function _canSetContractURI() internal view virtual override returns (bool) {
    return hasRole(DEFAULT_ADMIN_ROLE, msg.sender);
}

_setupRole

Registers a signer in the factory.

The role to set up. Must be of type bytes32.

The address of the account to register for the role.

function _setupRole(bytes32 role, address account) internal virtual override {
    super._setupRole(role, account);
    if (role == SIGNER_ROLE && factory.code.length > 0) {
        IAccountFactory(factory).addSigner(account);
    }
}

_revokeRole

Un-registers a signer in the factory.

The role to revoke. Must be of type bytes32.

The address of the account to un-register for the role.

function _revokeRole(bytes32 role, address account) internal virtual override {
    super._revokeRole(role, account);
    if (role == SIGNER_ROLE && factory.code.length > 0) {
        IAccountFactory(factory).removeSigner(account);
    }
}

_target

_value

_calldata

_target

_value

_calldata

role

account

role

account

​
​
​
​
​
​
​
​
​
​
​
​
​