Gas optimization is a critical aspect of developing efficient and cost-effective smart contracts on blockchain platforms. We recognize the importance of gas efficiency in enabling widespread adoption of blockchain-based applications.

This bounty aims to support optimizing gas usage for thirdweb's published smart contracts, enhancing their performance, scalability, and cost-effectiveness.

Objectives: The primary objective of this bounty is to encourage the development of gas-optimized versions of thirdweb's published smart contracts. The bounty recipients will be expected to achieve the following goals:

  1. Gas Efficiency: Identify and implement strategies to reduce gas consumption and improve the overall efficiency of thirdweb's published smart contracts. This includes optimizing contract logic, reducing unnecessary storage operations, minimizing computational complexity, and improving code structure and design.

    Steps on how to get started are detailed as followed:

    1. Fork the contracts repository
    2. Follow directions in the ReadMe to run your contract locally
    3. In your own branch, add gas optimizations to the contracts and commit your changes.
  2. Benchmarking and Testing: The proposed changes must be tested using thirdweb’s benchmark tests. Optionally, you may also add and run your own tests.

    Steps on how to run thirdweb’s benchmark tests are detailed as followed:

    1. Run forge build, followed by yarn gas. You’ll now see a diff in the gasreport.txt file, for how your optimizations affected gas consumption. Commit this change with the commit message “yarn gas”.
    2. Make a PR to the contracts repository and link the PR in your submission form.

Bounty Details:

Selected applicants will receive financial support in return for suggested gas improvements. The reward will be classified in three tiers:

This reward is calculated based on the total % of gas you’ve reduced across all contracts you’ve optimized. For each contract, we will only consider optimizations made to “relevant functions”. These are functions present in the benchmark test files in contracts/src/test/benchmark/*.

How to calculate my reward?

Let’s say you’ve reduced the gas of ExampleContractA.function from 10080 gas, and ExampleContractB.function from 5040 gas.

Your reward is calculated based on the total % of gas you’ve reduced across all contracts you’ve optimized.

percentageOptimized = ((total_gas_before - tota_gas_after) / total_gas_before ) * 100

So in this example case:

percentageOptimized = ((150 - 120) / 150) * 100 = 20 %

The percentage optimized is 20 %, which would qualify the optimization for the **Medium** category of reward payout.

Eligibility Criteria: