This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for(uint256 i; i<tokens.length; ++i) { | |
address token = tokens[i]; | |
uint256 balance = balances[i]; | |
if (address == WETH) { | |
safeTransferToken(WETH, WETHGateway, amount); | |
} else { | |
safeTransferToken(token, to, amount); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for(uint256 i; i<tokens.length; ++i) { | |
address token = tokens[i]; | |
uint256 balance = balances[i]; | |
if (address == WETH) { | |
_sendETH(to, amount); | |
} else { | |
safeTranferToken(token, to, amount); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: GPL-3.0 | |
pragma solidity ^0.8.10; | |
contract Test { | |
// Gas used for empy function: 22094 | |
function blank(uint16) public pure returns (string memory) {} | |
// Gas used: 31922 - 22094 = 9828 | |
function toBinary1(uint16 n) public pure returns (string memory) { | |
require(n < 1024); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (uint256 i = 0; i < len; ) { | |
address allowedContract = creditConfigurator.allowedContracts(i); | |
address adapter = creditFacade.contractToAdapter(allowedContract); | |
AdapterType aType = IAdapter(adapter)._gearboxAdapterType(); | |
if (aType == AdapterType.CONVEX_V1_BASE_REWARD_POOL) { | |
uint256 pid = IConvexV1BaseRewardPoolAdapter(adapter).pid(); | |
address stakedPhantomToken = IConvexV1BaseRewardPoolAdapter( | |
adapter | |
).stakedPhantomToken(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: agpl-3.0 | |
pragma solidity ^0.7.4; | |
pragma abicoder v2; | |
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; | |
import {ILendingPool} from "./interfaces/ILendingPool.sol"; | |
import {ILendingPoolAddressesProvider} from "./interfaces/ILendingPoolAddressesProvider.sol"; | |
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; | |
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; | |
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import childProcess from "child_process"; | |
import fs from "fs"; | |
const v1Metrics = "gasV1.json"; | |
const v2Metrics = "gasV2.json"; | |
export type GasMeasures = | |
| "openCreditAccount" | |
| "swapOnUniswapFastCheck" | |
| "swapOnUniswapFullCheck" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function _fullCheck(address creditAccount) internal { | |
uint256 borrowAmountPlusInterestRateUSD = priceOracle.convertToUSD( | |
calcCreditAccountAccruedInterest(creditAccount), | |
underlyingToken | |
); | |
uint256 total; | |
uint256 tokenMask; | |
uint256 eTokens = enabledTokens[creditAccount]; | |
uint256 len = allowedTokens.length; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// @dev Calculates Threshold Weighted Total Value | |
/// More: https://dev.gearbox.fi/developers/credit/economy#threshold-weighted-value | |
/// | |
/// @param creditAccount Credit account address | |
function calcThresholdWeightedValue(address creditAccount) | |
public | |
view | |
override | |
returns (uint256 total) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// store balances before swap | |
uint256 balanceInBefore = _vaultService.getBalance(tokenIn); | |
uint256 balanceOutBefore = _vaultService.getBalance(tokenOut); | |
// swapTokens | |
_vaultService.swapTokensForExactTokens( | |
amountOut, | |
amountInMax, | |
path, | |
deadline |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.25; | |
import "https://raw.githubusercontent.com/Arachnid/solidity-stringutils/master/src/strings.sol"; | |
contract HappyBirthdayDima { | |
using strings for *; | |
event SPBlockchainCommuntyGreeting (address sender, string greeting); | |
modifier onlyRazVGodu (){ |