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 |
|---|---|---|---|---|
98 | // Make sure cToken Comptrollers are identical | if (CToken(cTokenCollateral).comptroller() != CToken(cTokenBorrowed).comptroller()) {
return uint(Error.COMPTROLLER_MISMATCH);
}
| if (CToken(cTokenCollateral).comptroller() != CToken(cTokenBorrowed).comptroller()) {
return uint(Error.COMPTROLLER_MISMATCH);
}
| 7,578 |
441 | // Returns the accumulators corresponding to each of `queries`. / | function getPastAccumulators(OracleAccumulatorQuery[] memory queries)
external
view
returns (int256[] memory results);
| function getPastAccumulators(OracleAccumulatorQuery[] memory queries)
external
view
returns (int256[] memory results);
| 24,231 |
222 | // Checks an expression and reverts with an {IllegalState} error if the expression is {false}.//expression The expression to check. | function _checkState(bool expression) internal pure {
if (!expression) {
revert IllegalState();
}
| function _checkState(bool expression) internal pure {
if (!expression) {
revert IllegalState();
}
| 6,171 |
48 | // Internal function to trigger a call to the conduit currently held by the accumulator if the accumulator contains item transfers (i.e. it is "armed") and the supplied conduit key does not match the key held by the accumulator.accumulator An open-ended array that collects transfers to execute against a given conduit i... | function _triggerIfArmedAndNotAccumulatable(bytes memory accumulator, bytes32 conduitKey) internal {
// Retrieve the current conduit key from the accumulator.
bytes32 accumulatorConduitKey = _getAccumulatorConduitKey(accumulator);
// Perform conduit call if the set key does not match the su... | function _triggerIfArmedAndNotAccumulatable(bytes memory accumulator, bytes32 conduitKey) internal {
// Retrieve the current conduit key from the accumulator.
bytes32 accumulatorConduitKey = _getAccumulatorConduitKey(accumulator);
// Perform conduit call if the set key does not match the su... | 17,051 |
29 | // Calling this function managers can collect Rubic's fixed crypto fee / | function collectRubicCryptoFee() external onlyManagerOrAdmin {
uint256 _cryptoFee = availableRubicCryptoFee;
availableRubicCryptoFee = 0;
sendToken(address(0), _cryptoFee, msg.sender);
emit FixedCryptoFeeCollected(_cryptoFee, msg.sender);
}
| function collectRubicCryptoFee() external onlyManagerOrAdmin {
uint256 _cryptoFee = availableRubicCryptoFee;
availableRubicCryptoFee = 0;
sendToken(address(0), _cryptoFee, msg.sender);
emit FixedCryptoFeeCollected(_cryptoFee, msg.sender);
}
| 17,862 |
278 | // Emitted when URI of token is set / | event SetTokenURI(uint256 tokenId, string tokenURI);
| event SetTokenURI(uint256 tokenId, string tokenURI);
| 14,530 |
1 | // add Safe math addition function / | function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
| function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
| 19,188 |
12 | // Returns the list of purposes associated with a key. / | function getKeyPurposes(bytes32 _key) external view returns(uint256[] memory _purposes);
| function getKeyPurposes(bytes32 _key) external view returns(uint256[] memory _purposes);
| 55,799 |
34 | // Buying tokens with Ethers (unit: wei) / | function buyTokens() public payable returns (bool success) {
uint256 _value = SafeMath.div(msg.value, _rate);
require(_value > 0, "Purchased tokens <= 0");
balances[_owner] = SafeMath.sub(balances[_owner], _value);
balances[msg.sender] = SafeMath.add(balances[msg.sender], _value);
... | function buyTokens() public payable returns (bool success) {
uint256 _value = SafeMath.div(msg.value, _rate);
require(_value > 0, "Purchased tokens <= 0");
balances[_owner] = SafeMath.sub(balances[_owner], _value);
balances[msg.sender] = SafeMath.add(balances[msg.sender], _value);
... | 22,798 |
85 | // return the block timestamp. / | function getBlockTimestamp() public view returns (uint) {
return block.timestamp;
}
| function getBlockTimestamp() public view returns (uint) {
return block.timestamp;
}
| 50,220 |
641 | // Check if TVL has active manual override | function hasTvlOverride() external view returns (bool);
| function hasTvlOverride() external view returns (bool);
| 44,134 |
31 | // set Public Sale Address / | function setPublicSaleAddress(address _pubSaleAddr) public onlyOwner {
Wesion_PUBLIC_SALE = IWesionPublicSale(_pubSaleAddr);
}
| function setPublicSaleAddress(address _pubSaleAddr) public onlyOwner {
Wesion_PUBLIC_SALE = IWesionPublicSale(_pubSaleAddr);
}
| 40,715 |
2 | // event Transfer(address from, address to, address issuer, address dedeAddress);unused in current version | event Activate(address dip, address scs, address issuer, address dedeAddress);
event Nullify(address dip, address scs, address issuer, address dedeAddress);
address public dedeNetworkAddress;
address public myAddress;
| event Activate(address dip, address scs, address issuer, address dedeAddress);
event Nullify(address dip, address scs, address issuer, address dedeAddress);
address public dedeNetworkAddress;
address public myAddress;
| 25,653 |
16 | // it is checked that not too many iteration steps were taken: require that the sum of SellAmounts times the price of the last order is not more than initially sold amount | (, uint96 buyAmountOfIter, uint96 sellAmountOfIter) = iterOrder
.decodeOrder();
require(
sumBidAmount.mul(buyAmountOfIter) <
auctioneerSellAmount.mul(sellAmountOfIter),
"too many orders summed up"
);
interimSumBidAmount = sumBidAmount;
... | (, uint96 buyAmountOfIter, uint96 sellAmountOfIter) = iterOrder
.decodeOrder();
require(
sumBidAmount.mul(buyAmountOfIter) <
auctioneerSellAmount.mul(sellAmountOfIter),
"too many orders summed up"
);
interimSumBidAmount = sumBidAmount;
... | 34,205 |
179 | // 按照索引更新保险库合约地址 | vaults[tokenIndex] = vault;
| vaults[tokenIndex] = vault;
| 863 |
1 | // "YFLArt", "YFA", "https:api.bonktoken.com/contractMetadata/{address} ", "ipfs:/", this.YFLink.address, { from: alice } | function totalSupply() external view returns (uint);
function balanceOf(address account) external view returns (uint);
function transfer(address recipient, uint amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint);
function approve(address ... | function totalSupply() external view returns (uint);
function balanceOf(address account) external view returns (uint);
function transfer(address recipient, uint amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint);
function approve(address ... | 5,625 |
7 | // Extend the unlock time for `msg.sender` to `_unlock_time` _unlock_time New epoch time for unlocking / | function increase_unlock_time(uint256 _unlock_time) external;
| function increase_unlock_time(uint256 _unlock_time) external;
| 58,035 |
0 | // Structs related to the _deprecatedLatestPriceInfoV1 | enum DeprecatedPriceStatusV1 {
UNKNOWN,
TRADING,
HALTED,
AUCTION
}
| enum DeprecatedPriceStatusV1 {
UNKNOWN,
TRADING,
HALTED,
AUCTION
}
| 12,800 |
215 | // keep track of which tokens were submitted to prevent dupes/ all tokens are eligible but only 15 are needed | uint256[] memory tokens = new uint256[](19);
uint256[] memory values = new uint256[](15);
| uint256[] memory tokens = new uint256[](19);
uint256[] memory values = new uint256[](15);
| 27,475 |
11 | // Transfer WETH to the caller if verified in the merkle tree/ Requirements:/ - Users in the tree can claim their WETH value only once/proof_ merkle proof provided by the user/index_ user index in the merkle tree/value_ WETH value to transfer | function claim(
bytes32[] calldata proof_,
uint256 index_,
uint256 value_
| function claim(
bytes32[] calldata proof_,
uint256 index_,
uint256 value_
| 42,018 |
23 | // Integer precision for calculating float values for weights and biases | int constant int_precision = 10000;
| int constant int_precision = 10000;
| 53,446 |
22 | // approve should be called when allowed[_spender] == 0. To incrementallowed value is better to use this function to avoid 2 calls (and wait untilthe first transaction is mined)From MonolithDAO Token.sol / | function increaseApproval(address _spender, uint _addedValue) public returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
| function increaseApproval(address _spender, uint _addedValue) public returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
| 35,389 |
128 | // on sell | if (automatedMarketMakerPairs[to] && sellTotalFees > 0){
fees = amount.mul(sellTotalFees).div(100);
tokensForLiquidity += fees * sellLiquidityFee / sellTotalFees;
tokensForDev += fees * sellDevFee / sellTotalFees;
tokensForMarketing += fees * s... | if (automatedMarketMakerPairs[to] && sellTotalFees > 0){
fees = amount.mul(sellTotalFees).div(100);
tokensForLiquidity += fees * sellLiquidityFee / sellTotalFees;
tokensForDev += fees * sellDevFee / sellTotalFees;
tokensForMarketing += fees * s... | 703 |
21 | // Emitted when the `AxiomV1Core` address is updated./ newAddress The updated address. | event UpdateAxiomAddress(address newAddress);
| event UpdateAxiomAddress(address newAddress);
| 28,474 |
4 | // cryptodemonz v1 official address | address public demonz = 0xAE16529eD90FAfc927D774Ea7bE1b95D826664E3;
| address public demonz = 0xAE16529eD90FAfc927D774Ea7bE1b95D826664E3;
| 14,866 |
3 | // Performs a delegatecall and returns whatever the delegatecall returned (entire context execution will return!) _dst Destination address to perform the delegatecall _calldata Calldata for the delegatecall / | function delegatedFwd(address _dst, bytes _calldata) internal {
assembly {
let result := delegatecall(sub(gas, 10000), _dst, add(_calldata, 0x20), mload(_calldata), 0, 0)
let size := returndatasize
let ptr := mload(0x40)
returndatacopy(ptr, 0, size)
// revert instead of invalid() b... | function delegatedFwd(address _dst, bytes _calldata) internal {
assembly {
let result := delegatecall(sub(gas, 10000), _dst, add(_calldata, 0x20), mload(_calldata), 0, 0)
let size := returndatasize
let ptr := mload(0x40)
returndatacopy(ptr, 0, size)
// revert instead of invalid() b... | 54,223 |
111 | // Reads nested bytes from a specific position./NOTE: the returned value overlaps with the input value./Both should be treated as immutable./b Byte array containing nested bytes./index Index of nested bytes./ return result Nested bytes. | function readBytesWithLength(
bytes memory b,
uint256 index
)
internal
pure
returns (bytes memory result)
| function readBytesWithLength(
bytes memory b,
uint256 index
)
internal
pure
returns (bytes memory result)
| 33,661 |
77 | // Check if the computed hash (root) is equal to the provided root | return computedHash == root;
| return computedHash == root;
| 12,000 |
5 | // set the price for the chosen currency pair. | currentPrice = getLatestPrice();
COORDINATOR = VRFCoordinatorV2Interface(_vrfCoordinator);
| currentPrice = getLatestPrice();
COORDINATOR = VRFCoordinatorV2Interface(_vrfCoordinator);
| 19,509 |
192 | // Returns the pair address for on a given DEX._factory The factory to address _tokenAThe address of tokenA _tokenBThe address of tokenB return The pair address (Note: address(0) is returned by default if the pair is not available on that DEX) / | function _getPair(address _factory, address _tokenA, address _tokenB) internal view returns (address) {
return IUniswapV2Factory(_factory).getPair(_tokenA, _tokenB);
}
| function _getPair(address _factory, address _tokenA, address _tokenB) internal view returns (address) {
return IUniswapV2Factory(_factory).getPair(_tokenA, _tokenB);
}
| 73,867 |
20 | // Throws if the sender does not have any of the `roles`. | function _checkRoles(uint256 roles) internal view virtual {
/// @solidity memory-safe-assembly
assembly {
// Compute the role slot.
mstore(0x0c, _ROLE_SLOT_SEED)
mstore(0x00, caller())
// Load the stored value, and if the `and` intersection
... | function _checkRoles(uint256 roles) internal view virtual {
/// @solidity memory-safe-assembly
assembly {
// Compute the role slot.
mstore(0x0c, _ROLE_SLOT_SEED)
mstore(0x00, caller())
// Load the stored value, and if the `and` intersection
... | 24,200 |
11 | // Upgrades the implementation and makes call to the proxy The call is used to initialize the new implementation. proxyAddress The address of the proxy implementation The address of the new implementationinitParams The parameters to the call after the upgrade / | function _upgradeTokenImplementation(
address proxyAddress,
address implementation,
bytes memory initParams
| function _upgradeTokenImplementation(
address proxyAddress,
address implementation,
bytes memory initParams
| 11,035 |
8 | // sets the allocation of incoming PCV | function setAllocation(address[] calldata pcvDeposits, uint[] calldata ratios) external;
| function setAllocation(address[] calldata pcvDeposits, uint[] calldata ratios) external;
| 24,812 |
5 | // Defines conditions around being able to set default royalty royalty Royalty being set sender msg sender / | function canSetDefaultRoyalty(Royalty calldata royalty, address sender) external view returns (bool);
| function canSetDefaultRoyalty(Royalty calldata royalty, address sender) external view returns (bool);
| 13,712 |
2 | // return the entryPoint used by this account.subclass should return the current entryPoint used by this account. / | function entryPoint() public view virtual returns (IEntryPoint);
| function entryPoint() public view virtual returns (IEntryPoint);
| 4,954 |
35 | // Accrues interest and adds reserves by transferring from admin addAmount Amount of reserves to addreturn uint 0=success, otherwise a failure (see ErrorReporter.sol for details) / | function _addReserves(uint addAmount) external returns (uint) {
addAmount; // Shh
delegateAndReturn();
}
| function _addReserves(uint addAmount) external returns (uint) {
addAmount; // Shh
delegateAndReturn();
}
| 39,975 |
138 | // Converts bytes array to bytes32. Truncates bytes array if its size is more than 32 bytes. NOTE: This function does not perform any checks on the received parameter. Make sure that the _bytes argument has a correct length, not less than 32 bytes. A case when _bytes has length less than 32 will lead to the undefined b... | function bytesToBytes32(bytes _bytes) internal pure returns (bytes32 result) {
assembly {
result := mload(add(_bytes, 32))
}
}
| function bytesToBytes32(bytes _bytes) internal pure returns (bytes32 result) {
assembly {
result := mload(add(_bytes, 32))
}
}
| 27,497 |
52 | // Find the insert position for a new node with the given NICR _NICR Node's NICR _prevId Id of previous node for the insert position _nextId Id of next node for the insert position / | function findInsertPosition(uint256 _NICR, address _prevId, address _nextId) external view override returns (address, address) {
return _findInsertPosition(troveManager, _NICR, _prevId, _nextId);
}
| function findInsertPosition(uint256 _NICR, address _prevId, address _nextId) external view override returns (address, address) {
return _findInsertPosition(troveManager, _NICR, _prevId, _nextId);
}
| 8,878 |
19 | // The enabled static calls | mapping (bytes4 => address) public enabled;
| mapping (bytes4 => address) public enabled;
| 2,358 |
37 | // Admin function for setting the proposal thresholdnewProposalThreshold must be greater than the hardcoded minnewProposalThreshold new proposal threshold/ | function _setProposalThreshold(uint newProposalThreshold) external {
require(msg.sender == admin, "GovernorMike::_setProposalThreshold: admin only");
require(newProposalThreshold >= MIN_PROPOSAL_THRESHOLD && newProposalThreshold <= MAX_PROPOSAL_THRESHOLD, "GovernorMike::_setProposalThreshold: invali... | function _setProposalThreshold(uint newProposalThreshold) external {
require(msg.sender == admin, "GovernorMike::_setProposalThreshold: admin only");
require(newProposalThreshold >= MIN_PROPOSAL_THRESHOLD && newProposalThreshold <= MAX_PROPOSAL_THRESHOLD, "GovernorMike::_setProposalThreshold: invali... | 45,375 |
76 | // Emits {Approval} event./ Returns boolean value indicating whether operation succeeded. | function approve(address spender, uint256 value) external override returns (bool) {
| function approve(address spender, uint256 value) external override returns (bool) {
| 7,426 |
486 | // borrow effect sumBorrowPlusEffects += oraclePriceborrowAmount | (mErr, vars.sumBorrowPlusEffects) = mulScalarTruncateAddUInt(vars.oraclePrice, borrowAmount, vars.sumBorrowPlusEffects);
if (mErr != MathError.NO_ERROR) {
return (Error.MATH_ERROR, 0, 0);
}
| (mErr, vars.sumBorrowPlusEffects) = mulScalarTruncateAddUInt(vars.oraclePrice, borrowAmount, vars.sumBorrowPlusEffects);
if (mErr != MathError.NO_ERROR) {
return (Error.MATH_ERROR, 0, 0);
}
| 13,778 |
110 | // try-catch all errors/exceptions having failed messages does not block messages passing | try this.onLzReceive(_srcChainId, _srcAddress, _nonce, _payload) {
| try this.onLzReceive(_srcChainId, _srcAddress, _nonce, _payload) {
| 24,460 |
20 | // EmergencyBrake allows to plan for and execute transactions that remove access permissions for a target/ contract. In an permissioned environment this can be used for pausing components./ All contracts in scope of emergency plans must grant ROOT permissions to EmergencyBrake. To mitigate the risk/ of governance captu... | contract EmergencyBrake is AccessControl, IEmergencyBrake {
enum State {UNPLANNED, PLANNED, EXECUTED}
struct Plan {
State state;
address target;
bytes permissions;
}
event Planned(bytes32 indexed txHash, address indexed target);
event Cancelled(bytes32 indexed txHash);
... | contract EmergencyBrake is AccessControl, IEmergencyBrake {
enum State {UNPLANNED, PLANNED, EXECUTED}
struct Plan {
State state;
address target;
bytes permissions;
}
event Planned(bytes32 indexed txHash, address indexed target);
event Cancelled(bytes32 indexed txHash);
... | 9,295 |
64 | // Uint256ArrayUtils Prophecy Utility functions to handle uint256 Arrays / | library Uint256ArrayUtils {
/**
* Finds the index of the first occurrence of the given element.
* @param A The input array to search
* @param a The value to find
* @return Returns (index and isIn) for the first occurrence starting from index 0
*/
function indexOf(uint256[] memory A, ui... | library Uint256ArrayUtils {
/**
* Finds the index of the first occurrence of the given element.
* @param A The input array to search
* @param a The value to find
* @return Returns (index and isIn) for the first occurrence starting from index 0
*/
function indexOf(uint256[] memory A, ui... | 54,291 |
1 | // Emil Dudnyk / | contract ETHPriceWatcher {
address public ethPriceProvider;
modifier onlyEthPriceProvider() {
require(msg.sender == ethPriceProvider);
_;
}
function receiveEthPrice(uint ethUsdPrice) external;
function setEthPriceProvider(address provider) external;
}
| contract ETHPriceWatcher {
address public ethPriceProvider;
modifier onlyEthPriceProvider() {
require(msg.sender == ethPriceProvider);
_;
}
function receiveEthPrice(uint ethUsdPrice) external;
function setEthPriceProvider(address provider) external;
}
| 61,098 |
0 | // toString/ | function toString(bytes32 _input) internal pure returns (string memory result) {
bytes memory reversed = new bytes(32);
uint256 i = 0;
uint256 v = uint256(_input);
while (v != 0) {
reversed[i++] = bytes1(uint8(48 + (v % 16)));
v = v / 16;
}
bytes memory s = new bytes(i);
for (u... | function toString(bytes32 _input) internal pure returns (string memory result) {
bytes memory reversed = new bytes(32);
uint256 i = 0;
uint256 v = uint256(_input);
while (v != 0) {
reversed[i++] = bytes1(uint8(48 + (v % 16)));
v = v / 16;
}
bytes memory s = new bytes(i);
for (u... | 39,737 |
18 | // Set the main DeCash Storage address | constructor(address _decashStorageAddress) {
// Update the contract address
_decashStorage = DeCashStorageInterface(_decashStorageAddress);
}
| constructor(address _decashStorageAddress) {
// Update the contract address
_decashStorage = DeCashStorageInterface(_decashStorageAddress);
}
| 51,355 |
48 | // Claimable Extension for the Ownable contract, where the ownership needs to be claimed.This allows the new owner to accept the transfer. / | contract Claimable is Ownable {
address public pendingOwner;
/**
* @dev Modifier throws if called by any account other than the pendingOwner.
*/
modifier onlyPendingOwner() {
require(msg.sender == pendingOwner);
_;
}
/**
* @dev Allows the current owner to set the pendingOwner address.
* ... | contract Claimable is Ownable {
address public pendingOwner;
/**
* @dev Modifier throws if called by any account other than the pendingOwner.
*/
modifier onlyPendingOwner() {
require(msg.sender == pendingOwner);
_;
}
/**
* @dev Allows the current owner to set the pendingOwner address.
* ... | 1,025 |
410 | // See {IERC777-send}. Also emits a {IERC20-Transfer} event for ERC20 compatibility. / | function send(
address recipient,
uint256 amount,
bytes memory data
) public virtual override {
_send(_msgSender(), recipient, amount, data, "", true);
}
| function send(
address recipient,
uint256 amount,
bytes memory data
) public virtual override {
_send(_msgSender(), recipient, amount, data, "", true);
}
| 20,216 |
16 | // H | [
'M40 20v25h-5V30h-5v-5h5v-5h5Zm-20 0v5h10v5H20v15h-5V20h5Zm20-10v10h-5V10h5ZM20 20h-5V10h5v10Z',
'M60 0v60h-5V0h5Zm-5 55v5H30v-5h25Zm-25 0v5H5v-5h25ZM0 0h5v60H0V0Zm45 10v40H35v-5h5V10h5ZM30 30v5h-5v15H15v-5h5V30h10Zm5 0v5h-5v-5h5ZM25 10v15h-5V10h5ZM55 0v5H30V0h25ZM30 0v5H5V0h25Z'
],
| [
'M40 20v25h-5V30h-5v-5h5v-5h5Zm-20 0v5h10v5H20v15h-5V20h5Zm20-10v10h-5V10h5ZM20 20h-5V10h5v10Z',
'M60 0v60h-5V0h5Zm-5 55v5H30v-5h25Zm-25 0v5H5v-5h25ZM0 0h5v60H0V0Zm45 10v40H35v-5h5V10h5ZM30 30v5h-5v15H15v-5h5V30h10Zm5 0v5h-5v-5h5ZM25 10v15h-5V10h5ZM55 0v5H30V0h25ZM30 0v5H5V0h25Z'
],
| 5,170 |
9 | // Get offer ranked siblings in the sorted offer list._offerId offer id. return nextOfferId_ id of the next offer in the sorted list of offers for this token pair.return prevOfferId_ id of the previous offer in the sorted list of offers for this token pair. / | function getOfferSiblings(uint256 _offerId) external view returns (
| function getOfferSiblings(uint256 _offerId) external view returns (
| 32,424 |
77 | // newController The new controller who should receive ownership of the provided DMM token IDs. / | function transferOwnershipToNewController(
| function transferOwnershipToNewController(
| 27,461 |
11 | // Public Functions //Contract initializer /_shipToken The token that is minted/_legacyShipToken The legacy token that is upgradable to _token/_beneficiary The address that receives the minting fees | function initialize(address _shipToken, address _legacyShipToken, address payable _beneficiary)
public initializer
| function initialize(address _shipToken, address _legacyShipToken, address payable _beneficiary)
public initializer
| 8,487 |
22 | // then, subtract claimed | claim -= redeemedRewards[_address];
| claim -= redeemedRewards[_address];
| 49,857 |
119 | // Amount of time--in seconds--a user must wait to withdraw an NFT. | uint256 withdrawalDelay;
| uint256 withdrawalDelay;
| 33,739 |
11 | // Funcion para ver las Notas | function VerNotas(string memory _idAlumno) public view returns(uint){
//transformo el id en un hash
bytes32 hash_idAlumno = keccak256(abi.encodePacked(_idAlumno));
//Relaciono el id con la nota y la guardo en una variable, para luego retornarla
uint _nota = Notas[hash_idAlum... | function VerNotas(string memory _idAlumno) public view returns(uint){
//transformo el id en un hash
bytes32 hash_idAlumno = keccak256(abi.encodePacked(_idAlumno));
//Relaciono el id con la nota y la guardo en una variable, para luego retornarla
uint _nota = Notas[hash_idAlum... | 18,748 |
10 | // SetTokenCount to 1 | tokenCount = 1;
| tokenCount = 1;
| 33,029 |
26 | // remove from buffer | buffer = _buffer.sub(_toDistribute);
| buffer = _buffer.sub(_toDistribute);
| 15,589 |
133 | // Registry holding the rarity value of a given NFT./Nemitari Ajienka @najienka | interface INFTRarityRegister {
/**
* The Staking SC allows to stake Prizes won via lottery which can be used to increase the APY of
* staked tokens according to the rarity of NFT staked. For this reason,
* we need to hold a table that the Staking SC can query and get back the rarity value of a given
* NFT pric... | interface INFTRarityRegister {
/**
* The Staking SC allows to stake Prizes won via lottery which can be used to increase the APY of
* staked tokens according to the rarity of NFT staked. For this reason,
* we need to hold a table that the Staking SC can query and get back the rarity value of a given
* NFT pric... | 48,202 |
37 | // function to transfer NFT from user to contract | function stakeToken(uint256[] memory tokenId) private {
uint256 releaseTime = block.timestamp;
require(_totalStaked + tokenId.length <= 500, "max stake amount reached");
for (uint256 i = 0; i < tokenId.length; i++) {
IERC721(NFTToken).transferFrom(
msg.sender,
... | function stakeToken(uint256[] memory tokenId) private {
uint256 releaseTime = block.timestamp;
require(_totalStaked + tokenId.length <= 500, "max stake amount reached");
for (uint256 i = 0; i < tokenId.length; i++) {
IERC721(NFTToken).transferFrom(
msg.sender,
... | 12,804 |
7 | // keep track of who owns the nft | nftHolders[msg.sender] = newId;
| nftHolders[msg.sender] = newId;
| 52,096 |
34 | // emit ValorTraductoresModificado(valorTraductores); | 24,089 | ||
234 | // returns data to calculate amountIn, amountOut | function getTradeInfo()
external
virtual
override
view
returns (
uint112 _reserve0,
uint112 _reserve1,
uint112 _vReserve0,
uint112 _vReserve1,
| function getTradeInfo()
external
virtual
override
view
returns (
uint112 _reserve0,
uint112 _reserve1,
uint112 _vReserve0,
uint112 _vReserve1,
| 28,068 |
52 | // Binary search | uint256 _min;
uint256 _max = userPointEpoch[addr];
for (uint256 i = 0; i < 128; i++) {// Will be always enough for 128-bit numbers
if (_min >= _max) {
break;
}
| uint256 _min;
uint256 _max = userPointEpoch[addr];
for (uint256 i = 0; i < 128; i++) {// Will be always enough for 128-bit numbers
if (_min >= _max) {
break;
}
| 477 |
10 | // Public whitelist sale data | createPresale(4, 0.15 ether, 4101);
addReserveTokenMinters(0x72b6f2Ed3Cc57BEf3f5C5319DFbFe82D29e0B93F);
| createPresale(4, 0.15 ether, 4101);
addReserveTokenMinters(0x72b6f2Ed3Cc57BEf3f5C5319DFbFe82D29e0B93F);
| 37,411 |
182 | // This function is called by a borrower when they want to repay their loan. It can be called at any time after the loan has begun. The borrower will pay a pro-rata portion of their interest if the loan is paid off early. The interest will continue to accrue after the loan has expired. This function can continue to be ... | function payBackLoan(uint256 _loanId) external nonReentrant {
// Sanity check that payBackLoan() and liquidateOverdueLoan() have
// never been called on this loanId. Depending on how the rest of the
// code turns out, this check may be unnecessary.
require(!loanRepaidOrLiquidated[_lo... | function payBackLoan(uint256 _loanId) external nonReentrant {
// Sanity check that payBackLoan() and liquidateOverdueLoan() have
// never been called on this loanId. Depending on how the rest of the
// code turns out, this check may be unnecessary.
require(!loanRepaidOrLiquidated[_lo... | 10,256 |
130 | // Returns the ERC20 asset token used for deposits./Should be implemented in a child contract during the inheritance./ return The ERC20 asset token. | function _token() internal view virtual returns (IERC20Upgradeable);
| function _token() internal view virtual returns (IERC20Upgradeable);
| 29,753 |
65 | // make sure request is still valid | if (validUntil_ > 0 && validUntil_ < block.timestamp) {
revert AvoWallet__Expired();
}
| if (validUntil_ > 0 && validUntil_ < block.timestamp) {
revert AvoWallet__Expired();
}
| 25,480 |
28 | // Emoji | characterModifier = _characterList[i].skinToneModifier;
bytes memory charAsBytes = Utils.characterToUnicodeBytes(
0, // We still do the conversion for emojis to validate skin tone modifiers
tileData.characterIndex,
characterModi... | characterModifier = _characterList[i].skinToneModifier;
bytes memory charAsBytes = Utils.characterToUnicodeBytes(
0, // We still do the conversion for emojis to validate skin tone modifiers
tileData.characterIndex,
characterModi... | 14,756 |
106 | // Transfer tokens from one address to another. from The address you want to send tokens from. to The address you want to transfer to. value The amount of tokens to be transferred. / | function transferFrom(address from, address to, uint256 value)
external
validRecipient(to)
updateAccount(from)
updateAccount(to)
returns (bool)
| function transferFrom(address from, address to, uint256 value)
external
validRecipient(to)
updateAccount(from)
updateAccount(to)
returns (bool)
| 1,611 |
12 | // "burnable" | function burn(uint256 amount) external {
require(_balances[msg.sender] >= amount, ERROR_BTL);
_burn(msg.sender, amount);
}
| function burn(uint256 amount) external {
require(_balances[msg.sender] >= amount, ERROR_BTL);
_burn(msg.sender, amount);
}
| 38,532 |
410 | // dYdX SoloMargin contract object. / | SoloMargin constant private _soloMargin = SoloMargin(SOLO_MARGIN_CONTRACT);
| SoloMargin constant private _soloMargin = SoloMargin(SOLO_MARGIN_CONTRACT);
| 10,992 |
308 | // Total asset cash in the market | uint80 totalAssetCash;
| uint80 totalAssetCash;
| 2,246 |
18 | // Ensure that the component index is in range. | if (componentIndex >= offer.length) {
revert OfferCriteriaResolverOutOfRange();
}
| if (componentIndex >= offer.length) {
revert OfferCriteriaResolverOutOfRange();
}
| 14,956 |
41 | // accrueInterest emits logs on errors, but we still want to log the fact that an attempted borrow failed | return (Error(error).fail(FailureInfo.MINT_ACCRUE_INTEREST_FAILED), 0);
| return (Error(error).fail(FailureInfo.MINT_ACCRUE_INTEREST_FAILED), 0);
| 27,445 |
167 | // File: contracts\data\WitnetBoardData.sol/Witnet Request Board base data model. /The Witnet Foundation. | abstract contract WitnetBoardData {
bytes32 internal constant _WITNET_BOARD_DATA_SLOTHASH =
/* keccak256("io.witnet.boards.data") */
0xf595240b351bc8f951c2f53b26f4e78c32cb62122cf76c19b7fdda7d4968e183;
struct WitnetBoardState {
address base;
address owner;
uint256 ... | abstract contract WitnetBoardData {
bytes32 internal constant _WITNET_BOARD_DATA_SLOTHASH =
/* keccak256("io.witnet.boards.data") */
0xf595240b351bc8f951c2f53b26f4e78c32cb62122cf76c19b7fdda7d4968e183;
struct WitnetBoardState {
address base;
address owner;
uint256 ... | 19,867 |
4 | // triggered when the rate between two tokens in the converter changesnote that the event might be dispatched for rate updates between any two tokens in the convertertoken1 address of the first token token2 address of the second token rateN rate of 1 unit of `token1` in `token2` (numerator) rateD rate of 1 unit of `tok... | event TokenRateUpdate(address indexed token1, address indexed token2, uint256 rateN, uint256 rateD);
| event TokenRateUpdate(address indexed token1, address indexed token2, uint256 rateN, uint256 rateD);
| 14,305 |
15 | // Withdraws the specified amount of tokens from the sender's deposit with the specified ID | function withdraw(uint256 id, uint256 amount) external {
address msgSender = _msgSender();
uint256 blockNumber = block.number;
Unbond[] storage unbonds = _accountUnbonds[msgSender];
// Take this opportunity to clean up any expired unbonds
for (uint256 i = unbonds.length; i >... | function withdraw(uint256 id, uint256 amount) external {
address msgSender = _msgSender();
uint256 blockNumber = block.number;
Unbond[] storage unbonds = _accountUnbonds[msgSender];
// Take this opportunity to clean up any expired unbonds
for (uint256 i = unbonds.length; i >... | 26,397 |
37 | // Make sure input address is clean. (Solidity does not guarantee this) | input := and(input, 0xffffffffffffffffffffffffffffffffffffffff)
| input := and(input, 0xffffffffffffffffffffffffffffffffffffffff)
| 14,719 |
13 | // Avoid overflowing the Merkle tree (and prevent edge case in computing `branch`) | require(deposit_count < MAX_DEPOSIT_COUNT, "DepositContract: merkle tree full");
| require(deposit_count < MAX_DEPOSIT_COUNT, "DepositContract: merkle tree full");
| 12,250 |
34 | // delete request | clearDocumentKeyShadowRetrievalRequest(retrievalId, request);
| clearDocumentKeyShadowRetrievalRequest(retrievalId, request);
| 8,502 |
197 | // Deposit LP tokens to MasterYmen for MUTANT allocation. | function deposit(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (user.amount > 0) {
uint256 pending = user.amount.mul(pool.accMutantPerShare).div(1e12).sub(user.rewar... | function deposit(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (user.amount > 0) {
uint256 pending = user.amount.mul(pool.accMutantPerShare).div(1e12).sub(user.rewar... | 4,614 |
28 | // Withdraw unsale Token/ | function tokenWithdraw(address receiver, uint256 tokens) onlyFounder {
require(receiver != 0x0);
require(tokens > 0);
if (!tokenReward.transfer(receiver, tokens)) {
revert();
}
}
| function tokenWithdraw(address receiver, uint256 tokens) onlyFounder {
require(receiver != 0x0);
require(tokens > 0);
if (!tokenReward.transfer(receiver, tokens)) {
revert();
}
}
| 36,580 |
40 | // Function : Enables The Liquidity and Worth DVC Fund fee// Parameters : -- // Only Owner Function / | function enableAllFees() external onlyOwner {
_liquidityFee = 25;
_previousLiquidityFee = _liquidityFee;
_worthDVCFundFee = 25;
_previousWorthDVCFundFee = _worthDVCFundFee;
swapAndLiquifyEnabled = true;
emit SwapAndLiquifyEnabledUpdated(swapAndLiquif... | function enableAllFees() external onlyOwner {
_liquidityFee = 25;
_previousLiquidityFee = _liquidityFee;
_worthDVCFundFee = 25;
_previousWorthDVCFundFee = _worthDVCFundFee;
swapAndLiquifyEnabled = true;
emit SwapAndLiquifyEnabledUpdated(swapAndLiquif... | 54,946 |
72 | // Distribute sale eth input | modifier distributeSaleInput(address _owner) {
uint256 contractOwnerCommision; //1%
uint256 playerShare; //99%
if(msg.value > 100){
contractOwnerCommision = (msg.value / 100);
playerShare = msg.value - contractOwnerCommision;
}else{
contr... | modifier distributeSaleInput(address _owner) {
uint256 contractOwnerCommision; //1%
uint256 playerShare; //99%
if(msg.value > 100){
contractOwnerCommision = (msg.value / 100);
playerShare = msg.value - contractOwnerCommision;
}else{
contr... | 39,057 |
19 | // Withdraw token./Only owner can call this function./_token The address of token to withdraw./_amount The amount of token to withdraw. | function withdrawToken(address _token, uint256 _amount) external;
| function withdrawToken(address _token, uint256 _amount) external;
| 16,793 |
83 | // See {IERC721-ownerOf}./ | function ownerOf(uint256 tokenId) public view virtual override returns (address) {
address owner = _owners[tokenId];
require(owner != address(0), "ERC721: owner query for nonexistent token");
return owner;
}
| function ownerOf(uint256 tokenId) public view virtual override returns (address) {
address owner = _owners[tokenId];
require(owner != address(0), "ERC721: owner query for nonexistent token");
return owner;
}
| 1,422 |
14 | // Rewards accumulated by users | function rewards(address user) external view returns(uint128 accumulatedUserStart, uint128 accumulatedCheckpoint);
| function rewards(address user) external view returns(uint128 accumulatedUserStart, uint128 accumulatedCheckpoint);
| 42,233 |
10 | // Returns the amount of tokens owned by `account`. / | function balanceOf(address account) external view returns (uint256);
| function balanceOf(address account) external view returns (uint256);
| 28,398 |
127 | // start | block.timestamp,
| block.timestamp,
| 39,761 |
35 | // we can just check that call not reverts because it wants to withdraw all amount | (sent,) = address(this).call.gas(withdrawGasLimit)(
abi.encodeWithSignature("withdrawERC20Guarded(address,address,uint128,uint128)", tokenAddr, to, amount, amount)
);
| (sent,) = address(this).call.gas(withdrawGasLimit)(
abi.encodeWithSignature("withdrawERC20Guarded(address,address,uint128,uint128)", tokenAddr, to, amount, amount)
);
| 29,847 |
16 | // @custom:legacy/Legacy getter for the bridge. Use BRIDGE going forward. | function l2Bridge() public view returns (address) {
return BRIDGE;
}
| function l2Bridge() public view returns (address) {
return BRIDGE;
}
| 12,303 |
212 | // Function to stop minting new tokens. | * NOTE: restricting access to owner only. See {BEP20Mintable-finishMinting}.
*/
function _finishMinting() internal override onlyOwner {
super._finishMinting();
}
| * NOTE: restricting access to owner only. See {BEP20Mintable-finishMinting}.
*/
function _finishMinting() internal override onlyOwner {
super._finishMinting();
}
| 2,857 |
4 | // -------------------- MODIFIERS ---------------------------- | modifier onlyArbitrator {
require(msg.sender == arbitrator);
_;
}
| modifier onlyArbitrator {
require(msg.sender == arbitrator);
_;
}
| 13,346 |
26 | // claiming paid MKR back | if (msg.value > 0) {
| if (msg.value > 0) {
| 48,015 |
79 | // don't panic, no safemath, look above comment | (uint256(proportions[i]) * uint256(PROPORTION_BASE)) /
totalProportions
);
| (uint256(proportions[i]) * uint256(PROPORTION_BASE)) /
totalProportions
);
| 28,923 |
24 | // CrowdSale / | contract PreICO is Ownable {
ERC20 public token;
ERC20 public authorize;
using SafeMath for uint;
address public backEndOperator = msg.sender;
address bounty = 0xAddEB4E7780DB11b7C5a0b7E96c133e50f05740E; // 0.4% - для баунти программы
mapping(address=>bool) public whitelist;
ma... | contract PreICO is Ownable {
ERC20 public token;
ERC20 public authorize;
using SafeMath for uint;
address public backEndOperator = msg.sender;
address bounty = 0xAddEB4E7780DB11b7C5a0b7E96c133e50f05740E; // 0.4% - для баунти программы
mapping(address=>bool) public whitelist;
ma... | 16,885 |
20 | // Calculate geometric average of x and y, i.e. sqrt (xy) rounding down.Revert on overflow or in case xy is negative.x signed 64.64-bit fixed point number y signed 64.64-bit fixed point numberreturn signed 64.64-bit fixed point number / | function gavg (int128 x, int128 y) internal pure returns (int128) {
unchecked {
int256 m = int256 (x) * int256 (y);
require (m >= 0);
require (m <
0x4000000000000000000000000000000000000000000000000000000000000000);
return int128 (sqrtu (uint256 (m)));
}
}
| function gavg (int128 x, int128 y) internal pure returns (int128) {
unchecked {
int256 m = int256 (x) * int256 (y);
require (m >= 0);
require (m <
0x4000000000000000000000000000000000000000000000000000000000000000);
return int128 (sqrtu (uint256 (m)));
}
}
| 31,186 |
7 | // 0x00: Unknown error. Something went really bad! | Unknown,
| Unknown,
| 29,981 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.