Skip to content

Commit

Permalink
Merge pull request #178 from 1inch/feature/update-doc-generator
Browse files Browse the repository at this point in the history
[SC-1287] Remove deprecated script for docgen
  • Loading branch information
zZoMROT authored Nov 14, 2024
2 parents 2ffa648 + 4d62e8a commit 97aa7b7
Show file tree
Hide file tree
Showing 19 changed files with 2,438 additions and 989 deletions.
87 changes: 87 additions & 0 deletions docs/CrosschainWhitelistRegistry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@

## CrosschainWhitelistRegistry

The contract manages a promotees for crosschain resolvers. It also includes an
emergency rescue function for tokens sent to the contract accidentally.

### Functions list
- [constructor(_whitelistRegistry) public](#constructor)
- [rescueFunds(token_, amount) external](#rescuefunds)
- [promote(chainId, promotee) external](#promote)
- [getPromotees(chainId) external](#getpromotees)

### Events list
- [Promotion(promoter, chainId, promotee) ](#promotion)

### Errors list
- [SamePromotee() ](#samepromotee)

### Functions
### constructor

```solidity
constructor(contract WhitelistRegistry _whitelistRegistry) public
```

### rescueFunds

```solidity
function rescueFunds(contract IERC20 token_, uint256 amount) external
```
Allows the contract owner to recover any tokens accidentally sent to the contract.

#### Parameters

| Name | Type | Description |
| ---- | ---- | ----------- |
| token_ | contract IERC20 | The token to recover. |
| amount | uint256 | The amount of tokens to recover. |

### promote

```solidity
function promote(uint256 chainId, address promotee) external
```
Registers a worker for the resolver to settle orders.

#### Parameters

| Name | Type | Description |
| ---- | ---- | ----------- |
| chainId | uint256 | The chain ID where the worker will assigned. |
| promotee | address | The worker's address. |

### getPromotees

```solidity
function getPromotees(uint256 chainId) external view returns (address[] promotees)
```
Returns the worker list for a particular chain ID.

#### Parameters

| Name | Type | Description |
| ---- | ---- | ----------- |
| chainId | uint256 | The chain ID to get the promoted addresses for. |

#### Return Values

| Name | Type | Description |
| ---- | ---- | ----------- |
promotees | address[] | A list of worker addresses. |

### Events
### Promotion

```solidity
event Promotion(address promoter, uint256 chainId, address promotee)
```
Emitted when a new worker for a resolver is set.

### Errors
### SamePromotee

```solidity
error SamePromotee()
```

133 changes: 133 additions & 0 deletions docs/FeeBank.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@

## FeeBank

FeeBank contract introduces a credit system for paying fees.
A user can deposit tokens to the FeeBank contract, obtain credits and then use them to pay fees.

_FeeBank is coupled with FeeBankCharger to actually charge fees._

### Functions list
- [constructor(charger, feeToken, owner) public](#constructor)
- [availableCredit(account) external](#availablecredit)
- [deposit(amount) external](#deposit)
- [depositFor(account, amount) external](#depositfor)
- [depositWithPermit(amount, permit) external](#depositwithpermit)
- [depositForWithPermit(account, amount, permit) public](#depositforwithpermit)
- [withdraw(amount) external](#withdraw)
- [withdrawTo(account, amount) external](#withdrawto)
- [gatherFees(accounts) external](#gatherfees)
- [_depositFor(account, amount) internal](#_depositfor)
- [_withdrawTo(account, amount) internal](#_withdrawto)
- [rescueFunds(token, amount) external](#rescuefunds)

### Errors list
- [ZeroAddress() ](#zeroaddress)

### Functions
### constructor

```solidity
constructor(contract IFeeBankCharger charger, contract IERC20 feeToken, address owner) public
```

### availableCredit

```solidity
function availableCredit(address account) external view returns (uint256)
```
See {IFeeBank-availableCredit}.

### deposit

```solidity
function deposit(uint256 amount) external returns (uint256)
```
See {IFeeBank-deposit}.

### depositFor

```solidity
function depositFor(address account, uint256 amount) external returns (uint256)
```
See {IFeeBank-depositFor}.

### depositWithPermit

```solidity
function depositWithPermit(uint256 amount, bytes permit) external returns (uint256)
```
See {IFeeBank-depositWithPermit}.

### depositForWithPermit

```solidity
function depositForWithPermit(address account, uint256 amount, bytes permit) public returns (uint256)
```
See {IFeeBank-depositForWithPermit}.

### withdraw

```solidity
function withdraw(uint256 amount) external returns (uint256)
```
See {IFeeBank-withdraw}.

### withdrawTo

```solidity
function withdrawTo(address account, uint256 amount) external returns (uint256)
```
See {IFeeBank-withdrawTo}.

### gatherFees

```solidity
function gatherFees(address[] accounts) external returns (uint256 totalAccountFees)
```
Admin method returns commissions spent by users.

#### Parameters

| Name | Type | Description |
| ---- | ---- | ----------- |
| accounts | address[] | Accounts whose commissions are being withdrawn. |

#### Return Values

| Name | Type | Description |
| ---- | ---- | ----------- |
totalAccountFees | uint256 | The total amount of accounts commissions. |

### _depositFor

```solidity
function _depositFor(address account, uint256 amount) internal returns (uint256 totalAvailableCredit)
```

### _withdrawTo

```solidity
function _withdrawTo(address account, uint256 amount) internal returns (uint256 totalAvailableCredit)
```

### rescueFunds

```solidity
function rescueFunds(contract IERC20 token, uint256 amount) external
```
Retrieves funds accidently sent directly to the contract address

#### Parameters

| Name | Type | Description |
| ---- | ---- | ----------- |
| token | contract IERC20 | ERC20 token to retrieve |
| amount | uint256 | amount to retrieve |

### Errors
### ZeroAddress

```solidity
error ZeroAddress()
```

73 changes: 73 additions & 0 deletions docs/FeeBankCharger.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@

## FeeBankCharger

FeeBankCharger contract implements logic to increase or decrease users' credits in FeeBank.

### Functions list
- [constructor(feeToken, owner) public](#constructor)
- [availableCredit(account) external](#availablecredit)
- [increaseAvailableCredit(account, amount) external](#increaseavailablecredit)
- [decreaseAvailableCredit(account, amount) external](#decreaseavailablecredit)
- [_chargeFee(account, fee) internal](#_chargefee)

### Errors list
- [OnlyFeeBankAccess() ](#onlyfeebankaccess)
- [NotEnoughCredit() ](#notenoughcredit)

### Functions
### constructor

```solidity
constructor(contract IERC20 feeToken, address owner) public
```

### availableCredit

```solidity
function availableCredit(address account) external view returns (uint256)
```
See {IFeeBankCharger-availableCredit}.

### increaseAvailableCredit

```solidity
function increaseAvailableCredit(address account, uint256 amount) external returns (uint256 allowance)
```
See {IFeeBankCharger-increaseAvailableCredit}.

### decreaseAvailableCredit

```solidity
function decreaseAvailableCredit(address account, uint256 amount) external returns (uint256 allowance)
```
See {IFeeBankCharger-decreaseAvailableCredit}.

### _chargeFee

```solidity
function _chargeFee(address account, uint256 fee) internal virtual
```
Internal function that charges a specified fee from a given account's credit allowance.

_Reverts with 'NotEnoughCredit' if the account's credit allowance is insufficient to cover the fee._

#### Parameters

| Name | Type | Description |
| ---- | ---- | ----------- |
| account | address | The address of the account from which the fee is being charged. |
| fee | uint256 | The amount of fee to be charged from the account. |

### Errors
### OnlyFeeBankAccess

```solidity
error OnlyFeeBankAccess()
```

### NotEnoughCredit

```solidity
error NotEnoughCredit()
```

Loading

0 comments on commit 97aa7b7

Please sign in to comment.