Unnamed: 0
int64
0
7.36k
comments
stringlengths
3
35.2k
code_string
stringlengths
1
527k
code
stringlengths
1
527k
__index_level_0__
int64
0
88.6k
106
// Set liquidation incentive to new incentive
liquidationIncentiveMantissa = newLiquidationIncentiveMantissa;
liquidationIncentiveMantissa = newLiquidationIncentiveMantissa;
6,159
0
// Source address => (symbol => price)
mapping(address => mapping (string => uint256)) private pricesBySource;
mapping(address => mapping (string => uint256)) private pricesBySource;
38,866
12
// Returns the id of the Aave market to which this contract points to.return The market id /
function getMarketId() external view returns (string memory);
function getMarketId() external view returns (string memory);
25,739
121
// Note: This checks whether an already existing position has a pending withdrawal. This cannot be used on the `create` method because it is possible that `create` is called on a new position (i.e. one without any collateral or tokens outstanding) which would fail the `onlyCollateralizedPosition` modifier on `_getPositionData`.
function _positionHasNoPendingWithdrawal(address sponsor) internal view { require(_getPositionData(sponsor).withdrawalRequestPassTimestamp == 0, "Pending withdrawal"); }
function _positionHasNoPendingWithdrawal(address sponsor) internal view { require(_getPositionData(sponsor).withdrawalRequestPassTimestamp == 0, "Pending withdrawal"); }
27,528
172
// calculates term2 = term2f
term2 = MathHelpers.getPartialAmountRoundedUp( f.num, f.den, term2 ); return term1.add(term2);
term2 = MathHelpers.getPartialAmountRoundedUp( f.num, f.den, term2 ); return term1.add(term2);
72,251
30
// Sends the entire contract balance to a `recipient`./
function withdraw(address recipient) external nonReentrant onlyRole(FUNDER_ROLE)
function withdraw(address recipient) external nonReentrant onlyRole(FUNDER_ROLE)
42,932
19
// Create a Redeem functionality for the collection Address/redeemCollectionAddress Order struct consists of the listedtoken details/list list struct consists of the
function createRedeem( address redeemCollectionAddress, RedeemDetails memory list
function createRedeem( address redeemCollectionAddress, RedeemDetails memory list
19,338
236
// Finder contract used to look up addresses for UMA system contracts.
FinderInterface public finder;
FinderInterface public finder;
34,805
65
// calculate amount of kcrv to withdraw for amount of _want_
uint256 _kcrv = _amount.mul(1e18).div(ICurveFi(curve).get_virtual_price());
uint256 _kcrv = _amount.mul(1e18).div(ICurveFi(curve).get_virtual_price());
25,085
13
// auth new AUTO_SURPLUS_BUFFER_SETTER_OVERLAY
newAutoSurplusBuffer.addAuthorization(address(newAutoSurplusBufferOverlay));
newAutoSurplusBuffer.addAuthorization(address(newAutoSurplusBufferOverlay));
61,859
51
// `returndatasize()` will be `0x20` upon success, and `0x00` otherwise.
result := mload(xor(0x60, returndatasize()))
result := mload(xor(0x60, returndatasize()))
21,277
43
// _interestByLoanDurationType =(_contract.terms.interest30) /(100365);
(, uint256 saInterestByLoanDurationType) = SafeMathUpgradeable .tryDiv(_contract.terms.interest * 30, 365); (, uint256 saPenaltyOfInterestRate) = SafeMathUpgradeable.tryMul( _paymentrequest.remainingPenalty, saInterestByLoanDurationType ); (, uint256 saPenaltyOfInterest) = SafeMathUpgradeable.tryDiv( saPenaltyOfInterestRate, (100 * 10**5) );
(, uint256 saInterestByLoanDurationType) = SafeMathUpgradeable .tryDiv(_contract.terms.interest * 30, 365); (, uint256 saPenaltyOfInterestRate) = SafeMathUpgradeable.tryMul( _paymentrequest.remainingPenalty, saInterestByLoanDurationType ); (, uint256 saPenaltyOfInterest) = SafeMathUpgradeable.tryDiv( saPenaltyOfInterestRate, (100 * 10**5) );
35,537
163
// Global debt pool tracking
uint[] public debtLedger;
uint[] public debtLedger;
6,090
371
// 1 Bassetratio / ratioScale == x Masset (relative value)If ratio == 10e8 then 1 bAsset = 10 mAssetsA ratio is divised as 10^(18-tokenDecimals)measurementMultiple(relative value of 1 base unit)
uint256 ratio;
uint256 ratio;
80,809
14
// Approve the SoloMargin contract to pull the owed amount + flashFee
IERC20(token).approve(address(soloMargin), amount.add(flashFee));
IERC20(token).approve(address(soloMargin), amount.add(flashFee));
41,369
2
// Fails for {y = >0, msg.sender == owner, x = 0}.
assert(x > 0);
assert(x > 0);
16,206
169
// Calculate the new position unit given total notional values pre and post executing an action that changes CKToken stateThe intention is to make updates to the units without accidentally picking up airdropped assets as well._ckTokenSupply Supply of CKToken in precise units (10^18) _preTotalNotional Total notional amount of component prior to executing action _postTotalNotionalTotal notional amount of component after the executing action _prePositionUnitPosition unit of CKToken prior to executing actionreturnNew position unit /
function calculateDefaultEditPositionUnit( uint256 _ckTokenSupply, uint256 _preTotalNotional, uint256 _postTotalNotional, uint256 _prePositionUnit ) internal pure returns (uint256)
function calculateDefaultEditPositionUnit( uint256 _ckTokenSupply, uint256 _preTotalNotional, uint256 _postTotalNotional, uint256 _prePositionUnit ) internal pure returns (uint256)
6,976
200
// This can only be used with trusted contracts
crossTokens(tokenToUse, from, amount, userData);
crossTokens(tokenToUse, from, amount, userData);
9,187
90
// Get the number of wallets tagged as double spenders/ return Number of double spender wallets
function doubleSpenderWalletsCount() public view returns (uint256)
function doubleSpenderWalletsCount() public view returns (uint256)
76,709
0
// Assumption, any new unstake queue will have the same interface
interface IExitQueue { function join(address _exiter, uint256 _amount) external; }
interface IExitQueue { function join(address _exiter, uint256 _amount) external; }
79,557
45
// Destroy tokens amount from another account (Caution!!! the operation is destructive and you can not go back)
function OWN_burnToken(address _from, uint256 _value) onlyOwner public returns (bool success) { require(balances[_from] >= _value); balances[_from] -= _value; totalSupply -= _value; emit Burn(_from, _value); return true; }
function OWN_burnToken(address _from, uint256 _value) onlyOwner public returns (bool success) { require(balances[_from] >= _value); balances[_from] -= _value; totalSupply -= _value; emit Burn(_from, _value); return true; }
57,431
6
// Get the owner
address _owner = _event.owner;
address _owner = _event.owner;
14,589
43
// Return 1inch Token Taker Address /
function getOneInchTokenTaker() internal pure returns (address payable) { return 0xE4C9194962532fEB467DCe8b3d42419641c6eD2E; }
function getOneInchTokenTaker() internal pure returns (address payable) { return 0xE4C9194962532fEB467DCe8b3d42419641c6eD2E; }
30,417
4
// Emits an event when a user purchases a batch with direct shipping/from The address of the user who purchased the batch/shippingHash The double hash of the encrypted user data/calls The array of calls to make to individual collections that host the item
event BatchPurchaseWithShipping(address indexed from, bytes32 indexed shippingHash, BatchPurchaseParams[] calls);
event BatchPurchaseWithShipping(address indexed from, bytes32 indexed shippingHash, BatchPurchaseParams[] calls);
12,210
61
// invest
uint256 NewInvestID; mapping(uint256 => InvestInfo) Invests; mapping(address => uint256) InvestAddrID;
uint256 NewInvestID; mapping(uint256 => InvestInfo) Invests; mapping(address => uint256) InvestAddrID;
22,985
56
// mapping from token address to pool that is selling that token/we maintain two order pools, one for each token that is tradable in the AMM
OrderPool OrderPool0; OrderPool OrderPool1;
OrderPool OrderPool0; OrderPool OrderPool1;
44,691
4
// Convert ETH to Any kind of Tokens .../
function convertETHtoAnyToken(address _tokensOut, address _to) public payable { address[] memory path = new address[](2); path[0] = uniswapRouter.WETH(); path[1] = _tokensOut; uint[] memory amounts = uniswapRouter.getAmountsOut(msg.value, path); emit Logamounts(amounts); uniswapRouter.swapExactETHForTokens{value : msg.value}(0, path, _to, getNow()); //emit convertEthToAnyToken(_amount, _tokensOut, path); }
function convertETHtoAnyToken(address _tokensOut, address _to) public payable { address[] memory path = new address[](2); path[0] = uniswapRouter.WETH(); path[1] = _tokensOut; uint[] memory amounts = uniswapRouter.getAmountsOut(msg.value, path); emit Logamounts(amounts); uniswapRouter.swapExactETHForTokens{value : msg.value}(0, path, _to, getNow()); //emit convertEthToAnyToken(_amount, _tokensOut, path); }
46,789
114
// This is the address of the actual backing asset token/ in the case of ETH, this address will be 0/ return Address of the Backing Token
function backingToken() external view returns (address);
function backingToken() external view returns (address);
80,438
6
// Get the index and append the value.
treeIndex = tree.nodes.length; tree.nodes.push(_value);
treeIndex = tree.nodes.length; tree.nodes.push(_value);
29,090
8
// target amount
uint256 targetAmount;
uint256 targetAmount;
29,643
36
// Returns the token collection name. /
function name() public view virtual override returns (string memory) { return "MOAR by Joan Cornella"; }
function name() public view virtual override returns (string memory) { return "MOAR by Joan Cornella"; }
70,463
10
// Invariant after change
D[1] = getD(newBalances, amp); require(D[1] > D[0]);
D[1] = getD(newBalances, amp); require(D[1] > D[0]);
25,533
2
// reference to the $SHELL contract
SHELL public shell;
SHELL public shell;
6,438
3
// state of mint dynamics
bool public initialSaleIsActive = false; // yeah, yeah, i know bool public burnoffSaleIsActive = false; // yeah, yeah, i know
bool public initialSaleIsActive = false; // yeah, yeah, i know bool public burnoffSaleIsActive = false; // yeah, yeah, i know
15,230
243
// Update lockedTokens amount before using it in computations after.
updateAccounting(msg.sender); uint256 lockedTokens = totalLocked(); uint256 mintedLockedShares = (lockedTokens > 0) ? totalFrozenShares.mul(amount).div(lockedTokens) : amount.mul(_initialSharesPerToken); UnlockSchedule memory schedule; schedule.initialLockedShares = mintedLockedShares;
updateAccounting(msg.sender); uint256 lockedTokens = totalLocked(); uint256 mintedLockedShares = (lockedTokens > 0) ? totalFrozenShares.mul(amount).div(lockedTokens) : amount.mul(_initialSharesPerToken); UnlockSchedule memory schedule; schedule.initialLockedShares = mintedLockedShares;
13,435
50
// transfer ethereum from contract /
{ _to.transfer(_value); // CHECK THIS return true; }
{ _to.transfer(_value); // CHECK THIS return true; }
55,487
194
// returns the balance of a given reserve token_reserveTokenreserve token contract address return the balance of the given reserve token /
function reserveBalance(IERC20 _reserveToken) public view override returns (uint256) { uint256 reserveId = __reserveIds[_reserveToken]; require(reserveId != 0, "ERR_INVALID_RESERVE"); return reserveBalance(reserveId); }
function reserveBalance(IERC20 _reserveToken) public view override returns (uint256) { uint256 reserveId = __reserveIds[_reserveToken]; require(reserveId != 0, "ERR_INVALID_RESERVE"); return reserveBalance(reserveId); }
26,897
19
// Transfers control of the contract to a newOwner.newOwner The address to transfer ownership to./
function _transferOwnership(address newOwner) internal { require(newOwner != address(0)); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; }
function _transferOwnership(address newOwner) internal { require(newOwner != address(0)); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; }
8,318
68
// Extends OpenZeppelin AccessControl contract with modifiers This contract and AccessControlUpgradeSafe are essentially duplicates. /
contract AccessControl is OZAccessControl { /** @notice access control roles **/ bytes32 public constant CONTRACT_ROLE = keccak256("CONTRACT_ROLE"); bytes32 public constant LP_ROLE = keccak256("LP_ROLE"); bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE"); bytes32 public constant EMERGENCY_ROLE = keccak256("EMERGENCY_ROLE"); modifier onlyLpRole() { require(hasRole(LP_ROLE, _msgSender()), "NOT_LP_ROLE"); _; } modifier onlyContractRole() { require(hasRole(CONTRACT_ROLE, _msgSender()), "NOT_CONTRACT_ROLE"); _; } modifier onlyAdminRole() { require(hasRole(ADMIN_ROLE, _msgSender()), "NOT_ADMIN_ROLE"); _; } modifier onlyEmergencyRole() { require(hasRole(EMERGENCY_ROLE, _msgSender()), "NOT_EMERGENCY_ROLE"); _; } modifier onlyLpOrContractRole() { require( hasRole(LP_ROLE, _msgSender()) || hasRole(CONTRACT_ROLE, _msgSender()), "NOT_LP_OR_CONTRACT_ROLE" ); _; } modifier onlyAdminOrContractRole() { require( hasRole(ADMIN_ROLE, _msgSender()) || hasRole(CONTRACT_ROLE, _msgSender()), "NOT_ADMIN_OR_CONTRACT_ROLE" ); _; } }
contract AccessControl is OZAccessControl { /** @notice access control roles **/ bytes32 public constant CONTRACT_ROLE = keccak256("CONTRACT_ROLE"); bytes32 public constant LP_ROLE = keccak256("LP_ROLE"); bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE"); bytes32 public constant EMERGENCY_ROLE = keccak256("EMERGENCY_ROLE"); modifier onlyLpRole() { require(hasRole(LP_ROLE, _msgSender()), "NOT_LP_ROLE"); _; } modifier onlyContractRole() { require(hasRole(CONTRACT_ROLE, _msgSender()), "NOT_CONTRACT_ROLE"); _; } modifier onlyAdminRole() { require(hasRole(ADMIN_ROLE, _msgSender()), "NOT_ADMIN_ROLE"); _; } modifier onlyEmergencyRole() { require(hasRole(EMERGENCY_ROLE, _msgSender()), "NOT_EMERGENCY_ROLE"); _; } modifier onlyLpOrContractRole() { require( hasRole(LP_ROLE, _msgSender()) || hasRole(CONTRACT_ROLE, _msgSender()), "NOT_LP_OR_CONTRACT_ROLE" ); _; } modifier onlyAdminOrContractRole() { require( hasRole(ADMIN_ROLE, _msgSender()) || hasRole(CONTRACT_ROLE, _msgSender()), "NOT_ADMIN_OR_CONTRACT_ROLE" ); _; } }
34,503
4
// holds the current balance of the user for each erc1155TokenId - user => tokenId => balance
mapping(address => mapping(uint256 => uint256)) private erc1155Balance;
mapping(address => mapping(uint256 => uint256)) private erc1155Balance;
65,663
5
// In this IDO, the `asset` MUST conform to `IERC20` /
abstract contract BaseERC20IDO is BaseIDO { using SafeERC20 for IERC20; constructor(address _owner, Config memory config) BaseIDO(_owner, config) { // Empty } /** * @notice Transfers amount of ERC20 `asset` to `to` address. Parameter `tokenIds` is ignored. */ function _offerAssets( address to, uint256[] memory, uint256[] memory amounts ) internal virtual override { for (uint256 i; i < amounts.length; i++) { IERC20(asset).safeTransferFrom(address(this), to, amounts[i]); } } /** * @notice Transfers all balance of ERC20 `asset` from `this` contract to `owner` */ function _returnAssets(uint256[] memory) internal virtual override { IERC20(asset).safeTransfer(owner(), IERC20(asset).balanceOf(address(this))); } }
abstract contract BaseERC20IDO is BaseIDO { using SafeERC20 for IERC20; constructor(address _owner, Config memory config) BaseIDO(_owner, config) { // Empty } /** * @notice Transfers amount of ERC20 `asset` to `to` address. Parameter `tokenIds` is ignored. */ function _offerAssets( address to, uint256[] memory, uint256[] memory amounts ) internal virtual override { for (uint256 i; i < amounts.length; i++) { IERC20(asset).safeTransferFrom(address(this), to, amounts[i]); } } /** * @notice Transfers all balance of ERC20 `asset` from `this` contract to `owner` */ function _returnAssets(uint256[] memory) internal virtual override { IERC20(asset).safeTransfer(owner(), IERC20(asset).balanceOf(address(this))); } }
29,642
313
// Selector of `log(bool,address,bool,address)`.
mstore(0x00, 0x1c41a336) mstore(0x20, p0) mstore(0x40, p1) mstore(0x60, p2) mstore(0x80, p3)
mstore(0x00, 0x1c41a336) mstore(0x20, p0) mstore(0x40, p1) mstore(0x60, p2) mstore(0x80, p3)
30,589
8
// Mint cost contract
address public mintCostContract;
address public mintCostContract;
79,086
75
// Retrieves the gas price that any assigned reporter will have to pay when reporting / result to a previously posted Witnet data request./Fails if the `_queryId` is not valid or, if it has already been /reported, or deleted. /_queryId The unique query identifier
function readRequestGasPrice(uint256 _queryId) external view override inStatus(_queryId, Witnet.QueryStatus.Posted) returns (uint256)
function readRequestGasPrice(uint256 _queryId) external view override inStatus(_queryId, Witnet.QueryStatus.Posted) returns (uint256)
26,440
56
// Fallback function, works only if ICO is running /
function() payable onlyRunning { var supplied = cat.totalSupply(); var tokens = tokenEmission(msg.value, supplied); // revert if nothing to emit require(tokens > 0); // emit tokens bool success = cat.emit(tokens); assert(success); // transfer new tokens to its owner success = cat.transfer(msg.sender, tokens); assert(success); // send value to the wallet wallet.transfer(msg.value); }
function() payable onlyRunning { var supplied = cat.totalSupply(); var tokens = tokenEmission(msg.value, supplied); // revert if nothing to emit require(tokens > 0); // emit tokens bool success = cat.emit(tokens); assert(success); // transfer new tokens to its owner success = cat.transfer(msg.sender, tokens); assert(success); // send value to the wallet wallet.transfer(msg.value); }
49,270
38
// transfers the governance from one account(`caller`) to another account(`_newOwner`). /
function revokeOwnership(address _newOwner) external returns (bool);
function revokeOwnership(address _newOwner) external returns (bool);
75,451
11
// add buyer manually/Contract owner should only be allowed to call this function
function addBuyer() private onlyOwner { // TODO: add buyer to array of authorized ETH addresses // TODO: Implement event TestDriveReservation }
function addBuyer() private onlyOwner { // TODO: add buyer to array of authorized ETH addresses // TODO: Implement event TestDriveReservation }
53,249
35
// Pre-sale ICO
amountOfIRC = amountOfWei.mul(IRC_PER_ETH_PRE_SALE); absLowTimeBonusLimit = preSaleStartTime + lowTimeBonusLimit; absMidTimeBonusLimit = preSaleStartTime + midTimeBonusLimit; absHighTimeBonusLimit = preSaleStartTime + highTimeBonusLimit; totalIRCAvailable = maxPresaleSupply - totalIRCAllocated;
amountOfIRC = amountOfWei.mul(IRC_PER_ETH_PRE_SALE); absLowTimeBonusLimit = preSaleStartTime + lowTimeBonusLimit; absMidTimeBonusLimit = preSaleStartTime + midTimeBonusLimit; absHighTimeBonusLimit = preSaleStartTime + highTimeBonusLimit; totalIRCAvailable = maxPresaleSupply - totalIRCAllocated;
33,908
2
// Contract constructor, define initial administrator/
constructor() internal { admin = msg.sender; //Set initial admin to contract creator emit AdminedEvent(admin); }
constructor() internal { admin = msg.sender; //Set initial admin to contract creator emit AdminedEvent(admin); }
24,854
15
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
(bool success, ) = recipient.call{ value: amount }("");
26
26
// Sets the address of the L2 Graph Token _l2GRT Address of the GRT contract on L2 /
function setL2TokenAddress(address _l2GRT) external onlyGovernor { require(_l2GRT != address(0), "INVALID_L2_GRT"); l2GRT = _l2GRT; emit L2TokenAddressSet(_l2GRT); }
function setL2TokenAddress(address _l2GRT) external onlyGovernor { require(_l2GRT != address(0), "INVALID_L2_GRT"); l2GRT = _l2GRT; emit L2TokenAddressSet(_l2GRT); }
18,831
69
// PIGGY-MODIFY: Checks if the account should be allowed to borrow the underlying asset of the given market pToken The market to verify the borrow against borrower The account which would borrow the asset borrowAmount The amount of underlying the account would borrowreturn 0 if the borrow is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol) /
function borrowAllowed(
function borrowAllowed(
13,545
68
// Returns array of owners./ return Array of Safe owners.
function getOwners() public view returns (address[] memory) { address[] memory array = new address[](ownerCount); // populate return array uint256 index = 0; address currentOwner = owners[SENTINEL_OWNERS]; while (currentOwner != SENTINEL_OWNERS) { array[index] = currentOwner; currentOwner = owners[currentOwner]; index++; } return array; }
function getOwners() public view returns (address[] memory) { address[] memory array = new address[](ownerCount); // populate return array uint256 index = 0; address currentOwner = owners[SENTINEL_OWNERS]; while (currentOwner != SENTINEL_OWNERS) { array[index] = currentOwner; currentOwner = owners[currentOwner]; index++; } return array; }
30,968
118
// Register the approval (replacing any previous approval).
indexToApproved[tokenId_] = approved_;
indexToApproved[tokenId_] = approved_;
26,576
32
// new implementation
uint256 currentNonce = _useNonce(signer);
uint256 currentNonce = _useNonce(signer);
23,578
23
// Internal function used by function 'tokenURI()' to format words for .json file output /
function getMetaWord(string memory word) internal pure returns(string memory) { string memory length = string(abi.encodePacked("\"", word, "\"")); return length; }
function getMetaWord(string memory word) internal pure returns(string memory) { string memory length = string(abi.encodePacked("\"", word, "\"")); return length; }
31,095
0
// This should be owned by the microservice that is paying for gas.
interface IAxelarGasService { error NothingReceived(); error InvalidAddress(); error NotCollector(); error InvalidAmounts(); event GasPaidForContractCall( address indexed sourceAddress, string destinationChain, string destinationAddress, bytes32 indexed payloadHash, address gasToken, uint256 gasFeeAmount, address refundAddress ); event GasPaidForContractCallWithToken( address indexed sourceAddress, string destinationChain, string destinationAddress, bytes32 indexed payloadHash, string symbol, uint256 amount, address gasToken, uint256 gasFeeAmount, address refundAddress ); event NativeGasPaidForContractCall( address indexed sourceAddress, string destinationChain, string destinationAddress, bytes32 indexed payloadHash, uint256 gasFeeAmount, address refundAddress ); event NativeGasPaidForContractCallWithToken( address indexed sourceAddress, string destinationChain, string destinationAddress, bytes32 indexed payloadHash, string symbol, uint256 amount, uint256 gasFeeAmount, address refundAddress ); event GasPaidForExpressCallWithToken( address indexed sourceAddress, string destinationChain, string destinationAddress, bytes32 indexed payloadHash, string symbol, uint256 amount, address gasToken, uint256 gasFeeAmount, address refundAddress ); event NativeGasPaidForExpressCallWithToken( address indexed sourceAddress, string destinationChain, string destinationAddress, bytes32 indexed payloadHash, string symbol, uint256 amount, uint256 gasFeeAmount, address refundAddress ); event GasAdded( bytes32 indexed txHash, uint256 indexed logIndex, address gasToken, uint256 gasFeeAmount, address refundAddress ); event NativeGasAdded( bytes32 indexed txHash, uint256 indexed logIndex, uint256 gasFeeAmount, address refundAddress ); event ExpressGasAdded( bytes32 indexed txHash, uint256 indexed logIndex, address gasToken, uint256 gasFeeAmount, address refundAddress ); event NativeExpressGasAdded( bytes32 indexed txHash, uint256 indexed logIndex, uint256 gasFeeAmount, address refundAddress ); // This is called on the source chain before calling the gateway to execute a remote contract. function payGasForContractCall( address sender, string calldata destinationChain, string calldata destinationAddress, bytes calldata payload, address gasToken, uint256 gasFeeAmount, address refundAddress ) external; // This is called on the source chain before calling the gateway to execute a remote contract. function payGasForContractCallWithToken( address sender, string calldata destinationChain, string calldata destinationAddress, bytes calldata payload, string calldata symbol, uint256 amount, address gasToken, uint256 gasFeeAmount, address refundAddress ) external; // This is called on the source chain before calling the gateway to execute a remote contract. function payNativeGasForContractCall( address sender, string calldata destinationChain, string calldata destinationAddress, bytes calldata payload, address refundAddress ) external payable; // This is called on the source chain before calling the gateway to execute a remote contract. function payNativeGasForContractCallWithToken( address sender, string calldata destinationChain, string calldata destinationAddress, bytes calldata payload, string calldata symbol, uint256 amount, address refundAddress ) external payable; // This is called on the source chain before calling the gateway to execute a remote contract. function payGasForExpressCallWithToken( address sender, string calldata destinationChain, string calldata destinationAddress, bytes calldata payload, string calldata symbol, uint256 amount, address gasToken, uint256 gasFeeAmount, address refundAddress ) external; // This is called on the source chain before calling the gateway to execute a remote contract. function payNativeGasForExpressCallWithToken( address sender, string calldata destinationChain, string calldata destinationAddress, bytes calldata payload, string calldata symbol, uint256 amount, address refundAddress ) external payable; function addGas( bytes32 txHash, uint256 txIndex, address gasToken, uint256 gasFeeAmount, address refundAddress ) external; function addNativeGas( bytes32 txHash, uint256 logIndex, address refundAddress ) external payable; function addExpressGas( bytes32 txHash, uint256 txIndex, address gasToken, uint256 gasFeeAmount, address refundAddress ) external; function addNativeExpressGas( bytes32 txHash, uint256 logIndex, address refundAddress ) external payable; function collectFees( address payable receiver, address[] calldata tokens, uint256[] calldata amounts ) external; function refund( address payable receiver, address token, uint256 amount ) external; function gasCollector() external returns (address); }
interface IAxelarGasService { error NothingReceived(); error InvalidAddress(); error NotCollector(); error InvalidAmounts(); event GasPaidForContractCall( address indexed sourceAddress, string destinationChain, string destinationAddress, bytes32 indexed payloadHash, address gasToken, uint256 gasFeeAmount, address refundAddress ); event GasPaidForContractCallWithToken( address indexed sourceAddress, string destinationChain, string destinationAddress, bytes32 indexed payloadHash, string symbol, uint256 amount, address gasToken, uint256 gasFeeAmount, address refundAddress ); event NativeGasPaidForContractCall( address indexed sourceAddress, string destinationChain, string destinationAddress, bytes32 indexed payloadHash, uint256 gasFeeAmount, address refundAddress ); event NativeGasPaidForContractCallWithToken( address indexed sourceAddress, string destinationChain, string destinationAddress, bytes32 indexed payloadHash, string symbol, uint256 amount, uint256 gasFeeAmount, address refundAddress ); event GasPaidForExpressCallWithToken( address indexed sourceAddress, string destinationChain, string destinationAddress, bytes32 indexed payloadHash, string symbol, uint256 amount, address gasToken, uint256 gasFeeAmount, address refundAddress ); event NativeGasPaidForExpressCallWithToken( address indexed sourceAddress, string destinationChain, string destinationAddress, bytes32 indexed payloadHash, string symbol, uint256 amount, uint256 gasFeeAmount, address refundAddress ); event GasAdded( bytes32 indexed txHash, uint256 indexed logIndex, address gasToken, uint256 gasFeeAmount, address refundAddress ); event NativeGasAdded( bytes32 indexed txHash, uint256 indexed logIndex, uint256 gasFeeAmount, address refundAddress ); event ExpressGasAdded( bytes32 indexed txHash, uint256 indexed logIndex, address gasToken, uint256 gasFeeAmount, address refundAddress ); event NativeExpressGasAdded( bytes32 indexed txHash, uint256 indexed logIndex, uint256 gasFeeAmount, address refundAddress ); // This is called on the source chain before calling the gateway to execute a remote contract. function payGasForContractCall( address sender, string calldata destinationChain, string calldata destinationAddress, bytes calldata payload, address gasToken, uint256 gasFeeAmount, address refundAddress ) external; // This is called on the source chain before calling the gateway to execute a remote contract. function payGasForContractCallWithToken( address sender, string calldata destinationChain, string calldata destinationAddress, bytes calldata payload, string calldata symbol, uint256 amount, address gasToken, uint256 gasFeeAmount, address refundAddress ) external; // This is called on the source chain before calling the gateway to execute a remote contract. function payNativeGasForContractCall( address sender, string calldata destinationChain, string calldata destinationAddress, bytes calldata payload, address refundAddress ) external payable; // This is called on the source chain before calling the gateway to execute a remote contract. function payNativeGasForContractCallWithToken( address sender, string calldata destinationChain, string calldata destinationAddress, bytes calldata payload, string calldata symbol, uint256 amount, address refundAddress ) external payable; // This is called on the source chain before calling the gateway to execute a remote contract. function payGasForExpressCallWithToken( address sender, string calldata destinationChain, string calldata destinationAddress, bytes calldata payload, string calldata symbol, uint256 amount, address gasToken, uint256 gasFeeAmount, address refundAddress ) external; // This is called on the source chain before calling the gateway to execute a remote contract. function payNativeGasForExpressCallWithToken( address sender, string calldata destinationChain, string calldata destinationAddress, bytes calldata payload, string calldata symbol, uint256 amount, address refundAddress ) external payable; function addGas( bytes32 txHash, uint256 txIndex, address gasToken, uint256 gasFeeAmount, address refundAddress ) external; function addNativeGas( bytes32 txHash, uint256 logIndex, address refundAddress ) external payable; function addExpressGas( bytes32 txHash, uint256 txIndex, address gasToken, uint256 gasFeeAmount, address refundAddress ) external; function addNativeExpressGas( bytes32 txHash, uint256 logIndex, address refundAddress ) external payable; function collectFees( address payable receiver, address[] calldata tokens, uint256[] calldata amounts ) external; function refund( address payable receiver, address token, uint256 amount ) external; function gasCollector() external returns (address); }
25,317
693
// Auxiliary data is not supported
require (withdrawal.extraData.length == 0, "AUXILIARY_DATA_NOT_ALLOWED");
require (withdrawal.extraData.length == 0, "AUXILIARY_DATA_NOT_ALLOWED");
53,260
95
// Wallets
address public marketingWallet = 0xAfE6B307562E3b90a649E423e4Cb17bfF3Df90ea;
address public marketingWallet = 0xAfE6B307562E3b90a649E423e4Cb17bfF3Df90ea;
10,226
44
// ================================================================================== Data Model
function _incrementPoolBalances(uint _baseAmt, uint _tokenAmt) external onlyRouter { baseAmt += _baseAmt; tokenAmt += _tokenAmt; baseAmtStaked += _baseAmt; tokenAmtStaked += _tokenAmt; }
function _incrementPoolBalances(uint _baseAmt, uint _tokenAmt) external onlyRouter { baseAmt += _baseAmt; tokenAmt += _tokenAmt; baseAmtStaked += _baseAmt; tokenAmtStaked += _tokenAmt; }
30,597
28
// Gets DAI from the user's wallet
DaiJoinLike(apt).dai().transferFrom(msg.sender, address(this), wad);
DaiJoinLike(apt).dai().transferFrom(msg.sender, address(this), wad);
39,136
6
// return the beneficiary of the tokens. /
function beneficiary() external view returns (address) { return _beneficiary; }
function beneficiary() external view returns (address) { return _beneficiary; }
44,153
293
// Proposes a price value where caller is the proposer. requester sender of the initial price request. identifier price identifier to identify the existing request. timestamp timestamp to identify the existing request. ancillaryData ancillary data of the price being requested. request price request parameters whose hash must match the request that the caller wants topropose a price for. proposedPrice price being proposed.return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned tothe proposer once settled if the proposal is correct. /
function proposePrice( address requester, bytes32 identifier, uint32 timestamp, bytes memory ancillaryData, Request memory request, int256 proposedPrice
function proposePrice( address requester, bytes32 identifier, uint32 timestamp, bytes memory ancillaryData, Request memory request, int256 proposedPrice
32,589
1
// eth to token
uint amountInMax, address[] calldata path1,
uint amountInMax, address[] calldata path1,
24,168
27
// Returns the contract name hash needed for node's engine.
function contractNameHash() public pure
function contractNameHash() public pure
17,560
11
// Returns information about the value of the transaction.
function _msgValue() internal view virtual returns (uint256) { return msg.value; }
function _msgValue() internal view virtual returns (uint256) { return msg.value; }
4,740
44
// Returns LivepeerToken interface /
function livepeerToken() internal view returns (ILivepeerToken) { return ILivepeerToken(controller.getContract(keccak256("LivepeerToken"))); }
function livepeerToken() internal view returns (ILivepeerToken) { return ILivepeerToken(controller.getContract(keccak256("LivepeerToken"))); }
46,151
5
// VALIDATE
function validateDeposit(string memory user_name, uint[2] memory public_key, uint[2] memory signature) public payable returns(bytes memory, bytes32, bool){ bytes memory encodedABI = abi.encode(user_name, public_key, msg.value); bytes32 shaMSG = sha256(encodedABI); Holder memory holder = holders[user_name]; return ( encodedABI, shaMSG, validateSignature(shaMSG , signature, holder.public_key) ); }
function validateDeposit(string memory user_name, uint[2] memory public_key, uint[2] memory signature) public payable returns(bytes memory, bytes32, bool){ bytes memory encodedABI = abi.encode(user_name, public_key, msg.value); bytes32 shaMSG = sha256(encodedABI); Holder memory holder = holders[user_name]; return ( encodedABI, shaMSG, validateSignature(shaMSG , signature, holder.public_key) ); }
13,815
122
// ERC20 compliant token balance store. This contract serves as the store of balances, allowances, and supply for the ERC20 compliant token. No business logic exists here. This contract contains no business logic and instead is the final destination for any change in balances, allowances, or token supply. This contract is upgradeable in the sense that its custodian can update the `erc20Impl` address, thus redirecting the source of logic that determines how the balances will be updated./
contract ERC20Store is ERC20ImplUpgradeable { // MEMBERS /// @dev The total token supply. uint256 public totalSupply; /// @dev The mapping of balances. mapping (address => uint256) public balances; /// @dev The mapping of allowances. mapping (address => mapping (address => uint256)) public allowed; // CONSTRUCTOR constructor(address _custodian) ERC20ImplUpgradeable(_custodian) public { totalSupply = 0; } // PUBLIC FUNCTIONS // (ERC20 Ledger) /** @notice The function to set the total supply of tokens. * * @dev Intended for use by token implementation functions * that update the total supply. The only authorized caller * is the active implementation. * * @param _newTotalSupply the value to set as the new total supply */ function setTotalSupply( uint256 _newTotalSupply ) public onlyImpl { totalSupply = _newTotalSupply; } /** @notice Sets how much `_owner` allows `_spender` to transfer on behalf * of `_owner`. * * @dev Intended for use by token implementation functions * that update spending allowances. The only authorized caller * is the active implementation. * * @param _owner The account that will allow an on-behalf-of spend. * @param _spender The account that will spend on behalf of the owner. * @param _value The limit of what can be spent. */ function setAllowance( address _owner, address _spender, uint256 _value ) public onlyImpl { allowed[_owner][_spender] = _value; } /** @notice Sets the balance of `_owner` to `_newBalance`. * * @dev Intended for use by token implementation functions * that update balances. The only authorized caller * is the active implementation. * * @param _owner The account that will hold a new balance. * @param _newBalance The balance to set. */ function setBalance( address _owner, uint256 _newBalance ) public onlyImpl { balances[_owner] = _newBalance; } /** @notice Adds `_balanceIncrease` to `_owner`'s balance. * * @dev Intended for use by token implementation functions * that update balances. The only authorized caller * is the active implementation. * WARNING: the caller is responsible for preventing overflow. * * @param _owner The account that will hold a new balance. * @param _balanceIncrease The balance to add. */ function addBalance( address _owner, uint256 _balanceIncrease ) public onlyImpl { balances[_owner] = balances[_owner] + _balanceIncrease; } }
contract ERC20Store is ERC20ImplUpgradeable { // MEMBERS /// @dev The total token supply. uint256 public totalSupply; /// @dev The mapping of balances. mapping (address => uint256) public balances; /// @dev The mapping of allowances. mapping (address => mapping (address => uint256)) public allowed; // CONSTRUCTOR constructor(address _custodian) ERC20ImplUpgradeable(_custodian) public { totalSupply = 0; } // PUBLIC FUNCTIONS // (ERC20 Ledger) /** @notice The function to set the total supply of tokens. * * @dev Intended for use by token implementation functions * that update the total supply. The only authorized caller * is the active implementation. * * @param _newTotalSupply the value to set as the new total supply */ function setTotalSupply( uint256 _newTotalSupply ) public onlyImpl { totalSupply = _newTotalSupply; } /** @notice Sets how much `_owner` allows `_spender` to transfer on behalf * of `_owner`. * * @dev Intended for use by token implementation functions * that update spending allowances. The only authorized caller * is the active implementation. * * @param _owner The account that will allow an on-behalf-of spend. * @param _spender The account that will spend on behalf of the owner. * @param _value The limit of what can be spent. */ function setAllowance( address _owner, address _spender, uint256 _value ) public onlyImpl { allowed[_owner][_spender] = _value; } /** @notice Sets the balance of `_owner` to `_newBalance`. * * @dev Intended for use by token implementation functions * that update balances. The only authorized caller * is the active implementation. * * @param _owner The account that will hold a new balance. * @param _newBalance The balance to set. */ function setBalance( address _owner, uint256 _newBalance ) public onlyImpl { balances[_owner] = _newBalance; } /** @notice Adds `_balanceIncrease` to `_owner`'s balance. * * @dev Intended for use by token implementation functions * that update balances. The only authorized caller * is the active implementation. * WARNING: the caller is responsible for preventing overflow. * * @param _owner The account that will hold a new balance. * @param _balanceIncrease The balance to add. */ function addBalance( address _owner, uint256 _balanceIncrease ) public onlyImpl { balances[_owner] = balances[_owner] + _balanceIncrease; } }
11,016
6
// Get available mints for a membershipId /
function getAvailableMintsForMembership(uint256 membershipId) public view returns (uint256)
function getAvailableMintsForMembership(uint256 membershipId) public view returns (uint256)
14,990
133
// pay the transfer
tokenToPay.safeTransferFrom(msg.sender, order.maker, transferAmount);
tokenToPay.safeTransferFrom(msg.sender, order.maker, transferAmount);
38,238
93
// Events emitted by a pool/Contains all events emitted by the pool
interface IUniswapV3PoolEvents { /// @notice Emitted exactly once by a pool when #initialize is first called on the pool /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96 /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool event Initialize(uint160 sqrtPriceX96, int24 tick); /// @notice Emitted when liquidity is minted for a given position /// @param sender The address that minted the liquidity /// @param owner The owner of the position and recipient of any minted liquidity /// @param tickLower The lower tick of the position /// @param tickUpper The upper tick of the position /// @param amount The amount of liquidity minted to the position range /// @param amount0 How much token0 was required for the minted liquidity /// @param amount1 How much token1 was required for the minted liquidity event Mint( address sender, address indexed owner, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount, uint256 amount0, uint256 amount1 ); /// @notice Emitted when fees are collected by the owner of a position /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees /// @param owner The owner of the position for which fees are collected /// @param tickLower The lower tick of the position /// @param tickUpper The upper tick of the position /// @param amount0 The amount of token0 fees collected /// @param amount1 The amount of token1 fees collected event Collect( address indexed owner, address recipient, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount0, uint128 amount1 ); /// @notice Emitted when a position's liquidity is removed /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect /// @param owner The owner of the position for which liquidity is removed /// @param tickLower The lower tick of the position /// @param tickUpper The upper tick of the position /// @param amount The amount of liquidity to remove /// @param amount0 The amount of token0 withdrawn /// @param amount1 The amount of token1 withdrawn event Burn( address indexed owner, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount, uint256 amount0, uint256 amount1 ); /// @notice Emitted by the pool for any swaps between token0 and token1 /// @param sender The address that initiated the swap call, and that received the callback /// @param recipient The address that received the output of the swap /// @param amount0 The delta of the token0 balance of the pool /// @param amount1 The delta of the token1 balance of the pool /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96 /// @param liquidity The liquidity of the pool after the swap /// @param tick The log base 1.0001 of price of the pool after the swap event Swap( address indexed sender, address indexed recipient, int256 amount0, int256 amount1, uint160 sqrtPriceX96, uint128 liquidity, int24 tick ); /// @notice Emitted by the pool for any flashes of token0/token1 /// @param sender The address that initiated the swap call, and that received the callback /// @param recipient The address that received the tokens from flash /// @param amount0 The amount of token0 that was flashed /// @param amount1 The amount of token1 that was flashed /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee event Flash( address indexed sender, address indexed recipient, uint256 amount0, uint256 amount1, uint256 paid0, uint256 paid1 ); /// @notice Emitted by the pool for increases to the number of observations that can be stored /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index /// just before a mint/swap/burn. /// @param observationCardinalityNextOld The previous value of the next observation cardinality /// @param observationCardinalityNextNew The updated value of the next observation cardinality event IncreaseObservationCardinalityNext( uint16 observationCardinalityNextOld, uint16 observationCardinalityNextNew ); /// @notice Emitted when the protocol fee is changed by the pool /// @param feeProtocol0Old The previous value of the token0 protocol fee /// @param feeProtocol1Old The previous value of the token1 protocol fee /// @param feeProtocol0New The updated value of the token0 protocol fee /// @param feeProtocol1New The updated value of the token1 protocol fee event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New); /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner /// @param sender The address that collects the protocol fees /// @param recipient The address that receives the collected protocol fees /// @param amount0 The amount of token0 protocol fees that is withdrawn /// @param amount0 The amount of token1 protocol fees that is withdrawn event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1); }
interface IUniswapV3PoolEvents { /// @notice Emitted exactly once by a pool when #initialize is first called on the pool /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96 /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool event Initialize(uint160 sqrtPriceX96, int24 tick); /// @notice Emitted when liquidity is minted for a given position /// @param sender The address that minted the liquidity /// @param owner The owner of the position and recipient of any minted liquidity /// @param tickLower The lower tick of the position /// @param tickUpper The upper tick of the position /// @param amount The amount of liquidity minted to the position range /// @param amount0 How much token0 was required for the minted liquidity /// @param amount1 How much token1 was required for the minted liquidity event Mint( address sender, address indexed owner, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount, uint256 amount0, uint256 amount1 ); /// @notice Emitted when fees are collected by the owner of a position /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees /// @param owner The owner of the position for which fees are collected /// @param tickLower The lower tick of the position /// @param tickUpper The upper tick of the position /// @param amount0 The amount of token0 fees collected /// @param amount1 The amount of token1 fees collected event Collect( address indexed owner, address recipient, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount0, uint128 amount1 ); /// @notice Emitted when a position's liquidity is removed /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect /// @param owner The owner of the position for which liquidity is removed /// @param tickLower The lower tick of the position /// @param tickUpper The upper tick of the position /// @param amount The amount of liquidity to remove /// @param amount0 The amount of token0 withdrawn /// @param amount1 The amount of token1 withdrawn event Burn( address indexed owner, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount, uint256 amount0, uint256 amount1 ); /// @notice Emitted by the pool for any swaps between token0 and token1 /// @param sender The address that initiated the swap call, and that received the callback /// @param recipient The address that received the output of the swap /// @param amount0 The delta of the token0 balance of the pool /// @param amount1 The delta of the token1 balance of the pool /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96 /// @param liquidity The liquidity of the pool after the swap /// @param tick The log base 1.0001 of price of the pool after the swap event Swap( address indexed sender, address indexed recipient, int256 amount0, int256 amount1, uint160 sqrtPriceX96, uint128 liquidity, int24 tick ); /// @notice Emitted by the pool for any flashes of token0/token1 /// @param sender The address that initiated the swap call, and that received the callback /// @param recipient The address that received the tokens from flash /// @param amount0 The amount of token0 that was flashed /// @param amount1 The amount of token1 that was flashed /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee event Flash( address indexed sender, address indexed recipient, uint256 amount0, uint256 amount1, uint256 paid0, uint256 paid1 ); /// @notice Emitted by the pool for increases to the number of observations that can be stored /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index /// just before a mint/swap/burn. /// @param observationCardinalityNextOld The previous value of the next observation cardinality /// @param observationCardinalityNextNew The updated value of the next observation cardinality event IncreaseObservationCardinalityNext( uint16 observationCardinalityNextOld, uint16 observationCardinalityNextNew ); /// @notice Emitted when the protocol fee is changed by the pool /// @param feeProtocol0Old The previous value of the token0 protocol fee /// @param feeProtocol1Old The previous value of the token1 protocol fee /// @param feeProtocol0New The updated value of the token0 protocol fee /// @param feeProtocol1New The updated value of the token1 protocol fee event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New); /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner /// @param sender The address that collects the protocol fees /// @param recipient The address that receives the collected protocol fees /// @param amount0 The amount of token0 protocol fees that is withdrawn /// @param amount0 The amount of token1 protocol fees that is withdrawn event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1); }
67,361
2
// Database interface
interface DBInterface { function setContractManager(address _contractManager) external; // --------------------Set Functions------------------------ function setAddress(bytes32 _key, address _value) external; function setUint(bytes32 _key, uint _value) external; function setString(bytes32 _key, string _value) external; function setBytes(bytes32 _key, bytes _value) external; function setBytes32(bytes32 _key, bytes32 _value) external; function setBool(bytes32 _key, bool _value) external; function setInt(bytes32 _key, int _value) external; // -------------- Deletion Functions ------------------ function deleteAddress(bytes32 _key) external; function deleteUint(bytes32 _key) external; function deleteString(bytes32 _key) external; function deleteBytes(bytes32 _key) external; function deleteBytes32(bytes32 _key) external; function deleteBool(bytes32 _key) external; function deleteInt(bytes32 _key) external; // ----------------Variable Getters--------------------- function uintStorage(bytes32 _key) external view returns (uint); function stringStorage(bytes32 _key) external view returns (string); function addressStorage(bytes32 _key) external view returns (address); function bytesStorage(bytes32 _key) external view returns (bytes); function bytes32Storage(bytes32 _key) external view returns (bytes32); function boolStorage(bytes32 _key) external view returns (bool); function intStorage(bytes32 _key) external view returns (bool); }
interface DBInterface { function setContractManager(address _contractManager) external; // --------------------Set Functions------------------------ function setAddress(bytes32 _key, address _value) external; function setUint(bytes32 _key, uint _value) external; function setString(bytes32 _key, string _value) external; function setBytes(bytes32 _key, bytes _value) external; function setBytes32(bytes32 _key, bytes32 _value) external; function setBool(bytes32 _key, bool _value) external; function setInt(bytes32 _key, int _value) external; // -------------- Deletion Functions ------------------ function deleteAddress(bytes32 _key) external; function deleteUint(bytes32 _key) external; function deleteString(bytes32 _key) external; function deleteBytes(bytes32 _key) external; function deleteBytes32(bytes32 _key) external; function deleteBool(bytes32 _key) external; function deleteInt(bytes32 _key) external; // ----------------Variable Getters--------------------- function uintStorage(bytes32 _key) external view returns (uint); function stringStorage(bytes32 _key) external view returns (string); function addressStorage(bytes32 _key) external view returns (address); function bytesStorage(bytes32 _key) external view returns (bytes); function bytes32Storage(bytes32 _key) external view returns (bytes32); function boolStorage(bytes32 _key) external view returns (bool); function intStorage(bytes32 _key) external view returns (bool); }
25,685
426
// Sets the protocolFeeCollector contract address to 0./Only callable by owner.
function detachProtocolFeeCollector() external onlyOwner { _setProtocolFeeCollectorAddress(address(0)); }
function detachProtocolFeeCollector() external onlyOwner { _setProtocolFeeCollectorAddress(address(0)); }
12,348
6
// constructor must pass the address of the Router and xFUND smartcontracts to the constructor of your contract! Without it, this contractcannot interact with the system, nor request/receive any data.The constructor calls the parent ConsumerBase constructor to set these._router address of the Router smart contract _xfund address of the xFUND smart contract _provider address of the default provider _fee uint256 default fee /
constructor(address _router, address _xfund, address _provider, uint256 _fee)
constructor(address _router, address _xfund, address _provider, uint256 _fee)
44,317
79
// Perform an ERC20 token transfer. Designed to be called by transfer functions possessingthe onlyProxy or optionalProxy modifiers. /
function _transferByProxy( address from, address to, uint value
function _transferByProxy( address from, address to, uint value
23,581
4
// Ref: https:etherscan.io/address/0x8798249c2E607446EfB7Ad49eC89dD1865Ff4272code
interface ISushiBar { function enter(uint256 _amount) external; function leave(uint256 _share) external; }
interface ISushiBar { function enter(uint256 _amount) external; function leave(uint256 _share) external; }
29,055
31
// Gets vote record of proposal. proposalId The proposal UUID. /
function getVoteRecord(uint256 proposalId) public view returns (ProposalVoteRecord memory) { return voteRecords[proposalId]; }
function getVoteRecord(uint256 proposalId) public view returns (ProposalVoteRecord memory) { return voteRecords[proposalId]; }
19,516
13
// constructor, where first user is an administrator /
constructor() public { owner[msg.sender] = ++index; }
constructor() public { owner[msg.sender] = ++index; }
11,721
167
// Move the last token to the slot of the to-delete token
_ownedTokensIndex[lastTokenId] = tokenIndex;
_ownedTokensIndex[lastTokenId] = tokenIndex;
12,021
79
// Get price of DAI in ETH
(, int256 latestPrice, , , ) = oracle.latestRoundData(); uint256 minimumReq = (_amount.mul(1e12).mul(uint256(latestPrice))).div(_BASE); if (_withFactors) { return minimumReq.mul(collatF.a).mul(safetyF.a).div(collatF.b).div(safetyF.b); } else {
(, int256 latestPrice, , , ) = oracle.latestRoundData(); uint256 minimumReq = (_amount.mul(1e12).mul(uint256(latestPrice))).div(_BASE); if (_withFactors) { return minimumReq.mul(collatF.a).mul(safetyF.a).div(collatF.b).div(safetyF.b); } else {
39,532
102
// Underlying asset for this CToken
function underlying() external view returns (address);
function underlying() external view returns (address);
40,452
265
// update states
adjustPositionForLiquidityChanged(_exchange, _trader); PositionResp memory positionResp = internalClosePosition(_exchange, _trader, Decimal.zero(), false); enterRestrictionMode(_exchange); {
adjustPositionForLiquidityChanged(_exchange, _trader); PositionResp memory positionResp = internalClosePosition(_exchange, _trader, Decimal.zero(), false); enterRestrictionMode(_exchange); {
30,848
29
// report
function report(address _from, address _to, bytes _sign) public
function report(address _from, address _to, bytes _sign) public
45,539
51
// Index Of Locates and returns the position of a character within a string_base When being used for a data type this is the extended object otherwise this is the string acting as the haystack to be searched _value The needle to search for, at present this is currentlylimited to one characterreturn int The position of the needle starting from 0 and returning -1in the case of no matches found /
function indexOf(string memory _base, string memory _value) internal pure returns (int256)
function indexOf(string memory _base, string memory _value) internal pure returns (int256)
25,737
527
// Pool Collection interface /
interface IPoolCollection is IVersioned { /** * @dev returns the type of the pool */ function poolType() external pure returns (uint16); /** * @dev returns the default trading fee (in units of PPM) */ function defaultTradingFeePPM() external view returns (uint32); /** * @dev returns all the pools which are managed by this pool collection */ function pools() external view returns (Token[] memory); /** * @dev returns the number of all the pools which are managed by this pool collection */ function poolCount() external view returns (uint256); /** * @dev returns whether a pool is valid */ function isPoolValid(Token pool) external view returns (bool); /** * @dev returns specific pool's data */ function poolData(Token pool) external view returns (Pool memory); /** * @dev returns the overall liquidity in the pool */ function poolLiquidity(Token pool) external view returns (PoolLiquidity memory); /** * @dev returns the pool token of the pool */ function poolToken(Token pool) external view returns (IPoolToken); /** * @dev converts the specified pool token amount to the underlying base token amount */ function poolTokenToUnderlying(Token pool, uint256 poolTokenAmount) external view returns (uint256); /** * @dev converts the specified underlying base token amount to pool token amount */ function underlyingToPoolToken(Token pool, uint256 tokenAmount) external view returns (uint256); /** * @dev returns the number of pool token to burn in order to increase everyone's underlying value by the specified * amount */ function poolTokenAmountToBurn( Token pool, uint256 tokenAmountToDistribute, uint256 protocolPoolTokenAmount ) external view returns (uint256); /** * @dev creates a new pool * * requirements: * * - the caller must be the network contract * - the pool should have been whitelisted * - the pool isn't already defined in the collection */ function createPool(Token token) external; /** * @dev deposits base token liquidity on behalf of a specific provider and returns the respective pool token amount * * requirements: * * - the caller must be the network contract * - assumes that the base token has been already deposited in the vault */ function depositFor( bytes32 contextId, address provider, Token pool, uint256 tokenAmount ) external returns (uint256); /** * @dev handles some of the withdrawal-related actions and returns the withdrawn base token amount * * requirements: * * - the caller must be the network contract * - the caller must have approved the collection to transfer/burn the pool token amount on its behalf */ function withdraw( bytes32 contextId, address provider, Token pool, uint256 poolTokenAmount ) external returns (uint256); /** * @dev returns the amounts that would be returned if the position is currently withdrawn, * along with the breakdown of the base token and the BNT compensation */ function withdrawalAmounts(Token pool, uint256 poolTokenAmount) external view returns (WithdrawalAmounts memory); /** * @dev performs a trade by providing the source amount and returns the target amount and the associated fee * * requirements: * * - the caller must be the network contract */ function tradeBySourceAmount( bytes32 contextId, Token sourceToken, Token targetToken, uint256 sourceAmount, uint256 minReturnAmount ) external returns (TradeAmountAndFee memory); /** * @dev performs a trade by providing the target amount and returns the required source amount and the associated fee * * requirements: * * - the caller must be the network contract */ function tradeByTargetAmount( bytes32 contextId, Token sourceToken, Token targetToken, uint256 targetAmount, uint256 maxSourceAmount ) external returns (TradeAmountAndFee memory); /** * @dev returns the output amount and fee when trading by providing the source amount */ function tradeOutputAndFeeBySourceAmount( Token sourceToken, Token targetToken, uint256 sourceAmount ) external view returns (TradeAmountAndFee memory); /** * @dev returns the input amount and fee when trading by providing the target amount */ function tradeInputAndFeeByTargetAmount( Token sourceToken, Token targetToken, uint256 targetAmount ) external view returns (TradeAmountAndFee memory); /** * @dev notifies the pool of accrued fees * * requirements: * * - the caller must be the network contract */ function onFeesCollected(Token pool, uint256 feeAmount) external; /** * @dev migrates a pool to this pool collection * * requirements: * * - the caller must be the pool migrator contract */ function migratePoolIn(Token pool, Pool calldata data) external; /** * @dev migrates a pool from this pool collection * * requirements: * * - the caller must be the pool migrator contract */ function migratePoolOut(Token pool, IPoolCollection targetPoolCollection) external; }
interface IPoolCollection is IVersioned { /** * @dev returns the type of the pool */ function poolType() external pure returns (uint16); /** * @dev returns the default trading fee (in units of PPM) */ function defaultTradingFeePPM() external view returns (uint32); /** * @dev returns all the pools which are managed by this pool collection */ function pools() external view returns (Token[] memory); /** * @dev returns the number of all the pools which are managed by this pool collection */ function poolCount() external view returns (uint256); /** * @dev returns whether a pool is valid */ function isPoolValid(Token pool) external view returns (bool); /** * @dev returns specific pool's data */ function poolData(Token pool) external view returns (Pool memory); /** * @dev returns the overall liquidity in the pool */ function poolLiquidity(Token pool) external view returns (PoolLiquidity memory); /** * @dev returns the pool token of the pool */ function poolToken(Token pool) external view returns (IPoolToken); /** * @dev converts the specified pool token amount to the underlying base token amount */ function poolTokenToUnderlying(Token pool, uint256 poolTokenAmount) external view returns (uint256); /** * @dev converts the specified underlying base token amount to pool token amount */ function underlyingToPoolToken(Token pool, uint256 tokenAmount) external view returns (uint256); /** * @dev returns the number of pool token to burn in order to increase everyone's underlying value by the specified * amount */ function poolTokenAmountToBurn( Token pool, uint256 tokenAmountToDistribute, uint256 protocolPoolTokenAmount ) external view returns (uint256); /** * @dev creates a new pool * * requirements: * * - the caller must be the network contract * - the pool should have been whitelisted * - the pool isn't already defined in the collection */ function createPool(Token token) external; /** * @dev deposits base token liquidity on behalf of a specific provider and returns the respective pool token amount * * requirements: * * - the caller must be the network contract * - assumes that the base token has been already deposited in the vault */ function depositFor( bytes32 contextId, address provider, Token pool, uint256 tokenAmount ) external returns (uint256); /** * @dev handles some of the withdrawal-related actions and returns the withdrawn base token amount * * requirements: * * - the caller must be the network contract * - the caller must have approved the collection to transfer/burn the pool token amount on its behalf */ function withdraw( bytes32 contextId, address provider, Token pool, uint256 poolTokenAmount ) external returns (uint256); /** * @dev returns the amounts that would be returned if the position is currently withdrawn, * along with the breakdown of the base token and the BNT compensation */ function withdrawalAmounts(Token pool, uint256 poolTokenAmount) external view returns (WithdrawalAmounts memory); /** * @dev performs a trade by providing the source amount and returns the target amount and the associated fee * * requirements: * * - the caller must be the network contract */ function tradeBySourceAmount( bytes32 contextId, Token sourceToken, Token targetToken, uint256 sourceAmount, uint256 minReturnAmount ) external returns (TradeAmountAndFee memory); /** * @dev performs a trade by providing the target amount and returns the required source amount and the associated fee * * requirements: * * - the caller must be the network contract */ function tradeByTargetAmount( bytes32 contextId, Token sourceToken, Token targetToken, uint256 targetAmount, uint256 maxSourceAmount ) external returns (TradeAmountAndFee memory); /** * @dev returns the output amount and fee when trading by providing the source amount */ function tradeOutputAndFeeBySourceAmount( Token sourceToken, Token targetToken, uint256 sourceAmount ) external view returns (TradeAmountAndFee memory); /** * @dev returns the input amount and fee when trading by providing the target amount */ function tradeInputAndFeeByTargetAmount( Token sourceToken, Token targetToken, uint256 targetAmount ) external view returns (TradeAmountAndFee memory); /** * @dev notifies the pool of accrued fees * * requirements: * * - the caller must be the network contract */ function onFeesCollected(Token pool, uint256 feeAmount) external; /** * @dev migrates a pool to this pool collection * * requirements: * * - the caller must be the pool migrator contract */ function migratePoolIn(Token pool, Pool calldata data) external; /** * @dev migrates a pool from this pool collection * * requirements: * * - the caller must be the pool migrator contract */ function migratePoolOut(Token pool, IPoolCollection targetPoolCollection) external; }
3,601
88
// Event emitted when underlying is borrowed /
event Borrow(address borrower, uint borrowAmount, uint accountBorrows, uint totalBorrows);
event Borrow(address borrower, uint borrowAmount, uint accountBorrows, uint totalBorrows);
4,762
6
// Call the implementation. out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
10,213
118
// Sets vesting start date (as unix timestamp). Owner only _vestingStart Unix timestamp. /
function setVestingStart(uint256 _vestingStart) public onlyOwner { require(_vestingStart > 0, "VestedAkro: vestingStart should be > 0"); vestingStart = _vestingStart; }
function setVestingStart(uint256 _vestingStart) public onlyOwner { require(_vestingStart > 0, "VestedAkro: vestingStart should be > 0"); vestingStart = _vestingStart; }
60,140
187
// {ERC20} token, including:This contract uses {AccessControl} to lock permissioned functions using the/ Grants `DEFAULT_ADMIN_ROLE`, `MINTER_ROLE`, `PAUSER_ROLE` to theaccount that deploys the contract. See {ERC20-constructor}. /
constructor(string memory contractName, string memory contractSymbol, uint256 initialAmount, uint8 decimals) ERC20(contractName, contractSymbol) { _setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); _setupRole(MINTER_ROLE, _msgSender()); _setupRole(PAUSER_ROLE, _msgSender()); _setupDecimals(decimals);
constructor(string memory contractName, string memory contractSymbol, uint256 initialAmount, uint8 decimals) ERC20(contractName, contractSymbol) { _setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); _setupRole(MINTER_ROLE, _msgSender()); _setupRole(PAUSER_ROLE, _msgSender()); _setupDecimals(decimals);
21,087
182
// Source of liquidity to repay debt from liquidated troves
IStabilityPool internal constant stabilityPool = IStabilityPool(0x66017D22b0f8556afDd19FC67041899Eb65a21bb);
IStabilityPool internal constant stabilityPool = IStabilityPool(0x66017D22b0f8556afDd19FC67041899Eb65a21bb);
7,717
33
// Return the log in base 10, rounded down, of a positive value.Returns 0 if given 0. /
function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10**64) { value /= 10**64; result += 64; } if (value >= 10**32) { value /= 10**32; result += 32; } if (value >= 10**16) { value /= 10**16; result += 16; } if (value >= 10**8) { value /= 10**8; result += 8; } if (value >= 10**4) { value /= 10**4; result += 4; } if (value >= 10**2) { value /= 10**2; result += 2; } if (value >= 10**1) { result += 1; } } return result; }
function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10**64) { value /= 10**64; result += 64; } if (value >= 10**32) { value /= 10**32; result += 32; } if (value >= 10**16) { value /= 10**16; result += 16; } if (value >= 10**8) { value /= 10**8; result += 8; } if (value >= 10**4) { value /= 10**4; result += 4; } if (value >= 10**2) { value /= 10**2; result += 2; } if (value >= 10**1) { result += 1; } } return result; }
20,639
74
// conduct transfer from Luxarity to address
transferFrom(msg.sender, _buyerAddress, _tokenId);
transferFrom(msg.sender, _buyerAddress, _tokenId);
7,785
42
// Allows anyone to verify the declared timestamp for any given hash. /
function verifyDeclaredTime(bytes32 hash) public view returns (uint32)
function verifyDeclaredTime(bytes32 hash) public view returns (uint32)
10,201
96
// Token for which presale is being done
address public saleToken; uint public saleTokenDec;
address public saleToken; uint public saleTokenDec;
25,034
107
// Get minimum delegation amount
function getMinDelegationAmount() external view returns (uint256)
function getMinDelegationAmount() external view returns (uint256)
17,921
24
// Allows a graph account to publish a new subgraph, which means a new subgraph numberwill be used. _graphAccount Account that is publishing the subgraph _subgraphDeploymentID Subgraph deployment ID of the version, linked to the name _versionMetadata IPFS hash for the subgraph version metadata _subgraphMetadata IPFS hash for the subgraph metadata /
function publishNewSubgraph( address _graphAccount, bytes32 _subgraphDeploymentID, bytes32 _versionMetadata, bytes32 _subgraphMetadata
function publishNewSubgraph( address _graphAccount, bytes32 _subgraphDeploymentID, bytes32 _versionMetadata, bytes32 _subgraphMetadata
31,285
34
// Bid on the auction with the value sent with this transaction./ The value will only be refunded if the auction is not won.
function bid() payable atState(States.AcceptingBids) { require(msg.value > highestBid); if (highestBid != 0) { pendingReturns[highestBidder] = pendingReturns[highestBidder].add(highestBid); } highestBidder = msg.sender; highestBid = msg.value; HighestBidIncreased(msg.sender, msg.value); }
function bid() payable atState(States.AcceptingBids) { require(msg.value > highestBid); if (highestBid != 0) { pendingReturns[highestBidder] = pendingReturns[highestBidder].add(highestBid); } highestBidder = msg.sender; highestBid = msg.value; HighestBidIncreased(msg.sender, msg.value); }
29,775
12
// We verify that beta keys are available
require(betaKeysSold < maxBetaKeys);
require(betaKeysSold < maxBetaKeys);
26,238
116
// Need to make gas fee customizable to future-proof against Ethereum network upgrades.
uint256 public gasForTransfer; uint256 public totalDividendsDistributed;
uint256 public gasForTransfer; uint256 public totalDividendsDistributed;
27,502