Skip to content

Commit

Permalink
optimized solidity
Browse files Browse the repository at this point in the history
  • Loading branch information
kendricktan committed Apr 3, 2020
1 parent 3ea0e9b commit 491adbe
Show file tree
Hide file tree
Showing 49 changed files with 1,732 additions and 1,806 deletions.
464 changes: 232 additions & 232 deletions packages/smart-contracts/artifacts/Address.json

Large diffs are not rendered by default.

350 changes: 172 additions & 178 deletions packages/smart-contracts/artifacts/AddressRegistry.json

Large diffs are not rendered by default.

44 changes: 22 additions & 22 deletions packages/smart-contracts/artifacts/BytesLibLite.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"contractName": "BytesLibLite",
"abi": [],
"metadata": "{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/home/kendrick/Development/Ethereum/dedge/packages/smart-contracts/src/lib/BytesLib.sol\":\"BytesLibLite\"},\"evmVersion\":\"constantinople\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/home/kendrick/Development/Ethereum/dedge/packages/smart-contracts/src/lib/BytesLib.sol\":{\"keccak256\":\"0x2127d94e9d0443c4f0a5a8ebd8fd8746c7ea4e4d3849e3a45c41943019571ea7\",\"urls\":[\"bzz-raw://dbe24f863129a5062658ec1e6bc2695d7427dd8783aec86903125867f6343a4f\",\"dweb:/ipfs/QmfX7eArFhPnTa1bwjpfse3ni6EapoHfzuhdXxMxKU8kNb\"]}},\"version\":1}",
"bytecode": "0x6080604052348015600f57600080fd5b50603e80601d6000396000f3fe6080604052600080fdfea265627a7a72315820d0044b7ea85acdd6254ef13d6dc86fb5e3b021ad771a98f2bcefbb0c8a49e88d64736f6c63430005100032",
"deployedBytecode": "0x6080604052600080fdfea265627a7a72315820d0044b7ea85acdd6254ef13d6dc86fb5e3b021ad771a98f2bcefbb0c8a49e88d64736f6c63430005100032",
"metadata": "{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/home/kendrick/Development/Ethereum/dedge/packages/smart-contracts/src/lib/BytesLib.sol\":\"BytesLibLite\"},\"evmVersion\":\"constantinople\",\"libraries\":{},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"/home/kendrick/Development/Ethereum/dedge/packages/smart-contracts/src/lib/BytesLib.sol\":{\"keccak256\":\"0x2127d94e9d0443c4f0a5a8ebd8fd8746c7ea4e4d3849e3a45c41943019571ea7\",\"urls\":[\"bzz-raw://dbe24f863129a5062658ec1e6bc2695d7427dd8783aec86903125867f6343a4f\",\"dweb:/ipfs/QmfX7eArFhPnTa1bwjpfse3ni6EapoHfzuhdXxMxKU8kNb\"]}},\"version\":1}",
"bytecode": "0x6080604052348015600f57600080fd5b50603e80601d6000396000f3fe6080604052600080fdfea265627a7a723158208f5e73eebc0f3bcab9f733ab5a86fbb3c560f1665e56ba2ef551e64948db4d4d64736f6c63430005100032",
"deployedBytecode": "0x6080604052600080fdfea265627a7a723158208f5e73eebc0f3bcab9f733ab5a86fbb3c560f1665e56ba2ef551e64948db4d4d64736f6c63430005100032",
"sourceMap": "144:3359:14:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;144:3359:14;;;;;;;",
"deployedSourceMap": "144:3359:14:-;;;;;",
"source": "pragma solidity 0.5.16;\n\n// https://github.com/GNSPS/solidity-bytes-utils/blob/b1b22d1e9c4de64defb811f4c65a391630f220d7/contracts/BytesLib.sol\n\ncontract BytesLibLite {\n // A lite version of the ByteLib, containing only the \"slice\" function we need\n\n function sliceToEnd(\n bytes memory _bytes,\n uint256 _start\n ) internal pure returns (bytes memory) {\n require(_start < _bytes.length, \"bytes-read-out-of-bounds\");\n\n return slice(\n _bytes,\n _start,\n _bytes.length - _start\n );\n }\n \n function slice(\n bytes memory _bytes,\n uint256 _start,\n uint256 _length\n )\n internal\n pure\n returns (bytes memory)\n {\n require(_bytes.length >= (_start + _length), \"bytes-read-out-of-bounds\");\n\n bytes memory tempBytes;\n\n assembly {\n switch iszero(_length)\n case 0 {\n // Get a location of some free memory and store it in tempBytes as\n // Solidity does for memory variables.\n tempBytes := mload(0x40)\n\n // The first word of the slice result is potentially a partial\n // word read from the original array. To read it, we calculate\n // the length of that partial word and start copying that many\n // bytes into the array. The first word we copy will start with\n // data we don't care about, but the last `lengthmod` bytes will\n // land at the beginning of the contents of the new array. When\n // we're done copying, we overwrite the full first word with\n // the actual length of the slice.\n let lengthmod := and(_length, 31)\n\n // The multiplication in the next line is necessary\n // because when slicing multiples of 32 bytes (lengthmod == 0)\n // the following copy loop was copying the origin's length\n // and then ending prematurely not copying everything it should.\n let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)))\n let end := add(mc, _length)\n\n for {\n // The multiplication in the next line has the same exact purpose\n // as the one above.\n let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start)\n } lt(mc, end) {\n mc := add(mc, 0x20)\n cc := add(cc, 0x20)\n } {\n mstore(mc, mload(cc))\n }\n\n mstore(tempBytes, _length)\n\n //update free-memory pointer\n //allocating the array padded to 32 bytes like the compiler does now\n mstore(0x40, and(add(mc, 31), not(31)))\n }\n //if we want a zero-length slice let's just return a zero-length array\n default {\n tempBytes := mload(0x40)\n\n mstore(0x40, add(tempBytes, 0x20))\n }\n }\n\n return tempBytes;\n }\n\n function bytesToAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) {\n require(_bytes.length >= (_start + 20), \"Read out of bounds\");\n address tempAddress;\n\n assembly {\n tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000)\n }\n\n return tempAddress;\n }\n}\n",
Expand Down Expand Up @@ -146,10 +146,10 @@
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
7908,
7909
7830,
7831
],
"referencedDeclaration": 7909,
"referencedDeclaration": 7831,
"src": "382:7:14",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
Expand Down Expand Up @@ -572,10 +572,10 @@
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
7908,
7909
7830,
7831
],
"referencedDeclaration": 7909,
"referencedDeclaration": 7831,
"src": "741:7:14",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
Expand Down Expand Up @@ -1055,10 +1055,10 @@
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
7908,
7909
7830,
7831
],
"referencedDeclaration": 7909,
"referencedDeclaration": 7831,
"src": "3246:7:14",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
Expand Down Expand Up @@ -1428,10 +1428,10 @@
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
7908,
7909
7830,
7831
],
"referencedDeclaration": 7909,
"referencedDeclaration": 7831,
"src": "382:7:14",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
Expand Down Expand Up @@ -1854,10 +1854,10 @@
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
7908,
7909
7830,
7831
],
"referencedDeclaration": 7909,
"referencedDeclaration": 7831,
"src": "741:7:14",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
Expand Down Expand Up @@ -2337,10 +2337,10 @@
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
7908,
7909
7830,
7831
],
"referencedDeclaration": 7909,
"referencedDeclaration": 7831,
"src": "3246:7:14",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
Expand Down Expand Up @@ -2578,7 +2578,7 @@
},
"networks": {},
"schemaVersion": "3.0.23",
"updatedAt": "2020-04-01T11:18:01.795Z",
"updatedAt": "2020-04-03T06:25:13.479Z",
"devdoc": {
"methods": {}
},
Expand Down
62 changes: 31 additions & 31 deletions packages/smart-contracts/artifacts/Common.json

Large diffs are not rendered by default.

194 changes: 97 additions & 97 deletions packages/smart-contracts/artifacts/CompoundBase.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions packages/smart-contracts/artifacts/DACProxy.json

Large diffs are not rendered by default.

54 changes: 8 additions & 46 deletions packages/smart-contracts/artifacts/DACProxyFactory.json

Large diffs are not rendered by default.

Loading

0 comments on commit 491adbe

Please sign in to comment.