From 1a87eecda03607ecac5c8eaeb501bc5e29cf078e Mon Sep 17 00:00:00 2001 From: MJLNSN <96321798+MJLNSN@users.noreply.github.com> Date: Wed, 25 Sep 2024 10:20:52 +0800 Subject: [PATCH] Moved PalletId and AccountId to primitives. (#1437) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Bifrost v0.13.0 * Remove getter in buy-back. (#1354) * Bifrost v0.12.0 * remove old migrations * Fix vtokenVoting.removeDelegatorVote (#1288) * add PollClass type * add the calss parameter to the remove_delegator_vote method * Add metadata hash (#1299) * feat: 🎸 add buy-back * Bifrost v0.10.001 * feat: 🎸 benchmark * SLPx mint support commission id (#1261) * Add vtoken exchange rate rpc (#1260) * fix: 🐛 add event (#1263) * add update_currency_metadata function (#1259) * add update_currency_metadata function * fix: 🐛 correct update_currency_metadata weight * add the use of Vec (#1264) * Add vtoken exchange rate rpc * add the use of Vec * Upgrade to Polkadot-SDK v1.7.0 (#1262) * Bifrost v0.10.0 * fix: 🐛 clippy * Fix chain spec (#1243) * Upgrade to polkadot-v1.7.0 --------- Co-authored-by: SunTiebing <1045060705@qq.com> Co-authored-by: Edwin Wang * Fix compile * feat: 🎸 add metadata-hash-extension (#1265) * feat: 🎸 add metadata-hash-extension * Fix compile (#1266) * Fix/fix vtoken voting unlock (#1267) * update the exchange rate of vtokenminting of vtokenvoting test * Resolve the frozen anomaly when unlocking * Revert "feat: 🎸 add metadata-hash-extension (#1265)" (#1268) This reverts commit 489fc9c6adeae44d23edf449e74fde3d6aa40bc3. * rename the version number to 0.11.0 * Slp supports XCMv4 and reconstruct integration tests (#1272) * Fix compile * Reconstruct integration tests and slp supports XCMv4 * Fix slp construct_xcm_message * Feat/slpx mint add commission (#1273) * SLPx mint support commission id * remove the channel_id parameter from the mint method * add mint_with_channel_id method * perform data migration for OrderQueue storage * slpx: set the default value of channel_id to 0 * resolve conflicts * change the location of the old data structure during storage migration * Feat/add vtoken exchange rate rpc (#1274) * Add vtoken exchange rate rpc * add the use of Vec * supplement the RPC logic && fix bugs * adjust the RPC exchange rate precision to three decimal places * fix clippy * fix bug: storage migration anomaly (#1276) * SLPx mint support commission id * remove the channel_id parameter from the mint method * add mint_with_channel_id method * perform data migration for OrderQueue storage * slpx: set the default value of channel_id to 0 * resolve conflicts * change the location of the old data structure during storage migration * fix bug: storage migration anomaly * Slp removes refund (#1275) * Slp removes refund * Fix clippy * Feat/add vtoken exchange rate rpc (#1277) * Add vtoken exchange rate rpc * add the use of Vec * supplement the RPC logic && fix bugs * adjust the RPC exchange rate precision to three decimal places * fix clippy * supplement omissions: adjust the RPC exchange rate precision to three decimal places * Remove dmp queue (#1279) * fix: 🐛 CheckMetadataHash to false * fix: 🐛 update sp-api * refactor: 💡 fmt * fix: 🐛 add metadata-hash * fix: 🐛 add feature metadata-hash * fix: 🐛 rm metadata-hash feature --------- Co-authored-by: SunTiebing <1045060705@qq.com> Co-authored-by: SunTiebing <87381708+SunTiebing@users.noreply.github.com> Co-authored-by: NingBo Wang <2536935847@qq.com> Co-authored-by: Edwin Wang * refactor: 💡 update MaxTurnout and whitelisted_caller track (#1304) * Allow to receive and send Ethereum assets (#1305) * feat: 🎸 add buy-back * Bifrost v0.10.001 * feat: 🎸 benchmark * SLPx mint support commission id (#1261) * Add vtoken exchange rate rpc (#1260) * fix: 🐛 add event (#1263) * add update_currency_metadata function (#1259) * add update_currency_metadata function * fix: 🐛 correct update_currency_metadata weight * add the use of Vec (#1264) * Add vtoken exchange rate rpc * add the use of Vec * Upgrade to Polkadot-SDK v1.7.0 (#1262) * Bifrost v0.10.0 * fix: 🐛 clippy * Fix chain spec (#1243) * Upgrade to polkadot-v1.7.0 --------- Co-authored-by: SunTiebing <1045060705@qq.com> Co-authored-by: Edwin Wang * feat: 🎸 add metadata-hash-extension (#1265) * Fix compile (#1266) * Fix/fix vtoken voting unlock (#1267) * update the exchange rate of vtokenminting of vtokenvoting test * Resolve the frozen anomaly when unlocking * Revert "feat: 🎸 add metadata-hash-extension (#1265)" (#1268) This reverts commit 489fc9c6adeae44d23edf449e74fde3d6aa40bc3. * rename the version number to 0.11.0 * Slp supports XCMv4 and reconstruct integration tests (#1272) * Fix compile * Reconstruct integration tests and slp supports XCMv4 * Fix slp construct_xcm_message * Feat/slpx mint add commission (#1273) * SLPx mint support commission id * remove the channel_id parameter from the mint method * add mint_with_channel_id method * perform data migration for OrderQueue storage * slpx: set the default value of channel_id to 0 * resolve conflicts * change the location of the old data structure during storage migration * Feat/add vtoken exchange rate rpc (#1274) * Add vtoken exchange rate rpc * add the use of Vec * supplement the RPC logic && fix bugs * adjust the RPC exchange rate precision to three decimal places * fix clippy * fix bug: storage migration anomaly (#1276) * SLPx mint support commission id * remove the channel_id parameter from the mint method * add mint_with_channel_id method * perform data migration for OrderQueue storage * slpx: set the default value of channel_id to 0 * resolve conflicts * change the location of the old data structure during storage migration * fix bug: storage migration anomaly * Slp removes refund (#1275) * Slp removes refund * Fix clippy * Allow to receive and send Ethereum assets * Add constants --------- Co-authored-by: yooml Co-authored-by: SunTiebing <1045060705@qq.com> Co-authored-by: SunTiebing <87381708+SunTiebing@users.noreply.github.com> Co-authored-by: Edwin Wang * Disable supplement_fee_reserve (#1306) * Remove call_switchgear and add tx_pause (#1308) * Remove call_switchgear and add tx_pause * Fix clippy * Optimize flexible fee (#1307) * Optimize flexible fee * Fix bug * Fix bug * Add PalletId * Add error handle * feat: 🎸 add market-bond * fix: 🐛 test-all * fix: 🐛 try-runtime * Add the channel_id field to the Minted event * Upgrade to polkadot-v1.13.0 (#1312) * Upgrade to polkadot-v1.13.0 * remove the warning * Fix dep issues * Upgrade to polkadot-v1.13.0 * supplement and upgrade the code * Upgrade the new parts from v0.12.0 * Fix dep issues * format Cargo.toml * Modify the AddOrigin type of the fellowship in bifrost-polkadot * Cancel the cross-in-out migration. * fix clippy --------- Co-authored-by: hqwangningbo <2536935847@qq.com> * Use github dependencies (#1314) * Fix flexible_fee TransferTo (#1315) * Fix generate_genesis_state (#1317) * Optimize oracle (#1318) * refactor: 💡 optimize orml-oracle * fix: 🐛 MinimumTimestampInterval * style: 💄 rename to MaximumValueInterval * Add some tests for ve-minting * Add some tests for ve-minting * Integrate evm (#1319) * Update dep * Ingrate EVM * Fix deps * Add precompiles.rs * Remove pallet-hotfix-sufficients * Add pallet-evm-accounts * Evm precompiles * EVM integration * Fix compile * Fix rpc * Fix `encode_evm_address` and `decode_evm_address` * Fix evm precompile multicurrency * Implementing Erc20Mapping using xc-20 standard * Compatible with BNC Decimal * Increase min_gas_price * feat: enable dev mode with manual seal & fix pending block problem * Add copyright and fix some bugs * Change native token to WETH * Support evm flexible fee * Add inner_swap_exact_assets_for_assets to evm withdraw fee * Remove swap * EVM migration from bifrost kusama to bifrost polkadot * Fix erc20 precompile * Use OraclePrice * Fix some errors * feat: add prices genesis config & optimize dev mode code * Fix conflicts * Fix some errors * Fix clippy * Format Cargo.toml * Remove unused code * Fix clippy * Fix some errors * Fix erc20 precompile --------- Co-authored-by: Edwin Wang Co-authored-by: Damian.lu * Fix try-runtime (#1323) * Fix manual seal * Fix manual seal (#1324) * fix: 🐛 fellowship collective data (#1325) * fix: add parachain mock inherent data provider * Fix ethereum transfer fee (#1328) * Add evm genesis migration (#1338) * Bifrost v0.12.0 (#1286) * Bifrost v0.12.0 * remove old migrations * Fix vtokenVoting.removeDelegatorVote (#1288) * add PollClass type * add the calss parameter to the remove_delegator_vote method * Add metadata hash (#1299) * feat: 🎸 add buy-back * Bifrost v0.10.001 * feat: 🎸 benchmark * SLPx mint support commission id (#1261) * Add vtoken exchange rate rpc (#1260) * fix: 🐛 add event (#1263) * add update_currency_metadata function (#1259) * add update_currency_metadata function * fix: 🐛 correct update_currency_metadata weight * add the use of Vec (#1264) * Add vtoken exchange rate rpc * add the use of Vec * Upgrade to Polkadot-SDK v1.7.0 (#1262) * Bifrost v0.10.0 * fix: 🐛 clippy * Fix chain spec (#1243) * Upgrade to polkadot-v1.7.0 --------- Co-authored-by: SunTiebing <1045060705@qq.com> Co-authored-by: Edwin Wang * Fix compile * feat: 🎸 add metadata-hash-extension (#1265) * feat: 🎸 add metadata-hash-extension * Fix compile (#1266) * Fix/fix vtoken voting unlock (#1267) * update the exchange rate of vtokenminting of vtokenvoting test * Resolve the frozen anomaly when unlocking * Revert "feat: 🎸 add metadata-hash-extension (#1265)" (#1268) This reverts commit 489fc9c6adeae44d23edf449e74fde3d6aa40bc3. * rename the version number to 0.11.0 * Slp supports XCMv4 and reconstruct integration tests (#1272) * Fix compile * Reconstruct integration tests and slp supports XCMv4 * Fix slp construct_xcm_message * Feat/slpx mint add commission (#1273) * SLPx mint support commission id * remove the channel_id parameter from the mint method * add mint_with_channel_id method * perform data migration for OrderQueue storage * slpx: set the default value of channel_id to 0 * resolve conflicts * change the location of the old data structure during storage migration * Feat/add vtoken exchange rate rpc (#1274) * Add vtoken exchange rate rpc * add the use of Vec * supplement the RPC logic && fix bugs * adjust the RPC exchange rate precision to three decimal places * fix clippy * fix bug: storage migration anomaly (#1276) * SLPx mint support commission id * remove the channel_id parameter from the mint method * add mint_with_channel_id method * perform data migration for OrderQueue storage * slpx: set the default value of channel_id to 0 * resolve conflicts * change the location of the old data structure during storage migration * fix bug: storage migration anomaly * Slp removes refund (#1275) * Slp removes refund * Fix clippy * Feat/add vtoken exchange rate rpc (#1277) * Add vtoken exchange rate rpc * add the use of Vec * supplement the RPC logic && fix bugs * adjust the RPC exchange rate precision to three decimal places * fix clippy * supplement omissions: adjust the RPC exchange rate precision to three decimal places * Remove dmp queue (#1279) * fix: 🐛 CheckMetadataHash to false * fix: 🐛 update sp-api * refactor: 💡 fmt * fix: 🐛 add metadata-hash * fix: 🐛 add feature metadata-hash * fix: 🐛 rm metadata-hash feature --------- Co-authored-by: SunTiebing <1045060705@qq.com> Co-authored-by: SunTiebing <87381708+SunTiebing@users.noreply.github.com> Co-authored-by: NingBo Wang <2536935847@qq.com> Co-authored-by: Edwin Wang * refactor: 💡 update MaxTurnout and whitelisted_caller track (#1304) * Allow to receive and send Ethereum assets (#1305) * feat: 🎸 add buy-back * Bifrost v0.10.001 * feat: 🎸 benchmark * SLPx mint support commission id (#1261) * Add vtoken exchange rate rpc (#1260) * fix: 🐛 add event (#1263) * add update_currency_metadata function (#1259) * add update_currency_metadata function * fix: 🐛 correct update_currency_metadata weight * add the use of Vec (#1264) * Add vtoken exchange rate rpc * add the use of Vec * Upgrade to Polkadot-SDK v1.7.0 (#1262) * Bifrost v0.10.0 * fix: 🐛 clippy * Fix chain spec (#1243) * Upgrade to polkadot-v1.7.0 --------- Co-authored-by: SunTiebing <1045060705@qq.com> Co-authored-by: Edwin Wang * feat: 🎸 add metadata-hash-extension (#1265) * Fix compile (#1266) * Fix/fix vtoken voting unlock (#1267) * update the exchange rate of vtokenminting of vtokenvoting test * Resolve the frozen anomaly when unlocking * Revert "feat: 🎸 add metadata-hash-extension (#1265)" (#1268) This reverts commit 489fc9c6adeae44d23edf449e74fde3d6aa40bc3. * rename the version number to 0.11.0 * Slp supports XCMv4 and reconstruct integration tests (#1272) * Fix compile * Reconstruct integration tests and slp supports XCMv4 * Fix slp construct_xcm_message * Feat/slpx mint add commission (#1273) * SLPx mint support commission id * remove the channel_id parameter from the mint method * add mint_with_channel_id method * perform data migration for OrderQueue storage * slpx: set the default value of channel_id to 0 * resolve conflicts * change the location of the old data structure during storage migration * Feat/add vtoken exchange rate rpc (#1274) * Add vtoken exchange rate rpc * add the use of Vec * supplement the RPC logic && fix bugs * adjust the RPC exchange rate precision to three decimal places * fix clippy * fix bug: storage migration anomaly (#1276) * SLPx mint support commission id * remove the channel_id parameter from the mint method * add mint_with_channel_id method * perform data migration for OrderQueue storage * slpx: set the default value of channel_id to 0 * resolve conflicts * change the location of the old data structure during storage migration * fix bug: storage migration anomaly * Slp removes refund (#1275) * Slp removes refund * Fix clippy * Allow to receive and send Ethereum assets * Add constants --------- Co-authored-by: yooml Co-authored-by: SunTiebing <1045060705@qq.com> Co-authored-by: SunTiebing <87381708+SunTiebing@users.noreply.github.com> Co-authored-by: Edwin Wang * Disable supplement_fee_reserve (#1306) * Remove call_switchgear and add tx_pause (#1308) * Remove call_switchgear and add tx_pause * Fix clippy * Optimize flexible fee (#1307) * Optimize flexible fee * Fix bug * Fix bug * Add PalletId * Add error handle * feat: 🎸 add market-bond * fix: 🐛 test-all * fix: 🐛 try-runtime * Add the channel_id field to the Minted event * Upgrade to polkadot-v1.13.0 (#1312) * Upgrade to polkadot-v1.13.0 * remove the warning * Fix dep issues * Upgrade to polkadot-v1.13.0 * supplement and upgrade the code * Upgrade the new parts from v0.12.0 * Fix dep issues * format Cargo.toml * Modify the AddOrigin type of the fellowship in bifrost-polkadot * Cancel the cross-in-out migration. * fix clippy --------- Co-authored-by: hqwangningbo <2536935847@qq.com> * Use github dependencies (#1314) * Fix flexible_fee TransferTo (#1315) * Fix generate_genesis_state (#1317) * Optimize oracle (#1318) * refactor: 💡 optimize orml-oracle * fix: 🐛 MinimumTimestampInterval * style: 💄 rename to MaximumValueInterval * Add some tests for ve-minting * Add some tests for ve-minting * Integrate evm (#1319) * Update dep * Ingrate EVM * Fix deps * Add precompiles.rs * Remove pallet-hotfix-sufficients * Add pallet-evm-accounts * Evm precompiles * EVM integration * Fix compile * Fix rpc * Fix `encode_evm_address` and `decode_evm_address` * Fix evm precompile multicurrency * Implementing Erc20Mapping using xc-20 standard * Compatible with BNC Decimal * Increase min_gas_price * feat: enable dev mode with manual seal & fix pending block problem * Add copyright and fix some bugs * Change native token to WETH * Support evm flexible fee * Add inner_swap_exact_assets_for_assets to evm withdraw fee * Remove swap * EVM migration from bifrost kusama to bifrost polkadot * Fix erc20 precompile * Use OraclePrice * Fix some errors * feat: add prices genesis config & optimize dev mode code * Fix conflicts * Fix some errors * Fix clippy * Format Cargo.toml * Remove unused code * Fix clippy * Fix some errors * Fix erc20 precompile --------- Co-authored-by: Edwin Wang Co-authored-by: Damian.lu * Fix try-runtime (#1323) * Fix manual seal * Fix manual seal (#1324) * fix: 🐛 fellowship collective data (#1325) * fix: add parachain mock inherent data provider * Fix ethereum transfer fee (#1328) --------- Co-authored-by: Edwin Wang Co-authored-by: yooml Co-authored-by: NingBo Wang <2536935847@qq.com> Co-authored-by: Gemma Co-authored-by: Damian.lu * Add evm genesis storage * [skip ci] Add evmSince --------- Co-authored-by: SunTiebing <87381708+SunTiebing@users.noreply.github.com> Co-authored-by: Edwin Wang Co-authored-by: yooml Co-authored-by: Gemma Co-authored-by: Damian.lu * Bump version to 0.12.1 * Update Cargo.lock * Fix migration (#1341) * Bifrost v0.12.0 (#1286) * Bifrost v0.12.0 * remove old migrations * Fix vtokenVoting.removeDelegatorVote (#1288) * add PollClass type * add the calss parameter to the remove_delegator_vote method * Add metadata hash (#1299) * feat: 🎸 add buy-back * Bifrost v0.10.001 * feat: 🎸 benchmark * SLPx mint support commission id (#1261) * Add vtoken exchange rate rpc (#1260) * fix: 🐛 add event (#1263) * add update_currency_metadata function (#1259) * add update_currency_metadata function * fix: 🐛 correct update_currency_metadata weight * add the use of Vec (#1264) * Add vtoken exchange rate rpc * add the use of Vec * Upgrade to Polkadot-SDK v1.7.0 (#1262) * Bifrost v0.10.0 * fix: 🐛 clippy * Fix chain spec (#1243) * Upgrade to polkadot-v1.7.0 --------- Co-authored-by: SunTiebing <1045060705@qq.com> Co-authored-by: Edwin Wang * Fix compile * feat: 🎸 add metadata-hash-extension (#1265) * feat: 🎸 add metadata-hash-extension * Fix compile (#1266) * Fix/fix vtoken voting unlock (#1267) * update the exchange rate of vtokenminting of vtokenvoting test * Resolve the frozen anomaly when unlocking * Revert "feat: 🎸 add metadata-hash-extension (#1265)" (#1268) This reverts commit 489fc9c6adeae44d23edf449e74fde3d6aa40bc3. * rename the version number to 0.11.0 * Slp supports XCMv4 and reconstruct integration tests (#1272) * Fix compile * Reconstruct integration tests and slp supports XCMv4 * Fix slp construct_xcm_message * Feat/slpx mint add commission (#1273) * SLPx mint support commission id * remove the channel_id parameter from the mint method * add mint_with_channel_id method * perform data migration for OrderQueue storage * slpx: set the default value of channel_id to 0 * resolve conflicts * change the location of the old data structure during storage migration * Feat/add vtoken exchange rate rpc (#1274) * Add vtoken exchange rate rpc * add the use of Vec * supplement the RPC logic && fix bugs * adjust the RPC exchange rate precision to three decimal places * fix clippy * fix bug: storage migration anomaly (#1276) * SLPx mint support commission id * remove the channel_id parameter from the mint method * add mint_with_channel_id method * perform data migration for OrderQueue storage * slpx: set the default value of channel_id to 0 * resolve conflicts * change the location of the old data structure during storage migration * fix bug: storage migration anomaly * Slp removes refund (#1275) * Slp removes refund * Fix clippy * Feat/add vtoken exchange rate rpc (#1277) * Add vtoken exchange rate rpc * add the use of Vec * supplement the RPC logic && fix bugs * adjust the RPC exchange rate precision to three decimal places * fix clippy * supplement omissions: adjust the RPC exchange rate precision to three decimal places * Remove dmp queue (#1279) * fix: 🐛 CheckMetadataHash to false * fix: 🐛 update sp-api * refactor: 💡 fmt * fix: 🐛 add metadata-hash * fix: 🐛 add feature metadata-hash * fix: 🐛 rm metadata-hash feature --------- Co-authored-by: SunTiebing <1045060705@qq.com> Co-authored-by: SunTiebing <87381708+SunTiebing@users.noreply.github.com> Co-authored-by: NingBo Wang <2536935847@qq.com> Co-authored-by: Edwin Wang * refactor: 💡 update MaxTurnout and whitelisted_caller track (#1304) * Allow to receive and send Ethereum assets (#1305) * feat: 🎸 add buy-back * Bifrost v0.10.001 * feat: 🎸 benchmark * SLPx mint support commission id (#1261) * Add vtoken exchange rate rpc (#1260) * fix: 🐛 add event (#1263) * add update_currency_metadata function (#1259) * add update_currency_metadata function * fix: 🐛 correct update_currency_metadata weight * add the use of Vec (#1264) * Add vtoken exchange rate rpc * add the use of Vec * Upgrade to Polkadot-SDK v1.7.0 (#1262) * Bifrost v0.10.0 * fix: 🐛 clippy * Fix chain spec (#1243) * Upgrade to polkadot-v1.7.0 --------- Co-authored-by: SunTiebing <1045060705@qq.com> Co-authored-by: Edwin Wang * feat: 🎸 add metadata-hash-extension (#1265) * Fix compile (#1266) * Fix/fix vtoken voting unlock (#1267) * update the exchange rate of vtokenminting of vtokenvoting test * Resolve the frozen anomaly when unlocking * Revert "feat: 🎸 add metadata-hash-extension (#1265)" (#1268) This reverts commit 489fc9c6adeae44d23edf449e74fde3d6aa40bc3. * rename the version number to 0.11.0 * Slp supports XCMv4 and reconstruct integration tests (#1272) * Fix compile * Reconstruct integration tests and slp supports XCMv4 * Fix slp construct_xcm_message * Feat/slpx mint add commission (#1273) * SLPx mint support commission id * remove the channel_id parameter from the mint method * add mint_with_channel_id method * perform data migration for OrderQueue storage * slpx: set the default value of channel_id to 0 * resolve conflicts * change the location of the old data structure during storage migration * Feat/add vtoken exchange rate rpc (#1274) * Add vtoken exchange rate rpc * add the use of Vec * supplement the RPC logic && fix bugs * adjust the RPC exchange rate precision to three decimal places * fix clippy * fix bug: storage migration anomaly (#1276) * SLPx mint support commission id * remove the channel_id parameter from the mint method * add mint_with_channel_id method * perform data migration for OrderQueue storage * slpx: set the default value of channel_id to 0 * resolve conflicts * change the location of the old data structure during storage migration * fix bug: storage migration anomaly * Slp removes refund (#1275) * Slp removes refund * Fix clippy * Allow to receive and send Ethereum assets * Add constants --------- Co-authored-by: yooml Co-authored-by: SunTiebing <1045060705@qq.com> Co-authored-by: SunTiebing <87381708+SunTiebing@users.noreply.github.com> Co-authored-by: Edwin Wang * Disable supplement_fee_reserve (#1306) * Remove call_switchgear and add tx_pause (#1308) * Remove call_switchgear and add tx_pause * Fix clippy * Optimize flexible fee (#1307) * Optimize flexible fee * Fix bug * Fix bug * Add PalletId * Add error handle * feat: 🎸 add market-bond * fix: 🐛 test-all * fix: 🐛 try-runtime * Add the channel_id field to the Minted event * Upgrade to polkadot-v1.13.0 (#1312) * Upgrade to polkadot-v1.13.0 * remove the warning * Fix dep issues * Upgrade to polkadot-v1.13.0 * supplement and upgrade the code * Upgrade the new parts from v0.12.0 * Fix dep issues * format Cargo.toml * Modify the AddOrigin type of the fellowship in bifrost-polkadot * Cancel the cross-in-out migration. * fix clippy --------- Co-authored-by: hqwangningbo <2536935847@qq.com> * Use github dependencies (#1314) * Fix flexible_fee TransferTo (#1315) * Fix generate_genesis_state (#1317) * Optimize oracle (#1318) * refactor: 💡 optimize orml-oracle * fix: 🐛 MinimumTimestampInterval * style: 💄 rename to MaximumValueInterval * Add some tests for ve-minting * Add some tests for ve-minting * Integrate evm (#1319) * Update dep * Ingrate EVM * Fix deps * Add precompiles.rs * Remove pallet-hotfix-sufficients * Add pallet-evm-accounts * Evm precompiles * EVM integration * Fix compile * Fix rpc * Fix `encode_evm_address` and `decode_evm_address` * Fix evm precompile multicurrency * Implementing Erc20Mapping using xc-20 standard * Compatible with BNC Decimal * Increase min_gas_price * feat: enable dev mode with manual seal & fix pending block problem * Add copyright and fix some bugs * Change native token to WETH * Support evm flexible fee * Add inner_swap_exact_assets_for_assets to evm withdraw fee * Remove swap * EVM migration from bifrost kusama to bifrost polkadot * Fix erc20 precompile * Use OraclePrice * Fix some errors * feat: add prices genesis config & optimize dev mode code * Fix conflicts * Fix some errors * Fix clippy * Format Cargo.toml * Remove unused code * Fix clippy * Fix some errors * Fix erc20 precompile --------- Co-authored-by: Edwin Wang Co-authored-by: Damian.lu * Fix try-runtime (#1323) * Fix manual seal * Fix manual seal (#1324) * fix: 🐛 fellowship collective data (#1325) * fix: add parachain mock inherent data provider * Fix ethereum transfer fee (#1328) --------- Co-authored-by: Edwin Wang Co-authored-by: yooml Co-authored-by: NingBo Wang <2536935847@qq.com> Co-authored-by: Gemma Co-authored-by: Damian.lu * Add evm genesis storage * [skip ci] Add evmSince * Fix migration * Fix migration * Remove unused code --------- Co-authored-by: SunTiebing <87381708+SunTiebing@users.noreply.github.com> Co-authored-by: Edwin Wang Co-authored-by: yooml Co-authored-by: Gemma Co-authored-by: Damian.lu * Remove getter in buy-back --------- Co-authored-by: SunTiebing <1045060705@qq.com> Co-authored-by: SunTiebing <87381708+SunTiebing@users.noreply.github.com> Co-authored-by: Edwin Wang Co-authored-by: yooml Co-authored-by: NingBo Wang <2536935847@qq.com> Co-authored-by: Damian.lu * Remove getters in xcm-interface (#1352) * Remove getters in salp. (#1351) * Remove getter in evm-accounts (#1350) * Remove getters in slp (#1353) * Remove getters in slpx (#1360) * Remove getters in vstoken-conversion. (#1362) * Remove getters in vtoken-minting. (#1363) * Remove getter in system-maker. (#1364) * Remove getter in fee-share (#1365) * Remove getters in prices (#1367) * Remove getters in lend-market (#1366) * Remove getters in ve-minting (#1368) * Optimize clippy (#1369) * Deprecated unused pallets (#1383) * Review format (#1386) * style: 💄 format * style: 💄 check-all * fix: 🐛 bench * Update buy back (#1387) * style: 💄 format * style: 💄 check-all * fix: 🐛 bench * feat: 🎸 add destruction_ratio * fix: 🐛 benchmark * EVM flexible fee logic optimization (#1370) * EVM flexible fee logic optimization * Add comments * Add support for handling different currency precisions & included error handling. * Adjust the gas_fee parameter in the get_balance_in_currency method to an exact value * fix clippy * add test code of flexiable-fee pallet * Update fee share (#1395) * feat: 🎸 add usd_cumulation * feat: 🎸 bench * fix: 🐛 fmt * docs: ✏️ add note * Feat/change evm address convert rule (#1396) * Change EVM Address convert rule * Change EVM Address convert rule * Remove the unused function:is_evm_account & rename truncated_account_id function to convert_account_id * fix clippy * refactor: 💡 move to TechAdmin (#1398) * refactor: 💡 transfer to BuyBackAccount (#1399) * Fix mint_with_channel_id weights (#1400) * Recoverd imgs of banner and logo (#1401) * feat: 🎸 add fn set_swap_out_min (#1389) * feat: 🎸 add fn set_swap_out_min * fix: 🐛 fmt * fix: 🐛 fmt * fix: 🐛 error * feat: 🎸 add bais * fix: 🐛 add test * fix: 🐛 rename field bias * Optimize the `channel-commission` code. (#1390) * Optimize the `channel-commission` code. * Replace the insert method with the mutate method * Added a result check for the clear_prefix method * Supplement the test code of `channel-commission`. * Handling Error cases in hooks. * Optimize the handling of the `check_removed_all` method. * Remove getters in cross-in-out (#1402) * Removed getters in channel-commission. (#1404) * Removed getters in flexible-fee. (#1405) * Removed getters in channel-commission. * Removed getters in flexible-fee. * Removed getters in parachain-staking. (#1406) * Removed getters in channel-commission. * Removed getters in flexible-fee. * Removed getterd in parachain-staking. * Update buy back (#1407) * fix: 🐛 add field last_buyback_cycle for accurate judgment * style: 💄 fmt * Update ve minting (#1408) * refactor: 💡 transfer to BuyBackAccount * feat: 🎸 add auto notify_reward * Removed getters in stable-asset and system-staking. (#1409) * Removed getters in channel-commission. * Removed getters in flexible-fee. * Removed getterd in parachain-staking. * Removed getters in stable-asset. * Removed getters in stable-asset. * Removed getters in token-issuer. (#1410) * Removed getters in channel-commission. * Removed getters in flexible-fee. * Removed getterd in parachain-staking. * Removed getters in stable-asset. * Removed getters in stable-asset. * Removed getters in token-issuer. --------- Co-authored-by: Edwin * Moved PrarachainId to primitives. (#1394) * Moved PrarachainId to primitives * updated * bug fixed * Moved parachain ids to primitives. * bug fixed * Fixed error. * Removed getters in vsbond-auction. (#1412) * Fix evm TransferEvmFees (#1411) * Add slp v2 (#1397) * Add slp v2 * Add slp v2 weights * Optimize slp v2 * Optimize slp v2 * Remove operator * Feat/vbnc convert (#1413) * Add vbnc-convert pallet * add weights.rs of vbnc-convert pallet * update token id of VBNC_P * update weight of vbnc-convert pallet * Supplement the comments of `vbnc-convert`. * update VBNCConvert index in Runtime enum * Optimize vbnc-convert pallet pallet. * Updated (#1416) * Add more slp v2 docs (#1419) * Optimize xcm config (#1417) * Optimize xcm config * Fix moonbeam chain id * Update fee share (#1418) * refactor: 💡 for review * fix: 🐛 mv storage * fix: 🐛 bench * refactor: 💡 fmt --------- Co-authored-by: Edwin * Moved PalletId and AccountId to primitives * Optimize slp v2 (#1423) * Optimize slp v2 * Optimize weights * fix: 🐛 redefine system pool id (#1421) * fix: 🐛 redefine system pool id * fix: 🐛 auto_notify_reward * refactor: 💡 rename to bb-bnc * style: 💄 clippy * fix: 🐛 rename error * refactor: 💡 rm BbBNCPalletId * fix: 🐛 UserFarmingPool bound limit * Moved CurrencyId to primitives. * Updated to the latest version. * change VBNC_P_TOKEN_ID to 5 (#1425) * updated * update * updated * updated --------- Co-authored-by: SunTiebing <1045060705@qq.com> Co-authored-by: SunTiebing <87381708+SunTiebing@users.noreply.github.com> Co-authored-by: Edwin Wang Co-authored-by: yooml Co-authored-by: NingBo Wang <2536935847@qq.com> Co-authored-by: Damian.lu --- Cargo.lock | 2 + pallets/bb-bnc/src/mock.rs | 26 +++++------- pallets/buy-back/src/mock.rs | 24 ++++------- pallets/buy-back/src/tests.rs | 1 + pallets/channel-commission/src/mock.rs | 8 ++-- pallets/clouds-convert/src/mock.rs | 14 ++----- pallets/cross-in-out/src/mock.rs | 7 ++-- .../deprecated/lightening-redeem/src/mock.rs | 4 -- .../deprecated/liquidity-mining/src/mock.rs | 1 - pallets/deprecated/salp-lite/src/mock.rs | 1 - pallets/deprecated/system-maker/src/mock.rs | 21 ++++------ pallets/farming/src/mock.rs | 19 +++++---- pallets/fee-share/src/mock.rs | 20 ++++------ pallets/flexible-fee/src/mock.rs | 6 +-- pallets/lend-market/src/mock.rs | 11 ----- pallets/leverage-staking/src/mock.rs | 17 +++----- pallets/parachain-staking/Cargo.toml | 1 + pallets/parachain-staking/src/mock.rs | 3 +- pallets/salp/src/mock.rs | 31 ++++++-------- pallets/salp/src/tests.rs | 4 +- pallets/slp-v2/src/mock.rs | 12 ++---- pallets/slp-v2/src/tests.rs | 2 +- pallets/slp/src/mocks/mock.rs | 10 ++--- pallets/slp/src/mocks/mock_kusama.rs | 14 ++----- pallets/slpx/src/mock.rs | 21 ++++------ pallets/stable-asset/src/mock.rs | 6 +-- pallets/stable-pool/src/mock.rs | 23 ++++------- pallets/stable-pool/src/tests.rs | 2 +- pallets/system-staking/src/mock.rs | 21 ++++------ pallets/token-issuer/src/mock.rs | 4 +- pallets/vbnc-convert/src/mock.rs | 10 ++--- pallets/vsbond-auction/src/mock.rs | 5 +-- pallets/vstoken-conversion/src/mock.rs | 14 ++++--- pallets/vstoken-conversion/src/tests.rs | 1 + pallets/vtoken-minting/src/mock.rs | 20 +++------- pallets/vtoken-voting/src/mock.rs | 4 +- primitives/Cargo.toml | 1 + primitives/src/currency.rs | 2 + primitives/src/lib.rs | 40 +++++++++++++++++++ 39 files changed, 181 insertions(+), 252 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 06a763e293..6476ca98b2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1441,6 +1441,7 @@ dependencies = [ name = "bifrost-parachain-staking" version = "3.0.1" dependencies = [ + "bifrost-primitives", "frame-benchmarking", "frame-support", "frame-system", @@ -1620,6 +1621,7 @@ version = "0.8.0" dependencies = [ "bstringify", "frame-support", + "hex-literal 0.4.1", "orml-oracle", "orml-traits", "parity-scale-codec", diff --git a/pallets/bb-bnc/src/mock.rs b/pallets/bb-bnc/src/mock.rs index 0f5aff4bda..5bfd05d760 100644 --- a/pallets/bb-bnc/src/mock.rs +++ b/pallets/bb-bnc/src/mock.rs @@ -23,10 +23,13 @@ use crate as bb_bnc; use bifrost_asset_registry::AssetIdMaps; -use bifrost_primitives::MoonbeamChainId; pub use bifrost_primitives::{ currency::*, CurrencyId, CurrencyIdMapping, SlpxOperator, TokenSymbol, }; +use bifrost_primitives::{ + BifrostEntranceAccount, BifrostExitAccount, BifrostFeeAccount, BuyBackAccount, + IncentivePalletId, IncentivePoolAccount, MoonbeamChainId, +}; use bifrost_runtime_common::{micro, milli}; use bifrost_slp::{QueryId, QueryResponseManager}; pub use cumulus_primitives_core::ParaId; @@ -35,10 +38,8 @@ use frame_support::{ pallet_prelude::Get, parameter_types, traits::{Everything, Nothing}, - PalletId, }; use frame_system::{EnsureRoot, EnsureSignedBy}; -use hex_literal::hex; use orml_traits::{location::RelativeReserveProvider, parameter_type_with_key}; use sp_core::ConstU32; use sp_runtime::{ @@ -90,7 +91,7 @@ impl frame_system::Config for Runtime { } parameter_types! { - pub const NativeCurrencyId: CurrencyId = CurrencyId::Native(TokenSymbol::BNC); + pub const NativeCurrencyId: CurrencyId = BNC; } pub type AdaptedBasicCurrency = @@ -105,11 +106,8 @@ impl bifrost_currencies::Config for Runtime { parameter_types! { pub const ExistentialDeposit: Balance = 1; - // pub const NativeCurrencyId: CurrencyId = CurrencyId::Native(TokenSymbol::BNC); - // pub const RelayCurrencyId: CurrencyId = CurrencyId::Token(TokenSymbol::KSM); - pub const StableCurrencyId: CurrencyId = CurrencyId::Stable(TokenSymbol::KUSD); - // pub SelfParaId: u32 = ParachainInfo::parachain_id().into(); - pub const PolkadotCurrencyId: CurrencyId = CurrencyId::Token(TokenSymbol::DOT); + pub const StableCurrencyId: CurrencyId = KUSD; + pub const PolkadotCurrencyId: CurrencyId = DOT; } impl pallet_balances::Config for Runtime { @@ -192,15 +190,11 @@ impl orml_xtokens::Config for Runtime { parameter_types! { pub const MaximumUnlockIdOfUser: u32 = 1_000; pub const MaximumUnlockIdOfTimeUnit: u32 = 1_000; - pub BifrostEntranceAccount: PalletId = PalletId(*b"bf/vtkin"); - pub BifrostExitAccount: PalletId = PalletId(*b"bf/vtout"); - pub BifrostFeeAccount: AccountId = hex!["e4da05f08e89bf6c43260d96f26fffcfc7deae5b465da08669a9d008e64c2c63"].into(); - pub IncentivePoolAccount: PalletId = PalletId(*b"bf/inpoo"); } ord_parameter_types! { pub const One: AccountId = ALICE; - pub const RelayCurrencyId: CurrencyId = CurrencyId::Token(TokenSymbol::KSM); + pub const RelayCurrencyId: CurrencyId = KSM; } impl bifrost_vtoken_minting::Config for Runtime { @@ -240,9 +234,7 @@ impl bifrost_asset_registry::Config for Runtime { } parameter_types! { - pub const BbBNCTokenType: CurrencyId = CurrencyId::VToken(TokenSymbol::BNC); - pub IncentivePalletId: PalletId = PalletId(*b"bf/bbict"); - pub const BuyBackAccount: PalletId = PalletId(*b"bf/bybck"); + pub const BbBNCTokenType: CurrencyId = VBNC; pub const Week: BlockNumber = 50400; // a week pub const MaxBlock: BlockNumber = 10512000; // four years pub const Multiplier: Balance = 10_u128.pow(12); diff --git a/pallets/buy-back/src/mock.rs b/pallets/buy-back/src/mock.rs index ae4b9787a0..ce98941ad4 100644 --- a/pallets/buy-back/src/mock.rs +++ b/pallets/buy-back/src/mock.rs @@ -22,8 +22,11 @@ #![allow(non_upper_case_globals)] use bifrost_asset_registry::AssetIdMaps; -use bifrost_primitives::MoonbeamChainId; -pub use bifrost_primitives::{currency::*, CurrencyId, SlpxOperator, TokenSymbol}; +pub use bifrost_primitives::{currency::*, CurrencyId, SlpxOperator}; +use bifrost_primitives::{ + BifrostEntranceAccount, BifrostExitAccount, BifrostFeeAccount, BuyBackAccount, + IncentivePalletId, IncentivePoolAccount, LiquidityAccount, MoonbeamChainId, ZenlinkPalletId, +}; use bifrost_slp::{QueryId, QueryResponseManager}; pub use cumulus_primitives_core::ParaId; use frame_support::{ @@ -32,10 +35,8 @@ use frame_support::{ parameter_types, sp_runtime::{traits::ConvertInto, DispatchError, DispatchResult}, traits::{Everything, Nothing}, - PalletId, }; use frame_system::{EnsureRoot, EnsureSignedBy}; -use hex_literal::hex; use orml_traits::{location::RelativeReserveProvider, parameter_type_with_key, MultiCurrency}; use sp_core::ConstU32; use sp_runtime::{ @@ -104,7 +105,7 @@ impl frame_system::Config for Runtime { } parameter_types! { - pub const GetNativeCurrencyId: CurrencyId = CurrencyId::Native(TokenSymbol::BNC); + pub const GetNativeCurrencyId: CurrencyId = BNC; } pub type AdaptedBasicCurrency = @@ -158,14 +159,11 @@ impl orml_tokens::Config for Runtime { parameter_types! { pub const TreasuryAccount: AccountId32 = TREASURY_ACCOUNT; - pub BifrostVsbondAccount: PalletId = PalletId(*b"bf/salpb"); - pub const BuyBackAccount: PalletId = PalletId(*b"bf/bybck"); - pub const LiquidityAccount: PalletId = PalletId(*b"bf/liqdt"); } ord_parameter_types! { pub const One: AccountId = ALICE; - pub const RelayCurrencyId: CurrencyId = CurrencyId::Token(TokenSymbol::KSM); + pub const RelayCurrencyId: CurrencyId = KSM; } impl bifrost_buy_back::Config for Runtime { @@ -283,10 +281,6 @@ impl orml_xtokens::Config for Runtime { parameter_types! { pub const MaximumUnlockIdOfUser: u32 = 10; pub const MaximumUnlockIdOfTimeUnit: u32 = 50; - pub BifrostEntranceAccount: PalletId = PalletId(*b"bf/vtkin"); - pub BifrostExitAccount: PalletId = PalletId(*b"bf/vtout"); - pub BifrostFeeAccount: AccountId = hex!["e4da05f08e89bf6c43260d96f26fffcfc7deae5b465da08669a9d008e64c2c63"].into(); - pub IncentivePoolAccount: PalletId = PalletId(*b"bf/inpoo"); } impl bifrost_vtoken_minting::Config for Runtime { @@ -316,7 +310,6 @@ impl bifrost_vtoken_minting::Config for Runtime { } parameter_types! { - pub const ZenlinkPalletId: PalletId = PalletId(*b"/zenlink"); pub const GetExchangeFee: (u32, u32) = (3, 1000); // 0.3% pub const SelfParaId: u32 = 2001; } @@ -465,8 +458,7 @@ impl pallet_xcm::Config for Runtime { } parameter_types! { - pub const BbBNCTokenType: CurrencyId = CurrencyId::VToken(TokenSymbol::BNC); - pub IncentivePalletId: PalletId = PalletId(*b"bf/bbict"); + pub const BbBNCTokenType: CurrencyId = VBNC; pub const Week: BlockNumber = 50400; // a week pub const MaxBlock: BlockNumber = 10512000; // four years pub const Multiplier: Balance = 10_u128.pow(12); diff --git a/pallets/buy-back/src/tests.rs b/pallets/buy-back/src/tests.rs index 485d80d52d..864c9dfd9d 100644 --- a/pallets/buy-back/src/tests.rs +++ b/pallets/buy-back/src/tests.rs @@ -21,6 +21,7 @@ #![cfg(test)] use crate::{mock::*, *}; +use bifrost_primitives::IncentivePalletId; use frame_support::{assert_noop, assert_ok}; use sp_arithmetic::per_things::Permill; diff --git a/pallets/channel-commission/src/mock.rs b/pallets/channel-commission/src/mock.rs index 69ef466b25..aa9c70ae68 100644 --- a/pallets/channel-commission/src/mock.rs +++ b/pallets/channel-commission/src/mock.rs @@ -21,8 +21,8 @@ use crate::mock::sp_api_hidden_includes_construct_runtime::hidden_include::traits::OnInitialize; use bifrost_primitives::{ - currency::{BNC, KSM}, - CurrencyId, TokenSymbol, + currency::{ASG, BNC, KSM}, + CommissionPalletId, CurrencyId, }; use frame_support::{derive_impl, ord_parameter_types, parameter_types, traits::Nothing, PalletId}; use frame_system::EnsureSignedBy; @@ -66,7 +66,7 @@ impl frame_system::Config for Runtime { } parameter_types! { - pub const GetNativeCurrencyId: CurrencyId = CurrencyId::Native(TokenSymbol::ASG); + pub const GetNativeCurrencyId: CurrencyId = ASG; } pub type AdaptedBasicCurrency = @@ -127,10 +127,8 @@ ord_parameter_types! { } parameter_types! { - pub const CommissionPalletId: PalletId = PalletId(*b"bf/comms"); pub const ClearingDuration: u32 = 100; pub const NameLengthLimit: u32 = 20; - pub const FeeSharePalletId: PalletId = PalletId(*b"bf/feesh"); pub BifrostCommissionReceiver: AccountId = AccountId32::new([7u8; 32]); } diff --git a/pallets/clouds-convert/src/mock.rs b/pallets/clouds-convert/src/mock.rs index 72a89989ba..b4b455135b 100644 --- a/pallets/clouds-convert/src/mock.rs +++ b/pallets/clouds-convert/src/mock.rs @@ -24,9 +24,9 @@ use bifrost_asset_registry::AssetIdMaps; use bifrost_primitives::{ currency::{BNC, CLOUD, KSM, VBNC, VKSM}, - CurrencyId, CurrencyIdMapping, TokenSymbol, + BuyBackAccount, CloudsPalletId, CurrencyId, CurrencyIdMapping, IncentivePalletId, }; -use frame_support::{ord_parameter_types, parameter_types, traits::Nothing, PalletId}; +use frame_support::{ord_parameter_types, parameter_types, traits::Nothing}; use frame_system::EnsureSignedBy; use sp_core::H256; use sp_runtime::{ @@ -95,7 +95,7 @@ impl frame_system::Config for Runtime { } parameter_types! { - pub const NativeCurrencyId: CurrencyId = CurrencyId::Native(TokenSymbol::BNC); + pub const NativeCurrencyId: CurrencyId = BNC; } pub type AdaptedBasicCurrency = @@ -166,10 +166,6 @@ impl bifrost_asset_registry::Config for Runtime { type WeightInfo = (); } -parameter_types! { - pub const CloudsPalletId: PalletId = PalletId(*b"bf/cloud"); -} - impl bifrost_clouds_convert::Config for Runtime { type RuntimeEvent = RuntimeEvent; type MultiCurrency = Currencies; @@ -180,9 +176,7 @@ impl bifrost_clouds_convert::Config for Runtime { } parameter_types! { - pub const BbBNCTokenType: CurrencyId = CurrencyId::VToken(TokenSymbol::BNC); - pub IncentivePalletId: PalletId = PalletId(*b"bf/bbict"); - pub const BuyBackAccount: PalletId = PalletId(*b"bf/bybck"); + pub const BbBNCTokenType: CurrencyId = VBNC; pub const Week: BlockNumber = 50400; // a week pub const MaxBlock: BlockNumber = 10512000; // four years pub const Multiplier: Balance = 10_u128.pow(12); diff --git a/pallets/cross-in-out/src/mock.rs b/pallets/cross-in-out/src/mock.rs index 527975bec8..c76374cf31 100644 --- a/pallets/cross-in-out/src/mock.rs +++ b/pallets/cross-in-out/src/mock.rs @@ -20,8 +20,8 @@ #![allow(non_upper_case_globals)] use bifrost_primitives::{ - currency::{BNC, DOT, KSM, VDOT}, - CurrencyId, TokenSymbol, + currency::{ASG, BNC, DOT, KSM, VDOT}, + CurrencyId, SlpEntrancePalletId, }; use frame_support::{derive_impl, ord_parameter_types, parameter_types, traits::Nothing, PalletId}; use frame_system::EnsureSignedBy; @@ -65,7 +65,7 @@ impl frame_system::Config for Runtime { } parameter_types! { - pub const GetNativeCurrencyId: CurrencyId = CurrencyId::Native(TokenSymbol::ASG); + pub const GetNativeCurrencyId: CurrencyId = ASG; } pub type AdaptedBasicCurrency = @@ -126,7 +126,6 @@ ord_parameter_types! { } parameter_types! { - pub const SlpEntrancePalletId: PalletId = PalletId(*b"bf/vtkin"); pub const MaxLengthLimit: u32 = 100; } diff --git a/pallets/deprecated/lightening-redeem/src/mock.rs b/pallets/deprecated/lightening-redeem/src/mock.rs index bdf14c4615..a56b0d582e 100644 --- a/pallets/deprecated/lightening-redeem/src/mock.rs +++ b/pallets/deprecated/lightening-redeem/src/mock.rs @@ -129,10 +129,6 @@ impl pallet_collective::Config for Runtime { type WeightInfo = pallet_collective::weights::SubstrateWeight; } -parameter_types! { - pub const LighteningRedeemPalletId: PalletId = PalletId(*b"lighten#"); -} - impl bifrost_lightening_redeem::Config for Runtime { type RuntimeEvent = RuntimeEvent; type MultiCurrency = Tokens; diff --git a/pallets/deprecated/liquidity-mining/src/mock.rs b/pallets/deprecated/liquidity-mining/src/mock.rs index bae62a1039..8c9ac3b3f8 100644 --- a/pallets/deprecated/liquidity-mining/src/mock.rs +++ b/pallets/deprecated/liquidity-mining/src/mock.rs @@ -180,7 +180,6 @@ parameter_types! { pub const MinimumDuration: BlockNumber = MINUTES; pub const MaximumApproved: u32 = 4; pub const MaximumOptionRewards: u32 = 7; - pub const LiquidityMiningPalletId: PalletId = PalletId(*b"mining##"); } impl lm::Config for Test { diff --git a/pallets/deprecated/salp-lite/src/mock.rs b/pallets/deprecated/salp-lite/src/mock.rs index 962f5232d8..04a8bdafbb 100644 --- a/pallets/deprecated/salp-lite/src/mock.rs +++ b/pallets/deprecated/salp-lite/src/mock.rs @@ -161,7 +161,6 @@ impl bifrost_currencies::Config for Test { parameter_types! { pub const MinContribution: Balance = 10; - pub const BifrostCrowdloanId: PalletId = PalletId(*b"bf/salp#"); pub const RemoveKeysLimit: u32 = 50; pub const SlotLength: BlockNumber = 8u32 as BlockNumber; pub const LeasePeriod: BlockNumber = 6 * WEEKS; diff --git a/pallets/deprecated/system-maker/src/mock.rs b/pallets/deprecated/system-maker/src/mock.rs index 756815e07a..33f85fb4f9 100644 --- a/pallets/deprecated/system-maker/src/mock.rs +++ b/pallets/deprecated/system-maker/src/mock.rs @@ -22,8 +22,11 @@ #![allow(non_upper_case_globals)] use bifrost_asset_registry::AssetIdMaps; -use bifrost_primitives::MoonbeamChainId; -pub use bifrost_primitives::{currency::*, CurrencyId, SlpxOperator, TokenSymbol}; +pub use bifrost_primitives::{currency::*, CurrencyId, SlpxOperator}; +use bifrost_primitives::{ + BifrostEntranceAccount, BifrostExitAccount, BifrostFeeAccount, IncentivePoolAccount, + MoonbeamChainId, SystemMakerPalletId, ZenlinkPalletId, +}; use bifrost_slp::{QueryId, QueryResponseManager}; pub use cumulus_primitives_core::ParaId; use frame_support::{ @@ -32,10 +35,8 @@ use frame_support::{ parameter_types, sp_runtime::{DispatchError, DispatchResult}, traits::{Everything, Nothing}, - PalletId, }; use frame_system::{EnsureRoot, EnsureSignedBy}; -use hex_literal::hex; use orml_traits::{location::RelativeReserveProvider, parameter_type_with_key, MultiCurrency}; use sp_core::ConstU32; use sp_runtime::{ @@ -103,7 +104,7 @@ impl frame_system::Config for Runtime { } parameter_types! { - pub const GetNativeCurrencyId: CurrencyId = CurrencyId::Native(TokenSymbol::ASG); + pub const GetNativeCurrencyId: CurrencyId = ASG; } pub type AdaptedBasicCurrency = @@ -157,14 +158,11 @@ impl orml_tokens::Config for Runtime { parameter_types! { pub const TreasuryAccount: AccountId32 = TREASURY_ACCOUNT; - pub BifrostVsbondAccount: PalletId = PalletId(*b"bf/salpb"); - pub const SystemMakerPalletId: PalletId = PalletId(*b"bf/sysmk"); } ord_parameter_types! { pub const One: AccountId = ALICE; - // pub const RelayChainTokenSymbolKSM: TokenSymbol = TokenSymbol::KSM; - pub const RelayCurrencyId: CurrencyId = CurrencyId::Token(TokenSymbol::KSM); + pub const RelayCurrencyId: CurrencyId = KSM; } impl bifrost_system_maker::Config for Runtime { @@ -282,10 +280,6 @@ impl orml_xtokens::Config for Runtime { parameter_types! { pub const MaximumUnlockIdOfUser: u32 = 10; pub const MaximumUnlockIdOfTimeUnit: u32 = 50; - pub BifrostEntranceAccount: PalletId = PalletId(*b"bf/vtkin"); - pub BifrostExitAccount: PalletId = PalletId(*b"bf/vtout"); - pub BifrostFeeAccount: AccountId = hex!["e4da05f08e89bf6c43260d96f26fffcfc7deae5b465da08669a9d008e64c2c63"].into(); - pub IncentivePoolAccount: PalletId = PalletId(*b"bf/inpoo"); } impl bifrost_vtoken_minting::Config for Runtime { @@ -315,7 +309,6 @@ impl bifrost_vtoken_minting::Config for Runtime { } parameter_types! { - pub const ZenlinkPalletId: PalletId = PalletId(*b"/zenlink"); pub const GetExchangeFee: (u32, u32) = (3, 1000); // 0.3% pub const SelfParaId: u32 = 2001; } diff --git a/pallets/farming/src/mock.rs b/pallets/farming/src/mock.rs index fe91ffb785..28a443f841 100644 --- a/pallets/farming/src/mock.rs +++ b/pallets/farming/src/mock.rs @@ -21,8 +21,13 @@ #![cfg(test)] #![allow(non_upper_case_globals)] -pub use bifrost_primitives::{currency::*, CurrencyId, TokenSymbol}; -use frame_support::{derive_impl, ord_parameter_types, parameter_types, traits::Nothing, PalletId}; +pub use bifrost_primitives::{currency::*, CurrencyId}; +use bifrost_primitives::{ + currency::{ASG, VBNC}, + BuyBackAccount, FarmingBoostPalletId, FarmingGaugeRewardIssuerPalletId, FarmingKeeperPalletId, + FarmingRewardIssuerPalletId, IncentivePalletId, +}; +use frame_support::{derive_impl, ord_parameter_types, parameter_types, traits::Nothing}; use frame_system::EnsureSignedBy; use sp_core::ConstU32; use sp_runtime::{ @@ -69,7 +74,7 @@ impl frame_system::Config for Runtime { } parameter_types! { - pub const GetNativeCurrencyId: CurrencyId = CurrencyId::Native(TokenSymbol::ASG); + pub const GetNativeCurrencyId: CurrencyId = ASG; } pub type AdaptedBasicCurrency = @@ -123,12 +128,8 @@ impl orml_tokens::Config for Runtime { } parameter_types! { - pub const FarmingKeeperPalletId: PalletId = PalletId(*b"bf/fmkpr"); - pub const FarmingRewardIssuerPalletId: PalletId = PalletId(*b"bf/fmrir"); - pub const FarmingBoostPalletId: PalletId = PalletId(*b"bf/fmbst"); pub const TreasuryAccount: AccountId32 = TREASURY_ACCOUNT; pub const WhitelistMaximumLimit: u32 = 10; - pub const FarmingGaugeRewardIssuerPalletId: PalletId = PalletId(*b"bf/fmgar"); } ord_parameter_types! { @@ -152,9 +153,7 @@ impl bifrost_farming::Config for Runtime { } parameter_types! { - pub const BbBNCTokenType: CurrencyId = CurrencyId::VToken(TokenSymbol::BNC); - pub IncentivePalletId: PalletId = PalletId(*b"bf/bbict"); - pub const BuyBackAccount: PalletId = PalletId(*b"bf/bybck"); + pub const BbBNCTokenType: CurrencyId = VBNC; pub const Week: BlockNumber = 50400; // a week pub const MaxBlock: BlockNumber = 10512000; // four years pub const Multiplier: Balance = 10_u128.pow(12); diff --git a/pallets/fee-share/src/mock.rs b/pallets/fee-share/src/mock.rs index 16945802b9..5b404135b6 100644 --- a/pallets/fee-share/src/mock.rs +++ b/pallets/fee-share/src/mock.rs @@ -23,8 +23,11 @@ pub use super::*; use bifrost_asset_registry::AssetIdMaps; -pub use bifrost_primitives::{currency::*, CurrencyId, Moment, SlpxOperator, TokenSymbol}; -use bifrost_primitives::{MoonbeamChainId, PriceDetail}; +pub use bifrost_primitives::{currency::*, CurrencyId, Moment, SlpxOperator}; +use bifrost_primitives::{ + BifrostEntranceAccount, BifrostExitAccount, BifrostFeeAccount, FeeSharePalletId, + IncentivePoolAccount, MoonbeamChainId, PriceDetail, ZenlinkPalletId, +}; use bifrost_slp::{QueryId, QueryResponseManager}; pub use cumulus_primitives_core::ParaId; use frame_support::{ @@ -33,10 +36,8 @@ use frame_support::{ parameter_types, sp_runtime::{DispatchError, DispatchResult, FixedPointNumber}, traits::{Everything, Nothing}, - PalletId, }; use frame_system::{EnsureRoot, EnsureSignedBy}; -use hex_literal::hex; use orml_traits::{ location::RelativeReserveProvider, parameter_type_with_key, DataFeeder, DataProvider, DataProviderExtended, MultiCurrency, @@ -113,7 +114,7 @@ impl frame_system::Config for Runtime { } parameter_types! { - pub const GetNativeCurrencyId: CurrencyId = CurrencyId::Native(TokenSymbol::ASG); + pub const GetNativeCurrencyId: CurrencyId = ASG; } pub type AdaptedBasicCurrency = @@ -167,13 +168,11 @@ impl orml_tokens::Config for Runtime { parameter_types! { pub const TreasuryAccount: AccountId32 = TREASURY_ACCOUNT; - pub BifrostVsbondAccount: PalletId = PalletId(*b"bf/salpb"); - pub const FeeSharePalletId: PalletId = PalletId(*b"bf/feesh"); } ord_parameter_types! { pub const One: AccountId = ALICE; - pub const RelayCurrencyId: CurrencyId = CurrencyId::Token(TokenSymbol::KSM); + pub const RelayCurrencyId: CurrencyId = KSM; } impl bifrost_fee_share::Config for Runtime { @@ -394,10 +393,6 @@ impl orml_xtokens::Config for Runtime { parameter_types! { pub const MaximumUnlockIdOfUser: u32 = 10; pub const MaximumUnlockIdOfTimeUnit: u32 = 50; - pub BifrostEntranceAccount: PalletId = PalletId(*b"bf/vtkin"); - pub BifrostExitAccount: PalletId = PalletId(*b"bf/vtout"); - pub BifrostFeeAccount: AccountId = hex!["e4da05f08e89bf6c43260d96f26fffcfc7deae5b465da08669a9d008e64c2c63"].into(); - pub IncentivePoolAccount: PalletId = PalletId(*b"bf/inpoo"); } impl bifrost_vtoken_minting::Config for Runtime { @@ -427,7 +422,6 @@ impl bifrost_vtoken_minting::Config for Runtime { } parameter_types! { - pub const ZenlinkPalletId: PalletId = PalletId(*b"/zenlink"); pub const GetExchangeFee: (u32, u32) = (3, 1000); // 0.3% pub const SelfParaId: u32 = 2001; } diff --git a/pallets/flexible-fee/src/mock.rs b/pallets/flexible-fee/src/mock.rs index d8ef4559d7..7e061dcb07 100644 --- a/pallets/flexible-fee/src/mock.rs +++ b/pallets/flexible-fee/src/mock.rs @@ -21,7 +21,7 @@ use super::*; use crate::{self as flexible_fee, mock_price::MockOraclePriceProvider}; use bifrost_currencies::BasicCurrencyAdapter; -use bifrost_primitives::{Balance, CurrencyId, TokenSymbol}; +use bifrost_primitives::{Balance, CurrencyId, FlexibleFeePalletId, TokenSymbol, ZenlinkPalletId}; use cumulus_primitives_core::ParaId as Pid; use frame_support::{ derive_impl, parameter_types, @@ -149,7 +149,6 @@ impl orml_tokens::Config for Test { parameter_types! { pub const TreasuryAccount: AccountId32 = TREASURY_ACCOUNT; pub const MaxFeeCurrencyOrderListLen: u32 = 50; - pub const FlexibleFeePalletId: PalletId = PalletId(*b"bf/flexi"); } impl crate::Config for Test { @@ -196,7 +195,7 @@ impl Get for ParaInfo { } parameter_types! { - pub const GetNativeCurrencyId: CurrencyId = CurrencyId::Native(TokenSymbol::BNC); + pub const GetNativeCurrencyId: CurrencyId = BNC; } impl bifrost_currencies::Config for Test { @@ -207,7 +206,6 @@ impl bifrost_currencies::Config for Test { } parameter_types! { - pub const ZenlinkPalletId: PalletId = PalletId(*b"/zenlink"); pub const GetExchangeFee: (u32, u32) = (3, 1000); // 0.3% pub const SelfParaId: u32 = 2001; } diff --git a/pallets/lend-market/src/mock.rs b/pallets/lend-market/src/mock.rs index eecf3f21dd..9e2ba4bb14 100644 --- a/pallets/lend-market/src/mock.rs +++ b/pallets/lend-market/src/mock.rs @@ -22,7 +22,6 @@ pub use bifrost_primitives::{currency::*, *}; use frame_support::{ construct_runtime, derive_impl, parameter_types, traits::{AsEnsureOriginWithArg, Nothing, SortedMembers}, - PalletId, }; use frame_system::{EnsureRoot, EnsureSigned, EnsureSignedBy}; use orml_traits::{DataFeeder, DataProvider, DataProviderExtended}; @@ -88,11 +87,6 @@ parameter_types! { pub const MaxLocks: u32 = 50; } -parameter_types! { - pub const StableCurrencyId: CurrencyId = CurrencyId::Stable(TokenSymbol::KUSD); - pub const PolkadotCurrencyId: CurrencyId = CurrencyId::Token(TokenSymbol::DOT); -} - impl pallet_balances::Config for Test { type AccountStore = frame_system::Pallet; type Balance = Balance; @@ -116,10 +110,6 @@ impl bifrost_asset_registry::Config for Test { type WeightInfo = (); } -parameter_types! { - pub const NativeCurrencyId: CurrencyId = CurrencyId::Native(TokenSymbol::BNC); -} - orml_traits::parameter_type_with_key! { pub ExistentialDeposits: |currency_id: CurrencyId| -> Balance { match currency_id { @@ -316,7 +306,6 @@ impl pallet_prices::Config for Test { } parameter_types! { - pub const LendMarketPalletId: PalletId = PalletId(*b"bf/ldmkt"); pub const RewardAssetId: CurrencyId = BNC; pub const LiquidationFreeAssetId: CurrencyId = DOT; } diff --git a/pallets/leverage-staking/src/mock.rs b/pallets/leverage-staking/src/mock.rs index f7ab5dd74d..dc76e26b3f 100644 --- a/pallets/leverage-staking/src/mock.rs +++ b/pallets/leverage-staking/src/mock.rs @@ -22,12 +22,14 @@ use bifrost_asset_registry::AssetIdMaps; pub use bifrost_primitives::{ currency::*, Balance, CurrencyId, CurrencyIdMapping, SlpOperator, SlpxOperator, TokenSymbol, }; -use bifrost_primitives::{Moment, MoonbeamChainId, OraclePriceProvider, Price, PriceDetail, Ratio}; +use bifrost_primitives::{ + BifrostEntranceAccount, BifrostExitAccount, IncentivePoolAccount, LendMarketPalletId, Moment, + MoonbeamChainId, OraclePriceProvider, Price, PriceDetail, Ratio, StableAssetPalletId, +}; use bifrost_runtime_common::milli; use frame_support::{ derive_impl, ord_parameter_types, parameter_types, traits::{ConstU128, ConstU32, Everything, Nothing}, - PalletId, }; use frame_system::{EnsureRoot, EnsureSignedBy}; use lend_market::{InterestRateModel, JumpModel, Market, MarketState}; @@ -77,7 +79,7 @@ impl frame_system::Config for Test { } parameter_types! { - pub const NativeCurrencyId: CurrencyId = CurrencyId::Native(TokenSymbol::BNC); + pub const NativeCurrencyId: CurrencyId = BNC; } orml_traits::parameter_type_with_key! { @@ -235,9 +237,6 @@ impl bifrost_stable_asset::traits::ValidateAssetId for EnsurePoolAss true } } -parameter_types! { - pub const StableAssetPalletId: PalletId = PalletId(*b"nuts/sta"); -} impl bifrost_stable_asset::Config for Test { type RuntimeEvent = RuntimeEvent; @@ -279,9 +278,6 @@ impl leverage_staking::Config for Test { parameter_types! { pub const MaximumUnlockIdOfUser: u32 = 1_000; pub const MaximumUnlockIdOfTimeUnit: u32 = 1_000; - pub BifrostEntranceAccount: PalletId = PalletId(*b"bf/vtkin"); - pub BifrostExitAccount: PalletId = PalletId(*b"bf/vtout"); - pub IncentivePoolAccount: PalletId = PalletId(*b"bf/inpoo"); } pub struct SlpxInterface; @@ -292,7 +288,7 @@ impl SlpxOperator for SlpxInterface { } ord_parameter_types! { - pub const RelayCurrencyId: CurrencyId = CurrencyId::Token(TokenSymbol::KSM); + pub const RelayCurrencyId: CurrencyId = KSM; } impl bifrost_vtoken_minting::Config for Test { @@ -439,7 +435,6 @@ impl OraclePriceProvider for MockOraclePriceProvider { } parameter_types! { - pub const LendMarketPalletId: PalletId = PalletId(*b"bf/ldmkt"); pub const RewardAssetId: CurrencyId = BNC; pub const LiquidationFreeAssetId: CurrencyId = DOT; } diff --git a/pallets/parachain-staking/Cargo.toml b/pallets/parachain-staking/Cargo.toml index c3e5089c3b..c9a7d34b94 100644 --- a/pallets/parachain-staking/Cargo.toml +++ b/pallets/parachain-staking/Cargo.toml @@ -6,6 +6,7 @@ edition = "2021" version = "3.0.1" [dependencies] +bifrost-primitives = { workspace = true } log = { workspace = true } serde = { workspace = true, features = ["derive"] } diff --git a/pallets/parachain-staking/src/mock.rs b/pallets/parachain-staking/src/mock.rs index 29303a0278..45acfb13b9 100644 --- a/pallets/parachain-staking/src/mock.rs +++ b/pallets/parachain-staking/src/mock.rs @@ -18,7 +18,6 @@ use frame_support::{ construct_runtime, derive_impl, parameter_types, traits::{LockIdentifier, LockableCurrency, OnFinalize, OnInitialize, ReservableCurrency}, - PalletId, }; use sp_core::ConstU32; use sp_runtime::{traits::IdentityLookup, Perbill, Percent}; @@ -29,6 +28,7 @@ use crate::{ DelegatorReserveToLockMigrations, DelegatorState, InflationInfo, Points, Range, COLLATOR_LOCK_ID, DELEGATOR_LOCK_ID, }; +use bifrost_primitives::ParachainStakingPalletId; use sp_runtime::BuildStorage; pub type AccountId = u64; @@ -96,7 +96,6 @@ parameter_types! { pub const MinDelegation: u128 = 3; pub AllowInflation: bool = true; pub PaymentInRound: u128 = 10; - pub const ParachainStakingPalletId: PalletId = PalletId(*b"bf/stake"); pub ToMigrateInvulnables: Vec = vec![ 0,1 ]; diff --git a/pallets/salp/src/mock.rs b/pallets/salp/src/mock.rs index e2138c8596..f377cbab30 100644 --- a/pallets/salp/src/mock.rs +++ b/pallets/salp/src/mock.rs @@ -22,8 +22,13 @@ use bifrost_asset_registry::AssetIdMaps; use bifrost_primitives::{ - Amount, Balance, CurrencyId, CurrencyId::*, MessageId, MockXcmExecutor, ParaId, SlpOperator, - SlpxOperator, TokenSymbol, TokenSymbol::*, VKSM, + Amount, Balance, BifrostCrowdloanId, BifrostEntranceAccount, BifrostExitAccount, + BuybackPalletId, + CurrencyId::{self, *}, + IncentivePoolAccount, MessageId, MockXcmExecutor, ParaId, SlpOperator, SlpxOperator, + StableAssetPalletId, + TokenSymbol::{self, *}, + ZenlinkPalletId, ASG, KSM, KUSD, VKSM, }; use bifrost_xcm_interface::traits::XcmHelper; use cumulus_primitives_core::ParaId as Pid; @@ -32,7 +37,6 @@ use frame_support::{ sp_runtime::{DispatchError, DispatchResult, SaturatedConversion}, traits::{ConstU128, ConstU64, EnsureOrigin, Everything, Get, LockIdentifier, Nothing}, weights::Weight, - PalletId, }; use frame_system::{EnsureRoot, EnsureSignedBy, RawOrigin}; use orml_traits::{location::RelativeReserveProvider, parameter_type_with_key, MultiCurrency}; @@ -80,9 +84,9 @@ construct_runtime!( ); parameter_types! { - pub const NativeCurrencyId: CurrencyId = CurrencyId::Native(TokenSymbol::ASG); - pub const RelayCurrencyId: CurrencyId = CurrencyId::Token(TokenSymbol::KSM); - pub const StableCurrencyId: CurrencyId = CurrencyId::Stable(TokenSymbol::KUSD); + pub const NativeCurrencyId: CurrencyId = ASG; + pub const RelayCurrencyId: CurrencyId = KSM; + pub const StableCurrencyId: CurrencyId = KUSD; } parameter_types! { @@ -177,7 +181,6 @@ impl bifrost_currencies::Config for Test { } parameter_types! { - pub const ZenlinkPalletId: PalletId = PalletId(*b"/zenlink"); pub const GetExchangeFee: (u32, u32) = (3, 1000); // 0.3% pub const SelfParaId: u32 = 2001; } @@ -268,7 +271,6 @@ pub const TREASURY_ACCOUNT: AccountId = AccountId::new([9u8; 32]); parameter_types! { pub const MinContribution: Balance = 10; - pub const BifrostCrowdloanId: PalletId = PalletId(*b"bf/salp#"); pub const RemoveKeysLimit: u32 = 50; pub const SlotLength: BlockNumber = 8u32 as BlockNumber; pub const LeasePeriod: BlockNumber = 6 * WEEKS; @@ -281,7 +283,6 @@ parameter_types! { CATHI ],2); pub const TreasuryAccount: AccountId = TREASURY_ACCOUNT; - pub const BuybackPalletId: PalletId = PalletId(*b"bf/salpc"); pub const BatchLimit: u32 = 50; } @@ -330,9 +331,6 @@ impl bifrost_stable_asset::traits::ValidateAssetId for EnsurePoolAss true } } -parameter_types! { - pub const StableAssetPalletId: PalletId = PalletId(*b"nuts/sta"); -} impl bifrost_stable_asset::Config for Test { type RuntimeEvent = RuntimeEvent; @@ -364,9 +362,6 @@ impl bifrost_stable_pool::Config for Test { parameter_types! { pub const MaximumUnlockIdOfUser: u32 = 1_000; pub const MaximumUnlockIdOfTimeUnit: u32 = 1_000; - pub BifrostEntranceAccount: PalletId = PalletId(*b"bf/vtkin"); - pub BifrostExitAccount: PalletId = PalletId(*b"bf/vtout"); - pub IncentivePoolAccount: PalletId = PalletId(*b"bf/inpoo"); } pub struct SlpxInterface; @@ -576,8 +571,8 @@ pub(crate) fn new_test_ext() -> sp_io::TestExternalities { let currency = vec![ (Native(BNC), DOLLARS / 100, None), - (Stable(KUSD), DOLLARS / 10_000, None), - (Token(KSM), DOLLARS / 10_000, None), + (Stable(TokenSymbol::KUSD), DOLLARS / 10_000, None), + (Token(TokenSymbol::KSM), DOLLARS / 10_000, None), (Token(ZLK), DOLLARS / 1000_000, None), (Token(KAR), DOLLARS / 10_000, None), (Token(RMRK), DOLLARS / 1000_000, None), @@ -585,7 +580,7 @@ pub(crate) fn new_test_ext() -> sp_io::TestExternalities { (Token(MOVR), DOLLARS / 1000_000, None), (Token(DOT), DOLLARS / 1000_000, None), ]; - let vcurrency = vec![Native(BNC), Token(KSM), Token(MOVR)]; + let vcurrency = vec![Native(BNC), Token(TokenSymbol::KSM), Token(MOVR)]; let vsbond = vec![]; bifrost_asset_registry::GenesisConfig:: { currency, diff --git a/pallets/salp/src/tests.rs b/pallets/salp/src/tests.rs index 40b486f12d..b30fb0d16e 100644 --- a/pallets/salp/src/tests.rs +++ b/pallets/salp/src/tests.rs @@ -19,7 +19,9 @@ // Ensure we're `no_std` when compiling for Wasm. use crate::{mock::*, Error, FundStatus, *}; -use bifrost_primitives::{CurrencyId, TokenSymbol, TryConvertFrom, KSM, VKSM, VSKSM}; +use bifrost_primitives::{ + BuybackPalletId, CurrencyId, TokenSymbol, TryConvertFrom, KSM, VKSM, VSKSM, +}; use bifrost_xcm_interface::SalpHelper; use frame_support::{assert_noop, assert_ok}; use frame_system::pallet_prelude::BlockNumberFor; diff --git a/pallets/slp-v2/src/mock.rs b/pallets/slp-v2/src/mock.rs index 8104a81e84..c4f8990eb4 100644 --- a/pallets/slp-v2/src/mock.rs +++ b/pallets/slp-v2/src/mock.rs @@ -19,19 +19,18 @@ use crate as slp_v2; use bifrost_asset_registry::AssetIdMaps; use bifrost_primitives::{ - Amount, Balance, BlockNumber, CurrencyId, MockXcmRouter, MockXcmTransfer, SlpOperator, - SlpxOperator, BNC, DOT, + currency::DOT, Amount, Balance, BifrostEntranceAccount, BifrostExitAccount, BifrostFeeAccount, + BlockNumber, CommissionPalletId, CurrencyId, IncentivePoolAccount, MockXcmRouter, + MockXcmTransfer, SlpOperator, SlpxOperator, BNC, }; use frame_support::{ derive_impl, pallet_prelude::{ConstU32, Get}, parameter_types, traits::{Everything, Nothing}, - PalletId, }; use frame_system as system; use frame_system::EnsureRoot; -use hex_literal::hex; use pallet_xcm::EnsureResponse; use polkadot_parachain_primitives::primitives::Id as ParaId; use sp_core::{crypto::AccountId32, ConstU64}; @@ -142,7 +141,6 @@ parameter_types! { pub UnitWeightCost: Weight = Weight::from_parts(200_000_000, 0); pub const MaxInstructions: u32 = 100; pub UniversalLocation: InteriorLocation = Parachain(2030).into(); - pub CommissionPalletId: PalletId = PalletId(*b"bf/comms"); } pub struct XcmConfig; @@ -215,11 +213,7 @@ impl Get for ParachainId { parameter_types! { pub const MaximumUnlockIdOfUser: u32 = 10; pub const MaximumUnlockIdOfTimeUnit: u32 = 50; - pub BifrostEntranceAccount: PalletId = PalletId(*b"bf/vtkin"); - pub BifrostExitAccount: PalletId = PalletId(*b"bf/vtout"); - pub BifrostFeeAccount: AccountId = hex!["e4da05f08e89bf6c43260d96f26fffcfc7deae5b465da08669a9d008e64c2c63"].into(); pub const RelayCurrencyId: CurrencyId = DOT; - pub IncentivePoolAccount: PalletId = PalletId(*b"bf/inpoo"); } pub struct SlpxInterface; diff --git a/pallets/slp-v2/src/tests.rs b/pallets/slp-v2/src/tests.rs index d2649ecf2b..2140d23641 100644 --- a/pallets/slp-v2/src/tests.rs +++ b/pallets/slp-v2/src/tests.rs @@ -31,7 +31,7 @@ use crate::{ LedgerByStakingProtocolAndDelegator, NextDelegatorIndexByStakingProtocol, ValidatorsByStakingProtocolAndDelegator, }; -use bifrost_primitives::{TimeUnit, VtokenMintingOperator, VASTR}; +use bifrost_primitives::{CommissionPalletId, TimeUnit, VtokenMintingOperator, VASTR}; use cumulus_primitives_core::Weight; use frame_support::{assert_noop, assert_ok, traits::fungibles::Mutate}; use orml_traits::MultiCurrency; diff --git a/pallets/slp/src/mocks/mock.rs b/pallets/slp/src/mocks/mock.rs index a5f893b270..4495ad6bed 100644 --- a/pallets/slp/src/mocks/mock.rs +++ b/pallets/slp/src/mocks/mock.rs @@ -25,7 +25,9 @@ use crate::{Config, DispatchResult, QueryResponseManager, XcmDestWeightAndFeeHan use bifrost_asset_registry::AssetIdMaps; use bifrost_primitives::{ currency::{BNC, KSM}, - Amount, Balance, CurrencyId, MoonbeamChainId, SlpxOperator, TokenSymbol, XcmOperationType, + Amount, Balance, BifrostEntranceAccount, BifrostExitAccount, BifrostFeeAccount, CurrencyId, + IncentivePoolAccount, MoonbeamChainId, ParachainStakingPalletId, SlpxOperator, TokenSymbol, + XcmOperationType, }; pub use cumulus_primitives_core::ParaId; use frame_support::{ @@ -36,7 +38,6 @@ use frame_support::{ PalletId, }; use frame_system::{EnsureRoot, EnsureSignedBy}; -use hex_literal::hex; use orml_traits::{location::RelativeReserveProvider, parameter_type_with_key}; use parity_scale_codec::{Decode, Encode}; use sp_core::{bounded::BoundedVec, hashing::blake2_256, ConstU32}; @@ -185,10 +186,6 @@ impl orml_xtokens::Config for Runtime { parameter_types! { pub const MaximumUnlockIdOfUser: u32 = 10; pub const MaximumUnlockIdOfTimeUnit: u32 = 50; - pub BifrostEntranceAccount: PalletId = PalletId(*b"bf/vtkin"); - pub BifrostExitAccount: PalletId = PalletId(*b"bf/vtout"); - pub BifrostFeeAccount: AccountId = hex!["e4da05f08e89bf6c43260d96f26fffcfc7deae5b465da08669a9d008e64c2c63"].into(); - pub IncentivePoolAccount: PalletId = PalletId(*b"bf/inpoo"); } impl bifrost_vtoken_minting::Config for Runtime { @@ -237,7 +234,6 @@ parameter_types! { pub const MinDelegation: u128 = 3; pub AllowInflation: bool = true; pub PaymentInRound: u128 = 10; - pub const ParachainStakingPalletId: PalletId = PalletId(*b"bf/stake"); pub ToMigrateInvulnables: Vec = vec![AccountId32::new([1u8; 32])]; pub InitSeedStk: u128 = 10; } diff --git a/pallets/slp/src/mocks/mock_kusama.rs b/pallets/slp/src/mocks/mock_kusama.rs index 6aeafbf7c8..adb01aa243 100644 --- a/pallets/slp/src/mocks/mock_kusama.rs +++ b/pallets/slp/src/mocks/mock_kusama.rs @@ -25,8 +25,10 @@ use crate::{Config, DispatchResult, QueryResponseManager}; use bifrost_asset_registry::AssetIdMaps; use bifrost_primitives::{ currency::{BNC, KSM, MANTA}, - Amount, Balance, CurrencyId, MockXcmExecutor, MockXcmRouter, MoonbeamChainId, SlpxOperator, - TokenSymbol, XcmDestWeightAndFeeHandler, XcmOperationType, + Amount, Balance, BifrostEntranceAccount, BifrostExitAccount, BifrostFeeAccount, CurrencyId, + IncentivePoolAccount, MockXcmExecutor, MockXcmRouter, MoonbeamChainId, + ParachainStakingPalletId, SlpxOperator, StableAssetPalletId, TokenSymbol, + XcmDestWeightAndFeeHandler, XcmOperationType, }; pub use cumulus_primitives_core::ParaId; use frame_support::{ @@ -93,9 +95,6 @@ impl bifrost_stable_asset::traits::ValidateAssetId for EnsurePoolAss true } } -parameter_types! { - pub const StableAssetPalletId: PalletId = PalletId(*b"nuts/sta"); -} impl bifrost_stable_asset::Config for Runtime { type RuntimeEvent = RuntimeEvent; @@ -236,10 +235,6 @@ impl orml_xtokens::Config for Runtime { parameter_types! { pub const MaximumUnlockIdOfUser: u32 = 10; pub const MaximumUnlockIdOfTimeUnit: u32 = 50; - pub BifrostEntranceAccount: PalletId = PalletId(*b"bf/vtkin"); - pub BifrostExitAccount: PalletId = PalletId(*b"bf/vtout"); - pub BifrostFeeAccount: AccountId = hex!["e4da05f08e89bf6c43260d96f26fffcfc7deae5b465da08669a9d008e64c2c63"].into(); - pub IncentivePoolAccount: PalletId = PalletId(*b"bf/inpoo"); } pub struct SlpxInterface; @@ -295,7 +290,6 @@ parameter_types! { pub const MinDelegation: u128 = 3; pub AllowInflation: bool = true; pub PaymentInRound: u128 = 10; - pub const ParachainStakingPalletId: PalletId = PalletId(*b"bf/stake"); pub ToMigrateInvulnables: Vec = vec![AccountId32::new([1u8; 32])]; pub InitSeedStk: u128 = 10; } diff --git a/pallets/slpx/src/mock.rs b/pallets/slpx/src/mock.rs index ea6eaf1e88..13e32baf7a 100644 --- a/pallets/slpx/src/mock.rs +++ b/pallets/slpx/src/mock.rs @@ -19,9 +19,12 @@ use crate as slpx; use bifrost_asset_registry::AssetIdMaps; -use bifrost_primitives::MoonbeamChainId; +use bifrost_primitives::{ + BifrostEntranceAccount, BifrostExitAccount, BifrostFeeAccount, IncentivePoolAccount, + MoonbeamChainId, StableAssetPalletId, ZenlinkPalletId, +}; pub use bifrost_primitives::{ - CurrencyId, CurrencyIdMapping, MockXcmExecutor, SlpxOperator, TokenSymbol, BNC, KSM, + CurrencyId, CurrencyIdMapping, MockXcmExecutor, SlpxOperator, BNC, KSM, }; use bifrost_slp::{QueryId, QueryResponseManager}; use cumulus_primitives_core::ParaId; @@ -30,10 +33,8 @@ use frame_support::{ pallet_prelude::*, parameter_types, traits::{Everything, Nothing}, - PalletId, }; use frame_system::{EnsureRoot, EnsureSignedBy}; -use hex_literal::hex; use orml_traits::{ location::RelativeReserveProvider, parameter_type_with_key, xcm_transfer::Transferred, MultiCurrency, XcmTransfer, @@ -119,7 +120,7 @@ impl pallet_balances::Config for Test { } parameter_types! { - pub const GetNativeCurrencyId: CurrencyId = CurrencyId::Native(TokenSymbol::BNC); + pub const GetNativeCurrencyId: CurrencyId = BNC; } pub type AdaptedBasicCurrency = @@ -161,11 +162,7 @@ impl orml_tokens::Config for Test { parameter_types! { pub const MaximumUnlockIdOfUser: u32 = 10; pub const MaximumUnlockIdOfTimeUnit: u32 = 50; - pub BifrostEntranceAccount: PalletId = PalletId(*b"bf/vtkin"); - pub BifrostExitAccount: PalletId = PalletId(*b"bf/vtout"); - pub BifrostFeeAccount: AccountId = hex!["e4da05f08e89bf6c43260d96f26fffcfc7deae5b465da08669a9d008e64c2c63"].into(); pub const RelayCurrencyId: CurrencyId = KSM; - pub IncentivePoolAccount: PalletId = PalletId(*b"bf/inpoo"); } ord_parameter_types! { @@ -266,7 +263,6 @@ where type MultiAssets = ZenlinkMultiAssets>; parameter_types! { - pub const ZenlinkPalletId: PalletId = PalletId(*b"/zenlink"); pub const GetExchangeFee: (u32, u32) = (3, 1000); // 0.3% pub const SelfParaId: u32 = 2001; } @@ -476,9 +472,6 @@ impl bifrost_stable_asset::traits::ValidateAssetId for EnsurePoolAss true } } -parameter_types! { - pub const StableAssetPalletId: PalletId = PalletId(*b"nuts/sta"); -} impl bifrost_stable_asset::Config for Test { type RuntimeEvent = RuntimeEvent; @@ -509,7 +502,7 @@ impl bifrost_stable_pool::Config for Test { // Pallet slpx configuration parameter_types! { - pub const NativeCurrencyId: CurrencyId = CurrencyId::Native(TokenSymbol::BNC); + pub const NativeCurrencyId: CurrencyId = BNC; } pub struct XTokensMock; diff --git a/pallets/stable-asset/src/mock.rs b/pallets/stable-asset/src/mock.rs index ef1811effa..da1c64a1b8 100644 --- a/pallets/stable-asset/src/mock.rs +++ b/pallets/stable-asset/src/mock.rs @@ -17,12 +17,12 @@ // along with this program. If not, see . use crate as stable_asset; +use bifrost_primitives::StableAssetPalletId; use frame_support::{ derive_impl, dispatch::DispatchResult, parameter_types, traits::{ConstU128, ConstU32, Currency, EnsureOrigin, Nothing, OnUnbalanced}, - PalletId, }; use frame_system::RawOrigin; use orml_traits::MultiCurrency; @@ -266,10 +266,6 @@ impl crate::traits::ValidateAssetId for EnsurePoolAssetId { } } -parameter_types! { - pub const StableAssetPalletId: PalletId = PalletId(*b"nuts/sta"); -} - impl stable_asset::Config for Test { type RuntimeEvent = RuntimeEvent; type AssetId = i64; diff --git a/pallets/stable-pool/src/mock.rs b/pallets/stable-pool/src/mock.rs index d63321de7b..5dd4d67984 100644 --- a/pallets/stable-pool/src/mock.rs +++ b/pallets/stable-pool/src/mock.rs @@ -17,17 +17,19 @@ // along with this program. If not, see . use crate as bifrost_stable_pool; use bifrost_asset_registry::AssetIdMaps; -use bifrost_primitives::MoonbeamChainId; pub use bifrost_primitives::{ currency::{MOVR, VMOVR}, Balance, CurrencyId, CurrencyIdMapping, SlpOperator, SlpxOperator, TokenSymbol, ASTR, BNC, DOT, GLMR, VBNC, VDOT, }; +use bifrost_primitives::{ + BifrostEntranceAccount, BifrostExitAccount, IncentivePoolAccount, MoonbeamChainId, + StableAssetPalletId, KSM, KUSD, +}; use bifrost_runtime_common::milli; use frame_support::{ derive_impl, ord_parameter_types, parameter_types, traits::{ConstU128, ConstU32, Everything, Nothing}, - PalletId, }; use frame_system::{EnsureRoot, EnsureSignedBy}; use orml_traits::{location::RelativeReserveProvider, parameter_type_with_key}; @@ -63,7 +65,7 @@ impl frame_system::Config for Test { } parameter_types! { - pub const NativeCurrencyId: CurrencyId = CurrencyId::Native(TokenSymbol::BNC); + pub const NativeCurrencyId: CurrencyId = BNC; } orml_traits::parameter_type_with_key! { @@ -187,11 +189,8 @@ impl orml_xtokens::Config for Test { parameter_types! { pub const ExistentialDeposit: Balance = 1; - // pub const NativeCurrencyId: CurrencyId = CurrencyId::Native(TokenSymbol::BNC); - // pub const RelayCurrencyId: CurrencyId = CurrencyId::Token(TokenSymbol::KSM); - pub const StableCurrencyId: CurrencyId = CurrencyId::Stable(TokenSymbol::KUSD); - // pub SelfParaId: u32 = ParachainInfo::parachain_id().into(); - pub const PolkadotCurrencyId: CurrencyId = CurrencyId::Token(TokenSymbol::DOT); + pub const StableCurrencyId: CurrencyId = KUSD; + pub const PolkadotCurrencyId: CurrencyId = DOT; } impl pallet_balances::Config for Test { @@ -226,9 +225,6 @@ impl bifrost_stable_asset::traits::ValidateAssetId for EnsurePoolAss true } } -parameter_types! { - pub const StableAssetPalletId: PalletId = PalletId(*b"nuts/sta"); -} impl bifrost_stable_asset::Config for Test { type RuntimeEvent = RuntimeEvent; @@ -260,9 +256,6 @@ impl bifrost_stable_pool::Config for Test { parameter_types! { pub const MaximumUnlockIdOfUser: u32 = 1_000; pub const MaximumUnlockIdOfTimeUnit: u32 = 1_000; - pub BifrostEntranceAccount: PalletId = PalletId(*b"bf/vtkin"); - pub BifrostExitAccount: PalletId = PalletId(*b"bf/vtout"); - pub IncentivePoolAccount: PalletId = PalletId(*b"bf/inpoo"); } pub struct SlpxInterface; @@ -273,7 +266,7 @@ impl SlpxOperator for SlpxInterface { } ord_parameter_types! { - pub const RelayCurrencyId: CurrencyId = CurrencyId::Token(TokenSymbol::KSM); + pub const RelayCurrencyId: CurrencyId = KSM; } impl bifrost_vtoken_minting::Config for Test { diff --git a/pallets/stable-pool/src/tests.rs b/pallets/stable-pool/src/tests.rs index 807f32fde3..a6277a30a9 100644 --- a/pallets/stable-pool/src/tests.rs +++ b/pallets/stable-pool/src/tests.rs @@ -16,7 +16,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . use crate::{mock::*, AssetIdOf, AtLeast64BitUnsignedOf, Error}; -use bifrost_primitives::VtokenMintingOperator; +use bifrost_primitives::{StableAssetPalletId, VtokenMintingOperator}; use bifrost_stable_asset::{PoolCount, Pools, StableAssetPoolInfo}; use frame_support::{assert_noop, assert_ok, BoundedVec}; use orml_traits::MultiCurrency; diff --git a/pallets/system-staking/src/mock.rs b/pallets/system-staking/src/mock.rs index a450972d1f..a50e2f26ac 100644 --- a/pallets/system-staking/src/mock.rs +++ b/pallets/system-staking/src/mock.rs @@ -19,8 +19,12 @@ #![allow(non_upper_case_globals)] use bifrost_asset_registry::AssetIdMaps; -use bifrost_primitives::MoonbeamChainId; -pub use bifrost_primitives::{currency::*, CurrencyId, SlpxOperator, TokenSymbol}; +pub use bifrost_primitives::{currency::*, CurrencyId, SlpxOperator}; +use bifrost_primitives::{ + BifrostEntranceAccount, BifrostExitAccount, BifrostFeeAccount, FarmingBoostPalletId, + FarmingGaugeRewardIssuerPalletId, FarmingKeeperPalletId, FarmingRewardIssuerPalletId, + IncentivePoolAccount, MoonbeamChainId, SystemStakingPalletId, +}; use bifrost_slp::{QueryId, QueryResponseManager}; pub use cumulus_primitives_core::ParaId; use cumulus_primitives_core::*; @@ -29,10 +33,8 @@ use frame_support::{ pallet_prelude::Get, parameter_types, traits::{Everything, Nothing, OnFinalize, OnInitialize}, - PalletId, }; use frame_system::{EnsureRoot, EnsureSignedBy}; -use hex_literal::hex; use orml_traits::{location::RelativeReserveProvider, parameter_type_with_key}; use sp_core::ConstU32; use sp_runtime::{ @@ -87,7 +89,7 @@ impl frame_system::Config for Runtime { } parameter_types! { - pub const GetNativeCurrencyId: CurrencyId = CurrencyId::Native(TokenSymbol::ASG); + pub const GetNativeCurrencyId: CurrencyId = ASG; } pub type AdaptedBasicCurrency = @@ -173,11 +175,7 @@ impl orml_xtokens::Config for Runtime { parameter_types! { pub const MaximumUnlockIdOfUser: u32 = 10; pub const MaximumUnlockIdOfTimeUnit: u32 = 50; - pub BifrostEntranceAccount: PalletId = PalletId(*b"bf/vtkin"); - pub BifrostExitAccount: PalletId = PalletId(*b"bf/vtout"); - pub BifrostFeeAccount: AccountId = hex!["e4da05f08e89bf6c43260d96f26fffcfc7deae5b465da08669a9d008e64c2c63"].into(); pub const RelayCurrencyId: CurrencyId = KSM; - pub IncentivePoolAccount: PalletId = PalletId(*b"bf/inpoo"); } impl bifrost_vtoken_minting::Config for Runtime { @@ -277,11 +275,7 @@ impl bifrost_slp::Config for Runtime { } parameter_types! { - pub const FarmingKeeperPalletId: PalletId = PalletId(*b"bf/fmkpr"); - pub const FarmingRewardIssuerPalletId: PalletId = PalletId(*b"bf/fmrir"); - pub const FarmingBoostPalletId: PalletId = PalletId(*b"bf/fmbst"); pub const WhitelistMaximumLimit: u32 = 10; - pub const FarmingGaugeRewardIssuerPalletId: PalletId = PalletId(*b"bf/fmgar"); } ord_parameter_types! { @@ -309,7 +303,6 @@ parameter_types! { pub const BlocksPerRound: u32 = 5; pub const MaxTokenLen: u32 = 50; pub const MaxFarmingPoolIdLen: u32 = 100; - pub const SystemStakingPalletId: PalletId = PalletId(*b"bf/sysst"); } impl system_staking::Config for Runtime { diff --git a/pallets/token-issuer/src/mock.rs b/pallets/token-issuer/src/mock.rs index b110b7b22f..4764c9e600 100644 --- a/pallets/token-issuer/src/mock.rs +++ b/pallets/token-issuer/src/mock.rs @@ -22,7 +22,7 @@ use crate::Weight; use bifrost_primitives::{ currency::{BNC, DOT, KSM, VDOT}, - CurrencyId, TokenSymbol, + CurrencyId, ASG, }; use frame_support::{derive_impl, parameter_types, traits::Nothing, PalletId}; use frame_system::EnsureRoot; @@ -70,7 +70,7 @@ impl frame_system::Config for Runtime { } parameter_types! { - pub const GetNativeCurrencyId: CurrencyId = CurrencyId::Native(TokenSymbol::ASG); + pub const GetNativeCurrencyId: CurrencyId = ASG; } pub type AdaptedBasicCurrency = diff --git a/pallets/vbnc-convert/src/mock.rs b/pallets/vbnc-convert/src/mock.rs index ce3b49e9f5..88d8cc86ed 100644 --- a/pallets/vbnc-convert/src/mock.rs +++ b/pallets/vbnc-convert/src/mock.rs @@ -24,9 +24,9 @@ use bifrost_asset_registry::AssetIdMaps; use bifrost_primitives::{ currency::{BNC, KSM, VBNC, VBNC_P, VKSM}, - CurrencyId, CurrencyIdMapping, TokenSymbol, + CurrencyId, CurrencyIdMapping, VBNCConvertPalletId, }; -use frame_support::{ord_parameter_types, parameter_types, traits::Nothing, PalletId}; +use frame_support::{ord_parameter_types, parameter_types, traits::Nothing}; use frame_system::EnsureSignedBy; use sp_core::H256; use sp_runtime::{ @@ -94,7 +94,7 @@ impl frame_system::Config for Runtime { } parameter_types! { - pub const NativeCurrencyId: CurrencyId = CurrencyId::Native(TokenSymbol::BNC); + pub const NativeCurrencyId: CurrencyId = BNC; } pub type AdaptedBasicCurrency = @@ -165,10 +165,6 @@ impl bifrost_asset_registry::Config for Runtime { type WeightInfo = (); } -parameter_types! { - pub const VBNCConvertPalletId: PalletId = PalletId(*b"bf/vbncc"); -} - impl bifrost_vbnc_convert::Config for Runtime { type RuntimeEvent = RuntimeEvent; type MultiCurrency = Currencies; diff --git a/pallets/vsbond-auction/src/mock.rs b/pallets/vsbond-auction/src/mock.rs index 2e4c9088eb..a7ade8803d 100644 --- a/pallets/vsbond-auction/src/mock.rs +++ b/pallets/vsbond-auction/src/mock.rs @@ -16,7 +16,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -use bifrost_primitives::{Amount, Balance, CurrencyId, TokenSymbol}; +use bifrost_primitives::{Amount, Balance, CurrencyId, TokenSymbol, VsbondAuctionPalletId, KSM}; #[cfg(feature = "runtime-benchmarks")] use frame_benchmarking::{account, whitelisted_caller}; use frame_support::{ @@ -111,10 +111,9 @@ impl orml_tokens::Config for Test { } parameter_types! { - pub const InvoicingCurrency: CurrencyId = CurrencyId::Token(TokenSymbol::KSM); + pub const InvoicingCurrency: CurrencyId = KSM; pub const MaximumOrderInTrade: u32 = 5; pub const MinimumSupply: Balance = 0; - pub const VsbondAuctionPalletId: PalletId = PalletId(*b"bf/vsbnd"); pub BifrostTreasuryAccount: AccountId = PalletId(*b"bf/trsry").into_account_truncating(); } diff --git a/pallets/vstoken-conversion/src/mock.rs b/pallets/vstoken-conversion/src/mock.rs index 0e9fa07d88..46e56b292d 100644 --- a/pallets/vstoken-conversion/src/mock.rs +++ b/pallets/vstoken-conversion/src/mock.rs @@ -21,8 +21,12 @@ #![cfg(test)] #![allow(non_upper_case_globals)] -pub use bifrost_primitives::{currency::*, CurrencyId, TokenSymbol}; -use frame_support::{derive_impl, ord_parameter_types, parameter_types, traits::Nothing, PalletId}; +pub use bifrost_primitives::{currency::*, CurrencyId}; +use bifrost_primitives::{ + currency::{ASG, KSM}, + BifrostVsbondAccount, +}; +use frame_support::{derive_impl, ord_parameter_types, parameter_types, traits::Nothing}; use frame_system::EnsureSignedBy; use sp_core::ConstU32; use sp_runtime::{traits::IdentityLookup, AccountId32, BuildStorage}; @@ -66,7 +70,7 @@ impl frame_system::Config for Runtime { } parameter_types! { - pub const GetNativeCurrencyId: CurrencyId = CurrencyId::Native(TokenSymbol::ASG); + pub const GetNativeCurrencyId: CurrencyId = ASG; } pub type AdaptedBasicCurrency = @@ -120,13 +124,11 @@ impl orml_tokens::Config for Runtime { parameter_types! { pub const TreasuryAccount: AccountId32 = TREASURY_ACCOUNT; - pub BifrostVsbondAccount: PalletId = PalletId(*b"bf/salpb"); } ord_parameter_types! { pub const One: AccountId = ALICE; - // pub const RelayCurrencyId: CurrencyId = CurrencyId::Token2(DOT_TOKEN_ID); - pub const RelayCurrencyId: CurrencyId = CurrencyId::Token(TokenSymbol::KSM); + pub const RelayCurrencyId: CurrencyId = KSM; } impl bifrost_vstoken_conversion::Config for Runtime { diff --git a/pallets/vstoken-conversion/src/tests.rs b/pallets/vstoken-conversion/src/tests.rs index d997229fd1..c1eb850ad5 100644 --- a/pallets/vstoken-conversion/src/tests.rs +++ b/pallets/vstoken-conversion/src/tests.rs @@ -20,6 +20,7 @@ #![cfg(test)] +use bifrost_primitives::currency::KSM; use frame_support::{assert_noop, assert_ok}; pub use primitives::{VstokenConversionExchangeFee, VstokenConversionExchangeRate}; use sp_arithmetic::per_things::Percent; diff --git a/pallets/vtoken-minting/src/mock.rs b/pallets/vtoken-minting/src/mock.rs index f04aa0e800..3a7bb38ad8 100644 --- a/pallets/vtoken-minting/src/mock.rs +++ b/pallets/vtoken-minting/src/mock.rs @@ -25,7 +25,8 @@ use bb_bnc::{BbBNCInterface, Point}; use bifrost_asset_registry::AssetIdMaps; use bifrost_primitives::{ currency::{BNC, DOT, FIL, KSM, MOVR, VBNC, VFIL, VKSM, VMOVR}, - CurrencyId, CurrencyIdMapping, MoonbeamChainId, SlpxOperator, TokenSymbol, + BifrostEntranceAccount, BifrostExitAccount, BifrostFeeAccount, CurrencyId, CurrencyIdMapping, + IncentivePoolAccount, MoonbeamChainId, SlpxOperator, KUSD, }; use bifrost_runtime_common::{micro, milli}; use bifrost_slp::{QueryId, QueryResponseManager}; @@ -35,10 +36,8 @@ use frame_support::{ pallet_prelude::Get, parameter_types, traits::{Everything, Nothing}, - PalletId, }; use frame_system::{EnsureRoot, EnsureSignedBy}; -use hex_literal::hex; use orml_traits::{location::RelativeReserveProvider, parameter_type_with_key}; use sp_runtime::{ traits::{ConstU32, IdentityLookup}, @@ -89,7 +88,7 @@ impl frame_system::Config for Runtime { } parameter_types! { - pub const NativeCurrencyId: CurrencyId = CurrencyId::Native(TokenSymbol::BNC); + pub const NativeCurrencyId: CurrencyId = BNC; } pub type AdaptedBasicCurrency = @@ -104,11 +103,8 @@ impl bifrost_currencies::Config for Runtime { parameter_types! { pub const ExistentialDeposit: Balance = 1; - // pub const NativeCurrencyId: CurrencyId = CurrencyId::Native(TokenSymbol::BNC); - // pub const RelayCurrencyId: CurrencyId = CurrencyId::Token(TokenSymbol::KSM); - pub const StableCurrencyId: CurrencyId = CurrencyId::Stable(TokenSymbol::KUSD); - // pub SelfParaId: u32 = ParachainInfo::parachain_id().into(); - pub const PolkadotCurrencyId: CurrencyId = CurrencyId::Token(TokenSymbol::DOT); + pub const StableCurrencyId: CurrencyId = KUSD; + pub const PolkadotCurrencyId: CurrencyId = DOT; } impl pallet_balances::Config for Runtime { @@ -197,15 +193,11 @@ parameter_types! { pub const MaximumUnlockIdOfUser: u32 = 1_000; pub const MaximumUnlockIdOfTimeUnit: u32 = 1_000; pub const MaxLockRecords: u32 = 64; - pub BifrostEntranceAccount: PalletId = PalletId(*b"bf/vtkin"); - pub BifrostExitAccount: PalletId = PalletId(*b"bf/vtout"); - pub IncentivePoolAccount: PalletId = PalletId(*b"bf/inpoo"); - pub BifrostFeeAccount: AccountId = hex!["e4da05f08e89bf6c43260d96f26fffcfc7deae5b465da08669a9d008e64c2c63"].into(); } ord_parameter_types! { pub const One: AccountId = ALICE; - pub const RelayCurrencyId: CurrencyId = CurrencyId::Token(TokenSymbol::KSM); + pub const RelayCurrencyId: CurrencyId = KSM; } impl vtoken_minting::Config for Runtime { diff --git a/pallets/vtoken-voting/src/mock.rs b/pallets/vtoken-voting/src/mock.rs index a9bada2635..16a6adfc66 100644 --- a/pallets/vtoken-voting/src/mock.rs +++ b/pallets/vtoken-voting/src/mock.rs @@ -23,7 +23,7 @@ use crate::{BalanceOf, DerivativeAccountHandler, DerivativeIndex, DispatchResult use bifrost_primitives::{ currency::{KSM, VBNC, VKSM}, traits::XcmDestWeightAndFeeHandler, - CurrencyId, MockXcmRouter, TokenSymbol, VTokenSupplyProvider, XcmOperationType, + CurrencyId, MockXcmRouter, VTokenSupplyProvider, XcmOperationType, BNC, }; use cumulus_primitives_core::ParaId; use frame_support::{ @@ -80,7 +80,7 @@ impl frame_system::Config for Runtime { } parameter_types! { - pub const NativeCurrencyId: CurrencyId = CurrencyId::Native(TokenSymbol::BNC); + pub const NativeCurrencyId: CurrencyId = BNC; } pub type AdaptedBasicCurrency = diff --git a/primitives/Cargo.toml b/primitives/Cargo.toml index c7081880c2..93e60be9f8 100644 --- a/primitives/Cargo.toml +++ b/primitives/Cargo.toml @@ -11,6 +11,7 @@ scale-info = { workspace = true, features = ["derive"] } serde = { workspace = true, features = ["derive"] } frame-support = { workspace = true } +hex-literal = { workspace = true } sp-core = { workspace = true } sp-runtime = { workspace = true } sp-std = { workspace = true } diff --git a/primitives/src/currency.rs b/primitives/src/currency.rs index 3709c2598a..e6d1e67f48 100644 --- a/primitives/src/currency.rs +++ b/primitives/src/currency.rs @@ -44,6 +44,8 @@ pub const VSKSM: CurrencyId = CurrencyId::VSToken(TokenSymbol::KSM); pub const PHA: CurrencyId = CurrencyId::Token(TokenSymbol::PHA); pub const VPHA: CurrencyId = CurrencyId::VToken(TokenSymbol::PHA); pub const ZLK: CurrencyId = CurrencyId::Token(TokenSymbol::ZLK); +pub const KUSD: CurrencyId = CurrencyId::Stable(TokenSymbol::KUSD); +pub const ASG: CurrencyId = CurrencyId::Native(TokenSymbol::ASG); pub const DOT_TOKEN_ID: u8 = 0u8; pub const DOT: CurrencyId = CurrencyId::Token2(DOT_TOKEN_ID); diff --git a/primitives/src/lib.rs b/primitives/src/lib.rs index 0040e851d2..b711cb02dc 100644 --- a/primitives/src/lib.rs +++ b/primitives/src/lib.rs @@ -20,6 +20,8 @@ #![cfg_attr(not(feature = "std"), no_std)] +use frame_support::{parameter_types, PalletId}; +use hex_literal::hex; use parity_scale_codec::MaxEncodedLen; use scale_info::TypeInfo; use sp_core::{Decode, Encode, RuntimeDebug, H160}; @@ -156,6 +158,44 @@ pub type DerivativeIndex = u16; pub type TimeStampedPrice = orml_oracle::TimestampedValue; +// Pallet Id +parameter_types! { + pub const BifrostCrowdloanId: PalletId = PalletId(*b"bf/salp#"); + pub BifrostEntranceAccount: PalletId = PalletId(*b"bf/vtkin"); + pub BifrostExitAccount: PalletId = PalletId(*b"bf/vtout"); + pub BifrostVsbondAccount: PalletId = PalletId(*b"bf/salpb"); + pub const BuyBackAccount: PalletId = PalletId(*b"bf/bybck"); + pub const BuybackPalletId: PalletId = PalletId(*b"bf/salpc"); + pub const CloudsPalletId: PalletId = PalletId(*b"bf/cloud"); + pub const CommissionPalletId: PalletId = PalletId(*b"bf/comms"); + pub const FarmingBoostPalletId: PalletId = PalletId(*b"bf/fmbst"); + pub const FarmingGaugeRewardIssuerPalletId: PalletId = PalletId(*b"bf/fmgar"); + pub const FarmingKeeperPalletId: PalletId = PalletId(*b"bf/fmkpr"); + pub const FarmingRewardIssuerPalletId: PalletId = PalletId(*b"bf/fmrir"); + pub const FeeSharePalletId: PalletId = PalletId(*b"bf/feesh"); + pub const FlexibleFeePalletId: PalletId = PalletId(*b"bf/flexi"); + pub IncentivePoolAccount: PalletId = PalletId(*b"bf/inpoo"); + pub IncentivePalletId: PalletId = PalletId(*b"bf/bbict"); + pub const LendMarketPalletId: PalletId = PalletId(*b"bf/ldmkt"); + pub const LighteningRedeemPalletId: PalletId = PalletId(*b"lighten#"); + pub const LiquidityAccount: PalletId = PalletId(*b"bf/liqdt"); + pub const LiquidityMiningPalletId: PalletId = PalletId(*b"mining##"); + pub const ParachainStakingPalletId: PalletId = PalletId(*b"bf/stake"); + pub const SlpEntrancePalletId: PalletId = PalletId(*b"bf/vtkin"); + pub const StableAssetPalletId: PalletId = PalletId(*b"nuts/sta"); + pub const SystemMakerPalletId: PalletId = PalletId(*b"bf/sysmk"); + pub const SystemStakingPalletId: PalletId = PalletId(*b"bf/sysst"); + pub const VBNCConvertPalletId: PalletId = PalletId(*b"bf/vbncc"); + pub const VeMintingPalletId: PalletId = PalletId(*b"bf/vemnt"); + pub const VsbondAuctionPalletId: PalletId = PalletId(*b"bf/vsbnd"); + pub const ZenlinkPalletId: PalletId = PalletId(*b"/zenlink"); +} + +// Account Id +parameter_types! { + pub BifrostFeeAccount: AccountId = hex!["e4da05f08e89bf6c43260d96f26fffcfc7deae5b465da08669a9d008e64c2c63"].into(); +} + // For vtoken-minting #[derive( PartialEq, Eq, Clone, Encode, Decode, MaxEncodedLen, RuntimeDebug, scale_info::TypeInfo,