fix: remove lower_case_with_underscores and Capitalized_Words_With_Underscores from code examples

This commit is contained in:
Richie
2022-02-21 10:53:35 -08:00
parent daad9a42c1
commit 49f06dacdf
6 changed files with 58 additions and 60 deletions
+6 -6
View File
@@ -45,19 +45,19 @@ Solidity language without a compiler change.
pragma solidity >=0.4.16 <0.9.0;
library GetCode {
function at(address _addr) public view returns (bytes memory o_code) {
function at(address _addr) public view returns (bytes memory code) {
assembly {
// retrieve the size of the code, this needs assembly
let size := extcodesize(_addr)
// allocate output byte array - this could also be done without assembly
// by using o_code = new bytes(size)
o_code := mload(0x40)
// by using code = new bytes(size)
code := mload(0x40)
// new "memory end" including padding
mstore(0x40, add(o_code, and(add(add(size, 0x20), 0x1f), not(0x1f))))
mstore(0x40, add(code, and(add(add(size, 0x20), 0x1f), not(0x1f))))
// store length in memory
mstore(o_code, size)
mstore(code, size)
// actually retrieve the code, this needs assembly
extcodecopy(_addr, add(o_code, 0x20), 0, size)
extcodecopy(_addr, add(code, 0x20), 0, size)
}
}
}