Skip to content

Instantly share code, notes, and snippets.

View wadealexc's full-sized avatar

Alex wadealexc

View GitHub Profile
pragma solidity ^0.5.0;
library LibError {
function err(address sender, uint amt, string memory password) public pure returns (string memory errMessage) {
return string(abi.encodePacked("Call failed, please try again:: ", sender, amt, password));
}
}
contract Auth {

Keybase proof

I hereby claim:

  • I am wadealexc on github.
  • I am wadealexc (https://keybase.io/wadealexc) on keybase.
  • I have a public key ASDJ0x7qstpcrBfn9UxO_uDuVFwKfA9TsEDkToDX-bO7-wo

To claim this, I am signing this object:

@wadealexc
wadealexc / RegisterAccount.sol
Created November 8, 2018 15:32
Sample Account Registry utility
pragma solidity ^0.4.24;
contract ERC20_Utility {
function transfer(address _sender, address _to, uint _amt) external returns (bool);
}
contract RegisterAccount {
// Maps addresses to registry status
mapping (address => bool) public registered;
@wadealexc
wadealexc / Proxy.sol
Created November 8, 2018 12:56
Simple delegate-proxy implementation
pragma solidity ^0.4.24;
contract Proxy {
// Default delegatecall target
address destination;
/**
* @dev Constructor. Sets the default destination
* @param _dest The address to which this contract will forward execution
pragma solidity ^0.4.24;
library SafeMath {
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
@wadealexc
wadealexc / MIBToken.sol
Last active February 8, 2019 15:10
MIBToken.sol - Source file
pragma solidity ^0.4.24;
contract DMIBLog {
//because gas price
//event MIBLog(bytes4 indexed sig, address indexed sender, uint _value, bytes _call4) anonymous;
event MIBLog(bytes4 indexed sig, address indexed sender, uint _value) anonymous;
modifier mlog {
//emit MIBLog(msg.sig, msg.sender, msg.value, msg.data);
emit MIBLog(msg.sig, msg.sender, msg.value);
pragma solidity ^0.4.23;
contract Solver {
bytes4 internal constant SEL = bytes4(keccak256('Set(uint256)'));
function execute(address) public pure {
// constants are not accessible in assembly
bytes4 sel = SEL;
assembly {
pragma solidity ^0.4.23;
contract Calldata {
// Alters the values on the stack for _a and _b, and returns values not located in calldata
function ignoreCalldata(address _a, bytes memory _b) public view returns (address, bytes memory) {
_a = address(this);
_b = new bytes(5);
_b[0] = 0xaa;
_b[4] = 0xdd;
pragma solidity ^0.4.23;
contract Soln1 {
address public owner;
function execute(address) public {
owner = msg.sender;
}
}
pragma solidity ^0.4.23;
contract Attacker {
address public owner;
function () public {
owner = msg.sender;
msg.sender.transfer(address(this).balance);
}