Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

impl earning predeploy contract #180

Merged
merged 3 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
282 changes: 282 additions & 0 deletions contracts/docs/earning/Earning.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,282 @@
# Earning

*Acala Developers*

> Earning Predeploy Contract

You can use this predeploy contract to call earning pallet

*This contracts will interact with earning pallet*

## Methods

### bond

```solidity
function bond(uint256 bondAmount) external nonpayable returns (bool)
```

Bond.

*It'll emit an {Bonded} event.*

#### Parameters

| Name | Type | Description |
|---|---|---|
| bondAmount | uint256 | The amount of native currency used to bond. |

#### Returns

| Name | Type | Description |
|---|---|---|
| _0 | bool | Returns a boolean value indicating whether the operation succeeded. |

### getBondingLedger

```solidity
function getBondingLedger(address who) external view returns (struct IEarning.BondingLedger)
```

Get bonding ledger of `who`.



#### Parameters

| Name | Type | Description |
|---|---|---|
| who | address | undefined |

#### Returns

| Name | Type | Description |
|---|---|---|
| _0 | IEarning.BondingLedger | returns (BondingLedger). |

### getInstantUnstakeFee

```solidity
function getInstantUnstakeFee() external view returns (uint256, uint256)
```

Get instant unstake fee ratio.




#### Returns

| Name | Type | Description |
|---|---|---|
| _0 | uint256 | returns (percent, accuracy), the ratio is percent/accuracy |
| _1 | uint256 | undefined |

### getMaxUnbondingChunks

```solidity
function getMaxUnbondingChunks() external view returns (uint256)
```

Get the maximum unlocking chunk amount.




#### Returns

| Name | Type | Description |
|---|---|---|
| _0 | uint256 | returns (maximum_chunks). |

### getMinBond

```solidity
function getMinBond() external view returns (uint256)
```

Get the minimum bond amount.




#### Returns

| Name | Type | Description |
|---|---|---|
| _0 | uint256 | returns (min_bond). |

### getUnbondingPeriod

```solidity
function getUnbondingPeriod() external view returns (uint256)
```

Get unlocking block.




#### Returns

| Name | Type | Description |
|---|---|---|
| _0 | uint256 | returns (unlock_block_number). |

### rebond

```solidity
function rebond(uint256 rebondAmount) external nonpayable returns (bool)
```

Rebond.

*It'll emit an {Rebonded} event.*

#### Parameters

| Name | Type | Description |
|---|---|---|
| rebondAmount | uint256 | The amount of native currency used to rebond. |

#### Returns

| Name | Type | Description |
|---|---|---|
| _0 | bool | Returns a boolean value indicating whether the operation succeeded. |

### unbond

```solidity
function unbond(uint256 unbondAmount) external nonpayable returns (bool)
```

Unbond.

*It'll emit an {Unbonded} event.*

#### Parameters

| Name | Type | Description |
|---|---|---|
| unbondAmount | uint256 | The amount of native currency used to unbond. |

#### Returns

| Name | Type | Description |
|---|---|---|
| _0 | bool | Returns a boolean value indicating whether the operation succeeded. |

### unbondInstant

```solidity
function unbondInstant(uint256 unbondAmount) external nonpayable returns (bool)
```

Unbond instant.

*It'll emit an {Unbonded} event.*

#### Parameters

| Name | Type | Description |
|---|---|---|
| unbondAmount | uint256 | The amount of native currency used to unbond instant. |

#### Returns

| Name | Type | Description |
|---|---|---|
| _0 | bool | Returns a boolean value indicating whether the operation succeeded. |

### withdrawUnbonded

```solidity
function withdrawUnbonded() external nonpayable returns (bool)
```

Withdraw unbonded.

*It'll emit an {Withdrawn} event.*


#### Returns

| Name | Type | Description |
|---|---|---|
| _0 | bool | Returns a boolean value indicating whether the operation succeeded. |



## Events

### Bonded

```solidity
event Bonded(address indexed sender, uint256 amount)
```

Bonded event.



#### Parameters

| Name | Type | Description |
|---|---|---|
| sender `indexed` | address | The sender of the transaction. |
| amount | uint256 | The bond amount. |

### Rebonded

```solidity
event Rebonded(address indexed sender, uint256 amount)
```

Rebonded event.



#### Parameters

| Name | Type | Description |
|---|---|---|
| sender `indexed` | address | The sender of the transaction. |
| amount | uint256 | The rebond amount. |

### Unbonded

```solidity
event Unbonded(address indexed sender, uint256 amount)
```

Unbonded event.



#### Parameters

| Name | Type | Description |
|---|---|---|
| sender `indexed` | address | The sender of the transaction. |
| amount | uint256 | The unbond amount. |

### Withdrawn

```solidity
event Withdrawn(address indexed sender, uint256 amount)
```

Withdraw unbonded.



#### Parameters

| Name | Type | Description |
|---|---|---|
| sender `indexed` | address | The sender of the transaction. |
| amount | uint256 | The withdrawn unbonded amount. |



Loading
Loading