Skip to content

Instantly share code, notes, and snippets.

View aodhgan's full-sized avatar

aodhgan

  • 00:19 (UTC -07:00)
View GitHub Profile

Keybase proof

I hereby claim:

  • I am aodhgan on github.
  • I am aodhgan (https://keybase.io/aodhgan) on keybase.
  • I have a public key ASAnQc8btg5geZTXYLZ3hKB9e9m3rzpa-BEbLSs9xJglWwo

To claim this, I am signing this object:

@aodhgan
aodhgan / mint_gastoken.sol
Last active October 30, 2020 21:27
mint_gastoken.sol
function mint(uint256 value) public {
uint256 storage_location_array = STORAGE_LOCATION_ARRAY; // can't use constants inside assembly
if (value == 0) {
return;
}
// Read supply
uint256 supply;
assembly {
supply := sload(storage_location_array)
}
@aodhgan
aodhgan / free.sol
Created October 30, 2020 21:44
gastoken_free.sol
function freeStorage(uint256 value) internal {
uint256 storage_location_array = STORAGE_LOCATION_ARRAY; // can't use constants inside assembly
// Read supply
uint256 supply;
assembly {
supply := sload(storage_location_array)
}
// Clear memory locations in interval [l, r]
uint256 l = storage_location_array + supply - value + 1;
uint256 r = storage_location_array + supply;
function makeChild() internal returns (address addr) {
assembly {
// EVM assembler of runtime portion of child contract:
// ;; Pseudocode: if (msg.sender != 0x0000000000b3f879cb30fe243b4dfee438691c04) { throw; }
// ;; selfdestruct(msg.sender)
// PUSH15 0xb3f879cb30fe243b4dfee438691c04 ;; hardcoded address of this contract
// CALLER
// XOR
// PC
// JUMPI
function mint(uint256 value) public {
uint256 offset = totalMinted;
assembly {
mstore(0, 0x746d4946c0e9F43F4Dee607b0eF1fA1c3318585733ff6000526015600bf30000)
for {let i := div(value, 32)} i {i := sub(i, 1)} {
pop(create2(0, 0, 30, add(offset, 0))) pop(create2(0, 0, 30, add(offset, 1)))
pop(create2(0, 0, 30, add(offset, 2))) pop(create2(0, 0, 30, add(offset, 3)))
pop(create2(0, 0, 30, add(offset, 4))) pop(create2(0, 0, 30, add(offset, 5)))
pop(create2(0, 0, 30, add(offset, 6))) pop(create2(0, 0, 30, add(offset, 7)))
function _destroyChildren(uint256 value) internal {
assembly {
let i := sload(totalBurned_slot)
let end := add(i, value)
sstore(totalBurned_slot, end)
let data := mload(0x40)
mstore(data, 0xff0000000000004946c0e9F43F4Dee607b0eF1fA1c0000000000000000000000)
mstore(add(data, 53), 0x3c1644c68e5d6cb380c36d1bf847fdbc0c7ac28030025a2fc5e63cce23c16348)
let ptr := add(data, 21)
function destroyChildren(uint256 value) internal {
uint256 tail = s_tail;
// tail points to slot behind the last contract in the queue
for (uint256 i = tail + 1; i <= tail + value; i++) {
mk_contract_address(this, i).call();
}
s_tail = tail + value;
}
@aodhgan
aodhgan / PTIP'S 27-part-2, 29, 30, 31
Created August 4, 2021 00:21
PTIP'S 27-part-2, 29, 30, 31
*PTIP 27 part 2*
- POOL.approve(0x396b4489da692788e327E2e4b2B0459A5Ef26791, 2800000000000000000000)
- POOL Prize Pool (0x396b4489da692788e327e2e4b2b0459a5ef26791)
depositTo(0xd186302304fD367488b5087Af5b12CB9B7cf7540,
2800000000000000000000, 0x27D22A7648e955E510a40bDb058333E9190d12D4, 0x0000000000000000000000000000000000000000)
*PTIP 29*
- COMP PrizeStrategy
setTokenListener(0x9EE3FAECFFb7a02fC1696D3E7e672763C381dF3F)
## Approve ERC20Predicate contract to transfer pool
POOL(0x0cec1a9154ff802e7934fc916ed7ca50bde6844e).approve(0x40ec5B33f54e0E8A33A975908C5BA1c14e5BbbDf, 13400000000000000000000)
## call depositFor() on the RootChainManager for each receiving address (2 faucets, 1 safe)
0xA0c68C638235ee32657e8f720a23ceC1bFc77C77.depositFor(0x6cbc003fe015d753180f072d904ba841b2415498, 0x0cec1a9154ff802e7934fc916ed7ca50bde6844e,0x0000000000000000000000000000000000000000000000e3aeb5737240a00000)
0xA0c68C638235ee32657e8f720a23ceC1bFc77C77.depositFor(0x12533c9fe479ab8c27e55c1b7697e0647fadb153, 0x0cec1a9154ff802e7934fc916ed7ca50bde6844e,0x0000000000000000000000000000000000000000000000e3aeb5737240a00000)
0xA0c68C638235ee32657e8f720a23ceC1bFc77C77.depositFor(0xfaA08668FD52f74c09D4D3091E463ff736c5f269, 0x0cec1a9154ff802e7934fc916ed7ca50bde6844e, 0x00000000000000000000000000000000000000000000010f0cf064dd59200000)
@aodhgan
aodhgan / report
Created January 21, 2022 21:15
Auction test results
"rank","amount","ether","address","signature"
1,"5680000000000000000",5.68,"0x525D1818454b7C622461f897D1262c52fd1eD3A0","0x778dafba333c370f2eed6d7148b510ad093caedf8f7700f169a375ffb3f8aacf11ef7171b52dc0890ca900e82b061bcc4ac3086f2abc7e8f5f90d712e475634e1c"
2,"5410000000000000000",5.41,"0xF17A4DBAEE13E418C9EbEc02Bc4D8574C04bFc25","0x603abae5c98618bbb6a48fede4ae60ff0b42fbebe4ee1f4f87343678c452b4f04abe4253ea2181dd0c843d430127ee7ee9a1dfc62a7f2e258821142dfb0a2c5e1c"
3,"5250000000000000000",5.25,"0x5ed49ca3560d9c3140e2b3f662396769582350a0","0xc01af5e3a15048fd3d8174d21bd13005bf555d96cb6a147da3105921099527976f79676e942d7f64830629a5ae701fe2cdc22cfd00bd460242752f4106b7fd271b"
4,"5190000000000000000",5.19,"0x3049243cB01c16256611fF0c071b5Fcb8fba0E96","0x0edfb627ad4d6035fdecb8d484e97eb1dd9fe705152e426f8d3a4fe035d9d9232c1607261cea27ea329dc006c5bff306cd016e325e275e81567b7eda33115de11b"
5,"4970000000000000000",4.97,"0xA8FCeA9db35e573C2a2De4EC9Fce7DC2260566f9","0xa45619139b19ea719a29b09ede22cf0378d2edaece8fb4735cbf54cc6d4cb6af3