|
| 1 | +# Earning |
| 2 | + |
| 3 | +*Acala Developers* |
| 4 | + |
| 5 | +> Earning Predeploy Contract |
| 6 | +
|
| 7 | +You can use this predeploy contract to call earning pallet |
| 8 | + |
| 9 | +*This contracts will interact with earning pallet* |
| 10 | + |
| 11 | +## Methods |
| 12 | + |
| 13 | +### bond |
| 14 | + |
| 15 | +```solidity |
| 16 | +function bond(uint256 bondAmount) external nonpayable returns (bool) |
| 17 | +``` |
| 18 | + |
| 19 | +Bond. |
| 20 | + |
| 21 | +*It'll emit an {Bonded} event.* |
| 22 | + |
| 23 | +#### Parameters |
| 24 | + |
| 25 | +| Name | Type | Description | |
| 26 | +|---|---|---| |
| 27 | +| bondAmount | uint256 | The amount of native currency used to bond. | |
| 28 | + |
| 29 | +#### Returns |
| 30 | + |
| 31 | +| Name | Type | Description | |
| 32 | +|---|---|---| |
| 33 | +| _0 | bool | Returns a boolean value indicating whether the operation succeeded. | |
| 34 | + |
| 35 | +### getBondingLedger |
| 36 | + |
| 37 | +```solidity |
| 38 | +function getBondingLedger(address who) external view returns (struct IEarning.BondingLedger) |
| 39 | +``` |
| 40 | + |
| 41 | +Get bonding ledger of `who`. |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | +#### Parameters |
| 46 | + |
| 47 | +| Name | Type | Description | |
| 48 | +|---|---|---| |
| 49 | +| who | address | undefined | |
| 50 | + |
| 51 | +#### Returns |
| 52 | + |
| 53 | +| Name | Type | Description | |
| 54 | +|---|---|---| |
| 55 | +| _0 | IEarning.BondingLedger | returns (BondingLedger). | |
| 56 | + |
| 57 | +### getInstantUnstakeFee |
| 58 | + |
| 59 | +```solidity |
| 60 | +function getInstantUnstakeFee() external view returns (uint256, uint256) |
| 61 | +``` |
| 62 | + |
| 63 | +Get instant unstake fee ratio. |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | + |
| 68 | +#### Returns |
| 69 | + |
| 70 | +| Name | Type | Description | |
| 71 | +|---|---|---| |
| 72 | +| _0 | uint256 | returns (percent, accuracy), the ratio is percent/accuracy | |
| 73 | +| _1 | uint256 | undefined | |
| 74 | + |
| 75 | +### getMaxUnbondingChunks |
| 76 | + |
| 77 | +```solidity |
| 78 | +function getMaxUnbondingChunks() external view returns (uint256) |
| 79 | +``` |
| 80 | + |
| 81 | +Get the maximum unlocking chunk amount. |
| 82 | + |
| 83 | + |
| 84 | + |
| 85 | + |
| 86 | +#### Returns |
| 87 | + |
| 88 | +| Name | Type | Description | |
| 89 | +|---|---|---| |
| 90 | +| _0 | uint256 | returns (maximum_chunks). | |
| 91 | + |
| 92 | +### getMinBond |
| 93 | + |
| 94 | +```solidity |
| 95 | +function getMinBond() external view returns (uint256) |
| 96 | +``` |
| 97 | + |
| 98 | +Get the minimum bond amount. |
| 99 | + |
| 100 | + |
| 101 | + |
| 102 | + |
| 103 | +#### Returns |
| 104 | + |
| 105 | +| Name | Type | Description | |
| 106 | +|---|---|---| |
| 107 | +| _0 | uint256 | returns (min_bond). | |
| 108 | + |
| 109 | +### getUnbondingPeriod |
| 110 | + |
| 111 | +```solidity |
| 112 | +function getUnbondingPeriod() external view returns (uint256) |
| 113 | +``` |
| 114 | + |
| 115 | +Get unlocking block. |
| 116 | + |
| 117 | + |
| 118 | + |
| 119 | + |
| 120 | +#### Returns |
| 121 | + |
| 122 | +| Name | Type | Description | |
| 123 | +|---|---|---| |
| 124 | +| _0 | uint256 | returns (unlock_block_number). | |
| 125 | + |
| 126 | +### rebond |
| 127 | + |
| 128 | +```solidity |
| 129 | +function rebond(uint256 rebondAmount) external nonpayable returns (bool) |
| 130 | +``` |
| 131 | + |
| 132 | +Rebond. |
| 133 | + |
| 134 | +*It'll emit an {Bonded} event.* |
| 135 | + |
| 136 | +#### Parameters |
| 137 | + |
| 138 | +| Name | Type | Description | |
| 139 | +|---|---|---| |
| 140 | +| rebondAmount | uint256 | The amount of native currency used to rebond. | |
| 141 | + |
| 142 | +#### Returns |
| 143 | + |
| 144 | +| Name | Type | Description | |
| 145 | +|---|---|---| |
| 146 | +| _0 | bool | Returns a boolean value indicating whether the operation succeeded. | |
| 147 | + |
| 148 | +### unbond |
| 149 | + |
| 150 | +```solidity |
| 151 | +function unbond(uint256 unbondAmount) external nonpayable returns (bool) |
| 152 | +``` |
| 153 | + |
| 154 | +Unbond. |
| 155 | + |
| 156 | +*It'll emit an {Unbonded} event.* |
| 157 | + |
| 158 | +#### Parameters |
| 159 | + |
| 160 | +| Name | Type | Description | |
| 161 | +|---|---|---| |
| 162 | +| unbondAmount | uint256 | The amount of native currency used to unbond. | |
| 163 | + |
| 164 | +#### Returns |
| 165 | + |
| 166 | +| Name | Type | Description | |
| 167 | +|---|---|---| |
| 168 | +| _0 | bool | Returns a boolean value indicating whether the operation succeeded. | |
| 169 | + |
| 170 | +### unbondInstant |
| 171 | + |
| 172 | +```solidity |
| 173 | +function unbondInstant(uint256 unbondAmount) external nonpayable returns (bool) |
| 174 | +``` |
| 175 | + |
| 176 | +Unbond instant. |
| 177 | + |
| 178 | +*It'll emit an {Unbonded} event.* |
| 179 | + |
| 180 | +#### Parameters |
| 181 | + |
| 182 | +| Name | Type | Description | |
| 183 | +|---|---|---| |
| 184 | +| unbondAmount | uint256 | The amount of native currency used to unbond instant. | |
| 185 | + |
| 186 | +#### Returns |
| 187 | + |
| 188 | +| Name | Type | Description | |
| 189 | +|---|---|---| |
| 190 | +| _0 | bool | Returns a boolean value indicating whether the operation succeeded. | |
| 191 | + |
| 192 | +### withdrawUnbonded |
| 193 | + |
| 194 | +```solidity |
| 195 | +function withdrawUnbonded() external nonpayable returns (bool) |
| 196 | +``` |
| 197 | + |
| 198 | +Withdraw unbonded. |
| 199 | + |
| 200 | +*It'll emit an {Withdrawn} event.* |
| 201 | + |
| 202 | + |
| 203 | +#### Returns |
| 204 | + |
| 205 | +| Name | Type | Description | |
| 206 | +|---|---|---| |
| 207 | +| _0 | bool | Returns a boolean value indicating whether the operation succeeded. | |
| 208 | + |
| 209 | + |
| 210 | + |
| 211 | +## Events |
| 212 | + |
| 213 | +### Bonded |
| 214 | + |
| 215 | +```solidity |
| 216 | +event Bonded(address indexed sender, uint256 amount) |
| 217 | +``` |
| 218 | + |
| 219 | +Bonded event. |
| 220 | + |
| 221 | + |
| 222 | + |
| 223 | +#### Parameters |
| 224 | + |
| 225 | +| Name | Type | Description | |
| 226 | +|---|---|---| |
| 227 | +| sender `indexed` | address | The sender of the transaction. | |
| 228 | +| amount | uint256 | The bond amount. | |
| 229 | + |
| 230 | +### Unbonded |
| 231 | + |
| 232 | +```solidity |
| 233 | +event Unbonded(address indexed sender, uint256 amount) |
| 234 | +``` |
| 235 | + |
| 236 | +Unbonded event. |
| 237 | + |
| 238 | + |
| 239 | + |
| 240 | +#### Parameters |
| 241 | + |
| 242 | +| Name | Type | Description | |
| 243 | +|---|---|---| |
| 244 | +| sender `indexed` | address | The sender of the transaction. | |
| 245 | +| amount | uint256 | The unbond amount. | |
| 246 | + |
| 247 | +### Withdrawn |
| 248 | + |
| 249 | +```solidity |
| 250 | +event Withdrawn(address indexed sender, uint256 amount) |
| 251 | +``` |
| 252 | + |
| 253 | +Withdraw unbonded. |
| 254 | + |
| 255 | + |
| 256 | + |
| 257 | +#### Parameters |
| 258 | + |
| 259 | +| Name | Type | Description | |
| 260 | +|---|---|---| |
| 261 | +| sender `indexed` | address | The sender of the transaction. | |
| 262 | +| amount | uint256 | The withdrawn unbonded amount. | |
| 263 | + |
| 264 | + |
| 265 | + |
0 commit comments