Skip to content

Instantly share code, notes, and snippets.

View Maar-io's full-sized avatar
🏠
Working from home

Mar.io Maar-io

🏠
Working from home
View GitHub Profile
@Maar-io
Maar-io / benchmarking-rmrk.md
Last active December 29, 2022 20:03
Substrate pallet benchmarking (RMRK example)

Use this documentation on benchmarking. It is very good and will give all info you need.

To start existing benchmark tests I propose following steps:

  • rename pallets/rmrk-core/src/weights.rs to old_weights.rs. Just to keep it for referrence
  • examine the tests in benchmarks.rs files. They will produce measurements for the new weights.rs file
  • compile node with --features runtime-benchmarks
  • since rmrk node is missing production profile, use --profile=release in cargo build. Therefore instead of:
cd bin/node/cli
@Maar-io
Maar-io / mermaid.txt
Created June 13, 2022 07:50
aWASoMe mermaid
flowchart TD
subgraph Nodes
Swanky-node & Substrate-contracts-node & Shibuya & Contracts-Rococo
end
subgraph Interact
Swanky-CLI & Polkadot.js & ContractsUI & Polkadot_API & Redspot
end
subgraph Build
function isPassHolder(address user) private view returns (bool) {
uint128 staker = ASTARBASE.checkStakerStatusOnContract(user, MY_STAKING_PROJECT);
return staker > 0;
}
@Maar-io
Maar-io / BestProject.sol
Last active May 9, 2022 17:03
Example use case of minting ERC20 for dapps-stakers only
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "./IAstarBase.sol";
contract BestProject is ERC20 {
IAstarBase public ASTARBASE = IAstarBase(0xF183f51D3E8dfb2513c15B046F848D4a68bd3F5D);
address MY_STAKING_PROJECT = 0xDE0f34d2845511c20bAb0d7ce02B03c8065ff0c5;
uint256 ALLOWED_CLAIM = 10 * 10 ** decimals();

Keybase proof

I hereby claim:

  • I am maar-io on github.
  • I am maario (https://keybase.io/maario) on keybase.
  • I have a public key ASDIrEPoNkjRne_Y8PQDxnk2wGS1tU4jYhLOqZbhbncBPwo

To claim this, I am signing this object: