Skip to content

Instantly share code, notes, and snippets.

Avatar

Alexander Wade wadeAlexC

View GitHub Profile
View ComeAndTakeIt.sol
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 {
View keybase.md

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 Nov 8, 2018
Sample Account Registry utility
View RegisterAccount.sol
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 Nov 8, 2018
Simple delegate-proxy implementation
View Proxy.sol
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
View ERC20Target.sol
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 Feb 8, 2019
MIBToken.sol - Source file
View MIBToken.sol
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);
View Solver.sol
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 {
View Demo.sol
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;
View SafeExecutionNaiveSoln.sol
pragma solidity ^0.4.23;
contract Soln1 {
address public owner;
function execute(address) public {
owner = msg.sender;
}
}
View Attacker.sol
pragma solidity ^0.4.23;
contract Attacker {
address public owner;
function () public {
owner = msg.sender;
msg.sender.transfer(address(this).balance);
}