Skip to content

Instantly share code, notes, and snippets.

@MASDXI
MASDXI / RBTree.sol
Created June 24, 2024 07:52
RBTree.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0 <0.9.0;
/// @author sirawt
// applied portion of code from
// https://github.com/bokkypoobah/BokkyPooBahsTreeLibrary/
// https://github.com/rob-Hitchens/OrderStatisticsTree
// https://github.com/saurfang/solidity-treemap/
library RedBlackTree {
@MASDXI
MASDXI / LoopPerformance.sol
Last active May 12, 2024 11:19
Many style of 'Loop' in Solidity
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.5.0 <0.9.0;
// @author sirawt
contract LoopPerformance {
uint256 public sum;
function clear() public {
@MASDXI
MASDXI / genesis.json
Created January 26, 2024 03:37
genesis.json
{
"config": {
"chainId": 235,
"homesteadBlock": 0,
"eip150Block": 0,
"eip155Block": 0,
"eip158Block": 0,
"byzantiumBlock": 0,
"constantinopleBlock": 0,
"constantinopleFixBlock": 0,
@MASDXI
MASDXI / triedb.sol
Created November 12, 2023 07:43
TrieDB
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.14;
contract TrieDB {
enum TRIE_STATUS { INACTIVE, ACTIVE }
struct TrieNode {
bytes32 origin;
TRIE_STATUS status;
@MASDXI
MASDXI / iroha_v1-local-dev.sh
Created November 21, 2022 05:37
iroha v1 docker
#!usr/bin/bash
docker pull sirawitt42/iroha-1.5.0-rockdb:develop
git clone https://github.com/MASDXI/iroha.git -b masdxi/docker/hotfix
cd iroha
docker run --name iroha \
-d \
-p 50051:50051 \
@MASDXI
MASDXI / ABI.json
Created July 7, 2022 09:37
Test 0x44 on ETH 2.0
[
{
"inputs": [],
"name": "rand",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
// SPDX-License-Identifier: NONE
pragma solidity =0.7.5;
/*
* @source: https://youtu.be/P_Mtd5Fc_3E
* @author: Shahar Zini
* @revised: 0x91d9
*/
contract GuessTheNumber {
@MASDXI
MASDXI / Calculator.sol
Last active April 4, 2022 11:52
RTLO smart contract
// SPDX-License-Identifier: MIT
pragma solidity 0.7.5;
contract Calculator {
function add(uint256 x, uint256 y) public pure returns (uint256) {
/* start function*/
require(x + y >= x);
return /*first number*/x + y/*second number*/
/* end function*/;
@MASDXI
MASDXI / Crowsale.sol
Created March 20, 2022 13:30
Malicious contract
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
contract Crowdsale is Ownable, ReentrancyGuard, Pausable {
IERC20 private _tokenA;
@MASDXI
MASDXI / IPRNG.sol
Last active June 20, 2022 20:58
Signed Message RNG
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.1;
interface IPRNG {
struct Entropy {
address signer;
bytes32 hash;
bytes sig;
}