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 |
|---|---|---|---|---|
18 | // Authorizes an account to manage all tokens/_operator The account address/_approved If permission is being given or removed | function setApprovalForAll(address _operator, bool _approved) external {
operatorApprovals[msg.sender][_operator] = _approved;
emit ApprovalForAll(msg.sender, _operator, _approved);
}
| function setApprovalForAll(address _operator, bool _approved) external {
operatorApprovals[msg.sender][_operator] = _approved;
emit ApprovalForAll(msg.sender, _operator, _approved);
}
| 30,029 |
153 | // Emits a {Transfer} event for each transfer of this multi-sending function./Function blocked when contract is paused./Function has a number of checks and conditions - see {_transfer} internal function./_bundleTo array of addresses which will get tokens/ return true if function passed successfully | function transfer(address[] memory _bundleTo, uint256 _amount)
public
whenNotPaused
returns (bool)
{
address owner = _msgSender();
_bundlesLoop(owner, _bundleTo, _amount, _transfer);
return true;
}
| function transfer(address[] memory _bundleTo, uint256 _amount)
public
whenNotPaused
returns (bool)
{
address owner = _msgSender();
_bundlesLoop(owner, _bundleTo, _amount, _transfer);
return true;
}
| 15,156 |
54 | // currency required for redemption | uint256 currencyRequired = rmul(epochRedeem, epochs[epochID].redeemFulfillment);
uint256 diff;
if (currencySupplied > currencyRequired) {
| uint256 currencyRequired = rmul(epochRedeem, epochs[epochID].redeemFulfillment);
uint256 diff;
if (currencySupplied > currencyRequired) {
| 15,078 |
10 | // set DISTANCETHRESHOLD/ ONLY DAO can call this function/distanceThreshold the min rebalance threshold to include/ a validator in the delegation process. | function setDistanceThreshold(uint256 distanceThreshold) external;
| function setDistanceThreshold(uint256 distanceThreshold) external;
| 31,977 |
19 | // TODO implement a turn based smart contract so that winner will be calculated by each attack and defense pattern | Player P1 = players[idx1];
Player P2 = players[idx2];
uint16 difference = 0;
for (uint16 i = 0; i < P1.moves.length; i++){
difference += P1.attacks[P1.moves[i]] - P2.attacks[P1.moves[i]];
}
| Player P1 = players[idx1];
Player P2 = players[idx2];
uint16 difference = 0;
for (uint16 i = 0; i < P1.moves.length; i++){
difference += P1.attacks[P1.moves[i]] - P2.attacks[P1.moves[i]];
}
| 30,433 |
26 | // Check that components not claimed already | require(!claimedByTokenId[tokenId], "ALREADY_CLAIMED");
| require(!claimedByTokenId[tokenId], "ALREADY_CLAIMED");
| 24,659 |
18 | // Gets all accessed reads and write slot from a recording session, for a given address | function accesses(address) external returns (bytes32[] memory reads, bytes32[] memory writes);
| function accesses(address) external returns (bytes32[] memory reads, bytes32[] memory writes);
| 17,302 |
24 | // Extension of `ERC20` that allows an owner to create certificatesto allow users to redeem/mint their own tokens according to certificate parameters / | contract ERC20Certificate is ERC20, owned {
using ECDSA for bytes32;
using SafeMath for uint256;
mapping (bytes32 => certificateType) public certificateTypes;
mapping (address => bool) public condenserDelegates;
struct certificateType {
uint256 amount;
string metadata;
ma... | contract ERC20Certificate is ERC20, owned {
using ECDSA for bytes32;
using SafeMath for uint256;
mapping (bytes32 => certificateType) public certificateTypes;
mapping (address => bool) public condenserDelegates;
struct certificateType {
uint256 amount;
string metadata;
ma... | 18,481 |
0 | // poke is called when new data arrives | function poke() public;
| function poke() public;
| 49,750 |
5 | // admin reserve minting | function gift(uint[] calldata quantity, address[] calldata recipient) external onlyOwner{
require(quantity.length == recipient.length, "Provide quantities and recipients" );
for(uint i = 0; i < recipient.length; ++i){
_safeMint(recipient[i], quantity[i]);
}
}
| function gift(uint[] calldata quantity, address[] calldata recipient) external onlyOwner{
require(quantity.length == recipient.length, "Provide quantities and recipients" );
for(uint i = 0; i < recipient.length; ++i){
_safeMint(recipient[i], quantity[i]);
}
}
| 75,693 |
65 | // Admin Functions / | function withdrawFunds() external onlyOwner whenNotPaused isSaleFinalized {
require(minimumRaiseAchieved(), "Minimum raise has to be reached");
FEE_ADDRESS.transfer(address(this).balance.mul(feePercentage).div(100)); /* Fee Address */
msg.sender.transfer(address(this).balance);
}
| function withdrawFunds() external onlyOwner whenNotPaused isSaleFinalized {
require(minimumRaiseAchieved(), "Minimum raise has to be reached");
FEE_ADDRESS.transfer(address(this).balance.mul(feePercentage).div(100)); /* Fee Address */
msg.sender.transfer(address(this).balance);
}
| 65,448 |
54 | // This emits when the approved address for an NFT is changed or reaffirmed. The zeroaddress indicates there is no approved address. When a Transfer event emits, this alsoindicates that the approved address for that NFT (if any) is reset to none. _owner Owner of NFT. _approved Address that we are approving. _tokenId NF... | event Approval(
| event Approval(
| 3,779 |
101 | // Update the last block | pool.lastRewardBlock = block.number;
| pool.lastRewardBlock = block.number;
| 14,058 |
402 | // returns true if the reserve is enabled as collateral_reserve the reserve address return true if the reserve is enabled as collateral, false otherwise/ | function isReserveUsageAsCollateralEnabled(address _reserve) external view returns (bool) {
CoreLibrary.ReserveData storage reserve = reserves[_reserve];
return reserve.usageAsCollateralEnabled;
}
| function isReserveUsageAsCollateralEnabled(address _reserve) external view returns (bool) {
CoreLibrary.ReserveData storage reserve = reserves[_reserve];
return reserve.usageAsCollateralEnabled;
}
| 24,421 |
108 | // end of egses | 6,493 | ||
356 | // Return true if a particular market is in closing mode. Additional borrows cannot be takenfrom a market that is closing. marketIdThe market to queryreturn True if the market is closing / | function getMarketIsClosing(
uint256 marketId
)
public
view
returns (bool)
| function getMarketIsClosing(
uint256 marketId
)
public
view
returns (bool)
| 15,674 |
3 | // Setting the admin to be the person who has deployed this contract | admin = msg.sender;
| admin = msg.sender;
| 20,839 |
4 | // --- Auth --- |
address public ArchAdmin;
mapping(address => uint256) public wards;
|
address public ArchAdmin;
mapping(address => uint256) public wards;
| 4,749 |
28 | // Get a pointer to some free memory. | let freeMemoryPointer := mload(0x40)
| let freeMemoryPointer := mload(0x40)
| 8,459 |
32 | // https:docs.pynthetix.io/contracts/source/contracts/mixinresolver | contract MixinResolver {
AddressResolver public resolver;
mapping(bytes32 => address) private addressCache;
constructor(address _resolver) internal {
resolver = AddressResolver(_resolver);
}
/* ========== INTERNAL FUNCTIONS ========== */
function combineArrays(bytes32[] memory first,... | contract MixinResolver {
AddressResolver public resolver;
mapping(bytes32 => address) private addressCache;
constructor(address _resolver) internal {
resolver = AddressResolver(_resolver);
}
/* ========== INTERNAL FUNCTIONS ========== */
function combineArrays(bytes32[] memory first,... | 19,016 |
18 | // Decrements Through Available Card Stack / | function _drawAvailableCard() private view returns (uint256)
| function _drawAvailableCard() private view returns (uint256)
| 26,691 |
1 | // Executes an action. _target Target of execution. _a Address usually represention from. _b Address usually representing to. _c Integer usually repersenting amount/value/id. / | function execute(
address _target,
address _a,
address _b,
uint256 _c
)
external;
| function execute(
address _target,
address _a,
address _b,
uint256 _c
)
external;
| 44,750 |
18 | // calculate the amount of token how much input token should be reimbursed, BNB -> BUSD | uint256 amountRequired = IUniswapV2Router02(sourceRouter).getAmountsIn(
amountToken,
path2
)[0];
| uint256 amountRequired = IUniswapV2Router02(sourceRouter).getAmountsIn(
amountToken,
path2
)[0];
| 27,924 |
17 | // encode the payload | bytes memory payload = abi.encode(msg.sender, msg.value);
| bytes memory payload = abi.encode(msg.sender, msg.value);
| 1,718 |
49 | // Confirm | confirmations[transactionId][signer] = true;
emit Confirmation(signer, transactionId);
| confirmations[transactionId][signer] = true;
emit Confirmation(signer, transactionId);
| 12,430 |
137 | // Set governance for this token There will only be a limited supply of tokens ever | governance = msg.sender;
DOMAINSEPARATOR = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), _getChainId(), address(this)));
KPRH = IKeep3rV1Helper(_kph);
maxCap = _maxCap;
| governance = msg.sender;
DOMAINSEPARATOR = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), _getChainId(), address(this)));
KPRH = IKeep3rV1Helper(_kph);
maxCap = _maxCap;
| 42,495 |
20 | // Returns the historical price specified by `id`. Decimals is 8. / | function getPrice(uint256 id) external returns (uint256);
| function getPrice(uint256 id) external returns (uint256);
| 41,462 |
19 | // ERC20 params | string public name; // ERC20
string public symbol; // ERC20
uint private _totalSupply; // ERC20
uint public decimals = 8; // ERC20
| string public name; // ERC20
string public symbol; // ERC20
uint private _totalSupply; // ERC20
uint public decimals = 8; // ERC20
| 33,185 |
16 | // sets KYA Requirements: - the caller must have DEFAULT_ADMIN_ROLE./ | function setKYA(string calldata _knowYourAsset) external {
require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "must have DEFAULT_ADMIN_ROLE");
KYA = _knowYourAsset;
}
| function setKYA(string calldata _knowYourAsset) external {
require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "must have DEFAULT_ADMIN_ROLE");
KYA = _knowYourAsset;
}
| 18,246 |
369 | // _transfer, _mint and _burn are the only functions where the balances are modified, so it is there that the snapshots are updated. Note that the update happens _before_ the balance change, with the pre-modified value. The same is true for the total supply and _mint and _burn. | function _transfer(address from, address to, uint256 value) internal virtual override {
_updateAccountSnapshot(from);
_updateAccountSnapshot(to);
super._transfer(from, to, value);
}
| function _transfer(address from, address to, uint256 value) internal virtual override {
_updateAccountSnapshot(from);
_updateAccountSnapshot(to);
super._transfer(from, to, value);
}
| 11,715 |
55 | // Set whether the collection can be editable or not. This property is used off-chain to check whether the items of the collectioncan be updated or not _value - Value to set / | function setEditable(bool _value) external onlyOwner {
require(isEditable != _value, "setEditable: VALUE_IS_THE_SAME");
emit SetEditable(isEditable, _value);
isEditable = _value;
}
| function setEditable(bool _value) external onlyOwner {
require(isEditable != _value, "setEditable: VALUE_IS_THE_SAME");
emit SetEditable(isEditable, _value);
isEditable = _value;
}
| 19,045 |
11 | // underlying function is not available for Aave tokens | function underlying ( ) external view returns ( address );
function liquidateBorrow ( address borrower, uint256 repayAmount, address cTokenCollateral ) external returns ( uint256 );
| function underlying ( ) external view returns ( address );
function liquidateBorrow ( address borrower, uint256 repayAmount, address cTokenCollateral ) external returns ( uint256 );
| 10,895 |
258 | // mint function for TrueRewardBackedTokenMints TrueCurrency backed by debtWhen we add multiple opportunities, this needs to work for mutliple interfaces / | function mint(address _to, uint256 _value) public onlyOwner {
// check if to address is enabled
bool toEnabled = trueRewardEnabled(_to);
// if to enabled, mint to this contract and deposit into finOp
if (toEnabled) {
// mint to this contract
super.mint(addres... | function mint(address _to, uint256 _value) public onlyOwner {
// check if to address is enabled
bool toEnabled = trueRewardEnabled(_to);
// if to enabled, mint to this contract and deposit into finOp
if (toEnabled) {
// mint to this contract
super.mint(addres... | 32,638 |
6 | // theof refrerrals | uint256 public _totalReferReward;
| uint256 public _totalReferReward;
| 19,066 |
29 | // If none of the above conditions are satisfied, then should not rebalance | return ShouldRebalance.NONE;
| return ShouldRebalance.NONE;
| 11,784 |
55 | // Scheduled for minting reserve tokens amount is 575M FNP | uint256 public mintSize = uint256(575000000).mul(10 ** 18);
| uint256 public mintSize = uint256(575000000).mul(10 ** 18);
| 41,490 |
69 | // get edition ID from storage | return _tokenToEdition[_tokenId];
| return _tokenToEdition[_tokenId];
| 66,888 |
40 | // if(timeT > 0) | {
uint256 rewardToGive = calculateReward(timeT,user);
return rewardToGive;
}//else
| {
uint256 rewardToGive = calculateReward(timeT,user);
return rewardToGive;
}//else
| 8,740 |
26 | // Get appeal time window./_disputeID The dispute ID as in arbitrator./_ruling The ruling option to query./ return Start/ return End | function getAppealPeriod(uint256 _disputeID, RulingOptions _ruling)
external
view
virtual
returns (uint256, uint256);
| function getAppealPeriod(uint256 _disputeID, RulingOptions _ruling)
external
view
virtual
returns (uint256, uint256);
| 25,898 |
28 | // add balance | _xETHBalances[to] = _xETHBalances[to].add(xETHValue);
emit Transfer(address(0),to,amount);
| _xETHBalances[to] = _xETHBalances[to].add(xETHValue);
emit Transfer(address(0),to,amount);
| 1,687 |
147 | // Max deposit of ERC20 token that is possible to deposit | uint128 internal constant MAX_DEPOSIT_AMOUNT = 20282409603651670423947251286015;
| uint128 internal constant MAX_DEPOSIT_AMOUNT = 20282409603651670423947251286015;
| 16,046 |
48 | // Find if the user calling approve is the winner or loser. | bool winner = false;
bool loser = false;
if (proposedMatches[id].winner == msg.sender) {
winner = true;
}
| bool winner = false;
bool loser = false;
if (proposedMatches[id].winner == msg.sender) {
winner = true;
}
| 16,882 |
124 | // Reward adjustment |
rewardAdjustmentPeriod = 210000;
|
rewardAdjustmentPeriod = 210000;
| 18,279 |
39 | // Token for crowdsale (Token contract). Replace 0x0 by deployed ERC20 token address. | ERC20 public token = ERC20(0x0e27b0ca1f890d37737dd5cde9de22431255f524);
| ERC20 public token = ERC20(0x0e27b0ca1f890d37737dd5cde9de22431255f524);
| 42,880 |
0 | // See the documentation in {IPRBProxyRegistry}. | /*//////////////////////////////////////////////////////////////////////////
CONSTANTS
| /*//////////////////////////////////////////////////////////////////////////
CONSTANTS
| 13,338 |
59 | // src/interfaces/IELIP002.sol/ pragma solidity ^0.6.7; /// | interface IELIP002 {
struct Item {
// index of `Formula`
uint256 index;
// strength rate
uint128 rate;
uint16 objClassExt;
uint16 class;
uint16 grade;
// element prefer
uint16 prefer;
// ids of major material
uint256 id;
// addresses of major material
address token;
// amounts of minor mat... | interface IELIP002 {
struct Item {
// index of `Formula`
uint256 index;
// strength rate
uint128 rate;
uint16 objClassExt;
uint16 class;
uint16 grade;
// element prefer
uint16 prefer;
// ids of major material
uint256 id;
// addresses of major material
address token;
// amounts of minor mat... | 627 |
217 | // enforce that it is coming from uniswap | require(msg.sender == uniswap_pair, "bad msg.sender");
| require(msg.sender == uniswap_pair, "bad msg.sender");
| 12,762 |
123 | // V0 = V1(1+(sqrt-1)/2k) sqrt = √(1+4kidelta/V1) premium = 1+(sqrt-1)/2k uint256 sqrt = (4k).mul(i).mul(delta).div(V1).add(DecimalMath.ONE2).sqrt(); | uint256 sqrt;
uint256 ki = (4 * k).mul(i);
if (ki == 0) {
sqrt = DecimalMath.ONE;
} else if ((ki * delta) / ki == delta) {
| uint256 sqrt;
uint256 ki = (4 * k).mul(i);
if (ki == 0) {
sqrt = DecimalMath.ONE;
} else if ((ki * delta) / ki == delta) {
| 38,496 |
111 | // Crowdsale owners can collect ETH any number of times | function collect() public auth {
assert(currRound() > 0); // Prevent recycling during window 0
exec(msg.sender, address(this).balance);
emit LogCollect(address(this).balance);
}
| function collect() public auth {
assert(currRound() > 0); // Prevent recycling during window 0
exec(msg.sender, address(this).balance);
emit LogCollect(address(this).balance);
}
| 46,157 |
286 | // Verify the constructor params satisfy requirements _initParams is the initialization parameter including owner, keeper, etc. _vaultParams is the struct with vault general data / | function verifyInitializerParams(
InitParams calldata _initParams,
Vault.VaultParams calldata _vaultParams,
uint256 _min_auction_duration
| function verifyInitializerParams(
InitParams calldata _initParams,
Vault.VaultParams calldata _vaultParams,
uint256 _min_auction_duration
| 75,280 |
83 | // If allowance is infinite, don't decrease it to save on gas (breaks with EIP-20). | if (spenderAllowance != type(uint256).max) {
require(spenderAllowance >= shares, "Low allowance");
allowance[from][msg.sender] = spenderAllowance - shares; // Underflow is checked
}
| if (spenderAllowance != type(uint256).max) {
require(spenderAllowance >= shares, "Low allowance");
allowance[from][msg.sender] = spenderAllowance - shares; // Underflow is checked
}
| 41,507 |
269 | // Reserve 125 skulls for team - Giveaways/Prizes etc | uint public skullReserve = 1050;
event skullNameChange(address _by, uint _tokenId, string _name);
event licenseisLocked(string _licenseText);
| uint public skullReserve = 1050;
event skullNameChange(address _by, uint _tokenId, string _name);
event licenseisLocked(string _licenseText);
| 34,838 |
315 | // mint the user's LP tokens | v.lpToken.mint(msg.sender, toMint);
emit AddLiquidity(
msg.sender,
amounts,
fees,
v.d1,
v.totalSupply.add(toMint)
);
| v.lpToken.mint(msg.sender, toMint);
emit AddLiquidity(
msg.sender,
amounts,
fees,
v.d1,
v.totalSupply.add(toMint)
);
| 83,779 |
112 | // Handle ramping A up or down | uint256 t1 = future_A_time;
A1 = future_A;
if (block.timestamp < t1) {
uint256 A0 = initial_A;
uint256 t0 = initial_A_time;
| uint256 t1 = future_A_time;
A1 = future_A;
if (block.timestamp < t1) {
uint256 A0 = initial_A;
uint256 t0 = initial_A_time;
| 52,756 |
102 | // Emitted when 'tokenId' token is transferred from 'from' to 'to'. / | event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
| event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
| 43,762 |
18 | // state.amount1Desired = amount1Desired | mstore(add(state, 0x80), amount1Desired)
| mstore(add(state, 0x80), amount1Desired)
| 24,116 |
37 | // lockAccount | function lockStatus(address _add,bool _success) public validate_address(_add) is_admin {
lockedAccounts[_add] = _success;
_lockAccount(_add);
}
| function lockStatus(address _add,bool _success) public validate_address(_add) is_admin {
lockedAccounts[_add] = _success;
_lockAccount(_add);
}
| 1,499 |
47 | // Throws if called by any account other than the pauser. / | modifier whenNotPaused() {
if (pauser() != _msgSender()) {
require(_paused == false, 'Pauseable: Contract is paused');
}
_;
}
| modifier whenNotPaused() {
if (pauser() != _msgSender()) {
require(_paused == false, 'Pauseable: Contract is paused');
}
_;
}
| 12,122 |
198 | // Mark that withdraw is finished | request.status = requestStatus.FINISHED;
emit WithdrawFinished(_user, request.amounts, request.cluster);
| request.status = requestStatus.FINISHED;
emit WithdrawFinished(_user, request.amounts, request.cluster);
| 33,738 |
7 | // function _beforeTokenTransfer(address from,address to,uint256 tokenId | //) internal whenNotPaused {
// super._beforeTokenTransfer(from, to, tokenId,0);
//}
| //) internal whenNotPaused {
// super._beforeTokenTransfer(from, to, tokenId,0);
//}
| 6,643 |
29 | // Applies accrued interest to total borrows and reserves.This calculates interest accrued from the last checkpointed blockup to the current block and writes new checkpoint to storage./ | function accrueInterest() override public returns (uint) {
bytes memory data = delegateToImplementation(abi.encodeWithSignature("accrueInterest()"));
return abi.decode(data, (uint));
}
| function accrueInterest() override public returns (uint) {
bytes memory data = delegateToImplementation(abi.encodeWithSignature("accrueInterest()"));
return abi.decode(data, (uint));
}
| 2,877 |
94 | // Accessor method for the list of members with admin rolereturn array of addresses with admin role / | function getAdminMembers() external view override returns (address[] memory) {
uint256 numberOfMembers = getRoleMemberCount(DEFAULT_ADMIN_ROLE);
address[] memory members = new address[](numberOfMembers);
for (uint256 j = 0; j < numberOfMembers; j++) {
address newMember = getRoleMember(DEFAULT_ADMIN_... | function getAdminMembers() external view override returns (address[] memory) {
uint256 numberOfMembers = getRoleMemberCount(DEFAULT_ADMIN_ROLE);
address[] memory members = new address[](numberOfMembers);
for (uint256 j = 0; j < numberOfMembers; j++) {
address newMember = getRoleMember(DEFAULT_ADMIN_... | 38,403 |
2 | // Data needed for tuning bond market | mapping(uint256 => BondMetadata) public metadata;
| mapping(uint256 => BondMetadata) public metadata;
| 5,495 |
364 | // Reset the sponsors position to have zero outstanding and collateral. | delete positions[sponsor];
emit EndedSponsorPosition(sponsor);
| delete positions[sponsor];
emit EndedSponsorPosition(sponsor);
| 34,903 |
7 | // Transfers ownership of the contract to a new account (`newOwner`). This caninclude renouncing ownership by transferring to the zero address.Can only be called by the current owner. / | function transferOwnership(address newOwner) public virtual {
requireOwner();
require(newOwner != address(0), "oc3");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
| function transferOwnership(address newOwner) public virtual {
requireOwner();
require(newOwner != address(0), "oc3");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
| 77,085 |
110 | // 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(uint256 tokenId) internal view virtual returns (bool) {
return _owners[tokenId] != address(0);
}
| function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _owners[tokenId] != address(0);
}
| 55,751 |
123 | // Connection interface to connect to MakerDAO / Compound / | interface IConnector {
function getUserScore(address user) external view returns (uint256);
function getGlobalScore() external view returns (uint256);
} | interface IConnector {
function getUserScore(address user) external view returns (uint256);
function getGlobalScore() external view returns (uint256);
} | 60,407 |
246 | // Mint a new StakeToken.Requirements: | * - `account` must not be zero address, check ERC721 {_mint}
* - `amount` must not be zero
* @param account address of recipient.
* @param amount mint amount.
* @param depositedAt timestamp when stake was deposited.
*/
function _mint(
address account,
uint256 amount,
... | * - `account` must not be zero address, check ERC721 {_mint}
* - `amount` must not be zero
* @param account address of recipient.
* @param amount mint amount.
* @param depositedAt timestamp when stake was deposited.
*/
function _mint(
address account,
uint256 amount,
... | 26,818 |
11 | // De-whitelist a crowdsale participant/user The participant to revoke | function revokeParticipant(address user) external onlyOwner {
require(user != address(0));
participants[user].maxPurchaseAmount = 0;
}
| function revokeParticipant(address user) external onlyOwner {
require(user != address(0));
participants[user].maxPurchaseAmount = 0;
}
| 1,255 |
17 | // it is a flush | handVal = HandEnum.Flush;
return (handVal, sortCards);
| handVal = HandEnum.Flush;
return (handVal, sortCards);
| 16,873 |
3 | // Required interface of an ERC1155 compliant contract, as defined in the _Available since v3.1._ / | interface IERC1155 is IERC165 {
/**
* @dev Emitted when `value` tokens of token type `id` are transfered from `from` to `to` by `operator`.
*/
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
/**
* @dev Equivalent to multipl... | interface IERC1155 is IERC165 {
/**
* @dev Emitted when `value` tokens of token type `id` are transfered from `from` to `to` by `operator`.
*/
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
/**
* @dev Equivalent to multipl... | 1,330 |
3 | // Returns the token address that an overrideAddress is set for.Note: will not be accurate if the override was created before this function was added.overrideAddress - The override address you are looking up the token for / | function getOverrideLookupTokenAddress(address overrideAddress) external view returns (address);
| function getOverrideLookupTokenAddress(address overrideAddress) external view returns (address);
| 18,156 |
69 | // deposit ERC20 token asset (represented by address 0x0) on behalf of the sender into an app's safe/an account must call token.approve(logic, quantity) beforehand//appId index of the target app/token address of ERC20 token contract/quantity how much of token | function depositToken(uint32 appId, address token, uint quantity) external override provisioned(appId) {
transferTokensToGluonSecurely(appId, IERC20(token), quantity);
AppLogic(current(appId)).credit(msg.sender, token, quantity);
}
| function depositToken(uint32 appId, address token, uint quantity) external override provisioned(appId) {
transferTokensToGluonSecurely(appId, IERC20(token), quantity);
AppLogic(current(appId)).credit(msg.sender, token, quantity);
}
| 24,794 |
31 | // minting is not required as we already have coins in contract | pool.accAddPerShare = pool.accAddPerShare.add(addReward.mul(1e12).div(lpSupply));
if (block.number >= pool.toBlock) {
pool.isStopped = true;
}
| pool.accAddPerShare = pool.accAddPerShare.add(addReward.mul(1e12).div(lpSupply));
if (block.number >= pool.toBlock) {
pool.isStopped = true;
}
| 21,993 |
51 | // states | enum Reserving {OFF, ON}
Reserving private _reserve = Reserving.OFF;
enum State {Usual, Whitelist, PrivateSale, Closed}
State public state = State.Usual;
// events
event TokensPurchased(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);
event TokensSent... | enum Reserving {OFF, ON}
Reserving private _reserve = Reserving.OFF;
enum State {Usual, Whitelist, PrivateSale, Closed}
State public state = State.Usual;
// events
event TokensPurchased(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);
event TokensSent... | 30,978 |
27 | // Let the buyer retrieve the money if documents aren't compliant /works like transfer function but avoid reentrancy | (bool success,) = msg.sender.call{value : amount}("");
| (bool success,) = msg.sender.call{value : amount}("");
| 4,883 |
82 | // '{"name":"', getPatientName(tokenId), '","dateprescribed":"', getDatePrescribed(tokenId),'",', '","datefilled":"', getDateFilled(tokenId), '","datenextfill":"', getDateNextFill(tokenId), '",', '","quantity":"', getQuantity(tokenId), '",', '","quantityfilled":"', getQuantityFilled(tokenId), '","patientaddress":"', ge... | 1,513 | ||
143 | // Maps wallet to session | mapping (address => Session) internal sessions;
| mapping (address => Session) internal sessions;
| 29,310 |
19 | // process token which bridged alternative was already ACKed to be deployed | if (isBridgedTokenDeployAcknowledged(_token)) {
require(_tokenIds.length <= MAX_BATCH_BRIDGE_LIMIT);
return
abi.encodeWithSelector(
this.handleBridgedNFT.selector,
_token,
_receiver,
... | if (isBridgedTokenDeployAcknowledged(_token)) {
require(_tokenIds.length <= MAX_BATCH_BRIDGE_LIMIT);
return
abi.encodeWithSelector(
this.handleBridgedNFT.selector,
_token,
_receiver,
... | 4,653 |
231 | // only owner - check contract balance | function checkContractBalance()
public
onlyOwner
view
returns (uint256)
| function checkContractBalance()
public
onlyOwner
view
returns (uint256)
| 47,860 |
21 | // return the address of the staked token / | function token() external virtual override view returns (address) {
return address(_token);
}
| function token() external virtual override view returns (address) {
return address(_token);
}
| 3,687 |
48 | // get pool information | PoolInfo storage pool = poolInfo[_pid];
UserInfo memory user = userInfo[_pid][_address];
| PoolInfo storage pool = poolInfo[_pid];
UserInfo memory user = userInfo[_pid][_address];
| 24,160 |
106 | // if(stakeholders[i].stake.since< block.timestamp ) { | stakeholders[i].stake.amount += stakeholders[i].stake.nextReward;
stakeholders[i].stake.nextReward = stakeholders[i].stake.amount * auxPeriodRate / 100000;
auxTotalStaked += stakeholders[i].stake.amount;
| stakeholders[i].stake.amount += stakeholders[i].stake.nextReward;
stakeholders[i].stake.nextReward = stakeholders[i].stake.amount * auxPeriodRate / 100000;
auxTotalStaked += stakeholders[i].stake.amount;
| 14,972 |
14 | // Validate the values were signed by an authorized oracle | address signer = recover(val_[i], age_[i], v[i], r[i], s[i]);
| address signer = recover(val_[i], age_[i], v[i], r[i], s[i]);
| 34,194 |
260 | // Emit an event signifying that this contract is now the controller. | emit NewController(key, address(this));
| emit NewController(key, address(this));
| 22,554 |
45 | // See {IERC20-approve}. Requirements: - 'spender' cannot be the zero address. / | function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
| function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
| 5,584 |
9 | // Anonutopia's main contract. / | contract Anonutopia is Owned {
mapping(address => string) nicknames;
/**
* @notice Sets a nickname for some address.
* @param _nick User's nickname.
*/
function setNickname(string _nick) public {
nicknames[msg.sender] = _nick;
}
/**
* @notice Gets a nickname of some... | contract Anonutopia is Owned {
mapping(address => string) nicknames;
/**
* @notice Sets a nickname for some address.
* @param _nick User's nickname.
*/
function setNickname(string _nick) public {
nicknames[msg.sender] = _nick;
}
/**
* @notice Gets a nickname of some... | 6,530 |
198 | // Withdraw deposited funds from APWine _futureVault the address of the futureVault to withdraw the IBT from _amount the amount to withdraw / | function withdraw(address _futureVault, uint256 _amount) external;
| function withdraw(address _futureVault, uint256 _amount) external;
| 30,575 |
300 | // Reserves the name if isReserve is set to true, de-reserves if set to false / | function toggleReserveName(string memory str, bool isReserve) internal {
_nameReserved[toLower(str)] = isReserve;
}
| function toggleReserveName(string memory str, bool isReserve) internal {
_nameReserved[toLower(str)] = isReserve;
}
| 10,486 |
38 | // insert response | bytes32 invalidResponse = bytes32(0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);
ResponseSupport invalidResponseSupport = insertResponse(
request.commonRetrievalResponses,
keyServerIndex,
keyServersCount() / 2,
invalidResponse);
| bytes32 invalidResponse = bytes32(0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);
ResponseSupport invalidResponseSupport = insertResponse(
request.commonRetrievalResponses,
keyServerIndex,
keyServersCount() / 2,
invalidResponse);
| 8,504 |
149 | // Will emit a specific URI log event for corresponding token _tokenIDs IDs of the token corresponding to the _uris logged _URIsThe URIs of the specified _tokenIDs / | function _logURIs(uint256[] memory _tokenIDs, string[] memory _URIs)
internal
| function _logURIs(uint256[] memory _tokenIDs, string[] memory _URIs)
internal
| 22,041 |
1 | // Solidity automatically throws when dividing by 0 | uint256 c = a / b;
| uint256 c = a / b;
| 45,777 |
3 | // generates a conversion path between a given pair of tokens in the Bancor Network / | function findPath(IReserveToken sourceToken, IReserveToken targetToken)
external
view
override
returns (address[] memory)
| function findPath(IReserveToken sourceToken, IReserveToken targetToken)
external
view
override
returns (address[] memory)
| 31,432 |
74 | // Set the authorized address to add the initial roles and members _initiator is address of the initiator / | function setInititorAddress(address _initiator) external {
OwnedUpgradeabilityProxy proxy = OwnedUpgradeabilityProxy(
address(uint160(address(this)))
);
require(msg.sender == proxy.proxyOwner(), "Sender is not proxy owner.");
require(initiator == address(0), "Already Set"... | function setInititorAddress(address _initiator) external {
OwnedUpgradeabilityProxy proxy = OwnedUpgradeabilityProxy(
address(uint160(address(this)))
);
require(msg.sender == proxy.proxyOwner(), "Sender is not proxy owner.");
require(initiator == address(0), "Already Set"... | 41,554 |
37 | // Emitted when a role assigner gets added. role The role that can be assigned. roleGroup The rolegroup that will be able to assign this role. / | event AssignerAdded(bytes32 indexed role, bytes32 indexed roleGroup);
| event AssignerAdded(bytes32 indexed role, bytes32 indexed roleGroup);
| 7,029 |
55 | // Arrays | library Arrays {
function findUpperBound(uint256[] storage array, uint256 element) internal view returns (uint256) {
if (array.length == 0) {
return 0;
}
uint256 low = 0;
uint256 high = array.length;
while (low < high) {
uint256 mid = Math.averag... | library Arrays {
function findUpperBound(uint256[] storage array, uint256 element) internal view returns (uint256) {
if (array.length == 0) {
return 0;
}
uint256 low = 0;
uint256 high = array.length;
while (low < high) {
uint256 mid = Math.averag... | 41,995 |
192 | // Set the redemption address where redeemed NFTs will be transferred when "burned". Must be a wallet address or implement IERC721Receiver. Cannot be null address as this will break any ERC-721A implementation without a proper burn mechanic as ownershipOf cannot handle 0x00 holdings mid batch. | function setRedemptionAddress(address _newRedemptionAddress) public onlyTeamOrOwner {
if(_newRedemptionAddress == address(0)) revert CannotBeNullAddress();
redemptionAddress = _newRedemptionAddress;
}
| function setRedemptionAddress(address _newRedemptionAddress) public onlyTeamOrOwner {
if(_newRedemptionAddress == address(0)) revert CannotBeNullAddress();
redemptionAddress = _newRedemptionAddress;
}
| 4,446 |
7 | // The pause guardian may downgrade the router to the pauseRouter | pauseRouter = pauseRouter_;
pauseGuardian = pauseGuardian_;
hasInitialized == true;
| pauseRouter = pauseRouter_;
pauseGuardian = pauseGuardian_;
hasInitialized == true;
| 62,986 |
8 | // 1 | function batchWithdraw(uint t) external {
if (t != 2 && t != 4)
etop.withdrawFor(r1Add);
lrc.transferFrom(r1Add, recipient, lrc.balanceOf(r1Add));
for (uint i = 0; i < r2Adds.length; ++i) {
etop2020.withdrawFor(r2Adds[i]);
if (t != 3 && t != 4)
... | function batchWithdraw(uint t) external {
if (t != 2 && t != 4)
etop.withdrawFor(r1Add);
lrc.transferFrom(r1Add, recipient, lrc.balanceOf(r1Add));
for (uint i = 0; i < r2Adds.length; ++i) {
etop2020.withdrawFor(r2Adds[i]);
if (t != 3 && t != 4)
... | 80,876 |
22 | // Divide a scalar by an Exp, returning a new Exp./ | function divScalarByExp(uint scalar, Exp divisor) pure internal returns (Error, Exp memory) {
/*
We are doing this as:
getExp(mul(expScale, scalar), divisor.mantissa)
How it works:
Exp = a / b;
Scalar = s;
`s / (a / b)` = `b * s / a` a... | function divScalarByExp(uint scalar, Exp divisor) pure internal returns (Error, Exp memory) {
/*
We are doing this as:
getExp(mul(expScale, scalar), divisor.mantissa)
How it works:
Exp = a / b;
Scalar = s;
`s / (a / b)` = `b * s / a` a... | 34,871 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.