shift
  • Introduction
  • Underlying factors for developing shift
  • Get started
    • How to choose the Vault
    • How to deposit
    • How to withdraw
    • How to shuffle between Vault versions
    • How to track the balance
    • How to review transactions history
    • Emergency situation
  • SHIFT Products
    • Vault
    • DeFi strategy
    • Vault for Financial Institutes
  • Risk Management
    • Overview
    • Risk Assessment and Management Policy
    • Risk Mitigation
  • Developer Resources
    • Ecosystem overview
    • Vault contract
      • Position status logic
    • DEFII
      • Logic contract
      • LocalDefii contract
      • RemoteDefiiPrincipal contract
      • RemoteDefiiAgent contract
      • Instructions
    • OperatorRegistry contract
    • Emergency situations
    • Deployment addresses
  • Vaults
    • USD - Risk Level 3
  • FAQ
    • General
    • Fee terms
    • Platform design
    • Emergency
    • Utility
    • Security
    • Communication
  • Resources
    • Discord
    • Medium
    • Twitter
    • Telegram
    • Github
Powered by GitBook
On this page
  • Read functions
  • Write functions
  1. Developer Resources

OperatorRegistry contract

Last updated 1 year ago

Here is the translation of the provided information:

Operator - an account that can perform entry and exit operations in DEFII on behalf of a user. To allow an operator to handle deposits, the user must grant permission for the operator to manage their funds. The OperatorRegistry smart contract stores all user approvals. This contract is also used to check access by contracts in the SHIFT ecosystem.

OperatorRegistry uses to ensure that a user's permissions are granted on a single network, meaning the user does not need to approve the operator on different networks.

Access can be granted to a specific smart contract or to all contracts in the ecosystem.

Read functions

ALL

Constant indicating that the user has granted the operator access to all smart contracts in the ecosystem.

address public constant ALL = address(0xa11);

APPROVE_OPERATOR_SELECTOR

Selector for the function that grants access to the operator.

bytes32 constant APPROVE_OPERATOR_SELECTOR;

DOMAIN_SEPARATOR

Domain separator for permits. For additional information, see .

bytes32 immutable DOMAIN_SEPARATOR_COMMON;

DOMAIN_SEPARATOR_CHAIN_SPECIFIC

Domain separator for approvals on actions on a specific chain.

bytes32 immutable DOMAIN_SEPARATOR_CHAIN_SPECIFIC;

nonce

Mapping with nonces. Nonces are provided for replay protection.

mapping(address => uint256) public nonce;

Write functions

approveOperator

Grants the operator access to perform actions on behalf of the user on a specific contract or on all contracts in the SHIFT ecosystem.

function approveOperator(address operator, address forAddress) external;
Parameter
Type
Definition

operator

address

Operator address

forAddress

address

Address of the contract for which access is granted

approveOperatorWithPermit

Similar to approveOperator but using permit.

function approveOperatorWithPermit(
        address user,
        address operator,
        address forAddress,
        uint256 chainId,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;
Parameter
Type
Definition

user

address

User granting access

operator

address

Operator's address

forAddress

address

Address of the contract for which access is granted

chainId

uint256

Network ID of the contract

v

uint8

Permit V parameter

r

bytes32

Permit R parameter

s

bytes32

Permit S parameter

removeOperator

Revokes access from the operator.

function removeOperator(address operator, address forAddress) external;
Parameter
Type
Definition

operator

address

Operator from whom msg.sender is revoking access

forAddress

address

Address of the smart contract for which access is restricted

isOperatorApprovedForAddress

Checks if the operator has access to a specific smart contract.

EIP-2612
EIP-2612