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 |
|---|---|---|---|---|
12 | // old LP token should not be in this contract, or it will get stuck | uint256 _bal = token.balanceOf(address(this));
if(_bal > 0) {
token.safeTransfer(strategy, _bal);
}
| uint256 _bal = token.balanceOf(address(this));
if(_bal > 0) {
token.safeTransfer(strategy, _bal);
}
| 5,244 |
127 | // Internal functionality |
function _mint(
address recipient,
uint256 tokenId,
uint256 price
|
function _mint(
address recipient,
uint256 tokenId,
uint256 price
| 35,749 |
177 | // list of possible ingredients | string[] private main = ["Almonds","Apples","Asparagus","Avocado","Bananas","Basil","Bay Leaf","Beans","Beef","Beer","Beets","Bell Peppers","Blueberries","Bourbon","Bread","Broccoli","Broth","Brussel Sprouts","Butter","Buttermilk","Cabbage","Cane Berries","Cardamon","Carrots","Cauliflower","Celery","Cheddar","Chees... | string[] private main = ["Almonds","Apples","Asparagus","Avocado","Bananas","Basil","Bay Leaf","Beans","Beef","Beer","Beets","Bell Peppers","Blueberries","Bourbon","Bread","Broccoli","Broth","Brussel Sprouts","Butter","Buttermilk","Cabbage","Cane Berries","Cardamon","Carrots","Cauliflower","Celery","Cheddar","Chees... | 25,132 |
66 | // oods_coefficients[46]/ mload(add(context, 0x7d00)), res += c_47(f_6(x) - f_6(g^251z)) / (x - g^251z). | res := add(
res,
mulmod(mulmod(/*(x - g^251 * z)^(-1)*/ mload(add(denominatorsPtr, 0x700)),
| res := add(
res,
mulmod(mulmod(/*(x - g^251 * z)^(-1)*/ mload(add(denominatorsPtr, 0x700)),
| 76,980 |
341 | // point = g^2. |
point := mulmod(point, /*traceGenerator^2*/ mload(expmodsAndPoints), PRIME)
|
point := mulmod(point, /*traceGenerator^2*/ mload(expmodsAndPoints), PRIME)
| 3,299 |
52 | // calculates the CREATE2 address for a pair without making any external calls | function pairFor(address factory, address tokenA, address tokenB) internal pure returns (address pair) {
(address token0, address token1) = sortTokens(tokenA, tokenB);
pair = address(uint(keccak256(abi.encodePacked(
hex'ff',
factory,
keccak256(abi.enco... | function pairFor(address factory, address tokenA, address tokenB) internal pure returns (address pair) {
(address token0, address token1) = sortTokens(tokenA, tokenB);
pair = address(uint(keccak256(abi.encodePacked(
hex'ff',
factory,
keccak256(abi.enco... | 1,595 |
176 | // Returns amount available for transfer | function _withdraw(uint _amount) private returns (uint) {
uint bal = IERC20(underlying).balanceOf(address(this));
if (bal >= _amount) {
return _amount;
}
uint redeemAmount = _amount - bal;
/*
c = collateral ratio
s = supplied
b = borrowed
... | function _withdraw(uint _amount) private returns (uint) {
uint bal = IERC20(underlying).balanceOf(address(this));
if (bal >= _amount) {
return _amount;
}
uint redeemAmount = _amount - bal;
/*
c = collateral ratio
s = supplied
b = borrowed
... | 41,572 |
198 | // check fees has been well received do the action and assertion in one to save a variable | require(collectForREQBurning(fees));
| require(collectForREQBurning(fees));
| 47,270 |
16 | // Function updating maximum minting amount per account - available to owner_newmaxMintAmount The maximum mint amount per account Requirements: - the newmaxMintAmount is greater than zero/ | function setmaxMintAmount(uint256 _newmaxMintAmount) public onlyOwner {
require(_newmaxMintAmount > 0, "Max mint amount entered is zero");
maxMintAmount = _newmaxMintAmount;
}
| function setmaxMintAmount(uint256 _newmaxMintAmount) public onlyOwner {
require(_newmaxMintAmount > 0, "Max mint amount entered is zero");
maxMintAmount = _newmaxMintAmount;
}
| 15,340 |
6 | // need to update qr code for 1155 | function verifyData(
bytes memory signature,
uint256 tokenId,
string memory code
| function verifyData(
bytes memory signature,
uint256 tokenId,
string memory code
| 27,056 |
1 | // Log game result (heads 0 or tails 1) in order to display it on frontend | event GameResult(uint8 side);
| event GameResult(uint8 side);
| 21,382 |
575 | // Repays debt with the native and or synthetic token.// An approval is required to transfer native tokens to the transmuter. | function repay(uint256 _parentAmount, uint256 _childAmount) external nonReentrant noContractAllowed onLinkCheck expectInitialized {
CDP.Data storage _cdp = _cdps[msg.sender];
_cdp.update(_ctx);
if (_parentAmount > 0) {
token.safeTransferFrom(msg.sender, address(this), _parentAmount);
_distri... | function repay(uint256 _parentAmount, uint256 _childAmount) external nonReentrant noContractAllowed onLinkCheck expectInitialized {
CDP.Data storage _cdp = _cdps[msg.sender];
_cdp.update(_ctx);
if (_parentAmount > 0) {
token.safeTransferFrom(msg.sender, address(this), _parentAmount);
_distri... | 3,251 |
2 | // query child and parent is associated child: address of the child parent: address of the parentreturn child and parent is associated / | function isParent(address child,address parent) external view returns(bool);
| function isParent(address child,address parent) external view returns(bool);
| 5,895 |
23 | // The array of ``tokenId``'s that are waiting for the `Locked` event to be emitted / | uint256[] private tokensToLock;
| uint256[] private tokensToLock;
| 28,923 |
10 | // This is y = x2^(-n). | uint256 y = x >> n;
| uint256 y = x >> n;
| 3,544 |
193 | // View function to see pending SPECTREs on frontend. | function pendingSpectre(uint256 _pid, address _user)
external
view
returns (uint256)
| function pendingSpectre(uint256 _pid, address _user)
external
view
returns (uint256)
| 45,092 |
229 | // helper for sell Balancer pool/ |
function sellBalancerPool(
uint256 _amount,
IERC20 _poolToken,
bytes calldata _additionalData
)
private
returns(
address[] memory connectorsAddress,
uint256[] memory connectorsAmount
|
function sellBalancerPool(
uint256 _amount,
IERC20 _poolToken,
bytes calldata _additionalData
)
private
returns(
address[] memory connectorsAddress,
uint256[] memory connectorsAmount
| 8,819 |
0 | // MIN_BLOCK_ISSUANCE_LIMIT: {rTok/block} 10k whole RTok | uint192 constant MAX_ISSUANCE_RATE = 1e18; // {1}
| uint192 constant MAX_ISSUANCE_RATE = 1e18; // {1}
| 31,499 |
17 | // Maximum length we support | require(length <= 999999);
| require(length <= 999999);
| 8,222 |
60 | // solhint-disable-next-line max-line-length | require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
| require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
| 8,375 |
93 | // validate of the passed in `_param.subscriptionId` points at a valid subscription | require(_subscriptionId < getSubscriptionsAt(_clubId, _tierId).length, "!SUBSCRIPTION - subscription not found with `_param.subscriptionId`");
| require(_subscriptionId < getSubscriptionsAt(_clubId, _tierId).length, "!SUBSCRIPTION - subscription not found with `_param.subscriptionId`");
| 5,407 |
35 | // ------------------------------------------------------------------------ Query to get the total staking of the user_user wallet address of the staker ------------------------------------------------------------------------ | function YourTotalStakingTillToday(address _user) external view returns(uint256 _totalStaking){
return users[_user].totalDeposits;
}
| function YourTotalStakingTillToday(address _user) external view returns(uint256 _totalStaking){
return users[_user].totalDeposits;
}
| 4,381 |
311 | // all existing Curve metapools are paired with 3pool | Curve3poolAllocation public immutable curve3poolAllocation;
| Curve3poolAllocation public immutable curve3poolAllocation;
| 65,507 |
35 | // reduces the total supply by the amount of that users in that swap | self.total_supply = self.total_supply.sub(party_swap_balance);
| self.total_supply = self.total_supply.sub(party_swap_balance);
| 49,927 |
177 | // Transactions are After Transaction Root, Plus 64 Bytes (for bytes type metadata from ABI Encoding) | let transactions := safeAdd(transactionRoot, transactionRootLength)
| let transactions := safeAdd(transactionRoot, transactionRootLength)
| 21,507 |
10 | // When a deposit is initiated on L1, the L1 Bridge transfers the NFT to itself for future withdrawals. slither-disable-next-line reentrancy-events, reentrancy-benign | IERC721(_l1Token).transferFrom(_from, address(this), _tokenId);
| IERC721(_l1Token).transferFrom(_from, address(this), _tokenId);
| 21,438 |
7 | // ------------------------------------------------------------------------ Don't accept ETH ------------------------------------------------------------------------ | function () external payable {
revert();
}
| function () external payable {
revert();
}
| 14,785 |
209 | // Lock additional ether as collateral to agreement cdp contract _amount collateral amount for additional lockreturnOperation success / | function lockAdditionalCollateral(uint _amount) external payable onlyBorrower beforeStatus(Statuses.Closed) returns(bool _success) {
if (!isETH) {
erc20TokenContract(collateralType).transferFrom(msg.sender, address(this), _amount);
}
if (isStatus(Statuses.Active)) {
... | function lockAdditionalCollateral(uint _amount) external payable onlyBorrower beforeStatus(Statuses.Closed) returns(bool _success) {
if (!isETH) {
erc20TokenContract(collateralType).transferFrom(msg.sender, address(this), _amount);
}
if (isStatus(Statuses.Active)) {
... | 41,164 |
126 | // Emit event with old incentive, new incentive | emit NewLiquidationIncentive(oldLiquidationIncentiveMantissa, newLiquidationIncentiveMantissa);
return uint(Error.NO_ERROR);
| emit NewLiquidationIncentive(oldLiquidationIncentiveMantissa, newLiquidationIncentiveMantissa);
return uint(Error.NO_ERROR);
| 9,129 |
42 | // determine the trading ratio if swapping between tokens of differing supplies. (1% = 1% as an example) | if(token2TotalSupply > token1TotalSupply){
tradingRatio = token2TotalSupply / token1TotalSupply;
amountToSend = token1Balance * tradingRatio; // multiply if V2 supply is higher than V1
} else if (token1TotalSupply > token2TotalSupply){
| if(token2TotalSupply > token1TotalSupply){
tradingRatio = token2TotalSupply / token1TotalSupply;
amountToSend = token1Balance * tradingRatio; // multiply if V2 supply is higher than V1
} else if (token1TotalSupply > token2TotalSupply){
| 43,321 |
2 | // NOTE: this ds_slot must be the shared if you want to share storage with another contract under the proxy umbrella NOTE: this ds_slot must be unique if you want to NOT share storage with another contract under the proxy umbrella ds_slot = keccak256("diamond.storage.ninja.authentication"); | assembly { ds_slot := 0x23c99902bd20175af7869f805847c34572dcf321a973ed1a88e16e09df61afe6 }
| assembly { ds_slot := 0x23c99902bd20175af7869f805847c34572dcf321a973ed1a88e16e09df61afe6 }
| 12,272 |
16 | // Decrease amount of GAM tokens that can be minted _burnedAmount The amount of unminted tokens to be burned / | function burnUnmintedTokens(uint256 _burnedAmount) public onlyOwner returns (bool success){
require(_burnedAmount <= _unmintedTokens);
_unmintedTokens = _unmintedTokens.sub(_burnedAmount);
emit Burn(msg.sender, _burnedAmount);
return true;
}
| function burnUnmintedTokens(uint256 _burnedAmount) public onlyOwner returns (bool success){
require(_burnedAmount <= _unmintedTokens);
_unmintedTokens = _unmintedTokens.sub(_burnedAmount);
emit Burn(msg.sender, _burnedAmount);
return true;
}
| 46,702 |
3 | // for investors, we can whitelist addresses in order they can mint generals | mapping(address => bool) whitelist;
string private constant COMMANDER = "bafybeick7bj677i3fhq5upoc2vplu4gmgmgdpacbtahx6f4uqkgl7dattq"; //rank 1
string private constant GENERAL = "bafybeidzfegfpn24lpjkf235tdhqvk26b2bsr7ye7sj2ggsodxk4rs25ju"; //rank 2
string private constant SOLDIER = "bafybeiceynivd... | mapping(address => bool) whitelist;
string private constant COMMANDER = "bafybeick7bj677i3fhq5upoc2vplu4gmgmgdpacbtahx6f4uqkgl7dattq"; //rank 1
string private constant GENERAL = "bafybeidzfegfpn24lpjkf235tdhqvk26b2bsr7ye7sj2ggsodxk4rs25ju"; //rank 2
string private constant SOLDIER = "bafybeiceynivd... | 31,531 |
12 | // getting bytecode of feature created farming pool | bytes memory bytecode = abi.encodePacked(type(FarmingRewards).creationCode, abi.encode(
address(this),
_deployer,
_rewardToken,
_stakingToken,
_rewardAmount,
_startDate,
_endDate,
_epochDuration,
_minimum... | bytes memory bytecode = abi.encodePacked(type(FarmingRewards).creationCode, abi.encode(
address(this),
_deployer,
_rewardToken,
_stakingToken,
_rewardAmount,
_startDate,
_endDate,
_epochDuration,
_minimum... | 18,228 |
150 | // Get amount of stake required to raise a dispute / | function getDisputeResolutionParams() public view returns (uint256) {
return tokenStakeForDispute;
}
| function getDisputeResolutionParams() public view returns (uint256) {
return tokenStakeForDispute;
}
| 44,047 |
146 | // Gets the last applicable timestamp for this reward period / | function lastTimeRewardApplicable()
public
view
returns (uint256)
| function lastTimeRewardApplicable()
public
view
returns (uint256)
| 5,361 |
20 | // Enable garden creations to be fully open to the public (no need of Ishtar gate anymore) | bool public override gardenCreationIsOpen;
| bool public override gardenCreationIsOpen;
| 75,525 |
134 | // ============ Internal Functions ============ / | function _getNonCaller(address _signerOne, address _signerTwo) internal view returns(address) {
return msg.sender == _signerOne ? _signerTwo : _signerOne;
}
| function _getNonCaller(address _signerOne, address _signerTwo) internal view returns(address) {
return msg.sender == _signerOne ? _signerTwo : _signerOne;
}
| 59,966 |
242 | // initialize - sets current address of ContractManager of SkaleManager newContractManagerOfSkaleManager - current address of ContractManager of SkaleManager / | function initialize(
IContractManager newContractManagerOfSkaleManager
)
public
virtual
initializer
| function initialize(
IContractManager newContractManagerOfSkaleManager
)
public
virtual
initializer
| 37,122 |
33 | // update amountRedeemable | amountRedeemable = success ? amountRedeemable - amountToRedeem : amountRedeemable;
| amountRedeemable = success ? amountRedeemable - amountToRedeem : amountRedeemable;
| 12,067 |
5 | // ---------- Contracts ---------- | IERC20Burnable public immutable JAMON;
IJamonRouter public immutable ROUTER;
IAcornBank public immutable BANK;
| IERC20Burnable public immutable JAMON;
IJamonRouter public immutable ROUTER;
IAcornBank public immutable BANK;
| 25,444 |
867 | // Transfer approved withdrawal amount from the contract to the caller. | collateralCurrency.safeTransfer(msg.sender, amountWithdrawn.rawValue);
emit RequestWithdrawalExecuted(msg.sender, amountWithdrawn.rawValue);
| collateralCurrency.safeTransfer(msg.sender, amountWithdrawn.rawValue);
emit RequestWithdrawalExecuted(msg.sender, amountWithdrawn.rawValue);
| 10,183 |
15 | // pyro in vaults | balance = balance.add(IBEP20(autoSharkPyroPool).balanceOf(_voter));
return balance;
| balance = balance.add(IBEP20(autoSharkPyroPool).balanceOf(_voter));
return balance;
| 51,603 |
97 | // rate Number of token units a buyer gets per weitoken unit. So, if you are using a rate of 1 with a ERC20Detailed tokenwith 3 decimals called TOK, 1 wei will give you 1 unit, or 0.001 TOK. wallet Address where collected funds will be forwarded to token Address of the token being sold / | constructor ( uint256 rate, address payable wallet, DANACHO token) public {
require(rate > 0, "Crowdsale: rate is 0");
require(wallet != address(0), "Crowdsale: wallet is the zero address");
require(address(token) != address(0), "Crowdsale: token is the zero address");
_rate = rate... | constructor ( uint256 rate, address payable wallet, DANACHO token) public {
require(rate > 0, "Crowdsale: rate is 0");
require(wallet != address(0), "Crowdsale: wallet is the zero address");
require(address(token) != address(0), "Crowdsale: token is the zero address");
_rate = rate... | 20,537 |
16 | // lost tokens go to the first payee | tokenContract.transfer(payees[0], balance);
| tokenContract.transfer(payees[0], balance);
| 138 |
92 | // Caller must be approved by the Vault's Authorizer | function setSwapFeePercentage(uint256 swapFeePercentage) external virtual authenticate whenNotPaused {
_setSwapFeePercentage(swapFeePercentage);
}
| function setSwapFeePercentage(uint256 swapFeePercentage) external virtual authenticate whenNotPaused {
_setSwapFeePercentage(swapFeePercentage);
}
| 3,047 |
19 | // Les électeurs inscrits votent pour leurs propositions préférées. / | function vote(uint proposalId) external isWhitelisted {
require(workflowStatus == WorkflowStatus.VotingSessionStarted, "Vote pas en cours");
require(!whitelist[msg.sender].hasVoted, "Deja vote");
require(proposalId < proposals.length , "Id de proposition invalide");
whitelist[msg.sen... | function vote(uint proposalId) external isWhitelisted {
require(workflowStatus == WorkflowStatus.VotingSessionStarted, "Vote pas en cours");
require(!whitelist[msg.sender].hasVoted, "Deja vote");
require(proposalId < proposals.length , "Id de proposition invalide");
whitelist[msg.sen... | 23,896 |
40 | // every participant has an account index, the winners are picked from here all winners are picked in order from the single random intneeds to be cleared after every game | mapping (uint => mapping (uint => address)) participants; // game number => counter => address
uint256[] prizes = [0.04 ether,
0.02 ether,
0.01 ether,
5 finney,
5 finney,
5 finney,
... | mapping (uint => mapping (uint => address)) participants; // game number => counter => address
uint256[] prizes = [0.04 ether,
0.02 ether,
0.01 ether,
5 finney,
5 finney,
5 finney,
... | 43,940 |
116 | // Needs to be true if migration started | require(isMigrationInitiated, "Migration is not initiated");
| require(isMigrationInitiated, "Migration is not initiated");
| 16,809 |
19 | // Get token id by its address | uint16 tokenId = governance.validateTokenAddress(address(_token));
uint256 balance_before = _token.balanceOf(address(this));
require(Utils.transferFromERC20(_token, msg.sender, address(this), SafeCast.toUint128(_amount)), "fd012"); // token transfer failed deposit
uint256 balance_after ... | uint16 tokenId = governance.validateTokenAddress(address(_token));
uint256 balance_before = _token.balanceOf(address(this));
require(Utils.transferFromERC20(_token, msg.sender, address(this), SafeCast.toUint128(_amount)), "fd012"); // token transfer failed deposit
uint256 balance_after ... | 7,086 |
71 | // ============ State Variables ============ |
mapping (address => bool) public authorized;
|
mapping (address => bool) public authorized;
| 67,160 |
139 | // https:github.com/quantstamp/sushiswap-security-review 3.4 fixed. | function _transfer(address sender, address recipient, uint256 amount) internal override(ERC20) {
_moveDelegates(_delegates[sender], _delegates[recipient], amount);
ERC20._transfer(sender, recipient, amount);
}
| function _transfer(address sender, address recipient, uint256 amount) internal override(ERC20) {
_moveDelegates(_delegates[sender], _delegates[recipient], amount);
ERC20._transfer(sender, recipient, amount);
}
| 33,044 |
89 | // This function is used to calculate the amount of tokens that can be issued. The amount of oTokens is determined by:oTokensIssued<= collateralAmtcollateralToStrikePrice / (proportionstrikePrice) collateralAmt The amount of collateral proportion The proportion of the collateral to pay out. If 100% of collateralshould ... | function calculateOTokens(uint256 collateralAmt, Number memory proportion)
internal
view
returns (uint256)
| function calculateOTokens(uint256 collateralAmt, Number memory proportion)
internal
view
returns (uint256)
| 46,386 |
253 | // Extracts the previous block's hash from a block header/Block headers do NOT include block number :(/_header The header/ returnThe previous block's hash (little-endian) | function extractPrevBlockLE(bytes memory _header) internal pure returns (bytes memory) {
return _header.slice(4, 32);
}
| function extractPrevBlockLE(bytes memory _header) internal pure returns (bytes memory) {
return _header.slice(4, 32);
}
| 31,936 |
51 | // returns the upkeep privilege config / | function getUpkeepPrivilegeConfig(uint256 upkeepId) external view returns (bytes memory) {
return s_upkeepPrivilegeConfig[upkeepId];
}
| function getUpkeepPrivilegeConfig(uint256 upkeepId) external view returns (bytes memory) {
return s_upkeepPrivilegeConfig[upkeepId];
}
| 19,005 |
159 | // Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. This method is included for ERC20 compatibility. `increaseAllowance` and `decreaseAllowance` should be used instead.Changing an allowance with this method brings the risk that someone may transfer both the old and the new all... | function approve(address _spender, uint256 _value)
public
override
returns (bool)
| function approve(address _spender, uint256 _value)
public
override
returns (bool)
| 25,950 |
17 | // tokenId => Side => OrderBook | mapping(uint256 => mapping(Side => OrderBook)) private _markets;
| mapping(uint256 => mapping(Side => OrderBook)) private _markets;
| 18,501 |
1 | // constructor() ERC721("Timeshare", "TSBO") {} | function initialize() public initializer {
__Context_init_unchained();
__ERC165_init_unchained();
__Ownable_init_unchained();
__ERC721_init("Timeshare", "SHARE");
__ERC721Enumerable_init_unchained();
__ERC721Holder_init_unchained();
}
| function initialize() public initializer {
__Context_init_unchained();
__ERC165_init_unchained();
__Ownable_init_unchained();
__ERC721_init("Timeshare", "SHARE");
__ERC721Enumerable_init_unchained();
__ERC721Holder_init_unchained();
}
| 4,541 |
46 | // id brokers | mapping(bytes32 => address[]) public brokers;
| mapping(bytes32 => address[]) public brokers;
| 21,561 |
66 | // fallback function can be used to buy tokens | function () public payable {
buyPhaseTokens(msg.sender);
}
| function () public payable {
buyPhaseTokens(msg.sender);
}
| 8,571 |
3 | // Emits an {OwnershipTransferred} event. newOwner The address of the new owner of the contract. Using the zero address means renouncing ownership. / | function transferOwnership(address newOwner) external;
| function transferOwnership(address newOwner) external;
| 35,983 |
20 | // Price for member sales | uint256 membersSalePrice;
| uint256 membersSalePrice;
| 17,259 |
15 | // offset the bitboard to scan from `bucketIndex`. | bb = bb >> (0xff ^ bucketIndex); // bb >> (255 - bucketIndex)
if(bb > 0) {
unchecked {
return (bucket << 8) | (bucketIndex - bb.bitScanForward256());
}
| bb = bb >> (0xff ^ bucketIndex); // bb >> (255 - bucketIndex)
if(bb > 0) {
unchecked {
return (bucket << 8) | (bucketIndex - bb.bitScanForward256());
}
| 28,258 |
6 | // not sure what was returned: don't mark as success | default { }
| default { }
| 13,445 |
64 | // Gets investment asset active Status of a given currency. / | function getInvestmentAssetStatus(bytes4 curr) external view returns(bool status) {
return allInvestmentAssets[curr].status;
}
| function getInvestmentAssetStatus(bytes4 curr) external view returns(bool status) {
return allInvestmentAssets[curr].status;
}
| 7,930 |
310 | // We leave the round number as non-zero to save on gas for subsequent writes | withdrawals[msg.sender].shares = 0;
vaultState.queuedWithdrawShares = uint128(
uint256(vaultState.queuedWithdrawShares).sub(withdrawalShares)
);
uint256 withdrawAmount =
ShareMath.sharesToAsset(
withdrawalShares,
roundPricePerShare... | withdrawals[msg.sender].shares = 0;
vaultState.queuedWithdrawShares = uint128(
uint256(vaultState.queuedWithdrawShares).sub(withdrawalShares)
);
uint256 withdrawAmount =
ShareMath.sharesToAsset(
withdrawalShares,
roundPricePerShare... | 25,100 |
328 | // write first slot back, it can be still partially occupied, it can also be full | sstore(loc, v256)
| sstore(loc, v256)
| 50,525 |
160 | // Position Set Protocol Collection of helper functions for handling and updating AmorToken Positions CHANGELOG: - Updated editExternalPosition to work when no external position is associated with module / | library Position {
using SafeCast for uint256;
using SafeMath for uint256;
using SafeCast for int256;
using SignedSafeMath for int256;
using PreciseUnitMath for uint256;
/* ============ Helper ============ */
/**
* Returns whether the AmorToken has a default position for a given compo... | library Position {
using SafeCast for uint256;
using SafeMath for uint256;
using SafeCast for int256;
using SignedSafeMath for int256;
using PreciseUnitMath for uint256;
/* ============ Helper ============ */
/**
* Returns whether the AmorToken has a default position for a given compo... | 21,951 |
387 | // delegations will never be deleted to index in this array may be used like delegation id | Delegation[] public delegations;
| Delegation[] public delegations;
| 52,793 |
12 | // transfer token for a specified address_to The address to transfer to._value The amount to be transferred./ | function transfer(address _to, uint256 _value) public returns (bool) {
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
| function transfer(address _to, uint256 _value) public returns (bool) {
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
| 50,276 |
191 | // public functionplayer submit betonly if game is active & bet is valid can query oraclize and set player vars / | function playerRollDice(uint rollUnder) public
payable
gameIsActive
betIsValid(msg.value, rollUnder)
| function playerRollDice(uint rollUnder) public
payable
gameIsActive
betIsValid(msg.value, rollUnder)
| 69,137 |
33 | // For determining which interface to use | bool isMultiToken = amounts.length == tokenIds.length;
| bool isMultiToken = amounts.length == tokenIds.length;
| 55,728 |
13 | // get the winer address | winer = players[winerIndex];
| winer = players[winerIndex];
| 4,914 |
23 | // Checks if the symbols on reel 2 and 3 are the same and update pos to the corresponding position | if (r2 == r3) pos = 1;
payout = (_wager * payouts[r1][pos]);
_reels[i] = [r1, r2, r3];
_payouts[i] = payout;
_totalPayout += payout;
| if (r2 == r3) pos = 1;
payout = (_wager * payouts[r1][pos]);
_reels[i] = [r1, r2, r3];
_payouts[i] = payout;
_totalPayout += payout;
| 20,277 |
194 | // The block number when yoda mining starts. | uint256 public START_BLOCK;
uint256 public constant PERCENT_LOCK_BONUS_REWARD = 75; // lock 75% of bounus reward in 1 year
uint256 public constant PERCENT_FOR_DEV = 10; // 10% reward for dev
| uint256 public START_BLOCK;
uint256 public constant PERCENT_LOCK_BONUS_REWARD = 75; // lock 75% of bounus reward in 1 year
uint256 public constant PERCENT_FOR_DEV = 10; // 10% reward for dev
| 9,089 |
0 | // Counter && Safe Math | using Counters for Counters.Counter;
using SafeMath for uint256;
| using Counters for Counters.Counter;
using SafeMath for uint256;
| 30,425 |
44 | // get total invested in ETH | function getTotalInvestedEther() external view returns (uint);
| function getTotalInvestedEther() external view returns (uint);
| 47,923 |
52 | // Resume withdrawals / | function resumeWithdrawals() public {
require(hasRole(ADMIN_ROLE, msg.sender), "Caller is not allowed to resume withdrawals");
WITHRAWALS_PAUSED = false;
emit WithdrawalsResumed();
}
| function resumeWithdrawals() public {
require(hasRole(ADMIN_ROLE, msg.sender), "Caller is not allowed to resume withdrawals");
WITHRAWALS_PAUSED = false;
emit WithdrawalsResumed();
}
| 41,294 |
32 | // The auction participants. | mapping (address => uint) public participants;
| mapping (address => uint) public participants;
| 38,202 |
122 | // Updates the Prize Strategy when tokens are transferred between holders./from The address the tokens are being transferred from (0 if minting)/to The address the tokens are being transferred to (0 if burning)/amount The amount of tokens being trasferred | function beforeTokenTransfer(address from, address to, uint256 amount) external override onlyControlledToken(msg.sender) {
if (from != address(0)) {
uint256 fromBeforeBalance = IERC20Upgradeable(msg.sender).balanceOf(from);
// first accrue credit for their old balance
uint256 newCreditBalance = ... | function beforeTokenTransfer(address from, address to, uint256 amount) external override onlyControlledToken(msg.sender) {
if (from != address(0)) {
uint256 fromBeforeBalance = IERC20Upgradeable(msg.sender).balanceOf(from);
// first accrue credit for their old balance
uint256 newCreditBalance = ... | 7,030 |
29 | // Test all token addresses at once | require(
TokenRegistry(tokenRegistryAddress).areAllTokensRegistered(tokens)
); // "token not registered");
| require(
TokenRegistry(tokenRegistryAddress).areAllTokensRegistered(tokens)
); // "token not registered");
| 3,884 |
68 | // The owner can update the rate (PDT to ETH)._ratethe new rate for converting PDT to ETH / | function setRate(uint _rate) public onlyOwner {
require(_rate >= LOW_RANGE_RATE && _rate <= HIGH_RANGE_RATE);
rate = _rate;
}
| function setRate(uint _rate) public onlyOwner {
require(_rate >= LOW_RANGE_RATE && _rate <= HIGH_RANGE_RATE);
rate = _rate;
}
| 39,762 |
7 | // solium-disable-next-line security/no-low-level-calls | (bool success, bytes memory data) =
token.call(
| (bool success, bytes memory data) =
token.call(
| 9,312 |
88 | // heist character | if (_victimId==0){
narcoCore.incrementStat(_hijackerId, 5); // raidSuccessful
}
| if (_victimId==0){
narcoCore.incrementStat(_hijackerId, 5); // raidSuccessful
}
| 35,586 |
4 | // Chi is an atomic currency.It is not possible to have a fraction of a Chi. You are only able to haveinteger values of Chi tokens. / | uint256 public decimals = 0;
| uint256 public decimals = 0;
| 39,112 |
195 | // mint extra ALD to ald DAO | uint256 _percentageContributor = percentageContributor;
if (percentageContributor > 0) {
IALD(ald).mint(aldDAO, _bond.mul(_percentageContributor).div(PRECISION - _percentageContributor));
}
| uint256 _percentageContributor = percentageContributor;
if (percentageContributor > 0) {
IALD(ald).mint(aldDAO, _bond.mul(_percentageContributor).div(PRECISION - _percentageContributor));
}
| 24,884 |
5 | // Liquity | address LiquityProxyBorrowerOperations;
address LUSD;
| address LiquityProxyBorrowerOperations;
address LUSD;
| 51,789 |
30 | // Accept a certificate. / | function acceptCertificate(uint _id) external onlyIdentityPurpose(20002) {
Document storage doc = documents[_id];
require(!doc.published && doc.docType >= 60000);
// Add to index.
doc.index = uint16(documentsIndex.push(_id).sub(1));
// Publish.
doc.published = true;
... | function acceptCertificate(uint _id) external onlyIdentityPurpose(20002) {
Document storage doc = documents[_id];
require(!doc.published && doc.docType >= 60000);
// Add to index.
doc.index = uint16(documentsIndex.push(_id).sub(1));
// Publish.
doc.published = true;
... | 11,375 |
128 | // used to return the precise amount of tokens returned | _amount = tokenBalanceAfter - tokenBalanceBefore;
withdrawTokens(tokenAddr, _to, _amount);
return _amount;
| _amount = tokenBalanceAfter - tokenBalanceBefore;
withdrawTokens(tokenAddr, _to, _amount);
return _amount;
| 32,618 |
12 | // Setup the interface to the Blocklord contract | function setBLInterface(address newAddress) public onlyOwner {
BL = BLInterface(newAddress);
}
| function setBLInterface(address newAddress) public onlyOwner {
BL = BLInterface(newAddress);
}
| 14,775 |
3 | // Color of each token. / | mapping(uint256 => uint256) public pixelColor;
| mapping(uint256 => uint256) public pixelColor;
| 48,995 |
53 | // Transfers the ownership of an WAR from one address to another address/_from The current owner of the WAR/_to The new owner/_tokenId The WAR to transfer | function safeTransferFrom(address _from, address _to, uint256 _tokenId)
external
whenNotPaused
| function safeTransferFrom(address _from, address _to, uint256 _tokenId)
external
whenNotPaused
| 31,320 |
289 | // If the lock is expired | if (thisStake.ending_timestamp <= block.timestamp) {
// If the lock expired in the time since the last claim, the weight needs to be proportionately averaged this time
if (lastRewardClaimTime[account] < thisStake.ending_timestamp){
uint256 time_before_expiry = thisStake.e... | if (thisStake.ending_timestamp <= block.timestamp) {
// If the lock expired in the time since the last claim, the weight needs to be proportionately averaged this time
if (lastRewardClaimTime[account] < thisStake.ending_timestamp){
uint256 time_before_expiry = thisStake.e... | 17,881 |
4 | // Allows a user to supply asset tokens in exchange for yield-bearing tokens/ to be held in escrow by the Yield Service/amount The amount of asset tokens to be supplied | function _supply(uint256 amount) internal override {
_token().safeApprove(address(cToken), amount);
require(cToken.mint(amount) == 0, "CompoundPrizePool/mint-failed");
}
| function _supply(uint256 amount) internal override {
_token().safeApprove(address(cToken), amount);
require(cToken.mint(amount) == 0, "CompoundPrizePool/mint-failed");
}
| 6,971 |
81 | // Mints `quantity` tokens and transfers them to `to`. Requirements: - `to` cannot be the zero address.- `quantity` must be greater than 0. | * Emits a {Transfer} event for each mint.
*/
function _mint(address to, uint256 quantity) internal virtual {
uint256 startTokenId = ERC721AStorage.layout()._currentIndex;
if (quantity == 0) revert MintZeroQuantity();
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
// Overflows a... | * Emits a {Transfer} event for each mint.
*/
function _mint(address to, uint256 quantity) internal virtual {
uint256 startTokenId = ERC721AStorage.layout()._currentIndex;
if (quantity == 0) revert MintZeroQuantity();
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
// Overflows a... | 10,877 |
0 | // if totalSupply_ is 0, then unlimited supply | uint256 totalSupply;
uint256 price;
string description;
uint256 maxPerWallet;
| uint256 totalSupply;
uint256 price;
string description;
uint256 maxPerWallet;
| 31,381 |
12 | // set minimum amount and make sure ad hasnt expired | require(msg.value >= adPriceWeek);
require(block.timestamp > purchaseTimestamp.add(purchaseSeconds));
| require(msg.value >= adPriceWeek);
require(block.timestamp > purchaseTimestamp.add(purchaseSeconds));
| 49,722 |
167 | // RainbowToken with Governance. | contract RainbowToken is ERC20("RainbowToken", "RAINBOW"), Ownable {
/// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef).
function mint(address _to, uint256 _amount) public onlyOwner {
_mint(_to, _amount);
_moveDelegates(address(0), _delegates[_to], _amoun... | contract RainbowToken is ERC20("RainbowToken", "RAINBOW"), Ownable {
/// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef).
function mint(address _to, uint256 _amount) public onlyOwner {
_mint(_to, _amount);
_moveDelegates(address(0), _delegates[_to], _amoun... | 67,649 |
116 | // return the number of tokens in exporting state / | function countStatedTokens(State state) external view returns(uint256);
| function countStatedTokens(State state) external view returns(uint256);
| 39,626 |
227 | // Reference to other contracts | CarToken public token;
| CarToken public token;
| 49,863 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.