Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![Review Assignment Due Date](https://classroom.github.com/assets/deadline-readme-button-22041afd0340ce965d47ae6ef1cefeee28c7c493a6346c4f15d667ab976d596c.svg)](https://classroom.github.com/a/3JQ70u65)
[![Open in Visual Studio Code](https://classroom.github.com/assets/open-in-vscode-2e0aaae1b6195c2367325f4f02e2d04e9abb55f0b24a779b69b11b9e10269abc.svg)](https://classroom.github.com/online_ide?assignment_repo_id=21708661&assignment_repo_type=AssignmentRepo)
# Assignment 10: Gas Optimization

# Description
Expand Down
5 changes: 5 additions & 0 deletions foundry.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"lib/forge-std": {
"rev": "b93cf4bc34ff214c099dc970b153f85ade8c9f66"
}
}
8 changes: 4 additions & 4 deletions src/Assignment10.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ pragma solidity ^0.8.13;

contract Assignment10 {
// Use `constant` for values that will not change
uint256 public FEE = 100;
uint256 constant public FEE = 100;

// Pack variables in optimized order
uint128 x;
uint256 y;
uint128 z;
uint256 y;


// Use `private` instead of `public` for variables not accessed externally
uint256 public internalCounter;
uint256 private internalCounter;

// Use `external` instead of `public` for functions called externally only
function setValue(uint128 _x) public {
function setValue(uint128 _x) external {
x = _x;
}
}