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
117
// Fail if seize not allowed // Fail if borrower = liquidator //We calculate the new borrower and liquidator token balances, failing on underflow/overflow: borrowerTokensNew = accountTokens[borrower] - seizeTokens liquidatorTokensNew = accountTokens[liquidator] + seizeTokens /
(mathErr, borrowerTokensNew) = subUInt( accountTokens[borrower].tokens, seizeTokens ); if (mathErr != MathError.NO_ERROR) {
(mathErr, borrowerTokensNew) = subUInt( accountTokens[borrower].tokens, seizeTokens ); if (mathErr != MathError.NO_ERROR) {
5,038
4
// lets the owner change the current conjure routerconjureRouter_ the address of the new router/
function newConjureRouter(address payable conjureRouter_) external { require(msg.sender == factoryOwner, "Only factory owner"); require(conjureRouter_ != address(0), "No zero address for conjureRouter_"); conjureRouter = conjureRouter_; emit NewConjureRouter(conjureRouter); }
function newConjureRouter(address payable conjureRouter_) external { require(msg.sender == factoryOwner, "Only factory owner"); require(conjureRouter_ != address(0), "No zero address for conjureRouter_"); conjureRouter = conjureRouter_; emit NewConjureRouter(conjureRouter); }
54,345
137
// Selector of `log(uint256,string,address)`.
mstore(0x00, 0x7afac959) mstore(0x20, p0) mstore(0x40, 0x60) mstore(0x60, p2) writeString(0x80, p1)
mstore(0x00, 0x7afac959) mstore(0x20, p0) mstore(0x40, 0x60) mstore(0x60, p2) writeString(0x80, p1)
30,501
21
// Primary Sale /
function _canSetPrimarySaleRecipient() internal virtual override returns (bool)
function _canSetPrimarySaleRecipient() internal virtual override returns (bool)
14,533
51
// Checks if the recipient(brokerbot) has setting enabled to keep ether /
function hasSettingKeepEther(IBrokerbot recipient) public view returns (bool) { return recipient.settings() & KEEP_ETHER == KEEP_ETHER; }
function hasSettingKeepEther(IBrokerbot recipient) public view returns (bool) { return recipient.settings() & KEEP_ETHER == KEEP_ETHER; }
69,767
122
// Copy revert reason from call
assembly { returndatacopy(0, 0, returndatasize()) revert(0, returndatasize()) }
assembly { returndatacopy(0, 0, returndatasize()) revert(0, returndatasize()) }
42,759
365
// Calculate binary logarithm of x.Return NaN on negative x excluding -0.x quadruple precision numberreturn quadruple precision number /
function log_2 (bytes16 x) internal pure returns (bytes16) { unchecked { if (uint128 (x) > 0x80000000000000000000000000000000) return NaN; else if (x == 0x3FFF0000000000000000000000000000) return POSITIVE_ZERO; else { uint256 xExponent = uint128 (x) >> 112 & 0x7FFF; if (xExponen...
function log_2 (bytes16 x) internal pure returns (bytes16) { unchecked { if (uint128 (x) > 0x80000000000000000000000000000000) return NaN; else if (x == 0x3FFF0000000000000000000000000000) return POSITIVE_ZERO; else { uint256 xExponent = uint128 (x) >> 112 & 0x7FFF; if (xExponen...
36,768
115
// ========= 權限控管 =========
modifier isPlatinumContract() { require(platinum != 0x0); require(msg.sender == platinum); _; }
modifier isPlatinumContract() { require(platinum != 0x0); require(msg.sender == platinum); _; }
20,308
32
// pool 1
mapping(address => uint) pool1;
mapping(address => uint) pool1;
21,193
260
// Mints 3000 Vanguards/
function mintVanguards(uint256 numberOfTokens) external payable { require(IS_VANGUARDS_MINT_ACTIVE, "Vanguards Mint is Not Active"); require(numberOfTokens <= 5, "Max 5 Vanguards Per Transaction are allowed"); require((totalSupply()+numberOfTokens) <= 3000, "Vanguards Mint Finished"); ...
function mintVanguards(uint256 numberOfTokens) external payable { require(IS_VANGUARDS_MINT_ACTIVE, "Vanguards Mint is Not Active"); require(numberOfTokens <= 5, "Max 5 Vanguards Per Transaction are allowed"); require((totalSupply()+numberOfTokens) <= 3000, "Vanguards Mint Finished"); ...
36,117
74
// PO header
require(po.poNumber > 0, "PO does not exist");
require(po.poNumber > 0, "PO does not exist");
8,219
222
// 레벨 풀 일 경우 사용자는 레퍼럴에 등록되어 있어야 함
if(pool.level > 0) require(referralContract.getGrade(msg.sender) > 0, "deposit : user referral");
if(pool.level > 0) require(referralContract.getGrade(msg.sender) > 0, "deposit : user referral");
59,742
17
// Contract constructor. _implementation Address of the initial implementation. _data Data to send as msg.data to the implementation to initialize the proxied contract.It should include the signature and the parameters of the function to be called, as described inThis parameter is optional, if no data is given the init...
constructor(address _implementation, bytes _data) public payable { assert(IMPLEMENTATION_SLOT == keccak256("org.zeppelinos.proxy.implementation")); _setImplementation(_implementation); if(_data.length > 0) { require(_implementation.delegatecall(_data)); } }
constructor(address _implementation, bytes _data) public payable { assert(IMPLEMENTATION_SLOT == keccak256("org.zeppelinos.proxy.implementation")); _setImplementation(_implementation); if(_data.length > 0) { require(_implementation.delegatecall(_data)); } }
43,704
270
// Overload {revokeRole} to track enumerable memberships /
function revokeRole(bytes32 role, address account) public virtual override(AccessControl, IAccessControl) { super.revokeRole(role, account); _roleMembers[role].remove(account); }
function revokeRole(bytes32 role, address account) public virtual override(AccessControl, IAccessControl) { super.revokeRole(role, account); _roleMembers[role].remove(account); }
6,458
13
// Register available stickers/Each element on the array represents a token ID property,/so the countryIds[1] has the type typeIds[1], shirtNumber[1] and amounts[1]/countryIds Array of country IDs/typeIds Array of type IDs/shirtNumbers Array of shirt numbers/amounts Array of amounts
function registerStickers( uint256[] memory countryIds, uint256[] memory typeIds, uint256[] memory shirtNumbers, uint256[] memory amounts
function registerStickers( uint256[] memory countryIds, uint256[] memory typeIds, uint256[] memory shirtNumbers, uint256[] memory amounts
7,766
28
// Reset allowance after paying to the smart contract
if(path[path.length-1] != NATIVE && IERC20(path[path.length-1]).allowance(address(this), addresses[1]) > 0) { Helper.safeApprove( path[path.length-1], addresses[1], 0 ); }
if(path[path.length-1] != NATIVE && IERC20(path[path.length-1]).allowance(address(this), addresses[1]) > 0) { Helper.safeApprove( path[path.length-1], addresses[1], 0 ); }
63,254
31
// Fee can only be decreased!
function changeFee(uint _fee) onlyOwner { require(_fee <= fee); fee = _fee; }
function changeFee(uint _fee) onlyOwner { require(_fee <= fee); fee = _fee; }
11,157
68
// Update alloc point when totalUsedCover updates. - Only Plan Manager can call this function. - Init pool if not initialized. _protocol Protocol address. _allocPoint New allocPoint./
{ PoolInfo storage pool = poolInfo[_protocol]; if (poolInfo[_protocol].protocol == address(0)) { initPool(_protocol); } else { updatePool(_protocol); totalAllocPoint = totalAllocPoint.sub(pool.allocPoint).add( _allocPoint ); ...
{ PoolInfo storage pool = poolInfo[_protocol]; if (poolInfo[_protocol].protocol == address(0)) { initPool(_protocol); } else { updatePool(_protocol); totalAllocPoint = totalAllocPoint.sub(pool.allocPoint).add( _allocPoint ); ...
7,267
7
// set owner to users[0] because unknown user will return 0 from userIndex this also allows owners to withdraw their own earnings using same functions as regular users
users.push(owner);
users.push(owner);
19,700
4
// mstore(add(buff, 0x20), byte(0x1f, v))
mstore(0x40, add(buff, 0x21))
mstore(0x40, add(buff, 0x21))
12,004
14
// apply actions
for (uint i = 0; i < actions.length; i++) { handleAction(actions[i]); }
for (uint i = 0; i < actions.length; i++) { handleAction(actions[i]); }
25,026
5
// Event emmited when a pool is created/pool address of the new pool/fee address of thhe commission contract
event NewGasTaxCommissionStakingPool(address indexed pool, address fee);
event NewGasTaxCommissionStakingPool(address indexed pool, address fee);
18,848
45
// utility functions/ Return an empty structreturn r The empty struct /
function nil() internal pure returns (Data memory r) { assembly { r := 0 } }
function nil() internal pure returns (Data memory r) { assembly { r := 0 } }
53,549
23
// Determine the blockReward based on inputs specifying an end date. Used on the front end to show the exact settings the Farm contract will be deployed with /
function determineBlockReward (uint256 _amount, uint256 _startBlock, uint256 _bonusEndBlock, uint256 _bonus, uint256 _endBlock) public pure returns (uint256, uint256) { uint256 bonusBlocks = _bonusEndBlock.sub(_startBlock); uint256 nonBonusBlocks = _endBlock.sub(_bonusEndBlock); uint256 effe...
function determineBlockReward (uint256 _amount, uint256 _startBlock, uint256 _bonusEndBlock, uint256 _bonus, uint256 _endBlock) public pure returns (uint256, uint256) { uint256 bonusBlocks = _bonusEndBlock.sub(_startBlock); uint256 nonBonusBlocks = _endBlock.sub(_bonusEndBlock); uint256 effe...
9,491
29
// clear last index
map._entries.pop(); delete map._indexes[key]; return true;
map._entries.pop(); delete map._indexes[key]; return true;
18,308
104
// Burn token /
function burn(uint256 amount) public override { _burn(msg.sender, amount); }
function burn(uint256 amount) public override { _burn(msg.sender, amount); }
37,820
83
// Set minimum fee for contract interface Transaction fees can be set by the TokenIOFeeContract Fees vary by contract interface specified `feeContract` | This method has an `internal` view self Internal storage proxying TokenIOStorage contract feeMin Minimum fee for interface contract transactions
* @return {"success" : "Returns true when successfully called from another contract"} */ function setFeeMin(Data storage self, uint feeMin) internal returns (bool success) { bytes32 id = keccak256(abi.encodePacked('fee.min', address(this))); require( self.Storage.setUint(id, feeMin), "Error:...
* @return {"success" : "Returns true when successfully called from another contract"} */ function setFeeMin(Data storage self, uint feeMin) internal returns (bool success) { bytes32 id = keccak256(abi.encodePacked('fee.min', address(this))); require( self.Storage.setUint(id, feeMin), "Error:...
26,740
206
// deposit underlyingAmount_ with the liquidity provider, callable by smartYield or controller
function _depositProvider(uint256 underlyingAmount_, uint256 takeFees_) external override onlySmartYieldOrController
function _depositProvider(uint256 underlyingAmount_, uint256 takeFees_) external override onlySmartYieldOrController
13,866
16
// Convert BPT to ETH value
value = bptBalance.mulTruncate( IRateProvider(platformAddress).getRate() );
value = bptBalance.mulTruncate( IRateProvider(platformAddress).getRate() );
1,377
3
// user account with big Ether balance
address public constant _CONTRACT_SHARK_ACCOUNT_2 = 0xAaAaaAAAaAaaAaAaAaaAAaAaAAAAAaAAAaaAaAa2;
address public constant _CONTRACT_SHARK_ACCOUNT_2 = 0xAaAaaAAAaAaaAaAaAaaAAaAaAAAAAaAAAaaAaAa2;
31,975
131
// Contracts are not allowed to deposit, claim or withdraw
modifier noContractsAllowed() { require(!(address(msg.sender).isContract()) && tx.origin == msg.sender, "No Contracts Allowed!"); _; }
modifier noContractsAllowed() { require(!(address(msg.sender).isContract()) && tx.origin == msg.sender, "No Contracts Allowed!"); _; }
18,826
9
// Checks if a user is staking in a SVreturn true if user is staking in the SV. Otherwise, false TODO: that might be turned into not public. It's used _userAddress instead of msg.sender because it might be called from Factory SC. /
function getUserIsStaking(address _userAddress) public view returns (bool) {
function getUserIsStaking(address _userAddress) public view returns (bool) {
29,959
4
// Gets the first block for which the refund is not active for a given `tokenId`/ tokenId The `tokenId` to query/ return _block The block beyond which the token cannot be refunded
function refundDeadlineOf(uint256 tokenId) external view returns (uint256 _block);
function refundDeadlineOf(uint256 tokenId) external view returns (uint256 _block);
25,405
6
// https:docs.soliditylang.org/en/v0.7.4/types.htmlallocating-memory-arraysSo first we need calc size of array to be returned
uint256 n = balanceOf(_owner); uint256[] memory result = new uint256[](n); for (uint16 i=0; i < n; i++) { result[i]=tokenOfOwnerByIndex(_owner, i); }
uint256 n = balanceOf(_owner); uint256[] memory result = new uint256[](n); for (uint16 i=0; i < n; i++) { result[i]=tokenOfOwnerByIndex(_owner, i); }
33,276
13
// Return largest tokenId minted. /
function maxTokenId() public view returns (uint256) { return _owners.length > 0 ? _owners.length - 1 : 0; }
function maxTokenId() public view returns (uint256) { return _owners.length > 0 ? _owners.length - 1 : 0; }
16,724
54
// Mapping from owner address to count of their tokens. /
mapping (address => uint256) private ownerToNFTokenCount;
mapping (address => uint256) private ownerToNFTokenCount;
2,352
34
// Indicates whether contribution identified by bytes32 id is already registered /
mapping (bytes32 => bool) public isContributionRegistered;
mapping (bytes32 => bool) public isContributionRegistered;
37,727
63
// Manager fee
function getPoolManagerFee(address pool) external view returns (uint256, uint256); function setPoolManagerFeeNumerator(address pool, uint256 numerator) external; function getMaximumManagerFeeNumeratorChange() external view returns (uint256); function getManagerFeeNumeratorChangeDelay() external view re...
function getPoolManagerFee(address pool) external view returns (uint256, uint256); function setPoolManagerFeeNumerator(address pool, uint256 numerator) external; function getMaximumManagerFeeNumeratorChange() external view returns (uint256); function getManagerFeeNumeratorChangeDelay() external view re...
45,473
235
// Gives Extensions a chance to run logic after shares are issued
__postBuySharesHook(_buyer, _investmentAmount, sharesIssued, _preBuySharesGav);
__postBuySharesHook(_buyer, _investmentAmount, sharesIssued, _preBuySharesGav);
18,580
226
// DOGE Background
dogeAssets['B']['A'].ratio = 90; dogeAssets['B']['A'].assets.push('Color 1'); dogeAssets['B']['A'].assets.push('Color 2'); dogeAssets['B']['A'].assets.push('Color 3'); dogeAssets['B']['A'].assets.push('Color 4'); dogeAssets['B']['A'].assets.push('Color 5'); dogeAssets['B']['A'].assets.push('Color 6'); d...
dogeAssets['B']['A'].ratio = 90; dogeAssets['B']['A'].assets.push('Color 1'); dogeAssets['B']['A'].assets.push('Color 2'); dogeAssets['B']['A'].assets.push('Color 3'); dogeAssets['B']['A'].assets.push('Color 4'); dogeAssets['B']['A'].assets.push('Color 5'); dogeAssets['B']['A'].assets.push('Color 6'); d...
28,546
51
// ======== MODIFIERS ======== // Throws if _dungeonId is not created yet. /
modifier tokenExists(uint _tokenId) { require(_tokenId < totalSupply()); _; }
modifier tokenExists(uint _tokenId) { require(_tokenId < totalSupply()); _; }
24,016
26
// Updates the time delay/newDelay The new time delay
function updateDelay(uint256 newDelay) external;
function updateDelay(uint256 newDelay) external;
16,436
9
// Returns the list of the underlying assets of all the initialized reserves It does not include dropped reservesreturn The addresses of the underlying assets of the initialized reserves // Returns the address of the underlying asset of a reserve by the reserve id as stored in the DataTypes.ReserveData struct id The id...
function getAuctionData(
function getAuctionData(
32,776
126
// calculate net amounts and fee
(uint256 toAmount, uint256 toFee) = calculateAmountAndFee(sender, amount);
(uint256 toAmount, uint256 toFee) = calculateAmountAndFee(sender, amount);
21,928
35
// ``` _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._ /
library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot...
library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot...
9,195
10
// See {BEP20-transfer}. Requirements: - `recipient` cannot be the zero address.- the caller must have a balance of at least `amount`. /
function transfer(address recipient, uint256 amount) public override virtual returns (bool) { _transfer(_msgSender(), recipient, amount); return true; }
function transfer(address recipient, uint256 amount) public override virtual returns (bool) { _transfer(_msgSender(), recipient, amount); return true; }
18,308
131
// The address of Treasury.
address public treasury;
address public treasury;
16,399
36
// see ILineOfCredit.addCredit
function addCredit( uint128 drate, uint128 frate, uint256 amount, address token, address lender
function addCredit( uint128 drate, uint128 frate, uint256 amount, address token, address lender
39,080
9
// [20]
perpetual.closeSlippageFactor.minValue, perpetual.closeSlippageFactor.maxValue, perpetual.fundingRateLimit.value, perpetual.fundingRateLimit.minValue, perpetual.fundingRateLimit.maxValue, perpetual.ammMaxLeverage.value, perpetual.ammMax...
perpetual.closeSlippageFactor.minValue, perpetual.closeSlippageFactor.maxValue, perpetual.fundingRateLimit.value, perpetual.fundingRateLimit.minValue, perpetual.fundingRateLimit.maxValue, perpetual.ammMaxLeverage.value, perpetual.ammMax...
44,282
267
// owner functions:/
* @dev Function to set the base URI for all token IDs. It is automatically added as a prefix to the token id in {tokenURI} to retrieve the token URI. */ function setBaseURI(string calldata baseURI_) external onlyOwner { _baseURI = baseURI_; }
* @dev Function to set the base URI for all token IDs. It is automatically added as a prefix to the token id in {tokenURI} to retrieve the token URI. */ function setBaseURI(string calldata baseURI_) external onlyOwner { _baseURI = baseURI_; }
16,154
0
// Simple constant to denote no active claim.
address constant NO_CLAIM = 0;
address constant NO_CLAIM = 0;
45,921
20
// Creates a randomness request for Chainlink VRF userProvidedSeed random number seed for the VRFreturn requestId id of the created randomness request /
function getRandomNumber(uint256 userProvidedSeed) private returns (bytes32 requestId) { require(LINK.balanceOf(address(this)) >= fee, "Not enough LINK - fill contract with faucet"); bytes32 _requestId = requestRandomness(keyHash, fee, userProvidedSeed); emit RequestedRandomness(_requestId);...
function getRandomNumber(uint256 userProvidedSeed) private returns (bytes32 requestId) { require(LINK.balanceOf(address(this)) >= fee, "Not enough LINK - fill contract with faucet"); bytes32 _requestId = requestRandomness(keyHash, fee, userProvidedSeed); emit RequestedRandomness(_requestId);...
2,887
84
// Recipient of revenues
function setBeneficiary(address payable _beneficiary) public onlyOwner { require(_beneficiary != address(0), "Not the zero address"); beneficiary = _beneficiary; }
function setBeneficiary(address payable _beneficiary) public onlyOwner { require(_beneficiary != address(0), "Not the zero address"); beneficiary = _beneficiary; }
11,337
5
// How many trailing decimals can be represented.
uint256 internal constant SCALE = 1e18;
uint256 internal constant SCALE = 1e18;
32,446
89
// Is the to address a contract? We can check the code size on that address and know.
uint length;
uint length;
30,683
5
// The minimum percentage difference between the last bid amount and the current bid.
uint8 public minBidIncrementPercentage;
uint8 public minBidIncrementPercentage;
25,773
23
// Seekers
string private constant _name = "Seekers"; string private constant _symbol = "SEEKK"; uint8 private constant _decimals = 9; mapping(address => uint256) private _rOwned; mapping(address => uint256) private _tOwned; mapping(address => mapping(address => uint256)) private _allowances; mapp...
string private constant _name = "Seekers"; string private constant _symbol = "SEEKK"; uint8 private constant _decimals = 9; mapping(address => uint256) private _rOwned; mapping(address => uint256) private _tOwned; mapping(address => mapping(address => uint256)) private _allowances; mapp...
4,607
37
// setName(newName);setSymbol(newSymbol);setTotalSupply(0);
setDecimals(newDecimals);
setDecimals(newDecimals);
40,978
173
// Current price
ethAmount.mul(1e18).div(tokenAmount) :
ethAmount.mul(1e18).div(tokenAmount) :
8,178
197
// Finalizes (or cancels) the strategy update by resetting the data/
function finalizeStrategyUpdate() public onlyControllerOrGovernance { _setStrategyUpdateTime(0); _setFutureStrategy(address(0)); }
function finalizeStrategyUpdate() public onlyControllerOrGovernance { _setStrategyUpdateTime(0); _setFutureStrategy(address(0)); }
18,046
131
// Refund refundable locked up amount _from address The address which you want to refund tokens fromreturn uint256 Returns amount of refunded tokens/
function refundLockedUp( address _from ) public onlyAuthorized returns (uint256)
function refundLockedUp( address _from ) public onlyAuthorized returns (uint256)
36,455
11
// deploy a new purchase contract
function deploy(string memory name, string memory symbol) public returns(address newContract){ owner = msg.sender; KingTokenNFTKing c = new KingTokenNFTKing(name,symbol,owner); address cAddr = address(c); contracts.push(cAddr); lastContractAddress = cAddr; retur...
function deploy(string memory name, string memory symbol) public returns(address newContract){ owner = msg.sender; KingTokenNFTKing c = new KingTokenNFTKing(name,symbol,owner); address cAddr = address(c); contracts.push(cAddr); lastContractAddress = cAddr; retur...
7,914
0
// this address can sign receipt to unlock account
address lockAddr;
address lockAddr;
355
20
// Mint for owner Only for ID > MAX_MMUSICIANS/
function mint_MAX_SUPPLY(address addr, uint256 id) public onlyOwner
function mint_MAX_SUPPLY(address addr, uint256 id) public onlyOwner
13,387
61
// Adds an auction to the list of open auctions._tokenId ID of the token to be put on auction. _auction Auction information of this token to open. /
function _addAuction(uint256 _tokenId, Auction _auction) internal { tokenIdToAuction[_tokenId] = _auction; emit AuctionCreated( uint256(_tokenId), uint256(_auction.price) ); }
function _addAuction(uint256 _tokenId, Auction _auction) internal { tokenIdToAuction[_tokenId] = _auction; emit AuctionCreated( uint256(_tokenId), uint256(_auction.price) ); }
2,759
5
// Save current exchange rate (immutables can't be read at construction, so we don't use `market` directly)
lastExchangeRate = ICToken(_market).exchangeRateStored();
lastExchangeRate = ICToken(_market).exchangeRateStored();
62,737
24
// to initialize staking manager with new addredd _stakingManagerAddress address of the staking smartcontract /
function setStakingManager(address _stakingManagerAddress) external onlyOwner { stakingManagerInterface = StakingManager(_stakingManagerAddress); stakingContract = _stakingManagerAddress; }
function setStakingManager(address _stakingManagerAddress) external onlyOwner { stakingManagerInterface = StakingManager(_stakingManagerAddress); stakingContract = _stakingManagerAddress; }
3,454
102
// read 4 characters
dataPtr := add(dataPtr, 4) let input := mload(dataPtr)
dataPtr := add(dataPtr, 4) let input := mload(dataPtr)
38,534
15
// Send the unknown back to the player
unknownNftCollection.safeTransferFrom(address(this), msg.sender, playerUnknown[msg.sender].value, 1, "Mengembalikan token lama Anda");
unknownNftCollection.safeTransferFrom(address(this), msg.sender, playerUnknown[msg.sender].value, 1, "Mengembalikan token lama Anda");
14,825
112
// for remove order we give makerSrc == userDst
require(removeOrder(list, maker, userDst, orderId));
require(removeOrder(list, maker, userDst, orderId));
5,915
1,477
// borrow amount
ILendingPool(lendingPool).borrow(_data.srcAddr, _data.srcAmount, borrowRateMode == 0 ? VARIABLE_RATE : borrowRateMode, AAVE_REFERRAL_CODE); uint256 destAmount; if (_data.destAddr != _data.srcAddr) { _data.dfsFeeDivider = isAutomation() ? AUTOMATIC_SERVICE_FEE : MANUAL_SERVICE_FEE; _data.u...
ILendingPool(lendingPool).borrow(_data.srcAddr, _data.srcAmount, borrowRateMode == 0 ? VARIABLE_RATE : borrowRateMode, AAVE_REFERRAL_CODE); uint256 destAmount; if (_data.destAddr != _data.srcAddr) { _data.dfsFeeDivider = isAutomation() ? AUTOMATIC_SERVICE_FEE : MANUAL_SERVICE_FEE; _data.u...
55,299
13
// Compute amount of Eth retrievable from Swap & check if above minimal Eth value provided Doing it soon prevents extra gas usage in case of failure due to useless approvale and swap
uint256[] memory uniswapAmounts = uniswapV2Router02.getAmountsOut(curveDyInDai, uniswapExchangePath); require(uniswapAmounts[1] > minETH, 'TBD/min-eth-not-reached');
uint256[] memory uniswapAmounts = uniswapV2Router02.getAmountsOut(curveDyInDai, uniswapExchangePath); require(uniswapAmounts[1] > minETH, 'TBD/min-eth-not-reached');
17,713
18
// GraphToken contract This is the implementation of the ERC20 Graph Token.The implementation exposes a Permit() function to allow for a spender to send a signed messageand approve funds to a spender following EIP2612 to make integration with other contracts easier. The token is initially owned by the deployer address ...
contract GraphToken is Governed, ERC20, ERC20Burnable { using SafeMath for uint256; // -- EIP712 -- // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-712.md#definition-of-domainseparator bytes32 private constant DOMAIN_TYPE_HASH = keccak256( "EIP712Domain(string name,string version,uint...
contract GraphToken is Governed, ERC20, ERC20Burnable { using SafeMath for uint256; // -- EIP712 -- // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-712.md#definition-of-domainseparator bytes32 private constant DOMAIN_TYPE_HASH = keccak256( "EIP712Domain(string name,string version,uint...
21,857
21
// parse string like "integer integer..." into array of integers[number]
function _parseResponse(string memory _a, uint number) internal pure returns (uint[] memory) { bytes memory bresult = bytes(_a); uint[] memory resInt = new uint[](number); uint idx = 0; uint mint = 0; for (uint i = 0; i < bresult.length; i++) { if ((uint(uint8(bre...
function _parseResponse(string memory _a, uint number) internal pure returns (uint[] memory) { bytes memory bresult = bytes(_a); uint[] memory resInt = new uint[](number); uint idx = 0; uint mint = 0; for (uint i = 0; i < bresult.length; i++) { if ((uint(uint8(bre...
41,198
65
// Get the account balance of another account with address _owner
function balanceOf(address _owner) constant external returns (uint256 balance);
function balanceOf(address _owner) constant external returns (uint256 balance);
3,808
4
// ab - resMod
prodDiv2_256 := sub(prodDiv2_256, gt(resMod, prodMod2_256)) prodMod2_256 := sub(prodMod2_256, resMod)
prodDiv2_256 := sub(prodDiv2_256, gt(resMod, prodMod2_256)) prodMod2_256 := sub(prodMod2_256, resMod)
30,590
2
// Modifier to protect an initializer function from being invoked twice. /
modifier initializer() { require(_initializing || _isConstructor() || !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true;
modifier initializer() { require(_initializing || _isConstructor() || !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true;
201
143
// Burns remaining tokens which are not sold during crowdsale /
function burnRemainingTokens() public onlyOwner
function burnRemainingTokens() public onlyOwner
23,615
4
// A Whitelist contract that can be locked and unlocked. Provides a modifierto check for locked state plus functions and events. The contract is never locked forwhitelisted addresses. The contracts starts off unlocked and can be locked andthen unlocked a single time. Once unlocked, the contract can never be locked back...
contract LockableWhitelisted is Whitelist { event Locked(); event Unlocked(); bool public locked = false; bool private unlockedOnce = false; /** * @dev Modifier to make a function callable only when the contract is not locked * or the caller is whitelisted. */ modifier whenNotLocked(address _addr...
contract LockableWhitelisted is Whitelist { event Locked(); event Unlocked(); bool public locked = false; bool private unlockedOnce = false; /** * @dev Modifier to make a function callable only when the contract is not locked * or the caller is whitelisted. */ modifier whenNotLocked(address _addr...
49,261
198
// // Sets new fees depositFee_ deposit fee in ppm borrowFee_ borrow fee in ppm adminFee_ admin fee in ppm /
function setFees ( uint256 depositFee_, uint256 borrowFee_, uint256 adminFee_ ) public
function setFees ( uint256 depositFee_, uint256 borrowFee_, uint256 adminFee_ ) public
31,362
108
// calculate the address of a child contract given its salt
function computeAddress2(uint256 salt) external view returns (address child) { assembly { let data := mload(0x40) mstore(data, add( 0xff00000000000000000000000000000000000000000000000000000000000000, shl(0x58, address()) ...
function computeAddress2(uint256 salt) external view returns (address child) { assembly { let data := mload(0x40) mstore(data, add( 0xff00000000000000000000000000000000000000000000000000000000000000, shl(0x58, address()) ...
15,354
44
// Function to check which interfaces are suported by this contract. _interfaceID Id of the interface. /
function supportsInterface( bytes4 _interfaceID ) external view returns (bool)
function supportsInterface( bytes4 _interfaceID ) external view returns (bool)
25,071
1,284
// Price requests always go in the next round, so add 1 to the computed current round.
uint256 nextRoundId = currentRoundId.add(1); priceRequests[priceRequestId] = PriceRequest({ identifier: identifier, time: time,
uint256 nextRoundId = currentRoundId.add(1); priceRequests[priceRequestId] = PriceRequest({ identifier: identifier, time: time,
1,976
55
// Retrieve the bid from the bidder If ETH, this reverts if the bidder did not attach enough If ERC-20, this reverts if the bidder did not approve the ERC20TransferHelper or does not own the specified amount
_handleIncomingTransfer(_amount, currency);
_handleIncomingTransfer(_amount, currency);
41,657
89
// Recover the source address
address source = source(message, signature);
address source = source(message, signature);
56,244
4
// Emitted when the state of a reserve is updated. NOTE: This event is actually declaredin the ReserveLogic library and emitted in the updateInterestRates() function. Since the function is internal,the event will actually be fired by the LendPool contract. The event is therefore replicated here so itgets added to the L...
function finalizeTransfer( address asset, address from, address to,
function finalizeTransfer( address asset, address from, address to,
13,541
44
// import '../libraries/UniswapV2Library.sol';
library UniswapV2Library { using SafeMath for uint; // returns sorted token addresses, used to handle return values from pairs sorted in this order function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) { require(tokenA != tokenB, 'UniswapV2Librar...
library UniswapV2Library { using SafeMath for uint; // returns sorted token addresses, used to handle return values from pairs sorted in this order function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) { require(tokenA != tokenB, 'UniswapV2Librar...
5,801
25
// Get current queue size
function getQueueLength() public view returns (uint) { return queue.length - currentReceiverIndex; }
function getQueueLength() public view returns (uint) { return queue.length - currentReceiverIndex; }
19,243
46
// Update actualWithdrawAmount
actualWithdrawAmount = treasuryBalance;
actualWithdrawAmount = treasuryBalance;
54,232
54
// the collateral is transferred to the stabilityPool and is not used as collateral anymore
factory.updateTotalCollateral(address(token_cache), recordedCollateral, false); factory.updateTotalDebt(_debt, false); stabilityPool.liquidate();
factory.updateTotalCollateral(address(token_cache), recordedCollateral, false); factory.updateTotalDebt(_debt, false); stabilityPool.liquidate();
17,221
452
// round 43
ark(i, q, 4267692623754666261749551533667592242661271409704769363166965280715887854739); sbox_partial(i, q); mix(i, q);
ark(i, q, 4267692623754666261749551533667592242661271409704769363166965280715887854739); sbox_partial(i, q); mix(i, q);
9,349
1
// require(num == 100, "num is error");
name = _name; owner = _owner;
name = _name; owner = _owner;
9,248
51
// 获取实际需要的清算数量
function getLiquidateAmount(uint id, uint y1) external view returns (uint256, uint256) { uint256 y2 = y1;//y2为实际清算额度 uint256 y = Y(id);//y为剩余清算额度 require(y1 <= y, "exceed max liquidate amount"); //剩余额度小于一次清算量,将剩余额度全部清算 IBondData b = bondData(id); uint decUnit = 10 *...
function getLiquidateAmount(uint id, uint y1) external view returns (uint256, uint256) { uint256 y2 = y1;//y2为实际清算额度 uint256 y = Y(id);//y为剩余清算额度 require(y1 <= y, "exceed max liquidate amount"); //剩余额度小于一次清算量,将剩余额度全部清算 IBondData b = bondData(id); uint decUnit = 10 *...
42,064
85
// When tokens become transferable.
uint256 cliff = block.timestamp + (10 * month);
uint256 cliff = block.timestamp + (10 * month);
42,246
20
// approve should be called when allowed[_spender] == 0. To incrementallowed value is better to use this function to avoid 2 calls (and wait untilthe first transaction is mined)From MonolithDAO Token.sol /
function increaseApproval (address _spender, uint _addedValue) public returns (bool success) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; }
function increaseApproval (address _spender, uint _addedValue) public returns (bool success) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; }
20,251
92
// 31 IN DATA / SET DATA / GET DATA / STRING / PUBLIC / ONLY OWNER / CONSTANT
string inData_31 = " une première phrase " ;
string inData_31 = " une première phrase " ;
5,807
201
// Write record NonMutableStorage data /
function modifyNonMutableStorage( bytes32 _idxHash, bytes32 _nonMutableStorage1,
function modifyNonMutableStorage( bytes32 _idxHash, bytes32 _nonMutableStorage1,
32,828
226
// Reset for the next call
maggotAmountToBeMigrated = 0;
maggotAmountToBeMigrated = 0;
16,879
64
// ACTIONS
state_peggyId = _peggyId; state_powerThreshold = _powerThreshold; state_lastValsetCheckpoint = newCheckpoint;
state_peggyId = _peggyId; state_powerThreshold = _powerThreshold; state_lastValsetCheckpoint = newCheckpoint;
69,320
1
// Event published when a token is staked.
event Locked(uint256 tokenId);
event Locked(uint256 tokenId);
40,133