# Delegator

View Source: @nomisma/elektro-protocol-aux/contracts/delegate/Delegator.sol

**↘ Derived Contracts: ElektroEventEmitterRouter, ElektroRegistryAdmin, ElektroRegistryRouter, FundLockRouter, FundLockStorage, TokenManagerAdmin**

**Delegator**

Contract contains extracted common logic for call delegation. Contracts that are delegating calls are extending Delegator contract

## Functions

* [delegate(address calleeContract, bytes parameters, string errorMsg)](https://elektro.gitbook.io/elektro-protocol/smart-contracts/natspec-technical-documentation/proxy-pattern-base-logic/broken-reference)

### delegate

Delegates call to specified contract. If delegatecall fails, transaction is reverted Additional check is done to verify that contract to call exists

```js
function delegate(address calleeContract, bytes parameters, string errorMsg) internal nonpayable
returns(bytes)
```

**Returns**

result of delegatecall as bytes array. Those bytes can be used in contract that is delegating call

**Arguments**

| Name           | Type    | Description                                                      |
| -------------- | ------- | ---------------------------------------------------------------- |
| calleeContract | address | address of contract to delegate call to                          |
| parameters     | bytes   | function signature and parameters encoded to bytes               |
| errorMsg       | string  | error message to revert in case of failed delegatecall execution |
