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 |
|---|---|---|---|---|
203 | // oods_coefficients[174]/ mload(add(context, 0x6f80)), Read the next element. | let columnValue := mulmod(mload(add(compositionQueryResponses, 0x20)), kMontgomeryRInv, PRIME)
| let columnValue := mulmod(mload(add(compositionQueryResponses, 0x20)), kMontgomeryRInv, PRIME)
| 28,932 |
2 | // Calls an external contract with arbitrary data and parse the return value into an address. externalContract The address of the contract to call. callData The data to send to the contract.return contractAddress The address of the contract returned by the call. / | function callAndReturnContractAddress(address externalContract, bytes calldata callData)
internal
returns (address payable contractAddress)
| function callAndReturnContractAddress(address externalContract, bytes calldata callData)
internal
returns (address payable contractAddress)
| 11,722 |
9 | // Multiplies value a by value b (result is rounded down). It's assumed that the value b is the significandof a number with 18 decimals precision. / | function preciseMul(uint256 a, uint256 b) internal pure returns (uint256) {
return a.mul(b).div(PRECISE_UNIT);
}
| function preciseMul(uint256 a, uint256 b) internal pure returns (uint256) {
return a.mul(b).div(PRECISE_UNIT);
}
| 26,621 |
0 | // Swap./callArgs The args needed for swapping./amountETH ETH amount. If swap ETH for other token, amountETH is the amount to swap./ Else amountETH is 0. | function swap(bytes memory callArgs, uint256 amountETH)
external
onlyDelegation
{
(bool success, bytes memory returnData) = oneInchRouter.call{
value: amountETH
}(callArgs);
| function swap(bytes memory callArgs, uint256 amountETH)
external
onlyDelegation
{
(bool success, bytes memory returnData) = oneInchRouter.call{
value: amountETH
}(callArgs);
| 13,313 |
15 | // Raising event | emit Withdraw(tokensToSend, block.timestamp);
| emit Withdraw(tokensToSend, block.timestamp);
| 27,176 |
0 | // Main token smart contract | contract JEWToken is ERC20Mintable {
string public constant name = "JEW";
string public constant symbol = "JEW";
uint8 public constant decimals = 2;
} | contract JEWToken is ERC20Mintable {
string public constant name = "JEW";
string public constant symbol = "JEW";
uint8 public constant decimals = 2;
} | 12,463 |
1,206 | // 605 | entry "rubberily" : ENG_ADVERB
| entry "rubberily" : ENG_ADVERB
| 21,441 |
81 | // LayerZero endpoint will invoke this function to deliver the message on the destination_srcChainId - the source endpoint identifier_srcAddress - the source sending contract address from the source chain_nonce - the ordered message nonce_payload - the signed payload is the UA bytes has encoded to be sent | function lzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) external;
| function lzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) external;
| 2,721 |
0 | // delete ๆไฝ็ฌฆๅฏไปฅ็จไบ ไปปไฝๅ้(mapping้คๅค), ๅฐๅ
ถ่ฎพ็ฝฎๆ้ป่ฎคๅผ delete ๅ ้ค ่ฎพ็ฝฎๆ้ป่ฎคๅผ | function delStr() public {
delete str1;
}
| function delStr() public {
delete str1;
}
| 43,902 |
4 | // Initializes the contract setting the deployer as the initial owner./ | constructor() {
_transferOwnership(_msgSender());
}
| constructor() {
_transferOwnership(_msgSender());
}
| 8,339 |
2 | // Mapping storing the signer address for a given collection | mapping(address collection => address signer) private signerPerCollection;
| mapping(address collection => address signer) private signerPerCollection;
| 13,935 |
23 | // Freeze used bounty company |
function pay_Bounty(address _address, uint _sum_pay ) onlyOwner public {
transfer(_address, _sum_pay);
Freeze(_address, 1);
}
|
function pay_Bounty(address _address, uint _sum_pay ) onlyOwner public {
transfer(_address, _sum_pay);
Freeze(_address, 1);
}
| 48,284 |
22 | // Assigns ownership of a specific Kitty to an address. | function _transfer(address _from, address _to, uint256 _tokenId) internal {
// since the number of kittens is capped to 2^32
// there is no way to overflow this
ownershipTokenCount[_to]++;
// transfer ownership
kittyIndexToOwner[_tokenId] = _to;
// When creating new k... | function _transfer(address _from, address _to, uint256 _tokenId) internal {
// since the number of kittens is capped to 2^32
// there is no way to overflow this
ownershipTokenCount[_to]++;
// transfer ownership
kittyIndexToOwner[_tokenId] = _to;
// When creating new k... | 49,713 |
65 | // mint and distribute short and long position tokens to our caller | PositionToken(LONG_POSITION_TOKEN).mintAndSendToken(qtyToMint, minter);
PositionToken(SHORT_POSITION_TOKEN).mintAndSendToken(qtyToMint, minter);
| PositionToken(LONG_POSITION_TOKEN).mintAndSendToken(qtyToMint, minter);
PositionToken(SHORT_POSITION_TOKEN).mintAndSendToken(qtyToMint, minter);
| 15,801 |
11 | // Amount the contract borrowed | int256 public minted_sum_historical = 0;
int256 public burned_sum_historical = 0;
| int256 public minted_sum_historical = 0;
int256 public burned_sum_historical = 0;
| 6,380 |
150 | // A Yieldspace AMM implementation for pools which provide liquidity and trading of fyTokens vs base tokens./ The base tokens in this implementation are converted to ERC4626 compliant tokenized vault shares./ See whitepaper and derived formulas: https:hackmd.io/lRZ4mgdrRgOpxZQXqKYlFwUseful terminology:base - Example: D... | contract Pool is PoolEvents, IPool, ERC20Permit, AccessControl {
/* LIBRARIES
*****************************************************************************************************************/
using WDiv for uint256;
using RDiv for uint256;
using Math64x64 for int128;
using Math64x64 for uint2... | contract Pool is PoolEvents, IPool, ERC20Permit, AccessControl {
/* LIBRARIES
*****************************************************************************************************************/
using WDiv for uint256;
using RDiv for uint256;
using Math64x64 for int128;
using Math64x64 for uint2... | 25,455 |
109 | // SushiSwap `fromToken` `amountIn` to `toToken` for benefit of `to` - if `fromToken` is `wETH`, convert `msg.value` to `wETH`. | function swap(address fromToken, address toToken, address to, uint256 amountIn) external payable returns (uint256 amountOut) {
(address token0, address token1) = fromToken < toToken ? (fromToken, toToken) : (toToken, fromToken);
ISushiSwap pair =
ISushiSwap(
uint256(
... | function swap(address fromToken, address toToken, address to, uint256 amountIn) external payable returns (uint256 amountOut) {
(address token0, address token1) = fromToken < toToken ? (fromToken, toToken) : (toToken, fromToken);
ISushiSwap pair =
ISushiSwap(
uint256(
... | 3,839 |
217 | // Safe crane transfer function, just in case if rounding error causes pool to not have enough CRANEs. | function safeCraneTransfer(address _to, uint256 _amount) internal {
uint256 craneBal = crane.balanceOf(address(this));
if (_amount > craneBal) {
crane.transfer(_to, craneBal);
} else {
crane.transfer(_to, _amount);
}
}
| function safeCraneTransfer(address _to, uint256 _amount) internal {
uint256 craneBal = crane.balanceOf(address(this));
if (_amount > craneBal) {
crane.transfer(_to, craneBal);
} else {
crane.transfer(_to, _amount);
}
}
| 27,543 |
6 | // Sends a cross domain message. / | function _sendXDomainMessage(
bytes memory, // _message,
uint256 // _gasLimit
)
virtual
internal
| function _sendXDomainMessage(
bytes memory, // _message,
uint256 // _gasLimit
)
virtual
internal
| 37,840 |
6 | // ๅฐ่ตไบงๅ่ฝฌๅฐๅ็บฆ | for(uint256 i = 0; i < len; i++) {
CustomToken token = CustomToken(_tokens[i]);
token.transferFrom(msg.sender, address(this), _amounts[i]); // safeTransferFrom
}
| for(uint256 i = 0; i < len; i++) {
CustomToken token = CustomToken(_tokens[i]);
token.transferFrom(msg.sender, address(this), _amounts[i]); // safeTransferFrom
}
| 42,740 |
30 | // Allows owner to set new monetha address / | function setMonethaAddress(address _address, bool _isMonethaAddress) onlyOwner public {
isMonethaAddress[_address] = _isMonethaAddress;
emit MonethaAddressSet(_address, _isMonethaAddress);
}
| function setMonethaAddress(address _address, bool _isMonethaAddress) onlyOwner public {
isMonethaAddress[_address] = _isMonethaAddress;
emit MonethaAddressSet(_address, _isMonethaAddress);
}
| 16,794 |
98 | // Total number of shares that can be minted for owner from the cellar. Until after security audits, limits mints to $50k of shares per wallet. owner address of account that would receive the sharesreturn maximum amount of shares that can be minted / | function maxMint(address owner) public view returns (uint256) {
if (isShutdown || isPaused) return 0;
if (maxLiquidity == type(uint256).max) return type(uint256).max;
uint256 mintLimit = previewDeposit(50_000 * 10**assetDecimals);
uint256 shares = balanceOf[owner];
return ... | function maxMint(address owner) public view returns (uint256) {
if (isShutdown || isPaused) return 0;
if (maxLiquidity == type(uint256).max) return type(uint256).max;
uint256 mintLimit = previewDeposit(50_000 * 10**assetDecimals);
uint256 shares = balanceOf[owner];
return ... | 43,723 |
66 | // set the rest of the contract variables | uniswapV2Router = _uniswapV2Router;
| uniswapV2Router = _uniswapV2Router;
| 916 |
30 | // ๅฟ
้กปๅจๆ็ฅจๅจๆๅ
ๅฎๆไปฒ่ฃ๏ผ่ฟๆถ่ชๅจๆพๅผ | require(Tima > block.timestamp - tima[i][what], "arb1/relTime-not");
| require(Tima > block.timestamp - tima[i][what], "arb1/relTime-not");
| 8,691 |
307 | // Initialize can only be called once. It saves the block number in which it was initialized.Initialize an ACL instance and set `_permissionsCreator` as the entity that can create other permissions_permissionsCreator Entity that will be given permission over createPermission/ | function initialize(address _permissionsCreator) public onlyInit {
initialized();
require(msg.sender == address(kernel()), ERROR_AUTH_INIT_KERNEL);
_createPermission(_permissionsCreator, this, CREATE_PERMISSIONS_ROLE, _permissionsCreator);
}
| function initialize(address _permissionsCreator) public onlyInit {
initialized();
require(msg.sender == address(kernel()), ERROR_AUTH_INIT_KERNEL);
_createPermission(_permissionsCreator, this, CREATE_PERMISSIONS_ROLE, _permissionsCreator);
}
| 47,130 |
129 | // External function called to make the contract update weights according to plan bPool - Core BPool the CRP is wrapping gradualUpdate - gradual update parameters from the CRP/ | function pokeWeights(
IBPool bPool,
GradualUpdateParams storage gradualUpdate
)
external
| function pokeWeights(
IBPool bPool,
GradualUpdateParams storage gradualUpdate
)
external
| 33,529 |
56 | // clipperExchange.sellTokenForEth(address(srcToken), inputAmount, outputAmount, goodUntil, recipient, signature, _INCH_TAG); | address clipper = address(clipperExchange);
bytes4 selector = clipperExchange.sellTokenForEth.selector;
| address clipper = address(clipperExchange);
bytes4 selector = clipperExchange.sellTokenForEth.selector;
| 11,977 |
159 | // Writes a byte string to a buffer. Resizes if doing so would exceed the capacity of the buffer. buf The buffer to append to. off The start offset to write to. data The data to append. len The number of bytes to copy.return The original buffer, for chaining. / | function write(
buffer memory buf,
uint256 off,
bytes memory data,
uint256 len
| function write(
buffer memory buf,
uint256 off,
bytes memory data,
uint256 len
| 37,596 |
59 | // Approve new regular delay for this contract newDelay new delay time salt salt / | function approveNewRegularDelay(
uint256 newDelay,
bytes32 salt
| function approveNewRegularDelay(
uint256 newDelay,
bytes32 salt
| 35,898 |
27 | // Calculate tokens added (or lost). | amountAdded = int256(actualBalance) - int256(balance);
| amountAdded = int256(actualBalance) - int256(balance);
| 18,445 |
96 | // Sends (_mul/_div) of every token (and ether) the funds holds to _withdrawAddress_mulThe numerator_divThe denominator_withdrawAddressAddress to send the tokens/ether to NOTE: _withdrawAddress changed from address to address[] arrays because balance calculation should be performed once for all usesr who wants to withd... | function _withdraw(
uint256[] memory _mul,
uint256[] memory _div,
address[] memory _withdrawAddress
)
internal
| function _withdraw(
uint256[] memory _mul,
uint256[] memory _div,
address[] memory _withdrawAddress
)
internal
| 7,171 |
6 | // called on transfers | function updateReward(address _from, address _to) external onlyCC {
uint256 time = max(block.timestamp, START);
uint256 timerFrom = lastUpdate[_from];
if (timerFrom > 0) {
rewards[_from] += CHEEKY_CORGI
.balanceOf(_from)
.mul(BASE_RATE.mul((time.su... | function updateReward(address _from, address _to) external onlyCC {
uint256 time = max(block.timestamp, START);
uint256 timerFrom = lastUpdate[_from];
if (timerFrom > 0) {
rewards[_from] += CHEEKY_CORGI
.balanceOf(_from)
.mul(BASE_RATE.mul((time.su... | 33,629 |
207 | // Do anything necessary to prepare this Strategy for migration, such astransferring any reserve or LP tokens, CDPs, or other tokens or stores ofvalue. / |
function prepareMigration(address _newStrategy) internal virtual;
|
function prepareMigration(address _newStrategy) internal virtual;
| 10,731 |
28 | // Updates the trustee rewards that they have earned for the yearand then sends the unallocated reward to the hoard. Makes the assumption that there will be a trustee election resulting in a new cohortonce and only once per year, directly following the call to annualUpdate. / | function annualUpdate() external {
require(
getTime() > yearEnd,
"cannot call this until the current year term has ended"
);
address[] memory trustees = everTrustee;
for (uint256 i = 0; i < trustees.length; ++i) {
address trustee = trustees[i];
... | function annualUpdate() external {
require(
getTime() > yearEnd,
"cannot call this until the current year term has ended"
);
address[] memory trustees = everTrustee;
for (uint256 i = 0; i < trustees.length; ++i) {
address trustee = trustees[i];
... | 16,051 |
62 | // import '1_Storage.sol'; | contract UniverseFinance {
/**
* using safemath for uint256
*/
using SafeMath for uint256;
event Migration(
address indexed customerAddress,
address indexed referrar,
uint256 tokens
);
/**
events for transfer
*/
event Transfer(
a... | contract UniverseFinance {
/**
* using safemath for uint256
*/
using SafeMath for uint256;
event Migration(
address indexed customerAddress,
address indexed referrar,
uint256 tokens
);
/**
events for transfer
*/
event Transfer(
a... | 6,314 |
103 | // Burns a specific amount of the caller's tokens. Only burns the caller's tokens, so it is safe to leave this method permissionless. / | function burn(uint256 value) external virtual;
| function burn(uint256 value) external virtual;
| 1,060 |
11 | // ============ External Functions ============ //OPEERATOR ONLY: Initialize manager by passing in array of valid adapters. Only callable once. All new adapters must be addedthrough mutual upgrade._adapters Array of adapters to add to manager / | function initializeAdapters(address[] memory _adapters) external onlyOperator {
require(!initialized, "Manager already initialized");
for (uint256 i = 0; i < _adapters.length; i++) {
require(!isAdapter[_adapters[i]], "Adapter already exists");
isAdapter[_adapters[i]] = true... | function initializeAdapters(address[] memory _adapters) external onlyOperator {
require(!initialized, "Manager already initialized");
for (uint256 i = 0; i < _adapters.length; i++) {
require(!isAdapter[_adapters[i]], "Adapter already exists");
isAdapter[_adapters[i]] = true... | 18,217 |
643 | // uint ethVol = pd.ethVolumeLimit(); | if (curr == maxIACurr) {
_transferInvestmentAsset(curr, ms.getLatestAddress("P1"), amount);
} else if (curr == "ETH" && maxIACurr != "ETH") {
| if (curr == maxIACurr) {
_transferInvestmentAsset(curr, ms.getLatestAddress("P1"), amount);
} else if (curr == "ETH" && maxIACurr != "ETH") {
| 6,122 |
34 | // Helper function to calculate amount deposited into WiseLending/ | function _depositedInWiseLending(
address _poolToken
)
internal
view
returns (uint256)
| function _depositedInWiseLending(
address _poolToken
)
internal
view
returns (uint256)
| 22,215 |
19 | // Can't claim before Lock ends | require(block.timestamp >= nextTime, "TokenLock: release time is before current time");
uint256 payment = allocations[reserveWallet].div(vestingStages[reserveWallet]); // ๆป็่งฃ้้
require(payment <= allocations[reserveWallet], "TokenLock: no enough tokens to reserve");
uint256 to... | require(block.timestamp >= nextTime, "TokenLock: release time is before current time");
uint256 payment = allocations[reserveWallet].div(vestingStages[reserveWallet]); // ๆป็่งฃ้้
require(payment <= allocations[reserveWallet], "TokenLock: no enough tokens to reserve");
uint256 to... | 71,766 |
60 | // register this user as being owed no further dividends | lastDividend[_owner] = dividendSnapshots.length;
| lastDividend[_owner] = dividendSnapshots.length;
| 7,276 |
255 | // calculate fee and transfer token for fees@audit - can optimize by changing amm.swapInput/swapOutput's return type to (exchangedAmount, quoteToll, quoteSpread, quoteReserve, baseReserve) (@wraecca) | Decimal.decimal memory transferredFee = transferFee(trader, _exchange, positionResp.exchangedQuoteAssetAmount);
| Decimal.decimal memory transferredFee = transferFee(trader, _exchange, positionResp.exchangedQuoteAssetAmount);
| 10,209 |
329 | // Track the old oracle for the comptroller | PriceOracle oldOracle = oracle;
| PriceOracle oldOracle = oracle;
| 23,675 |
0 | // Include an address to specify the WitnetRequestBoard._wrb WitnetRequestBoard address./ | constructor(address _wrb) {
wrb = WitnetRequestBoardInterface(_wrb);
}
| constructor(address _wrb) {
wrb = WitnetRequestBoardInterface(_wrb);
}
| 25,780 |
12 | // Returns collateral values for two tokens, required for a fast check/amountFrom Amount of the outbound token/tokenFrom Address of the outbound token/amountTo Amount of the inbound token/tokenTo Address of the inbound token/ return collateralFrom Value of the outbound token amount in USD/ return collateralTo Value of ... | function fastCheck(
uint256 amountFrom,
address tokenFrom,
uint256 amountTo,
address tokenTo
) external view returns (uint256 collateralFrom, uint256 collateralTo);
| function fastCheck(
uint256 amountFrom,
address tokenFrom,
uint256 amountTo,
address tokenTo
) external view returns (uint256 collateralFrom, uint256 collateralTo);
| 26,144 |
82 | // METHODS | function getTradeAllowed() public view returns (bool);
function getMintAllowed() public view returns (bool);
function getBurnAllowed() public view returns (bool);
| function getTradeAllowed() public view returns (bool);
function getMintAllowed() public view returns (bool);
function getBurnAllowed() public view returns (bool);
| 45,085 |
139 | // Substract _amount | balances[_from][_id] = balances[_from][_id].sub(_amount);
| balances[_from][_id] = balances[_from][_id].sub(_amount);
| 1,268 |
40 | // Returns round info of `roundSerial`. roundSerial > 0: historyroundSerial == 0: latest / | function round(uint256 roundSerial)
public
view
returns (
uint256 serial,
uint256 openedBlock,
uint256 openedTimestamp,
uint256 closingBlock,
uint256 closingTimestamp,
| function round(uint256 roundSerial)
public
view
returns (
uint256 serial,
uint256 openedBlock,
uint256 openedTimestamp,
uint256 closingBlock,
uint256 closingTimestamp,
| 48,624 |
172 | // View function to see pending DRUGs on frontend. | function pendingAlloy(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accAlloyPerShare = pool.accAlloyPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
... | function pendingAlloy(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accAlloyPerShare = pool.accAlloyPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
... | 18,741 |
91 | // fee is total including refFee | (
uint256 fee,
uint256 refFee,
uint256 totalFees,
uint256[] memory newFees
) = _findFees(_pAmount);
uint256 arAmount = arValue(_pAmount - fee);
pToken.safeTransferFrom(user, address(this), _pAmount);
_saveFees(newFees, _referrer, refFee);
| (
uint256 fee,
uint256 refFee,
uint256 totalFees,
uint256[] memory newFees
) = _findFees(_pAmount);
uint256 arAmount = arValue(_pAmount - fee);
pToken.safeTransferFrom(user, address(this), _pAmount);
_saveFees(newFees, _referrer, refFee);
| 76,388 |
2 | // Enter 'uni' to lookup uni.tkn.eth | function addressFor(string calldata _name) public view returns (address) {
bytes32 namehash = 0x0000000000000000000000000000000000000000000000000000000000000000;
namehash = keccak256(
abi.encodePacked(namehash, keccak256(abi.encodePacked('eth')))
);
namehash = keccak256(
... | function addressFor(string calldata _name) public view returns (address) {
bytes32 namehash = 0x0000000000000000000000000000000000000000000000000000000000000000;
namehash = keccak256(
abi.encodePacked(namehash, keccak256(abi.encodePacked('eth')))
);
namehash = keccak256(
... | 51,599 |
34 | // Withdraw all assets in the safest way possible. This shouldn't fail. | function exit(uint256 balance) external returns (int256 amountAdded);
| function exit(uint256 balance) external returns (int256 amountAdded);
| 22,334 |
1 | // Mapping of Tweet id to the wallet address of the user | mapping(uint256 => address) taskToOwner;
| mapping(uint256 => address) taskToOwner;
| 19,746 |
3 | // / The creator of a contract is the owner.Ownership can be transferred. The only thing we let the owner do is mint more tokens. So the owner is administrator/controller of the token. | contract owned {
address public owner;
function owned() {
owner = msg.sender;
}
modifier onlyOwner {
if (msg.sender != owner) {
throw;
}
_ // solidity 0.3.6 does not require semi-colon after
}
function transferOwnership(address newOwner) onlyOwner {... | contract owned {
address public owner;
function owned() {
owner = msg.sender;
}
modifier onlyOwner {
if (msg.sender != owner) {
throw;
}
_ // solidity 0.3.6 does not require semi-colon after
}
function transferOwnership(address newOwner) onlyOwner {... | 29,038 |
50 | // move a given amount of tokens a new contract (destroying them here)/beneficiary address that will get tokens in new contract/amount the number of tokens to migrate | function migrate(address beneficiary, uint256 amount) external afterMinting {
require(beneficiary != address(0));
require(migrationAgent != address(0));
require(amount > 0);
// safemath subtraction will throw if balance < amount
balances[msg.sender] = balances[msg.sender].sub(amount);
totalSu... | function migrate(address beneficiary, uint256 amount) external afterMinting {
require(beneficiary != address(0));
require(migrationAgent != address(0));
require(amount > 0);
// safemath subtraction will throw if balance < amount
balances[msg.sender] = balances[msg.sender].sub(amount);
totalSu... | 26,017 |
4 | // Conversion of LP tokens to shares Simpler than Sushiswap strat because there's no compounding investment. Shares don't change. vaultId Vault lpTokens Amount of LP tokensreturn Number of shares for LP tokensreturn Total shares for this Vaultreturn Uniswap pool / | function sharesFromLp(uint256 vaultId, uint256 lpTokens)
external
view
override
returns (
uint256,
uint256,
IERC20
)
| function sharesFromLp(uint256 vaultId, uint256 lpTokens)
external
view
override
returns (
uint256,
uint256,
IERC20
)
| 18,276 |
133 | // Invariant: There will always be an ownership that has an address and is not burned before an ownership that does not have an address and is not burned. Hence, curr will not underflow. | while (true) {
curr--;
ownership = _ownerships[curr];
if (ownership.addr != address(0)) {
return ownership;
}
| while (true) {
curr--;
ownership = _ownerships[curr];
if (ownership.addr != address(0)) {
return ownership;
}
| 9,300 |
6 | // keccak256("Recollateraliser"); | bytes32 internal constant KEY_RECOLLATERALISER = 0x39e3ed1fc335ce346a8cbe3e64dd525cf22b37f1e2104a755e761c3c1eb4734f;
| bytes32 internal constant KEY_RECOLLATERALISER = 0x39e3ed1fc335ce346a8cbe3e64dd525cf22b37f1e2104a755e761c3c1eb4734f;
| 13,385 |
151 | // Initialization Variables | uint256 public MINTING_PHASE_START; // hex day that TEAM Minting Begins
uint256 public MINTING_PHASE_END; // hex day that TEAM Minting Ends
bool public IS_MINTING_ONGOING;
address public ESCROW_ADDRESS; // Contract where the MAXI is held and distributed from
address public MYSTERY_BOX_ADDRESS;
a... | uint256 public MINTING_PHASE_START; // hex day that TEAM Minting Begins
uint256 public MINTING_PHASE_END; // hex day that TEAM Minting Ends
bool public IS_MINTING_ONGOING;
address public ESCROW_ADDRESS; // Contract where the MAXI is held and distributed from
address public MYSTERY_BOX_ADDRESS;
a... | 50,935 |
43 | // Sets the platform fee address. Calling conditions:- The caller must be the owner of the contract.addr The platform fee address. / | function setPlatformFeeAddress(address addr) external;
| function setPlatformFeeAddress(address addr) external;
| 36,918 |
16 | // creator = msg.sender; | campaignUrl = _campaignUrl;
tokenReward = token(_addressOfTokenUsedAsReward);
emit LogFunderInitialized(
creator,
campaignUrl
);
| campaignUrl = _campaignUrl;
tokenReward = token(_addressOfTokenUsedAsReward);
emit LogFunderInitialized(
creator,
campaignUrl
);
| 57,530 |
21 | // Create new pending | Propose memory newPro = Propose(_sender, _receiver, _infoHash);
uint index = lsPropose.push(newPro);
if (_id == byte(0))
_id = bytes32(index);
| Propose memory newPro = Propose(_sender, _receiver, _infoHash);
uint index = lsPropose.push(newPro);
if (_id == byte(0))
_id = bytes32(index);
| 38,315 |
11 | // / | uint totalbet=betQueue[index].betAmount+betQueue[index+1].betAmount;
uint randval= random(totalbet,betQueue[index+1].blockPlaced,betQueue[index+1].bettor);
if(randval < betQueue[index].betAmount){
payout(betQueue[index].bettor,totalbet);
emit BetFinalized(... | uint totalbet=betQueue[index].betAmount+betQueue[index+1].betAmount;
uint randval= random(totalbet,betQueue[index+1].blockPlaced,betQueue[index+1].bettor);
if(randval < betQueue[index].betAmount){
payout(betQueue[index].bettor,totalbet);
emit BetFinalized(... | 26,174 |
53 | // Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. Tokens start existing when they are minted (`_mint`),and stop existing when they are burned (`_burn`). / | function _exists(uint tokenId) internal view virtual returns (bool) {
return _tokenOwners.contains(tokenId);
}
| function _exists(uint tokenId) internal view virtual returns (bool) {
return _tokenOwners.contains(tokenId);
}
| 14,100 |
46 | // HARD CHECK: Require the drawing to be started before shuffling | require(
goldenBool == true,
"Drawing hasn't started"
);
| require(
goldenBool == true,
"Drawing hasn't started"
);
| 34,952 |
32 | // The round that the given address won / | function roundForWinner(address user) public view returns (uint32) {
return winnerToRoundMapping[user];
}
| function roundForWinner(address user) public view returns (uint32) {
return winnerToRoundMapping[user];
}
| 29,750 |
112 | // Return the value of y corresponding to x on the given line. line in the form ofa rational number (numerator / denominator).If you treat a line as a line segment instead of a line, you should runincludesDomain(line, x) to check whether x is included in the line's domain or not. To guarantee accuracy, the bit length o... | function _mapXtoY(LineSegment memory line, uint64 x)
internal
pure
returns (uint128 numerator, uint64 denominator)
| function _mapXtoY(LineSegment memory line, uint64 x)
internal
pure
returns (uint128 numerator, uint64 denominator)
| 28,082 |
14 | // The following functions are overrides required by Solidity. |
function supportsInterface(bytes4 interfaceId)
public
view
override(HealthEntity)
returns (bool)
|
function supportsInterface(bytes4 interfaceId)
public
view
override(HealthEntity)
returns (bool)
| 19,329 |
21 | // Generates a pseudo-random seed for a raffle. / | function _generateSeed() private view returns (uint256) {
return
uint256(
keccak256(
abi.encodePacked(
raffles.length,
blockhash(block.number - 1),
block.coinbase,
... | function _generateSeed() private view returns (uint256) {
return
uint256(
keccak256(
abi.encodePacked(
raffles.length,
blockhash(block.number - 1),
block.coinbase,
... | 78,828 |
32 | // Function which returns claims for a given aggregated from and to index and amount of sharesOverTime This function is called internally, but also can be used by other protocols so has some checkswhich are unnecessary if it was solely an internal function _fromLoanIdx Loan index on which he wants to start aggregate cl... | function getClaimsFromAggregated(
| function getClaimsFromAggregated(
| 25,521 |
20 | // Total FRAX possessed in various forms | uint256 sum_frax = allocations[0] + allocations[1];
allocations[2] = sum_frax;
| uint256 sum_frax = allocations[0] + allocations[1];
allocations[2] = sum_frax;
| 19,607 |
28 | // getFantomMint returns the address of the Fantom fMint contract. / | function getFantomMint() external view returns (address){
return getAddress(MOD_FANTOM_MINT);
}
| function getFantomMint() external view returns (address){
return getAddress(MOD_FANTOM_MINT);
}
| 39,877 |
55 | // Allow for a 50% deviation from the market vQuote TWAP price to close this position | require(deviation < 5e17, "Amount submitted too far from the market price of the position");
| require(deviation < 5e17, "Amount submitted too far from the market price of the position");
| 3,135 |
10 | // Saved addresses of tokens that DAO is holding./ return array of holdings addresses. | function holdings() external view returns (address[] memory);
| function holdings() external view returns (address[] memory);
| 1,772 |
329 | // PToken initialize does the bulk of the work | super.init(comptroller_, interestRateModel_, initialExchangeRateMantissa_, name_, symbol_, decimals_);
| super.init(comptroller_, interestRateModel_, initialExchangeRateMantissa_, name_, symbol_, decimals_);
| 18,664 |
124 | // uint256 rFomo = tFomo.mul(currentRate); | uint256 rDev = tDev.mul(currentRate);
uint256 rnft = feeNFT.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rLiquidity);
if (_isExcluded[address(this)]) {
_tOwned[address(this)] = _tOwned[address(this)].add(... | uint256 rDev = tDev.mul(currentRate);
uint256 rnft = feeNFT.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rLiquidity);
if (_isExcluded[address(this)]) {
_tOwned[address(this)] = _tOwned[address(this)].add(... | 24,532 |
9 | // All token holders./ return array of addresses of token holders. | function holders() external view returns (address[] memory);
| function holders() external view returns (address[] memory);
| 10,746 |
37 | // Withdraw rewards from a specific token. token_ address of tokens to withdraw. / | function harvestToken(address token_) external whenNotPaused nonReentrant {
require(stakeHolders[_msgSender()].inStake, "Not in stake");
require(validTokens.contains(token_), "Invalid token");
_harvestToken(token_, _msgSender());
}
| function harvestToken(address token_) external whenNotPaused nonReentrant {
require(stakeHolders[_msgSender()].inStake, "Not in stake");
require(validTokens.contains(token_), "Invalid token");
_harvestToken(token_, _msgSender());
}
| 27,692 |
22 | // Claim the player's dividends of any round. _TowerType the tower type (0 to 6) _RoundID the round ID / | function dividendCashout (uint256 _TowerType, uint256 _RoundID) public {
require (GameRounds[_TowerType].timeLimit > 0);
uint256 _warriors = players[msg.sender].TowersList[_TowerType].RoundList[_RoundID].warriors;
require (_warriors > 0);
uint256 _totalEarned = _warriors*GameRounds[... | function dividendCashout (uint256 _TowerType, uint256 _RoundID) public {
require (GameRounds[_TowerType].timeLimit > 0);
uint256 _warriors = players[msg.sender].TowersList[_TowerType].RoundList[_RoundID].warriors;
require (_warriors > 0);
uint256 _totalEarned = _warriors*GameRounds[... | 36,177 |
41 | // Enable or disable approval for a third party ("operator") to manage all of `msg.sender`'s assets Emits the ApprovalForAll event. The contract MUST allow multiple operators per owner. _operator Address to add to the set of authorized operators _approved True if the operator is approved, false to revoke approval / | function setApprovalForAll(address _operator, bool _approved) external;
| function setApprovalForAll(address _operator, bool _approved) external;
| 17,263 |
15 | // Copy the foreground color. | for (uint ii = 0; ii < fg.length; ii++) {
output[offset++] = fg[ii];
}
| for (uint ii = 0; ii < fg.length; ii++) {
output[offset++] = fg[ii];
}
| 46,516 |
10 | // The LZRateProviderPoker Contract tritium.eth This is a simple contract to hold some eth and a list of LayerZeroRateProviders that need to be poked on mainnet When called by a set keeper, it uses it's internal eth balance to call updateRate() on all the listed providers. The contract includes the ability to withdraw ... | contract LZRateProviderPoker is ConfirmedOwner, Pausable, KeeperCompatibleInterface {
using EnumerableSet for EnumerableSet.AddressSet;
event poked(address[] gaugelist, uint256 cost);
event wrongCaller(address sender, address registry);
event minWaitPeriodUpdated(uint256 minWaitSeconds);
event gas... | contract LZRateProviderPoker is ConfirmedOwner, Pausable, KeeperCompatibleInterface {
using EnumerableSet for EnumerableSet.AddressSet;
event poked(address[] gaugelist, uint256 cost);
event wrongCaller(address sender, address registry);
event minWaitPeriodUpdated(uint256 minWaitSeconds);
event gas... | 25,805 |
210 | // Check for the case where there is a bid from the new owner and refund it. Any other bid can stay in place. | Bid memory bid = punkBids[tokenId];
if (bid.bidder == msg.sender) {
| Bid memory bid = punkBids[tokenId];
if (bid.bidder == msg.sender) {
| 33,243 |
193 | // Compound PCV Deposit constructor/_core Fei Core for reference/_cToken Compound cToken to deposit | constructor(address _core, address _cToken) CoreRef(_core) {
cToken = CToken(_cToken);
require(cToken.isCToken(), "CompoundPCVDeposit: Not a cToken");
}
| constructor(address _core, address _cToken) CoreRef(_core) {
cToken = CToken(_cToken);
require(cToken.isCToken(), "CompoundPCVDeposit: Not a cToken");
}
| 40,695 |
3 | // The maximum value that can be returned from getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK) | uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;
| uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;
| 4,333 |
6 | // Gets the rects a trait from storage traitIndex The trait type index traitValue The location within the array / |
function getRects(uint256 traitIndex, uint256 traitValue)
public
view
returns (bytes memory rects)
|
function getRects(uint256 traitIndex, uint256 traitValue)
public
view
returns (bytes memory rects)
| 35,919 |
9 | // Reduce the patron's investment. | totalInvestment = totalInvestment.sub(amount);
| totalInvestment = totalInvestment.sub(amount);
| 4,274 |
68 | // Called to mint controlled tokens.Ensures that token listener callbacks are fired./to The user who is receiving the tokens/amount The amount of tokens they are receiving/controlledToken The token that is going to be minted/referrer The user who referred the minting | function _mint(address to, uint256 amount, address controlledToken, address referrer) internal {
if (address(prizeStrategy) != address(0)) {
prizeStrategy.beforeTokenMint(to, amount, controlledToken, referrer);
}
ControlledToken(controlledToken).controllerMint(to, amount);
}
| function _mint(address to, uint256 amount, address controlledToken, address referrer) internal {
if (address(prizeStrategy) != address(0)) {
prizeStrategy.beforeTokenMint(to, amount, controlledToken, referrer);
}
ControlledToken(controlledToken).controllerMint(to, amount);
}
| 38,513 |
347 | // ไปทๆ ผๅปๅบฆไธๅฑ | int24 tickUpper;
| int24 tickUpper;
| 56,811 |
18 | // UintArray | contract DynamicUintArrayMock {
using DynamicArray for DynamicArray.UintArray;
DynamicArray.UintArray private _array;
function set(uint256 position, uint256 value) public {
_array.set(position, value);
}
function get(uint256 position) public view returns (uint256) {
return _array.get(position);
}... | contract DynamicUintArrayMock {
using DynamicArray for DynamicArray.UintArray;
DynamicArray.UintArray private _array;
function set(uint256 position, uint256 value) public {
_array.set(position, value);
}
function get(uint256 position) public view returns (uint256) {
return _array.get(position);
}... | 12,873 |
17 | // Returns an array of authorized destination addressesreturn Array of addresses authorized to pull funds from a token lock / | function getTokenDestinations() external view override returns (address[] memory) {
address[] memory dstList = new address[](_tokenDestinations.length());
for (uint256 i = 0; i < _tokenDestinations.length(); i++) {
dstList[i] = _tokenDestinations.at(i);
}
return dstList;
... | function getTokenDestinations() external view override returns (address[] memory) {
address[] memory dstList = new address[](_tokenDestinations.length());
for (uint256 i = 0; i < _tokenDestinations.length(); i++) {
dstList[i] = _tokenDestinations.at(i);
}
return dstList;
... | 15,952 |
152 | // currStake (the transcoder's delegatedAmount field) will reflect the transcoder's stake from lastActiveStakeUpdateRound because it is updated every time lastActiveStakeUpdateRound is updated The current active total stake is set to currStake to ensure that the value can be used in updateTranscoderWithRewards() and up... | if (t.lastActiveStakeUpdateRound < currRound) {
t.earningsPoolPerRound[currRound].setStake(currStake);
}
| if (t.lastActiveStakeUpdateRound < currRound) {
t.earningsPoolPerRound[currRound].setStake(currStake);
}
| 33,942 |
284 | // flash loan to position | if(position > minWant){
doDyDxFlashLoan(deficit, position);
}
| if(position > minWant){
doDyDxFlashLoan(deficit, position);
}
| 9,087 |
6 | // Vote count will not change and tally is available, terminal state | Final
| Final
| 28,090 |
8 | // Signature using EIP712 | } else if (signatureType == SignatureType.EIP712) {
| } else if (signatureType == SignatureType.EIP712) {
| 36,083 |
1 | // tokenId -> max_supply | mapping(uint256 => uint256) public tokenMaxSupply;
| mapping(uint256 => uint256) public tokenMaxSupply;
| 20,947 |
40 | // handle if this token and target chain token in bridge have different decimals current decimals = 9 -- 100 tokens == 100000000000 target decimals = 18 -- 100 tokens == 100000000000000000000 to get current amount to transfer, need to multiply by ratio of 10^currentDecimals / 10^targetDecimals | uint256 _swapAmount = swap.amount;
if (targetTokenDecimals > 0) {
_swapAmount =
(_swapAmount * 10**_token.decimals()) /
10**targetTokenDecimals;
}
| uint256 _swapAmount = swap.amount;
if (targetTokenDecimals > 0) {
_swapAmount =
(_swapAmount * 10**_token.decimals()) /
10**targetTokenDecimals;
}
| 53,340 |
13 | // Duration additional profit percent | uint256 profit_percent = 6; //0.6%
uint256 stake_duration = safeDivision(now - stake_start_time, 30*day); // devide 30 days
if (stake_duration >= 1) {
profit_percent += 1;
}
| uint256 profit_percent = 6; //0.6%
uint256 stake_duration = safeDivision(now - stake_start_time, 30*day); // devide 30 days
if (stake_duration >= 1) {
profit_percent += 1;
}
| 40,437 |
168 | // initial delay between spawns | uint256 public initialDelay;
| uint256 public initialDelay;
| 5,233 |
13 | // When the latest bid expires and the auction can be settled | uint48 bidExpiry; // [unix epoch time]
| uint48 bidExpiry; // [unix epoch time]
| 58,709 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.