Skip to content

Instantly share code, notes, and snippets.

View Mc01's full-sized avatar
🥑
Chilling and looking for 🦖

Mc01.eth Mc01

🥑
Chilling and looking for 🦖
View GitHub Profile
@Mc01
Mc01 / InputOutput.sol
Last active February 9, 2024 14:17
Naming convention
pragma solidity 0.8.21;
library InputOutput {
function _finalize(
Context memory _context, // - input argument
uint64[4] memory _output_ // - input argument and also output of the function
) internal view {
// tx.members
uint256 now_ = block.timestamp; // local var
@Mc01
Mc01 / string_to_account_id.rs
Created January 29, 2024 16:51
[Substrate] Convert string to AccountId
use bs58;
#[inline]
pub fn convert_string_to_accountid(account_str: &str) -> AccountId {
let mut output = vec![0xFF; 35];
bs58::decode(account_str).onto(&mut output).unwrap();
let cut_address_vec: Vec<_> = output.drain(1..33).collect();
let mut array = [0; 32];
let bytes = &cut_address_vec[..array.len()];
array.copy_from_slice(bytes);
@Mc01
Mc01 / flashloan.sol
Last active April 18, 2023 20:19
[SCAM] Flash Loan Attack
pragma solidity ^0.5.0;
// Multiplier-Finance Smart Contracts - this is bullshit
import "https://github.com/Multiplier-Finance/MCL-FlashloanDemo/blob/main/contracts/interfaces/ILendingPoolAddressesProvider.sol";
import "https://github.com/Multiplier-Finance/MCL-FlashloanDemo/blob/main/contracts/interfaces/ILendingPool.sol";
// PancakeSwap Smart Contracts - this is bullshit
import "https://github.com/pancakeswap/pancake-swap-core/blob/master/contracts/interfaces/IPancakeCallee.sol";
import "https://github.com/pancakeswap/pancake-swap-core/blob/master/contracts/interfaces/IPancakeFactory.sol";
import "https://github.com/pancakeswap/pancake-swap-core/blob/master/contracts/interfaces/IPancakePair.sol";
@Mc01
Mc01 / scratch.py
Created April 20, 2020 11:04
Microframework ideas
class HTTP:
Create = 0
List = 1
Retrieve = 2
Update = 3
Delete = 4
class App:
def __init__(self, **kwargs):
@Mc01
Mc01 / TrivialToken.sol
Created August 23, 2017 07:20
Trivial Token of Chain Object - v1.04
pragma solidity ^0.4.11;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;