The goal of this exercise is to optimize contracts for minimal gas usage. This assignment contains 3 tasks in form of gas optimization examples. For each task your goal is to reduce the gas usage as much as possible
- Optimize each contract in
contracts/directory by making changes in the same file
Example1- Stores certain variables such as
day,amountandownerAddr
- Stores certain variables such as
Example2- Stores a state variable
counter. FunctionincrementBytakes in an array and adds each element of this array to counter variable
- Stores a state variable
Example3- Stores a state variable
marginPercentage. FunctiongetOwnerMargintakes in an amount and returns respective amounts for owner and sender
- Stores a state variable
-
Create a fork of this repo
-
Create a new branch with your name. You can use the following command
git checkout -b my-name -
Install all dependencies
npm install -
Make changes to contracts in this directory -
contract/. The tests intest/directory should run successfully. -
Run Tests
npm test -
Create a pull request from your forked repo to main branch of original repo to run the github workflow.