Skip to content

Commit

Permalink
docs: updates
Browse files Browse the repository at this point in the history
  • Loading branch information
PacificYield committed Jan 6, 2025
1 parent de71bf8 commit abc967b
Show file tree
Hide file tree
Showing 19 changed files with 1,244 additions and 380 deletions.
170 changes: 170 additions & 0 deletions docs/finance/ConfidentialVestingWallet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
## ConfidentialVestingWallet

This contract offers a simple vesting wallet for [ConfidentialERC20](../token/ERC20/IConfidentialERC20.md) tokens. This
is based on the
[VestingWallet.sol contract written by OpenZeppelin](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v5.1/contracts/finance/VestingWallet.sol).

_Default implementation is a linear vesting curve. To use with the native asset, it is necessary to wrap the native
asset to a ConfidentialERC20-like token._

### ConfidentialERC20Released

```solidity
event ConfidentialERC20Released(address token)
```

Emitted when tokens are released to the beneficiary address.

#### Parameters

| Name | Type | Description |
| ----- | ------- | ------------------------------------ |
| token | address | Address of the token being released. |

### BENEFICIARY

```solidity
address BENEFICIARY
```

Beneficiary address.

### DURATION

```solidity
uint128 DURATION
```

Duration (in seconds).

### END_TIMESTAMP

```solidity
uint128 END_TIMESTAMP
```

End timestamp.

### START_TIMESTAMP

```solidity
uint128 START_TIMESTAMP
```

Start timestamp.

### \_EUINT64_ZERO

```solidity
euint64 _EUINT64_ZERO
```

Constant for zero using TFHE.

_Since it is expensive to compute 0, it is stored instead._

### \_amountReleased

```solidity
mapping(address => euint64) _amountReleased
```

Total encrypted amount released (to the beneficiary).

### constructor

```solidity
constructor(address beneficiary_, uint128 startTimestamp_, uint128 duration_) internal
```

#### Parameters

| Name | Type | Description |
| ---------------- | ------- | ---------------------- |
| beneficiary\_ | address | Beneficiary address. |
| startTimestamp\_ | uint128 | Start timestamp. |
| duration\_ | uint128 | Duration (in seconds). |

### release

```solidity
function release(address token) public virtual
```

Release the tokens that have already vested.

_Anyone can call this function but the beneficiary receives the tokens._

### released

```solidity
function released(address token) public view virtual returns (euint64 amountReleased)
```

Return the encrypted amount of total tokens released.

_It is only reencryptable by the owner._

#### Return Values

| Name | Type | Description |
| -------------- | ------- | -------------------------------- |
| amountReleased | euint64 | Total amount of tokens released. |

### \_releasable

```solidity
function _releasable(address token) internal virtual returns (euint64 releasableAmount)
```

Calculate the amount of tokens that can be released.

#### Return Values

| Name | Type | Description |
| ---------------- | ------- | ------------------ |
| releasableAmount | euint64 | Releasable amount. |

### \_vestedAmount

```solidity
function _vestedAmount(address token, uint128 timestamp) internal virtual returns (euint64 vestedAmount)
```

Calculate the amount of tokens that has already vested.

#### Parameters

| Name | Type | Description |
| --------- | ------- | ------------------ |
| token | address | |
| timestamp | uint128 | Current timestamp. |

#### Return Values

| Name | Type | Description |
| ------------ | ------- | -------------- |
| vestedAmount | euint64 | Vested amount. |

### \_vestingSchedule

```solidity
function _vestingSchedule(euint64 totalAllocation, uint128 timestamp) internal virtual returns (euint64 vestedAmount)
```

Return the vested amount based on a linear vesting schedule.

_It must be overriden for non-linear schedules._

#### Parameters

| Name | Type | Description |
| --------------- | ------- | -------------------------------- |
| totalAllocation | euint64 | Total allocation that is vested. |
| timestamp | uint128 | Current timestamp. |

#### Return Values

| Name | Type | Description |
| ------------ | ------- | -------------- |
| vestedAmount | euint64 | Vested amount. |
60 changes: 60 additions & 0 deletions docs/finance/ConfidentialVestingWalletCliff.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
## ConfidentialVestingWalletCliff

This contract offers a simple vesting wallet with a cliff for [ConfidentialERC20](../token/ERC20/IConfidentialERC20.md)
tokens. This is based on the
[VestingWalletCliff.sol contract written by OpenZeppelin](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v5.1/contracts/finance/VestingWalletCliff.sol).

_This implementation is a linear vesting curve with a cliff. To use with the native asset, it is necessary to wrap the
native asset to a ConfidentialERC20-like token._

### InvalidCliffDuration

```solidity
error InvalidCliffDuration(uint128 cliffSeconds, uint128 durationSeconds)
```

Returned if the cliff duration is greater than the vesting duration.

### CLIFF

```solidity
uint128 CLIFF
```

Cliff timestamp.

### constructor

```solidity
constructor(address beneficiary_, uint128 startTimestamp_, uint128 duration_, uint128 cliffSeconds_) internal
```

#### Parameters

| Name | Type | Description |
| ---------------- | ------- | ---------------------- |
| beneficiary\_ | address | Beneficiary address. |
| startTimestamp\_ | uint128 | Start timestamp. |
| duration\_ | uint128 | Duration (in seconds). |
| cliffSeconds\_ | uint128 | Cliff (in seconds). |

### \_vestingSchedule

```solidity
function _vestingSchedule(euint64 totalAllocation, uint128 timestamp) internal virtual returns (euint64)
```

Return the vested amount based on a linear vesting schedule with a cliff.

#### Parameters

| Name | Type | Description |
| --------------- | ------- | -------------------------------- |
| totalAllocation | euint64 | Total allocation that is vested. |
| timestamp | uint128 | Current timestamp. |

#### Return Values

| Name | Type | Description |
| ------------ | ------- | -------------- |
| vestedAmount | euint64 | Vested amount. |
38 changes: 19 additions & 19 deletions docs/governance/CompoundTimelock.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
# CompoundTimelock
## CompoundTimelock

This contract allows the admin to set a delay period before executing transactions. Transactions must be queued before
execution. No transaction can be executed during this period, which offers time to verify the validity of pending
transactions. It also has a grace period to allow for transactions not to be executed after a specific period following
the queuing.

## GRACE_PERIOD
### GRACE_PERIOD

```solidity
uint256 GRACE_PERIOD
```

See {ICompoundTimelock-GRACE_PERIOD}.

## MINIMUM_DELAY
### MINIMUM_DELAY

```solidity
uint256 MINIMUM_DELAY
```

Minimum delay that can be set in the `setDelay` function.

## MAXIMUM_DELAY
### MAXIMUM_DELAY

```solidity
uint256 MAXIMUM_DELAY
```

Maximum delay that can be set in the `setDelay` function.

## admin
### admin

```solidity
address admin
```

Admin address.

## pendingAdmin
### pendingAdmin

```solidity
address pendingAdmin
Expand All @@ -47,42 +47,42 @@ Pending admin address.

_The transer of the admin is a two-step process._

## delay
### delay

```solidity
uint256 delay
```

See {ICompoundTimelock-delay}.

## queuedTransactions
### queuedTransactions

```solidity
mapping(bytes32 => bool) queuedTransactions
```

Return whether the transaction is queued based on its hash.

## constructor
### constructor

```solidity
constructor(address admin_, uint256 delay_) public
```

### Parameters
#### Parameters

| Name | Type | Description |
| ------- | ------- | --------------------- |
| admin\_ | address | Admin address. |
| delay\_ | uint256 | Delay (in timestamp). |

## receive
### receive

```solidity
receive() external payable
```

## setDelay
### setDelay

```solidity
function setDelay(uint256 delay_) public
Expand All @@ -92,21 +92,21 @@ Set the delay.

_This transaction must be queued._

### Parameters
#### Parameters

| Name | Type | Description |
| ------- | ------- | --------------------- |
| delay\_ | uint256 | Delay (in timestamp). |

## acceptAdmin
### acceptAdmin

```solidity
function acceptAdmin() public
```

See {ICompoundTimelock-acceptAdmin}.

## setPendingAdmin
### setPendingAdmin

```solidity
function setPendingAdmin(address pendingAdmin_) public
Expand All @@ -116,29 +116,29 @@ Set the pending admin.

_This transaction must be queued._

### Parameters
#### Parameters

| Name | Type | Description |
| -------------- | ------- | ---------------------- |
| pendingAdmin\_ | address | Pending admin address. |

## queueTransaction
### queueTransaction

```solidity
function queueTransaction(address target, uint256 value, string signature, bytes data, uint256 eta) public returns (bytes32)
```

See {ICompoundTimelock-queueTransaction}.

## cancelTransaction
### cancelTransaction

```solidity
function cancelTransaction(address target, uint256 value, string signature, bytes data, uint256 eta) public
```

See {ICompoundTimelock-cancelTransaction}.

## executeTransaction
### executeTransaction

```solidity
function executeTransaction(address target, uint256 value, string signature, bytes data, uint256 eta) public payable returns (bytes)
Expand Down
Loading

0 comments on commit abc967b

Please sign in to comment.