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 / gist:c9a66526aab19c20b1ce57c5d2da5ebb
Created October 9, 2024 14:33
Quick check for devnet. But it can be run on any OP network. Place file in proper folder and change l1 addresses. RPCs are set for devnet
// SPDX-License-Identifier: MIT
// Place this script in the optimism/packages/contracts-bedrock/scripts directory
// start with: forge script checkL1.s.sol
pragma solidity ^0.8.0;
import 'forge-std/Script.sol';
contract CheckDevnet is Script {
@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: