Skip to content

Commit

Permalink
reduce contract size
Browse files Browse the repository at this point in the history
  • Loading branch information
furkhat committed Jan 21, 2020
1 parent d0ed6ec commit 340f372
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions contracts/contracts/Franklin.sol
Original file line number Diff line number Diff line change
Expand Up @@ -279,21 +279,18 @@ contract Franklin {
bytes memory depositsPubData = priorityQueue.getOutstandingDeposits();
uint64 i = 0;
while (i < depositsPubData.length) {
bytes memory deposit = Bytes.slice(depositsPubData, i, ETH_ADDR_BYTES+TOKEN_BYTES+AMOUNT_BYTES);
bytes memory owner = new bytes(ETH_ADDR_BYTES);
for (uint8 j = 0; j < ETH_ADDR_BYTES; ++j) {
owner[j] = deposit[j];
}
bytes memory token = new bytes(TOKEN_BYTES);
for (uint8 j = 0; j < TOKEN_BYTES; j++) {
token[j] = deposit[ETH_ADDR_BYTES + j];
}
bytes memory amount = new bytes(AMOUNT_BYTES);
for (uint8 j = 0; j < AMOUNT_BYTES; ++j) {
amount[j] = deposit[ETH_ADDR_BYTES + TOKEN_BYTES + j];
}
bytes memory owner = Bytes.slice(depositsPubData, i, ETH_ADDR_BYTES);
i += ETH_ADDR_BYTES;

bytes memory token = Bytes.slice(depositsPubData, i, TOKEN_BYTES);
i += TOKEN_BYTES;

bytes memory amount = Bytes.slice(depositsPubData, i, AMOUNT_BYTES);
i += AMOUNT_BYTES;

i += PUBKEY_HASH_BYTES;

balancesToWithdraw[Bytes.bytesToAddress(owner)][Bytes.bytesToUInt16(token)] += Bytes.bytesToUInt128(amount);
i += ETH_ADDR_BYTES+TOKEN_BYTES+AMOUNT_BYTES+PUBKEY_HASH_BYTES;
}
}

Expand Down

0 comments on commit 340f372

Please sign in to comment.