Skip to content

Instantly share code, notes, and snippets.

View tamjid0x01's full-sized avatar
:shipit:
Web3 <3

Tamjid tamjid0x01

:shipit:
Web3 <3
View GitHub Profile

Report

Gas Optimizations

Issue Instances
[GAS-1] Use != 0 instead of > 0 for unsigned integer comparison 5
[GAS-2] Don't initialize variables with default value 1

Report

Gas Optimizations

Issue Instances
[GAS-1] Cache array length outside of loop 1
[GAS-2] Use != 0 instead of > 0 for unsigned integer comparison 5
// takes a numeraire amount, calculates the raw amount of eurs, transfers it in and returns the corresponding raw amount
function intakeNumeraire(int128 _amount)
external
override
returns (uint256 amount_)
{
uint256 _rate = getRate();
amount_ = (_amount.mulu(10**tokenDecimals) * 10**oracleDecimals) / _rate;
@Philogy
Philogy / day1.rs
Last active June 25, 2023 21:58
Advent Of Code 2022 (Day 1) in Rust
use std::fs;
fn sort_desc<T: Ord>(v: &mut Vec<T>) {
v.sort_by(|a, b| b.cmp(a));
}
/// # Advent Of Code 2022 (Day 1).
///
/// Challenge is you an input which displays "calories of elves" ([link](https://adventofcode.com/2022/day/1)):
///