Created
May 4, 2019 09:01
-
-
Save 0xAshish/49e8d6da2f062cd3895c6e1586c13f9c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contract a { | |
uint256 gasLimit = 2400; | |
function doThis() public { | |
address _token = address(0x3); | |
address depositManager = address(new b()); | |
address exitOwner = address(0x2); | |
uint256 amount = 2323; | |
uint256 one = 1; | |
// uint256 gasLimit = 2400; | |
assembly { | |
let ptr := mload(0x20) | |
// keccak256('transferAmount(address,address,uint256)') & 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 | |
mstore(ptr, 0x01f4747100000000000000000000000000000000000000000000000000000000) | |
// copy from, to, value from calldata to memory | |
mstore(add(ptr, 4), add(_token,0)) | |
mstore(add(ptr, 36), add(exitOwner,0)) | |
mstore(add(ptr, 68), add(amount,0)) | |
// call ERC20 Token contract transferFrom function | |
let result := call(gas, depositManager, 0, ptr, 100, ptr, 32) | |
log0(ptr,32) | |
log0(result,32) | |
// log0(result,32) | |
log1(one,32,result) | |
log1(one,32,ptr) | |
result :=and(ptr,result) | |
log1(one,32,result) | |
// log0(0,32) | |
// let out := 0x0000000000000000000000000000000000000000000000000000000000000000 | |
if eq(result, 1) { | |
// revert(0,0) | |
} | |
} | |
} | |
} | |
contract b { | |
uint256 public a; | |
address[] x; | |
event yo(address indexed _token, address indexed _user, uint256 indexed _amountOrNFTId); | |
function transferAmount(address _token, address _user, uint256 _amountOrNFTId) | |
external | |
/* onlyWithdrawManager */ | |
returns(bool) { | |
// a=_amountOrNFTId; | |
// x.push(_user); | |
// x.push(_user); | |
// x.push(_user);x.push(_user); | |
// x.push(_user); | |
// for(uint256) | |
// revert(); | |
return true; | |
// emit yo(_token,_user,_amountOrNFTId); | |
// bytes memory x= hex"0ddddddd"; | |
// return hex"00000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000020"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment