Skip to content

Instantly share code, notes, and snippets.

View aj07's full-sized avatar

aj07 aj07

  • Open Source
  • Remote
View GitHub Profile
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV2V3Interface.sol";
import "@chainlink/contracts/src/v0.8/Denominations.sol";
pragma solidity ^0.5.0;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(address from, address to, uint256 value) external returns (bool);
@aj07
aj07 / BaseJumpRateModelV2.txt
Created January 3, 2021 23:18
AMPT_SLither_analysis
Slither BaseJumpRateModelV2.sol
INFO:Detectors:
BaseJumpRateModelV2.getSupplyRate(uint256,uint256,uint256,uint256) (BaseJumpRateModelV2.sol#115-120) performs a multiplication on the result of a division:
-rateToPool = borrowRate.mul(oneMinusReserveFactor).div(1e18) (BaseJumpRateModelV2.sol#118)
-utilizationRate(cash,borrows,reserves).mul(rateToPool).div(1e18) (BaseJumpRateModelV2.sol#119)
Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#divide-before-multiply
INFO:Detectors:
Constant BaseJumpRateModelV2.blocksPerYear (BaseJumpRateModelV2.sol#23) is not in UPPER_CASE_WITH_UNDERSCORES
@aj07
aj07 / BaseJumpRateModelV2.txt
Last active January 3, 2021 23:15
AMPT_Slither_analysis
Slither BaseJumpRateModelV2.sol
INFO:Detectors:
BaseJumpRateModelV2.getSupplyRate(uint256,uint256,uint256,uint256) (BaseJumpRateModelV2.sol#115-120) performs a multiplication on the result of a division:
-rateToPool = borrowRate.mul(oneMinusReserveFactor).div(1e18) (BaseJumpRateModelV2.sol#118)
-utilizationRate(cash,borrows,reserves).mul(rateToPool).div(1e18) (BaseJumpRateModelV2.sol#119)
Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#divide-before-multiply
INFO:Detectors:
Constant BaseJumpRateModelV2.blocksPerYear (BaseJumpRateModelV2.sol#23) is not in UPPER_CASE_WITH_UNDERSCORES
INFO:Detectors:
EIP20NonStandardInterface (EIP20NonStandardInterface.sol#8-70) has incorrect ERC20 function interface:EIP20NonStandardInterface.transfer(address,uint256) (EIP20NonStandardInterface.sol#34)
EIP20NonStandardInterface (EIP20NonStandardInterface.sol#8-70) has incorrect ERC20 function interface:EIP20NonStandardInterface.transferFrom(address,address,uint256) (EIP20NonStandardInterface.sol#48)
Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#incorrect-erc20-interface
INFO:Detectors:
CToken.accrueInterest() (CToken.sol#384-462) uses a dangerous strict equality:
- accrualBlockNumberPrior == currentBlockNumber (CToken.sol#390)
CToken.accrueInterest() (CToken.sol#384-462) uses a dangerous strict equality:
- require(bool,string)(mathErr == MathError.NO_ERROR,could not calculate block delta) (CToken.sol#406)
CToken.balanceOfUnderlying(address) (CToken.sol#190-195) uses a dangerous strict equality:
pragma solidity >=0.4.21 <0.6.0;
//Add ProductManagement ABI to allow calls
contract ProductManagement{
struct Part{
address manufacturer;
string serial_number;
string part_type;
string creation_date;
}
@aj07
aj07 / voting.sol
Created March 31, 2019 17:00
Voting Contract
pragma solidity >=0.4.0 <0.6.0;
// This line says the code will compile with version greater than 0.4 and less than 0.6
contract Voting {
// constructor to initialize candidates
// vote for candidates
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
@aj07
aj07 / Steps.txt
Last active June 9, 2018 21:31
Hyperledger fabric setup
Step One: Create a Business Network Definition
We will begin by cloning a sample business network. Open up a command prompt and execute the
following command:
git clone https://github.com/hyperledger/composer-sample-networks.git
Make a copy of this directory in your project, called 'my-network’ by using the following command:
cp -r ./composer-sample-networks/packages/basic-sample-network/ ./my-network
Open Visual Studio(VS) Code and click on Open Folder.

/** * Access control rules for mynetwork / rule Default { description: "Allow all participants access to all resources" participant: "ANY" operation: ALL resource: "org.acme.mynetwork." action: ALLOW } rule SystemACL { description: "System ACL to permit all access" participant: "org.hyperledger.composer.system.Participant" operation: ALL