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 |
|---|---|---|---|---|
162 | // Creates an access control instance, setting contract creator to have full privileges / | constructor() {
// contract creator has full privileges
userRoles[msg.sender] = FULL_PRIVILEGES_MASK;
}
| constructor() {
// contract creator has full privileges
userRoles[msg.sender] = FULL_PRIVILEGES_MASK;
}
| 66,866 |
5 | // Resume interaction with the rollup contract / | function resume() external override {
_unpause();
emit OwnerFunctionCalled(4);
}
| function resume() external override {
_unpause();
emit OwnerFunctionCalled(4);
}
| 20,434 |
22 | // Stores received frozen IPT Global tokens in an accumulated fashion. | mapping(address => uint256) public frozenTokensReceived;
| mapping(address => uint256) public frozenTokensReceived;
| 330 |
3 | // Can pause and panic vaults. | bytes32 public constant PAUSE_VAULT_ROLE = keccak256("PAUSE_VAULT_ROLE");
| bytes32 public constant PAUSE_VAULT_ROLE = keccak256("PAUSE_VAULT_ROLE");
| 28,175 |
52 | // Amount delta applied on this cycle | int128 thisCycle;
| int128 thisCycle;
| 21,616 |
114 | // mint to tokens to sender | _rOwned[_msgSender()] = _rTotal;
emit Transfer(address(0), _msgSender(), _tTotal);
| _rOwned[_msgSender()] = _rTotal;
emit Transfer(address(0), _msgSender(), _tTotal);
| 20,279 |
208 | // Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation./ See {IERC165-supportsInterface}. / | function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
| function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
| 629 |
93 | // _bBTC bBTC token address/ | constructor(address _bBTC) public {
require(_bBTC != address(0), "NULL_ADDRESS");
bBTC = IbBTC(_bBTC);
}
| constructor(address _bBTC) public {
require(_bBTC != address(0), "NULL_ADDRESS");
bBTC = IbBTC(_bBTC);
}
| 5,083 |
53 | // Requires that msg.sender owns or is approved for the token. | modifier onlyApprovedOrOwner(uint256 tokenId) {
if (
_ownershipOf(tokenId).addr != _msgSender() &&
getApproved(tokenId) != _msgSender()
) {
revert Access_MissingOwnerOrApproved();
}
_;
}
| modifier onlyApprovedOrOwner(uint256 tokenId) {
if (
_ownershipOf(tokenId).addr != _msgSender() &&
getApproved(tokenId) != _msgSender()
) {
revert Access_MissingOwnerOrApproved();
}
_;
}
| 24,392 |
303 | // Return whether an unbonding lock for a delegator is valid _delegator Address of delegator _unbondingLockId ID of unbonding lockreturn true if unbondingLock for ID has a non-zero withdraw round / | function isValidUnbondingLock(address _delegator, uint256 _unbondingLockId) public view returns (bool) {
// A unbonding lock is only valid if it has a non-zero withdraw round (the default value is zero)
return delegators[_delegator].unbondingLocks[_unbondingLockId].withdrawRound > 0;
}
| function isValidUnbondingLock(address _delegator, uint256 _unbondingLockId) public view returns (bool) {
// A unbonding lock is only valid if it has a non-zero withdraw round (the default value is zero)
return delegators[_delegator].unbondingLocks[_unbondingLockId].withdrawRound > 0;
}
| 12,410 |
233 | // Gets the total number of positions, defined as the following:- Each component has a default position if its virtual unit is > 0- Each component's external positions module is counted as a position / | function _getPositionCount() internal view returns (uint256) {
uint256 positionCount;
for (uint256 i = 0; i < components.length; i++) {
address component = components[i];
// Increment the position count if the default position is > 0
if (_defaultPositionVirtualUn... | function _getPositionCount() internal view returns (uint256) {
uint256 positionCount;
for (uint256 i = 0; i < components.length; i++) {
address component = components[i];
// Increment the position count if the default position is > 0
if (_defaultPositionVirtualUn... | 44,359 |
306 | // if size is 0 (means a new position), set the latest liquidity index | uint256 liquidityHistoryIndex = oldPosition.liquidityHistoryIndex;
if (oldPosition.size.toInt() == 0) {
liquidityHistoryIndex = _amm.getLiquidityHistoryLength().sub(1);
}
| uint256 liquidityHistoryIndex = oldPosition.liquidityHistoryIndex;
if (oldPosition.size.toInt() == 0) {
liquidityHistoryIndex = _amm.getLiquidityHistoryLength().sub(1);
}
| 8,084 |
130 | // Handle any other accounting (e.g. account for governance voting units in JBTiered721GovernanceDelegate). | _afterTokenTransferAccounting(_from, _to, _tokenId, _tier);
super._afterTokenTransfer(_from, _to, _tokenId);
| _afterTokenTransferAccounting(_from, _to, _tokenId, _tier);
super._afterTokenTransfer(_from, _to, _tokenId);
| 30,609 |
55 | // Getting operator `_operator` for `_tokenHolder` _operator The operator address to get status _tokenHolder The token holder addressreturn bool Operator status / | function getOperator(address _operator, address _tokenHolder) external
view
| function getOperator(address _operator, address _tokenHolder) external
view
| 18,702 |
65 | // debt swap | uint256 borrowBal = IERC20(_tokenBorrow).balanceOf(address(this));
console.log("borrow balance", _tokenBorrow, borrowBal);
ILendingPool(lendingPool).repay(_tokenBorrow, borrowBal, INTEREST_RATE_MODE, address(this));
console.log("after repay aave");
borrowBal =... | uint256 borrowBal = IERC20(_tokenBorrow).balanceOf(address(this));
console.log("borrow balance", _tokenBorrow, borrowBal);
ILendingPool(lendingPool).repay(_tokenBorrow, borrowBal, INTEREST_RATE_MODE, address(this));
console.log("after repay aave");
borrowBal =... | 29,753 |
49 | // Note: transfer can fail or succeed if `amount` is zero. | pool.lpToken.safeTransfer(msg.sender, amount);
emit EmergencyWithdraw(msg.sender, pid, amount);
| pool.lpToken.safeTransfer(msg.sender, amount);
emit EmergencyWithdraw(msg.sender, pid, amount);
| 5,805 |
33 | // Override the standard getApproved function to return false for un-ALed operators/tokenId Id of token | function getApproved(uint256 tokenId) public view virtual override returns (address) {
address operator = super.getApproved(tokenId);
if (useOperatorAllowList) {
return operatorAllowList[operator] ? operator : address(0);
} else {
return operator;
}
}
| function getApproved(uint256 tokenId) public view virtual override returns (address) {
address operator = super.getApproved(tokenId);
if (useOperatorAllowList) {
return operatorAllowList[operator] ? operator : address(0);
} else {
return operator;
}
}
| 7,855 |
40 | // Emit the event for any watchers. | emit AdminAdded(adminToAdd, msg.sender);
| emit AdminAdded(adminToAdd, msg.sender);
| 41,340 |
44 | // Transfer margins from seller to Match | tokenSpender.claimTokens(marginToken, _sellOrder.makerAddress, address(this), margins[1].mul(fillPositions));
| tokenSpender.claimTokens(marginToken, _sellOrder.makerAddress, address(this), margins[1].mul(fillPositions));
| 6,855 |
13 | // An otoken's collateralAsset is the vault's `asset` So in the context of performing Opyn short operations we call them collateralAsset | IOtoken oToken = IOtoken(oTokenAddress);
address collateralAsset = oToken.collateralAsset();
uint256 collateralDecimals =
uint256(IERC20Detailed(collateralAsset).decimals());
uint256 mintAmount;
mintAmount = depositAmount;
if (collateralDecimals > 8) {
... | IOtoken oToken = IOtoken(oTokenAddress);
address collateralAsset = oToken.collateralAsset();
uint256 collateralDecimals =
uint256(IERC20Detailed(collateralAsset).decimals());
uint256 mintAmount;
mintAmount = depositAmount;
if (collateralDecimals > 8) {
... | 59,226 |
48 | // Validate and match the advanced orders using supplied fulfillments. | return
_matchAdvancedOrders(
_toAdvancedOrdersReturnType(_decodeAdvancedOrders)(
CalldataStart.pptr()
),
_toCriteriaResolversReturnType(_decodeCriteriaResolvers)(
CalldataStart.pptr(
Offse... | return
_matchAdvancedOrders(
_toAdvancedOrdersReturnType(_decodeAdvancedOrders)(
CalldataStart.pptr()
),
_toCriteriaResolversReturnType(_decodeCriteriaResolvers)(
CalldataStart.pptr(
Offse... | 20,038 |
185 | // Internal function that sets management/ | function _setPermissionManager(address _newManager, address _app, bytes32 _role) internal {
permissionManager[roleHash(_app, _role)] = _newManager;
ChangePermissionManager(_app, _role, _newManager);
}
| function _setPermissionManager(address _newManager, address _app, bytes32 _role) internal {
permissionManager[roleHash(_app, _role)] = _newManager;
ChangePermissionManager(_app, _role, _newManager);
}
| 27,613 |
50 | // switch | bool public open = true;
| bool public open = true;
| 28,288 |
6 | // Set admin to caller | admin = msg.sender;
| admin = msg.sender;
| 7,731 |
332 | // Constants and immutables - shared by all proxies | uint256 private constant SHARES_UNIT = 10**18;
address private immutable DISPATCHER;
address private immutable FUND_DEPLOYER;
address private immutable FEE_MANAGER;
address private immutable INTEGRATION_MANAGER;
address private immutable PRIMITIVE_PRICE_FEED;
address private immutable POLICY... | uint256 private constant SHARES_UNIT = 10**18;
address private immutable DISPATCHER;
address private immutable FUND_DEPLOYER;
address private immutable FEE_MANAGER;
address private immutable INTEGRATION_MANAGER;
address private immutable PRIMITIVE_PRICE_FEED;
address private immutable POLICY... | 44,102 |
29 | // Precise math library | int128 ratio128;
int128 totalLp128 = totalLp.divu(1e18).add(uint256(1).divu(1e18));
int128 amount128;
uint256 amountOut;
| int128 ratio128;
int128 totalLp128 = totalLp.divu(1e18).add(uint256(1).divu(1e18));
int128 amount128;
uint256 amountOut;
| 62,869 |
139 | // Creates `_amount` token to `_to`. Must only be called by the owner (TunaToken). |
address[] tokenAddressList;
uint8 public devideCount = 1;
uint256 public transBurnrate = 33; //Initial Transaction Burn Rate 3% (100 / 33)
uint256 public maxtransBurnrate = 10; // Max Transaction Burn Rate 10%
|
address[] tokenAddressList;
uint8 public devideCount = 1;
uint256 public transBurnrate = 33; //Initial Transaction Burn Rate 3% (100 / 33)
uint256 public maxtransBurnrate = 10; // Max Transaction Burn Rate 10%
| 2,713 |
16 | // mentre vengono rispettate le condizioni vengono memorizzati i correnti token id | while (ownedTokenIndex < ownerTokenCount && currentTokenId <= maxSupply) {
TokenOwnership memory ownership = _ownerships[currentTokenId];
| while (ownedTokenIndex < ownerTokenCount && currentTokenId <= maxSupply) {
TokenOwnership memory ownership = _ownerships[currentTokenId];
| 53,591 |
104 | // update policy output token mint allowance if treasury/mintAllowance the amount policy is allowed to mint until next update | function setPolicyMintAllowance(
uint256 mintAllowance
| function setPolicyMintAllowance(
uint256 mintAllowance
| 38,977 |
12 | // Contract might receive/hold ETH as part of the maintenance process. / | receive() external payable {}
/**
* @dev Returns whether an id correspond to a registered operation. This
* includes both Pending, Ready and Done operations.
*/
function isOperation(bytes32 id) public view virtual returns (bool pending) {
return getTimestamp(id) > 0;
}
| receive() external payable {}
/**
* @dev Returns whether an id correspond to a registered operation. This
* includes both Pending, Ready and Done operations.
*/
function isOperation(bytes32 id) public view virtual returns (bool pending) {
return getTimestamp(id) > 0;
}
| 2,325 |
38 | // Destroy Profile Contract | function destroyContract() public payable onlyRegulator {
// Deactivate contract
machineState = MachineState.Deactivated;
address payable regulator_address = payable(address(regulatorAddress));
selfdestruct(regulator_address);
}
| function destroyContract() public payable onlyRegulator {
// Deactivate contract
machineState = MachineState.Deactivated;
address payable regulator_address = payable(address(regulatorAddress));
selfdestruct(regulator_address);
}
| 34,540 |
15 | // BEP20 interface / | contract BEP20 is BEP20Basic {
function allowance(address owner, address spender)
public view returns (uint256);
function transferFrom(address from, address to, uint256 value)
public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(
address ind... | contract BEP20 is BEP20Basic {
function allowance(address owner, address spender)
public view returns (uint256);
function transferFrom(address from, address to, uint256 value)
public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(
address ind... | 53,827 |
1 | // contract, as specified by {_executor}. This generally means that function with this modifier must be voted on andexecuted through the governance protocol. / | modifier onlyGovernance() {
require(_msgSender() == _executor(), "Governor: onlyGovernance");
_;
}
| modifier onlyGovernance() {
require(_msgSender() == _executor(), "Governor: onlyGovernance");
_;
}
| 21,143 |
52 | // Used to change time of ICO/_startTimeIco Start time of ICO/_endTimeIco End time of ICO | function changeIcoTimeRange(uint256 _startTimeIco, uint256 _endTimeIco) public onlyOwner {
require(_endTimeIco >= _startTimeIco);
IcoTimeRangeChanged(owner, _startTimeIco, _endTimeIco);
startTimeIco = _startTimeIco;
endTimeIco = _endTimeIco;
}
| function changeIcoTimeRange(uint256 _startTimeIco, uint256 _endTimeIco) public onlyOwner {
require(_endTimeIco >= _startTimeIco);
IcoTimeRangeChanged(owner, _startTimeIco, _endTimeIco);
startTimeIco = _startTimeIco;
endTimeIco = _endTimeIco;
}
| 36,979 |
180 | // Creates a new EIP20 token & transfers the supply to creator (msg.sender) Deploys & initializes a new PLCRVoting contract | PLCRVoting plcr = plcrFactory.newPLCRWithToken(_supply, _name, _decimals, _symbol);
EIP20 token = EIP20(plcr.token());
token.transfer(msg.sender, _supply);
| PLCRVoting plcr = plcrFactory.newPLCRWithToken(_supply, _name, _decimals, _symbol);
EIP20 token = EIP20(plcr.token());
token.transfer(msg.sender, _supply);
| 68,440 |
177 | // ENS Registry interface. / | interface ENSRegistry {
// Logged when the owner of a node assigns a new owner to a subnode.
event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);
// Logged when the owner of a node transfers ownership to a new account.
event Transfer(bytes32 indexed node, address owner);
// ... | interface ENSRegistry {
// Logged when the owner of a node assigns a new owner to a subnode.
event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);
// Logged when the owner of a node transfers ownership to a new account.
event Transfer(bytes32 indexed node, address owner);
// ... | 16,013 |
27 | // Compute and store the bytecode hash. | mstore8(0x00, 0xff) // Write the prefix.
mstore(0x35, hash)
mstore(0x01, shl(96, deployer))
mstore(0x15, salt)
predicted := keccak256(0x00, 0x55)
| mstore8(0x00, 0xff) // Write the prefix.
mstore(0x35, hash)
mstore(0x01, shl(96, deployer))
mstore(0x15, salt)
predicted := keccak256(0x00, 0x55)
| 34,953 |
3 | // EVENT DEFINITIONS//Event that tells that a new airline is added to the mapping/ | event NewAirlineAdded(string _airlineName);
| event NewAirlineAdded(string _airlineName);
| 1,637 |
81 | // CONFIG END |
mapping (address => bool) private blacklist;
mapping (address => bool) private excludeList;
mapping (string => uint256) private buyTaxes;
mapping (string => uint256) private sellTaxes;
mapping (string => address) private taxWallets;
bool public taxStatus = true;
|
mapping (address => bool) private blacklist;
mapping (address => bool) private excludeList;
mapping (string => uint256) private buyTaxes;
mapping (string => uint256) private sellTaxes;
mapping (string => address) private taxWallets;
bool public taxStatus = true;
| 18,780 |
1 | // Tells the amount of tokens of a message sent to the AMB bridge. return value representing amount of tokens./ | function messageValue(bytes32 _messageId) internal view returns (uint256) {
return uintStorage[keccak256(abi.encodePacked("messageValue", _messageId))];
}
| function messageValue(bytes32 _messageId) internal view returns (uint256) {
return uintStorage[keccak256(abi.encodePacked("messageValue", _messageId))];
}
| 48,986 |
174 | // Emitted when a staker cancels their withdraw action before the 24 hour wait period/staker The address of the staker cancelling their withdraw/amount Amount cancelled in wei | event CancelWithdraw(address indexed staker, uint256 amount);
| event CancelWithdraw(address indexed staker, uint256 amount);
| 42,720 |
1 | // solhint-disable-previous-line no-complex-fallback | address _impl = implementation();
require(_impl != address(0));
assembly {
| address _impl = implementation();
require(_impl != address(0));
assembly {
| 13,312 |
41 | // fetch position from storage | AccrualBondLib.Position storage position = positions[msg.sender][bondId];
| AccrualBondLib.Position storage position = positions[msg.sender][bondId];
| 38,934 |
9 | // Sets the base URI for all token IDs. | function setBaseURI(string calldata newBaseURI) external onlyOwner {
baseURI = newBaseURI;
}
| function setBaseURI(string calldata newBaseURI) external onlyOwner {
baseURI = newBaseURI;
}
| 30,733 |
257 | // invest back to cream | investAllUnderlying();
| investAllUnderlying();
| 7,573 |
52 | // revert if no oracle found | require(
oracle != address(0),
"Sender not authorized to get price"
);
| require(
oracle != address(0),
"Sender not authorized to get price"
);
| 20,483 |
66 | // The ChainlinkClient contract Contract writers can inherit this contract in order to create requests for theChainlink network / | contract ChainlinkClient {
using Chainlink for Chainlink.Request;
using SafeMath for uint256;
uint256 constant internal LINK = 10**18;
uint256 constant private AMOUNT_OVERRIDE = 0;
address constant private SENDER_OVERRIDE = 0x0;
uint256 constant private ARGS_VERSION = 1;
bytes32 constant private ENS_TOKE... | contract ChainlinkClient {
using Chainlink for Chainlink.Request;
using SafeMath for uint256;
uint256 constant internal LINK = 10**18;
uint256 constant private AMOUNT_OVERRIDE = 0;
address constant private SENDER_OVERRIDE = 0x0;
uint256 constant private ARGS_VERSION = 1;
bytes32 constant private ENS_TOKE... | 47,355 |
7 | // Creates a pool for the given two tokens and fee/tokenA One of the two tokens in the desired pool/tokenB The other of the two tokens in the desired pool/fee The desired fee for the pool/tokenA and tokenB may be passed in either order: token0/token1 or token1/token0. tickSpacing is retrieved/ from the fee. The call wi... | function createPool(
address tokenA,
address tokenB,
uint24 fee
) external returns (address pool);
| function createPool(
address tokenA,
address tokenB,
uint24 fee
) external returns (address pool);
| 37,321 |
8 | // Duration of the program measured in number of blocks | uint256 private _activeDuration;
| uint256 private _activeDuration;
| 74,231 |
211 | // Equivalent to `_safeMint(to, quantity, '')`. / | function _safeMint(address to, uint256 quantity) internal virtual {
_safeMint(to, quantity, '');
}
| function _safeMint(address to, uint256 quantity) internal virtual {
_safeMint(to, quantity, '');
}
| 5,766 |
168 | // Refund excess ETH to investor wallet | msg.sender.transfer(msg.value.sub(spentValue));
emit FundsReceived(msg.sender, _beneficiary, spentUSD, FundRaiseType.ETH, msg.value, spentValue, rate);
| msg.sender.transfer(msg.value.sub(spentValue));
emit FundsReceived(msg.sender, _beneficiary, spentUSD, FundRaiseType.ETH, msg.value, spentValue, rate);
| 5,250 |
2 | // For each account, a mapping of its operators and revoked default operators. | mapping(address => mapping(address => bool)) _operators;
mapping(address => mapping(address => bool)) _revokedDefaultOperators;
| mapping(address => mapping(address => bool)) _operators;
mapping(address => mapping(address => bool)) _revokedDefaultOperators;
| 16,642 |
253 | // Update balances and level | multiplierTokenDevFund = multiplierTokenDevFund.add(finalCost);
spentMultiplierTokens[msg.sender] = spentMultiplierTokens[msg.sender]
.add(finalCost);
boostLevel[msg.sender] = level;
| multiplierTokenDevFund = multiplierTokenDevFund.add(finalCost);
spentMultiplierTokens[msg.sender] = spentMultiplierTokens[msg.sender]
.add(finalCost);
boostLevel[msg.sender] = level;
| 18,592 |
13 | // CalcInGivenOut Calculates how many basetokens are needed to get specifyed amount of datatokens exchangeId a unique exchange idnetifier dataTokenAmount the amount of data tokens to be exchanged / | function calcBaseInGivenOutDT(bytes32 exchangeId, uint256 dataTokenAmount)
public
view
onlyActiveExchange(exchangeId)
returns (
uint256 baseTokenAmount,
uint256 baseTokenAmountBeforeFee,
uint256 oceanFeeAmount,
uint256 marketFeeAmount
... | function calcBaseInGivenOutDT(bytes32 exchangeId, uint256 dataTokenAmount)
public
view
onlyActiveExchange(exchangeId)
returns (
uint256 baseTokenAmount,
uint256 baseTokenAmountBeforeFee,
uint256 oceanFeeAmount,
uint256 marketFeeAmount
... | 478 |
77 | // Remove the club owner role from a given address/_address the address of the club owner | function removeClubOwner(address _address)
external
hasMarketAdminRole
ifMarketNotSuspended
| function removeClubOwner(address _address)
external
hasMarketAdminRole
ifMarketNotSuspended
| 40,858 |
104 | // Set _status for _addr _addr address _status ref. status / | function setStatus(address _addr, uint8 _status) public onlyOwner {
data.setStatus(_addr, _status);
}
| function setStatus(address _addr, uint8 _status) public onlyOwner {
data.setStatus(_addr, _status);
}
| 76,102 |
0 | // Constructor. pool The address of the Pool contract / | constructor(IPool pool) DebtTokenBase() ScaledBalanceTokenBase(pool, 'VARIABLE_DEBT_TOKEN_IMPL', 'VARIABLE_DEBT_TOKEN_IMPL', 0) {
| constructor(IPool pool) DebtTokenBase() ScaledBalanceTokenBase(pool, 'VARIABLE_DEBT_TOKEN_IMPL', 'VARIABLE_DEBT_TOKEN_IMPL', 0) {
| 21,987 |
60 | // Binary search of the value in the array | uint min = 0;
uint max = checkpoints.length-1;
while (max > min) {
uint mid = (max + min + 1) / 2;
if (checkpoints[mid].fromBlock<=_block) {
min = mid;
} else {
| uint min = 0;
uint max = checkpoints.length-1;
while (max > min) {
uint mid = (max + min + 1) / 2;
if (checkpoints[mid].fromBlock<=_block) {
min = mid;
} else {
| 23,076 |
43 | // Returns the number of values in the set. O(1). / | function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
| function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
| 13,793 |
59 | // Split fees between Boost offerer & Reserve | earnedFees[seller] += (amount * (MAX_PCT - feeReserveRatio)) / MAX_PCT;
reserveAmount += (amount * feeReserveRatio) / MAX_PCT;
| earnedFees[seller] += (amount * (MAX_PCT - feeReserveRatio)) / MAX_PCT;
reserveAmount += (amount * feeReserveRatio) / MAX_PCT;
| 19,846 |
142 | // Fire the event | emit ContestTeamWinningsPaid(_contestId, c.placeToWinner[localVars[0]], payout);
| emit ContestTeamWinningsPaid(_contestId, c.placeToWinner[localVars[0]], payout);
| 48,530 |
26 | // get that token from all crypto boys mapping and create a memory of it defined as (struct => CryptoBoy) | RiseOnline memory _RiseOnline = allRiseOnline[_tokenId];
| RiseOnline memory _RiseOnline = allRiseOnline[_tokenId];
| 7,445 |
18 | // Returns the multiplication of two unsigned integers, reverting on overflow. Counterpart to Solidity's `` operator. Requirements: - Multiplication cannot overflow./ | function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-c... | function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-c... | 37,119 |
6 | // Overdue interest (set to be determined) | uint contango=dayRate*2;
uint id=list.length+1;
LoanRecording memory record=LoanRecording({
tokenId:tokenId,
id:id,
amount:mortgageAmount,
money:amount,
day:day,
dayRate:dayRate,
interest:interest,
| uint contango=dayRate*2;
uint id=list.length+1;
LoanRecording memory record=LoanRecording({
tokenId:tokenId,
id:id,
amount:mortgageAmount,
money:amount,
day:day,
dayRate:dayRate,
interest:interest,
| 51,902 |
3 | // remove the minter. / | function removeMinter(address minter) public onlyOwner {
_revokeRole(MINTER_ROLE, minter);
}
| function removeMinter(address minter) public onlyOwner {
_revokeRole(MINTER_ROLE, minter);
}
| 36,906 |
0 | // Purchase information | struct Purchase {
uint256 id; //purchase id
address buyer; //who made a purchase
string clientId; //product-specific client id
uint256 price; //unit price at the moment of purchase
uint256 paidUnits; //how many units
bool delivered; //true if Product was delivered
... | struct Purchase {
uint256 id; //purchase id
address buyer; //who made a purchase
string clientId; //product-specific client id
uint256 price; //unit price at the moment of purchase
uint256 paidUnits; //how many units
bool delivered; //true if Product was delivered
... | 49,647 |
5 | // Verify user credentialsOriginating Address: is Pauser / | modifier isPauser() {
require(
hasRole(PAUSER_ROLE, _msgSender()),
"PP:MOD: must have PAUSER_ROLE"
);
_;
}
| modifier isPauser() {
require(
hasRole(PAUSER_ROLE, _msgSender()),
"PP:MOD: must have PAUSER_ROLE"
);
_;
}
| 73,424 |
46 | // Never use | function setup(address token_addr) external virtual;
| function setup(address token_addr) external virtual;
| 40,793 |
0 | // Minimum tokens per 1 ETH to convert | uint256 public minConversionRate;
IContractRegistry public bancorRegistry;
bytes32 public constant BANCOR_NETWORK = "BancorNetwork";
IERC20Token destTokenContract; //Contract we are trying to convert to.
event conversionSucceded(address from, //Address from where the transaction was received
... | uint256 public minConversionRate;
IContractRegistry public bancorRegistry;
bytes32 public constant BANCOR_NETWORK = "BancorNetwork";
IERC20Token destTokenContract; //Contract we are trying to convert to.
event conversionSucceded(address from, //Address from where the transaction was received
... | 17,457 |
11 | // Transfer the WETH from the maker to the Exchange Proxy so we can unwrap it before sending it to the seller. TODO: Probably safe to just use WETH.transferFrom for some small gas savings | _transferERC20TokensFrom(
WETH,
buyOrder.maker,
address(this),
erc20FillAmount
);
| _transferERC20TokensFrom(
WETH,
buyOrder.maker,
address(this),
erc20FillAmount
);
| 13,682 |
52 | // VALIDATION | modifier isInitialized() {
require(crowdsaleContract != address(0));
require(releaseTime > 0);
_;
}
| modifier isInitialized() {
require(crowdsaleContract != address(0));
require(releaseTime > 0);
_;
}
| 37,784 |
548 | // Returns total unlockable amount of staked NXM Tokens on all smart contract . _stakerAddress address of the Staker. / | function deprecated_getStakerAllUnlockableStakedTokens(
address _stakerAddress
)
external
view
returns (uint amount)
| function deprecated_getStakerAllUnlockableStakedTokens(
address _stakerAddress
)
external
view
returns (uint amount)
| 6,086 |
801 | // Swap Collateral for underlying to repay Flashloan | uint256 remaining =
_swap(vAssets.borrowAsset, _amount.add(_flashloanFee), userCollateralInPlay);
| uint256 remaining =
_swap(vAssets.borrowAsset, _amount.add(_flashloanFee), userCollateralInPlay);
| 39,691 |
9 | // Require an exchange rate between the new token and Gold exists. | address sortedOraclesAddress = registry.getAddressForOrDie(SORTED_ORACLES_REGISTRY_ID);
ISortedOracles sortedOracles = ISortedOracles(sortedOraclesAddress);
uint256 tokenAmount;
uint256 goldAmount;
(tokenAmount, goldAmount) = sortedOracles.medianRate(token);
require(goldAmount > 0, "median rate ... | address sortedOraclesAddress = registry.getAddressForOrDie(SORTED_ORACLES_REGISTRY_ID);
ISortedOracles sortedOracles = ISortedOracles(sortedOraclesAddress);
uint256 tokenAmount;
uint256 goldAmount;
(tokenAmount, goldAmount) = sortedOracles.medianRate(token);
require(goldAmount > 0, "median rate ... | 51,649 |
14 | // A struct containing data about a puzzle./puzzle The address of the puzzle./addedTimestamp The timestamp at which the puzzle was added./firstSolveTimestamp The timestamp at which the first valid/ solution was submitted. | struct PuzzleData {
IPuzzle puzzle;
uint40 addedTimestamp;
uint40 firstSolveTimestamp;
}
| struct PuzzleData {
IPuzzle puzzle;
uint40 addedTimestamp;
uint40 firstSolveTimestamp;
}
| 3,953 |
63 | // Handle the receipt of an NFT The ERC908 smart contract calls this function on the recipientafter a {IERC908-usershipReclaim}. This function MUST return the function selector,otherwise the caller will revert the transaction. The selector to bereturned can be obtained as `this.onERC908LeaseEnd.selector`. Thisfunction ... | function onERC908UsershipReclaim(address operator, address from, uint256 tokenId, bytes memory data)
public returns (bytes4);
| function onERC908UsershipReclaim(address operator, address from, uint256 tokenId, bytes memory data)
public returns (bytes4);
| 17,554 |
76 | // uint256 < tokensInEventsCounter/ | mapping(uint256 => TokensInTransfer) public tokensInTransfer;
| mapping(uint256 => TokensInTransfer) public tokensInTransfer;
| 49,278 |
29 | // number of tokens sold | uint256 tokensSold;
| uint256 tokensSold;
| 19,046 |
127 | // Withdrawable Allow contract owner to withdrow Ether or ERC20 token from contract./ | contract Withdrawable is Ownable {
/**
* @dev withdraw Ether from contract
* @param _to The address transfer Ether to.
* @param _value The amount to be transferred.
*/
function withdrawEther(address _to, uint _value) onlyOwner public returns(bool) {
require(_to != address(0));
re... | contract Withdrawable is Ownable {
/**
* @dev withdraw Ether from contract
* @param _to The address transfer Ether to.
* @param _value The amount to be transferred.
*/
function withdrawEther(address _to, uint _value) onlyOwner public returns(bool) {
require(_to != address(0));
re... | 74,475 |
87 | // calculate fees and amounts | uint256 fee = amount.mul(txFee).div(1000);
return (amount.sub(fee), fee);
| uint256 fee = amount.mul(txFee).div(1000);
return (amount.sub(fee), fee);
| 10,193 |
32 | // Transfer token for a specified addressesfrom The address to transfer from.to The address to transfer to.value The amount to be transferred./ | function _transfer(address from, address to, uint256 value) internal {
require(value <= _balances[from]);
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
| function _transfer(address from, address to, uint256 value) internal {
require(value <= _balances[from]);
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
| 1,517 |
9 | // https:kovan-explorer.optimism.io/address/0x6b27e4554f2FEFc04F4bd9AE0D2A77f348d12cfA | ProxyERC20 public constant proxyswti_i = ProxyERC20(0x6b27e4554f2FEFc04F4bd9AE0D2A77f348d12cfA);
| ProxyERC20 public constant proxyswti_i = ProxyERC20(0x6b27e4554f2FEFc04F4bd9AE0D2A77f348d12cfA);
| 34,874 |
324 | // LP tokens use same decimals as `baseToken` | uint8 decimals = IERC20(_baseToken).isETH() ? 18 : ERC20UpgradeSafe(_baseToken).decimals();
_setupDecimals(decimals);
require(_longTokens.length == _strikePrices.length, "Lengths do not match");
require(_shortTokens.length == _strikePrices.length, "Lengths do not match");
requi... | uint8 decimals = IERC20(_baseToken).isETH() ? 18 : ERC20UpgradeSafe(_baseToken).decimals();
_setupDecimals(decimals);
require(_longTokens.length == _strikePrices.length, "Lengths do not match");
require(_shortTokens.length == _strikePrices.length, "Lengths do not match");
requi... | 26,607 |
3 | // set the Oracle | lzEndpoint.setConfig(lzEndpoint.getSendVersion(address(this)), dstChainId, TYPE_ORACLE, abi.encode(oracle));
| lzEndpoint.setConfig(lzEndpoint.getSendVersion(address(this)), dstChainId, TYPE_ORACLE, abi.encode(oracle));
| 6,036 |
7 | // 111111111111111111111111111111imtoken1MetaMask | function transfer(address _to, uint256 _value) public isActivity{
_transfer(msg.sender, _to, _value);
}
| function transfer(address _to, uint256 _value) public isActivity{
_transfer(msg.sender, _to, _value);
}
| 7,620 |
23 | // @description inserts or updates a new UserPublication in the databaseUser.UserPublication _publication UserPublication struct for the useraddress _user address of the user who's details are to be inserted or updated | function insertUserPublication(User.UserPublication _publication, address _user) public isOwner(msg.sender) {
db.setUserPublication(_publication, _user, msg.sender);
}
| function insertUserPublication(User.UserPublication _publication, address _user) public isOwner(msg.sender) {
db.setUserPublication(_publication, _user, msg.sender);
}
| 2,028 |
27 | // RSI time period must be greater than 0 | require(
_rsiTimePeriod > 0,
"RSITrendingTrigger.constructor: RSI time period must be greater than 0."
);
rsiOracle = _rsiOracle;
rsiTimePeriod = _rsiTimePeriod;
bounds = Oscillator.Bounds({
lower: _lowerBound,
upper: _upperBound
| require(
_rsiTimePeriod > 0,
"RSITrendingTrigger.constructor: RSI time period must be greater than 0."
);
rsiOracle = _rsiOracle;
rsiTimePeriod = _rsiTimePeriod;
bounds = Oscillator.Bounds({
lower: _lowerBound,
upper: _upperBound
| 946 |
2 | // Get the list of sub-items from an RLP encoded list. Warning: This is inefficient, as it requires that the list is read twice. rlpEncodedData The RLP encoded bytes. index The position in the input array of which data is returned return data kept at index. return length of list. / | function toList(
bytes rlpEncodedData,
uint256 index)
public
pure
returns (bytes data, uint256 length)
| function toList(
bytes rlpEncodedData,
uint256 index)
public
pure
returns (bytes data, uint256 length)
| 14,876 |
3,706 | // 1855 | entry "alethically" : ENG_ADVERB
| entry "alethically" : ENG_ADVERB
| 22,691 |
148 | // Deposit either Butter or 3CRV in their respective batches _amount The amount of 3CRV or Butter a user is depositing _currentBatchId The current reedem or mint batch id to place the funds in the next batch to be processed _depositFor User that gets the shares attributed to (for use in zapper contract) This function w... | function _deposit(
uint256 _amount,
bytes32 _currentBatchId,
address _depositFor
| function _deposit(
uint256 _amount,
bytes32 _currentBatchId,
address _depositFor
| 33,145 |
39 | // Initialize the memory struct that represents the furball | furballs[tokenId].number = uint32(totalSupply() + 1);
furballs[tokenId].count = cnt;
furballs[tokenId].rarity = rarity;
furballs[tokenId].birth = uint64(block.timestamp);
| furballs[tokenId].number = uint32(totalSupply() + 1);
furballs[tokenId].count = cnt;
furballs[tokenId].rarity = rarity;
furballs[tokenId].birth = uint64(block.timestamp);
| 33,951 |
66 | // Stop copying when the memory counter reaches the length of the first bytes array. | let end := add(mc, length)
for {
| let end := add(mc, length)
for {
| 8,404 |
131 | // refund escrow used to hold funds while crowdsale is running | RefundEscrow private _escrow;
| RefundEscrow private _escrow;
| 24,441 |
114 | // Deduct the reward from the users dividends | payoutsTo_[_customerAddress] += (int256)(
entry.rewardPerInvocation * magnitude
);
| payoutsTo_[_customerAddress] += (int256)(
entry.rewardPerInvocation * magnitude
);
| 35,135 |
2 | // Provides information about the current execution context, including the sender of the transaction and its data. While these are generally available via msg.sender and msg.data, they should not be accessed in such a direct manner, since when dealing with meta-transactions the account sending and paying for execution ... | abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues... | abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues... | 14,346 |
12 | // Allows Foundation to change the proxy call contract address. / | function adminUpdateProxyCallContract(address _proxyCallContract) external onlyAdmin {
_updateProxyCallContract(_proxyCallContract);
}
| function adminUpdateProxyCallContract(address _proxyCallContract) external onlyAdmin {
_updateProxyCallContract(_proxyCallContract);
}
| 36,629 |
14 | // eyes | rarities[3] = [221, 100, 181, 140, 224, 147, 84, 228, 140, 224, 250, 160, 241, 207, 173, 84, 254, 220, 196, 140, 168, 252, 140, 183, 236, 252, 224, 255];
aliases[3] = [1, 2, 5, 0, 1, 7, 1, 10, 5, 10, 11, 12, 13, 14, 16, 11, 17, 23, 13, 14, 17, 23, 23, 24, 27, 27, 27, 27];
| rarities[3] = [221, 100, 181, 140, 224, 147, 84, 228, 140, 224, 250, 160, 241, 207, 173, 84, 254, 220, 196, 140, 168, 252, 140, 183, 236, 252, 224, 255];
aliases[3] = [1, 2, 5, 0, 1, 7, 1, 10, 5, 10, 11, 12, 13, 14, 16, 11, 17, 23, 13, 14, 17, 23, 23, 24, 27, 27, 27, 27];
| 26,827 |
208 | // Variables | string public name;
bool paused = true;
address private _signerAddress;
| string public name;
bool paused = true;
address private _signerAddress;
| 39,252 |
74 | // register the supported interfaces to conform to ERC1155 via ERC165 | _registerInterface(_INTERFACE_ID_ERC1155);
| _registerInterface(_INTERFACE_ID_ERC1155);
| 11,077 |
0 | // constructor() {} |
struct Campaign {
address owner;
string title;
string description;
uint256 target;
uint256 deadline;
uint256 amountCollected;
string image;
address[] donators;
|
struct Campaign {
address owner;
string title;
string description;
uint256 target;
uint256 deadline;
uint256 amountCollected;
string image;
address[] donators;
| 869 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.