@@ -30,330 +30,62 @@ All of the tokens and predeployed system contracts have generated code in `./con
30
30
## ERC20 Contracts
31
31
These ERC20 contracts make native and cross-chain tokens available inside Acala EVM.
32
32
- Mirrored Token contract address: ` ADDRESS.ACA ` , ` ADDRESS.AUSD ` ...(` ./contracts/utils/AcalaAddress.sol ` or ` ./contracts/utils/KaruraAddress.sol ` )
33
- ```
34
- // Returns the currencyId of the token.
35
- function currencyId() public view returns (uint256);
36
-
37
- // Returns the name of the token.
38
- function name() public view returns (string memory);
39
-
40
- // Returns the symbol of the token, usually a shorter version of the name.
41
- function symbol() public view returns (string memory);
42
-
43
- // Returns the number of decimals used to get its user representation.
44
- function decimals() public view returns (uint8);
45
-
46
- // Returns the amount of tokens in existence.
47
- function totalSupply() public view returns (uint256);
48
-
49
- // Returns the amount of tokens owned by `account`.
50
- function balanceOf(address account) public view returns (uint256);
51
-
52
- // Moves `amount` tokens from the caller's account to `recipient`.
53
- // Returns a boolean value indicating whether the operation succeeded.
54
- // Emits a {Transfer} event.
55
- function transfer(address recipient, uint256 amount) public returns (bool);
56
-
57
- // Returns the remaining number of tokens that `spender` will be allowed to spend on behalf of `owner` through {transferFrom}.
58
- // This is zero by default.
59
- function allowance(address owner, address spender) public view returns (uint256);
60
-
61
- // Sets `amount` as the allowance of `spender` over the caller's tokens.
62
- // Returns a boolean value indicating whether the operation succeeded.
63
- function approve(address spender, uint256 amount) public returns (bool);
64
-
65
- // Moves `amount` tokens from `sender` to `recipient` using the allowance mechanism. `amount` is then deducted from the caller's allowance.
66
- // Returns a boolean value indicating whether the operation succeeded.
67
- function transferFrom(address sender, address recipient, uint256 amount) public returns (bool);
68
-
69
- // Atomically increases the allowance granted to `spender` by the caller.
70
- // This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}.
71
- // Emits an {Approval} event indicating the updated allowance.
72
- function increaseAllowance(address spender, uint256 addedValue) public returns (bool);
73
-
74
- // Atomically decreases the allowance granted to `spender` by the caller.
75
- // This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}.
76
- // Emits an {Approval} event indicating the updated allowance.
77
- function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool);
78
- ```
33
+ - Docs [ contracts/docs/token/Token.md] ( ./contracts/docs/token/Token.md )
34
+ - NPM docs [ docs/token/Token.md] ( ./docs/token/Token.md )
79
35
80
36
81
37
## Other System Contracts:
82
38
These contracts make other chain-native functionalities available in Acala EVM.
83
39
84
40
### EVM
85
41
- EVM contract address: ` ADDRESS.EVM `
86
- ```
87
- // Returns the const of NewContractExtraBytes.
88
- function newContractExtraBytes() public view returns (uint256);
89
-
90
- // Returns the const of StorageDepositPerByte.
91
- function storageDepositPerByte() public view returns (uint256);
92
-
93
- // Returns the maintainer of the contract.
94
- function maintainerOf(address contract_address) public view returns (address);
95
-
96
- // Returns the const of DeveloperDeposit.
97
- function developerDeposit() public view returns (uint256);
98
-
99
- // Returns the const of PublicationFee.
100
- function publicationFee() public view returns (uint256);
101
-
102
- // Transfer the maintainer of the contract.
103
- // Returns a boolean value indicating whether the operation succeeded.
104
- function transferMaintainer(address contract_address, address new_maintainer) public returns (bool);
105
-
106
- // Publish contract
107
- // Returns a boolean value indicating whether the operation succeeded.
108
- function publishContract(address contract_address) external returns (bool);
109
-
110
- // Returns if the account is enabled for developer mode
111
- function developerStatus(address account) external view returns (bool);
112
-
113
- // Enables account for development mode, taking a deposit
114
- // Returns a boolean value indicating whether the operation succeeded.
115
- function developerEnable() external returns (bool);
116
-
117
- // Disables account for development mode, returns deposit
118
- // Returns a boolean value indicating whether the operation succeeded.
119
- function developerDisable() external returns (bool);
120
- ```
42
+ - Docs [ contracts/docs/evm/EVM.md] ( ./contracts/docs/evm/EVM.md )
43
+ - NPM docs [ docs/evm/EVM.md] ( ./docs/evm/EVM.md )
121
44
122
45
### Oracle Price Feed
123
46
- Oracle contract address: ` ADDRESS.ORACLE `
124
- ```
125
- // Get the price of the currency_id.
126
- // Returns the (price, timestamp)
127
- function getPrice(address token) public view returns (uint256, uint256);
128
- ```
47
+ - Docs [ contracts/docs/oracle/Oracle.md] ( ./contracts/docs/oracle/Oracle.md )
48
+ - NPM docs [ docs/oracle/Oracle.md] ( ./docs/oracle/Oracle.md )
129
49
130
50
### On-chain Automatic Scheduler
131
51
- ScheduleCall contract address: ` ADDRESS.SCHEDULE `
132
- ```
133
- // Schedule call the contract.
134
- // Returns a bytes value equal to the task_id of the task created.
135
- function scheduleCall(address contract_address, uint256 value, uint256 gas_limit, uint256 storage_limit, uint256 min_delay, bytes memory input_data) public returns (bytes memory);
136
-
137
- // Cancel schedule call the contract.
138
- // Returns a boolean value indicating whether the operation succeeded.
139
- function cancelCall(bytes memory task_id) public returns (bool);
140
-
141
- // Reschedule call the contract.
142
- // Returns a boolean value indicating whether the operation succeeded.
143
- function rescheduleCall(uint256 min_delay, bytes memory task_id) public returns (bool);
144
- ```
52
+ - Docs [ contracts/docs/schdule/Schdule.md] ( ./contracts/docs/schdule/Schdule.md )
53
+ - NPM docs [ docs/schdule/Schdule.md] ( ./docs/schdule/Schdule.md )
145
54
146
55
### DEX
147
56
- DEX contract address: ` ADDRESS.DEX `
148
- ```
149
- // Get liquidity of the currency_id_a and currency_id_b.
150
- // Returns (liquidity_a, liquidity_b).
151
- function getLiquidity(address tokenA, address tokenB) public view returns (uint256, uint256)
152
-
153
- // Get Liquidity token address.
154
- // Returns (liquidity_token_address). Return address(0x0) if the liquidity token address is not mapped.
155
- function getLiquidityTokenAddress(address tokenA, address tokenB) external view returns (address);
156
-
157
- // Get swap target amount.
158
- // Returns (target_amount). Returns 0 if getting the target amount fails.
159
- function getSwapTargetAmount(address[] calldata path, uint256 supplyAmount) external view returns (uint256);
160
-
161
- // Get swap supply amount.
162
- // Returns (supply_amount). Returns 0 if getting the supply amount fails.
163
- function getSwapSupplyAmount(address[] calldata path, uint256 targetAmount) external view returns (uint256);
164
-
165
- // Swap with exact supply.
166
- // Returns a boolean value indicating whether the operation succeeded.
167
- function swapWithExactSupply(address[] calldata path, uint256 supplyAmount, uint256 minTargetAmount) external returns (bool);
168
-
169
- // Swap with exact target.
170
- // Returns a boolean value indicating whether the operation succeeded.
171
- function swapWithExactTarget(address[] calldata path, uint256 targetAmount, uint256 maxSupplyAmount) external returns (bool);
172
-
173
- // Add liquidity to the trading pair.
174
- // Returns a boolean value indicating whether the operation succeeded.
175
- function addLiquidity(address tokenA, address tokenB, uint256 maxAmountA, uint256 maxAmountB) external returns (bool);
176
-
177
- // Remove liquidity from the trading pair.
178
- // Returns a boolean value indicating whether the operation succeeded.
179
- function removeLiquidity(address tokenA, address tokenB, uint256 removeShare) external returns (bool);
180
- ```
57
+ - Docs [ contracts/docs/dex/DEX.md] ( ./contracts/docs/dex/DEX.md )
58
+ - NPM docs [ docs/dex/DEX.md] ( ./docs/dex/DEX.md )
181
59
182
60
### Homa Liquid Staking Protocol
183
61
- Homa contract address: ` ADDRESS.HOMA `
184
- ```
185
- // Mint liquid currency with staking currency.
186
- // Returns a boolean value indicating whether the operation succeeded.
187
- function mint(uint256 mintAmount) external returns (bool);
188
-
189
- // Request to redeem liquid curency for staking currency
190
- // Returns a boolean value indicating whether the operation succeeded.
191
- function requestRedeem(uint256 redeemAmount, bool fastMatch) external returns (bool);
192
-
193
- // Get exchange rate
194
- // returns (exchange_rate) is a FixedU128 representing a decimal
195
- function getExchangeRate() external view returns (uint256);
196
-
197
- // Get estimated reward rate
198
- // returns (reward_rate) is a FixedU128 representing a decimal value
199
- function getEstimatedRewardRate() external view returns (uint256);
200
-
201
- // Get commission rate
202
- // returns (commission_rate) is a FixedU128 representing a decimal
203
- function getCommissionRate() external view returns (uint256);
204
-
205
- // Get fast match fee rate
206
- // returns (fast_match_fee) is a FixedU128 representing a decimal
207
- function getFastMatchFee() external view returns (uint256);
208
- ```
62
+ - Docs [ contracts/docs/homa/Homa.md] ( ./contracts/docs/homa/Homa.md )
63
+ - NPM docs [ docs/homa/Homa.md] ( ./docs/homa/Homa.md )
209
64
210
65
### EVM Accounts
211
66
- EVMAccounts contract address: ` ADDRESS.EVM_ACCOUNTS `
212
- ```
213
- event ClaimAccount(address indexed sender, bytes32 indexed accountId, address indexed evmAddress);
214
-
215
- // Get the AccountId used to generate the given EvmAddress.
216
- // Returns (accountId).
217
- function getAccountId(address evmAddress) external view returns (bytes32);
218
-
219
- // Returns the EvmAddress associated with a given AccountId or the underlying EvmAddress of the AccountId.
220
- // Returns (evmAddress). Return address(0x0) if the AccountId is not mapped.
221
- function getEvmAddress(bytes32 accountId) external view returns (address);
222
-
223
- // Claim account mapping between AccountId and a generated EvmAddress based off of the AccountId.
224
- // Returns a boolean value indicating whether the operation succeeded.
225
- function claimDefaultEvmAddress(bytes32 accountId) external returns (bool);
226
- ```
67
+ - Docs [ contracts/docs/evm-accounts/EVMAccounts.md] ( ./contracts/docs/evm-accounts/EVMAccounts.md )
68
+ - NPM docs [ docs/evm-accounts/EVMAccounts.md] ( ./docs/evm-accounts/EVMAccounts.md )
227
69
228
70
### Honzon Protocol
229
71
- Honzon contract address: ` ADDRESS.HONZON `
230
- ```
231
- // Adjust CDP position
232
- // Returns a boolean value indicating whether the operation succeeded.
233
- function adjustLoan(address currencyId, int128 collateralAdjustment, int128 debitAdjustment) external returns (bool);
234
-
235
- // Close CDP position with DEX
236
- // Returns a boolean value indicating whether the operation succeeded.
237
- function closeLoanByDex(address currencyId, uint256 maxCollateralAmount) external returns (bool);
238
-
239
- // Get an open CDP position
240
- // returns (collateral_amount, debit_amount)
241
- function getPosition(address who, address currencyId) external view returns (uint256, uint256);
242
-
243
- // Get collateral parameters for a currencyId
244
- // returns (params) which is an array with 5 entries in the order that follows:
245
- //
246
- // - [0] `maximum_total_debit_value`: Hardcap of total debit value generated from this collateral.
247
- // - [1] `interest_rate_per_sec`: A FixedU128 representing a decimal value. Interest rate of CDP loan per second
248
- // - [2] `liquidation_ratio`: A FixedU128 representing a decimal value. Liquidation ratio for this collateral type
249
- // - [3] `liquidation_penalty`: A FixedU128 representing a decimal value. Penalty added on for getting liquidated
250
- // - [4] `required_collateral_ratio`: A FixedU128 representing a decimal value. Cannot adjust
251
- // the position of CDP so that the current collateral ratio is lower than the required collateral ratio.
252
- function getCollateralParameters(address currencyId) external view returns (uint256[] memory);
253
-
254
- // Get current collateral ratio for a particular CDP position
255
- // returns (current_collateral_ratio) is a FixedU128 representing a decimal value
256
- function getCurrentCollateralRatio(address who, address currencyId) external view returns (uint256);
257
-
258
- // Get exchange rate of debit units to debit value for a currency_id
259
- // returns (exchange_rate) is a FixedU128 representing a decimal value
260
- function getDebitExchangeRate(address currencyId) external view returns (uint256);
261
- ```
72
+ - Docs [ contracts/docs/honzon/Honzon.md] ( ./contracts/docs/honzon/Honzon.md )
73
+ - NPM docs [ docs/honzon/Honzon.md] ( ./docs/honzon/Honzon.md )
262
74
263
75
### Incentives
264
76
- Incentives contract address: ` ADDRESS.INCENTIVES `
265
- ```
266
- enum PoolId { LOANS, DEX }
267
-
268
- // Gets reward amount in `rewardCurrency` added per period
269
- // Returns (reward_amount)
270
- function getIncentiveRewardAmount(PoolId pool, address poolCurrencyId, address rewardCurrencyId) external view returns (uint256);
271
-
272
- // Stake LP token to add shares to PoolId::Dex
273
- // Returns a boolean value indicating whether the operation succeeded.
274
- function depositDexShare(address currencyId, uint256 amount) external returns (bool);
275
-
276
- // Unstake LP token to remove shares from PoolId::Dex
277
- // Returns a boolean value indicating whether the operation succeeded.
278
- function withdrawDexShare(address currencyId, uint256 amount) external returns (bool);
279
-
280
- // Claim all avalible multi currencies rewards for specific PoolId
281
- // Returns a boolean value indicating whether the operation succeeded.
282
- function claimRewards(PoolId pool, address poolCurrencyId) external returns (bool);
283
-
284
- // Gets deduction rate for claiming reward early
285
- // returns (claim_reward_deduction_rate) as a FixedU128 representing a decimal value
286
- function getClaimRewardDeductionRate(PoolId pool, address poolCurrencyId) external view returns (uint256);
287
-
288
- // Gets the pending rewards for a pool, actual reward could be deducted.
289
- // returns (balances), an array of reward balances corresponding to currencyIds
290
- function getPendingRewards(address[] calldata currencyIds, PoolId pool, address poolCurrencyId, address who) external view returns (uint256[] memory);
291
- ```
77
+ - Docs [ contracts/docs/incentives/Incentives.md] ( ./contracts/docs/incentives/Incentives.md )
78
+ - NPM docs [ docs/incentives/Incentives.md] ( ./docs/incentives/Incentives.md )
292
79
293
80
### StableAsset
294
81
- StableAsset contract address: ` ADDRESS.STABLE_ASSET `
295
- ```
296
- // Get stable asset pool tokens.
297
- // Returns a boolean value indicating whether the pool exists and the corresponding value.
298
- function getStableAssetPoolTokens(uint32 poolId) external view returns (bool, address[] memory);
299
-
300
- // Get stable asset pool total supply.
301
- // Returns a boolean value indicating whether the pool exists and the corresponding value.
302
- function getStableAssetPoolTotalSupply(uint32 poolId) external view returns (bool, uint256);
82
+ - Docs [ contracts/docs/stable-asset/StableAsset.md] ( ./contracts/docs/stable-asset/StableAsset.md )
83
+ - NPM docs [ docs/stable-asset/StableAsset.md] ( ./docs/stable-asset/StableAsset.md )
303
84
304
- // Get stable asset pool precision.
305
- // Returns a boolean value indicating whether the pool exists and the corresponding value.
306
- function getStableAssetPoolPrecision(uint32 poolId) external view returns (bool, uint256);
307
-
308
- // Get stable asset pool mint fee.
309
- // Returns a boolean value indicating whether the pool exists and the corresponding value.
310
- function getStableAssetPoolMintFee(uint32 poolId) external view returns (bool, uint256);
311
-
312
- // Get stable asset pool swap fee.
313
- // Returns a boolean value indicating whether the pool exists and the corresponding value.
314
- function getStableAssetPoolSwapFee(uint32 poolId) external view returns (bool, uint256);
315
-
316
- // Get stable asset pool redeem fee.
317
- // Returns a boolean value indicating whether the pool exists and the corresponding value.
318
- function getStableAssetPoolRedeemFee(uint32 poolId) external view returns (bool, uint256);
319
-
320
- // Stable asset swap tokens.
321
- // Returns a boolean value indicating whether the operation succeeded.
322
- function stableAssetSwap(
323
- uint32 poolId,
324
- uint32 i,
325
- uint32 j,
326
- uint256 dx,
327
- uint256 minDY,
328
- uint32 assetLength
329
- ) external returns (bool);
330
-
331
- // Stable asset mint.
332
- // Returns a boolean value indicating whether the operation succeeded.
333
- function stableAssetMint(uint32 poolId, uint256[] calldata amounts, uint256 minMintAmount) external returns (bool);
334
-
335
- // Stable asset redeem.
336
- // Returns a boolean value indicating whether the operation succeeded.
337
- function stableAssetRedeem(uint32 poolId, uint256 redeemAmount, uint256[] calldata amounts) external returns (bool);
338
-
339
- // Stable asset redeem single.
340
- // Returns a boolean value indicating whether the operation succeeded.
341
- function stableAssetRedeemSingle(
342
- uint32 poolId,
343
- uint256 redeemAmount,
344
- uint32 i,
345
- uint256 minRedeemAmount,
346
- uint32 assetLength
347
- ) external returns (bool);
348
-
349
- // Stable asset redeem multi.
350
- // Returns a boolean value indicating whether the operation succeeded.
351
- function stableAssetRedeemMulti(
352
- uint32 poolId,
353
- uint256[] calldata amounts,
354
- uint256 maxRedeemAmount
355
- ) external returns (bool);
356
- ```
85
+ ### Xtokens
86
+ - Xtokens contract address: ` ADDRESS.XTOKENS `
87
+ - Docs [ contracts/docs/xtokens/Xtokens.md] ( ./contracts/docs/xtokens/Xtokens.md )
88
+ - NPM docs [ docs/xtokens/Xtokens.md] ( ./docs/xtokens/Xtokens.md )
357
89
358
90
## DeFi Contracts (Coming Soon)
359
91
These contracts will make Acala's DeFi primitives (stablecoin, staking derivative, and DeX) available in Acala EVM.
0 commit comments