Shaun Wang

@shaunw

Joined on Jun 6, 2019

  • L2 gas fee calculation comparison For Polygon zkEVM, there are multiple cases depending on configuration: With follower mode and enabled effective gas price, the gas fee is min(Effective gas price, L2 gas price * L2 gas used). Polygon zkEVM mainnet is using this approach. With follower mode and disabled effective gas price, the gas fee is L2 gas price * L2 gas used. Astar zkEVM would take this approach for testnet. For Optimism, the gas calculation formula is: [ Fee Scalar * L1 Gas Price * (Calldata + Fixed Overhead) ] + [ L2 Gas Price * L2 Gas Used ], which is basically L1 fee + L2 fee. Source: Transaction fees on OP Mainnet
     Like  Bookmark
  • Trigger liquidations by off-chain worker On every block, an off-chain worker will run to check if there is any unsafe CDP that needs to be liquidated. The off-chain worker is an integral part of the blockchain, it replaces the Keeper system as a more secure and efficient way to monitor and trigger blockchain state changes. On each off-chain worker running, it will check a maximum 1000 number of CDPs. If the maximum is reached, the next run will pick up what was left and check. The first time when the check runs, a random one will be picked from the collateral type list, and off-chain work will check its CDPs. If all the CDPs of a certain collateral type are checked, but the maximum check amount is not reached yet, the check will continue with the next collateral type on the collateral list. In addition, the CDP location cursor for the next check of the current type will be reset. For each CDP, if it's unsafe and there was no emergency shutdown, it will be liquidated Or if there is an emergency shutdown and this CDP has any debit, it will be settled.
     Like  Bookmark
  • Contract interface to implement Note for all calls from Karura/Acala runtime, the sender will be 0x31382d495fed5a6820d9c07e8b6efe8d2166e9dd, which liquidation contracts should check for security reason. liquidate(address collateral, address repay_dest, uint256 amount, uint256 - min_repayment) onCollateralTransfer(address collateral, uint256 amount) onRepaymentRefund(address collateral, uint256 repayment) Note that gas fee will be charged from contract address, which should be guaranteed to have sufficient balance. Liquidation process on Karura/Acala
     Like  Bookmark
  • Overview When a CDP is liquidated, liquidation mechanisms are used in the order of priority: Immediate liquidation. Collateral auctions. Immediate liquidation is executed with on-chain participants, including the Acala/Karura DEX and smart contracts. If immediate liquidation failed, the collateral auctions would be initiated.
     Like  Bookmark
  • Runtime constants can be covered with integration tests, as they are fixed in compile time. will need to check to make sure integration tests covered these params Pallet storage parameters Make them bounded: min, max, maxChangeAbs To limit maximum, minimum value, and maximum change on each update. Similar to BoundedVec, bounds are defined as runtime types. Define more new bounded types if needed.
     Like  Bookmark
  • Steps to open HRMP channels: Sender parachain send a init open channel request. Recipient parachain accept request. The steps above are done via Xcm::Transact from the sender's or recipient's part. Send init open channel request Get encoded transact In PolkadotJS app, switch to the relay chain network. Go to Developer -> Extrinsics section.
     Like 1 Bookmark
  • Step 1: Encode the call Get the encoded call via polkadot.js apps: const ALICE = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY'; const addProxy = api.tx.proxy.addProxy(ALICE, "Any", 0); const asDerivative = api.tx.utility.asDerivative(0, addProxy); console.log("As derivative: ", asDerivative.toHex()); Note to replace account id ALICE and proxy type Any. And double check the first param of asDerivative (the derive index).
     Like  Bookmark
  • XCM::Transact weight query, which is the runtime weight info data. Creating independent crates and let runtimes import other runtime's weight info could help, but in a quite chaotic way: If the depended runtime redo benchmark, others need to do runtime upgrade to follow changes. It could be better to using XCM messages to communicate weight info, other than relying on runtime upgrades. Support multi-token(trader) to pay execution fees. Existing traders like FixedRateOfConcreteFungible and UsingComponents only support one type of asset for payment for each of them. Provide WeightTrader impl for tuples so if one trader failed, we can try another one.
     Like  Bookmark
  • ORML changes since last audit (266518ffaf5b9f664c1481330295a994dd71b01b) Use account provider https://github.com/open-web3-stack/open-runtime-module-library/pull/361 Refactor reward https://github.com/open-web3-stack/open-runtime-module-library/pull/412 Acala DEX Get LP token price from price module https://github.com/AcalaNetwork/Acala/pull/788
     Like  Bookmark
  • Tools setup Refer to this guide Validators 3 validators are required, namely Alice, Bob, Charlie. Build validators Fetch polkadot repo, check out rococo-v1 branch and commit 9bc8915acd5507a77737371fdd892bb1f6a8db22. Go to the root of repo, Build polkadot by:
     Like  Bookmark
  • Build Mandala PC1 release with cargo build --release Run an Acala collator by: ~/path_to_acala_repo/target/release/acala \ --collator \ --chain=dev \ --ws-port=9977 \ --port=30777 \ --rpc-methods=unsafe \
     Like  Bookmark