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 |
|---|---|---|---|---|
189 | // clear filter | for (uint i = 0; i < standardLen; i++) {
repetitionFilter[_tokenAddresses[i]][_tokenIDs[i]] = false;
}
| for (uint i = 0; i < standardLen; i++) {
repetitionFilter[_tokenAddresses[i]][_tokenIDs[i]] = false;
}
| 54,143 |
6 | // 1 allowed | else
require( owners[msg.sender].claimed + quantity == 1, "only 1 ChimeraPillar may be claimed" );
| else
require( owners[msg.sender].claimed + quantity == 1, "only 1 ChimeraPillar may be claimed" );
| 39,404 |
34 | // - Update Fee Rate | function UpdateFeeRate(uint _feerate) public onlyOwner returns(bool) {
if (FeeRate == _feerate) revert("Fee Rate No Change!");
FeeRate = _feerate;
return true;
}
| function UpdateFeeRate(uint _feerate) public onlyOwner returns(bool) {
if (FeeRate == _feerate) revert("Fee Rate No Change!");
FeeRate = _feerate;
return true;
}
| 34,141 |
37 | // Returns the amount of BPT that would be burned from `sender` if the `onExitPool` hook were called by theVault with the same arguments, along with the number of tokens `recipient` would receive. This function is not meant to be called directly, but rather from a helper contract that fetches current Vaultdata, such as... | function queryExit(
bytes32 poolId,
address sender,
address recipient,
uint256[] memory balances,
uint256 lastChangeBlock,
uint256 protocolSwapFeePercentage,
bytes memory userData
) external returns (uint256 bptIn, uint256[] memory amountsOut);
| function queryExit(
bytes32 poolId,
address sender,
address recipient,
uint256[] memory balances,
uint256 lastChangeBlock,
uint256 protocolSwapFeePercentage,
bytes memory userData
) external returns (uint256 bptIn, uint256[] memory amountsOut);
| 29,199 |
28 | // Remove an account's access to this role. / | function remove(Role storage role, address account) internal {
require(has(role, account), "Roles: account does not have role");
role.bearer[account] = false;
}
| function remove(Role storage role, address account) internal {
require(has(role, account), "Roles: account does not have role");
role.bearer[account] = false;
}
| 409 |
21 | // ------------------------------------------------------------------------/Admin function to update the voting configurationminQuorum_ The min number of votes to approve a proposal maxVotes_ The max number of votes a proposal can have / | function setVotingConfig(uint64 minQuorum_, uint64 maxVotes_) external onlyOwnerOrAdmin {
votingConfig = VotingConfig(minQuorum_, maxVotes_);
}
| function setVotingConfig(uint64 minQuorum_, uint64 maxVotes_) external onlyOwnerOrAdmin {
votingConfig = VotingConfig(minQuorum_, maxVotes_);
}
| 2,360 |
76 | // fill in the reverse binding | reverseBindings[targetContract][targetId] = recordId;
| reverseBindings[targetContract][targetId] = recordId;
| 54,227 |
514 | // factually allocate if any needs distribution | if(_toDistribute > 0){
| if(_toDistribute > 0){
| 18,488 |
196 | // Role identifiers for AccessControl bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;inherited from AccessControl | bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE");
bytes32 public constant REVOKER_ROLE = keccak256("REVOKER_ROLE");
bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
bytes32 public constant WHITELISTER_ROLE =... | bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE");
bytes32 public constant REVOKER_ROLE = keccak256("REVOKER_ROLE");
bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
bytes32 public constant WHITELISTER_ROLE =... | 29,790 |
11 | // Verifies that the last return was a successful `transfer` call./ This is done by checking that the return data is either empty, or/ is a valid ABI encoded boolean. | function getLastTransferResult(IERC20 token) private view returns (bool success) {
// NOTE: Inspecting previous return data requires assembly. Note that
// we write the return data to memory 0 in the case where the return
// data size is 32, this is OK since the first 64 bytes of memory are
// reserve... | function getLastTransferResult(IERC20 token) private view returns (bool success) {
// NOTE: Inspecting previous return data requires assembly. Note that
// we write the return data to memory 0 in the case where the return
// data size is 32, this is OK since the first 64 bytes of memory are
// reserve... | 31,592 |
1 | // The BalleMaster contract. | IBalleMaster public immutable balleMaster;
| IBalleMaster public immutable balleMaster;
| 21,775 |
35 | // The following values should be assigned in _xcall. | nonce: 0,
canonicalDomain: 0,
bridgedAmt: 0,
normalizedIn: 0,
canonicalId: bytes32(0)
| nonce: 0,
canonicalDomain: 0,
bridgedAmt: 0,
normalizedIn: 0,
canonicalId: bytes32(0)
| 18,836 |
2 | // Storage entry for a trait type (category) | struct TraitType {
string name; //the name of the category (i.e., 'Clothes')
uint16[] rarity; //the rarity table is mapped to each Trait in a TraitType and should be provided as an array of desired occurrences out of 1000 samples. E.g.: [500,200,200,100,100]. 0 rarity indicates that the trait will not oc... | struct TraitType {
string name; //the name of the category (i.e., 'Clothes')
uint16[] rarity; //the rarity table is mapped to each Trait in a TraitType and should be provided as an array of desired occurrences out of 1000 samples. E.g.: [500,200,200,100,100]. 0 rarity indicates that the trait will not oc... | 79,693 |
72 | // AddressSet | struct AddressSet {
Set _inner;
}
| struct AddressSet {
Set _inner;
}
| 3,052 |
23 | // 5a| GAS | gas addr 0 cds 0 0 0| [0, cds] = calldata f4| DELEGATECALL| success 0 | [0, cds] = calldata 3d| RETURNDATASIZE| rds success 0 | [0, cds] = calldata 82| DUP3| 0 rds success 0 | [0, cds] = calldata 80| DUP1| 0 0 rds success 0 | [0, cds] = calldata 3e| RETURNDATACOPY| success 0 | [0, rds] = return data (there... |
mstore(
add(ptr, 0x34),
0x5af43d82803e903d91603657fd5bf30000000000000000000000000000000000
)
|
mstore(
add(ptr, 0x34),
0x5af43d82803e903d91603657fd5bf30000000000000000000000000000000000
)
| 72,488 |
10 | // 6. Refund leftovers to users | (address tokenA, address tokenB) = getPair(lp);
doRefundETH();
doRefund(tokenA);
doRefund(tokenB);
| (address tokenA, address tokenB) = getPair(lp);
doRefundETH();
doRefund(tokenA);
doRefund(tokenB);
| 42,382 |
18 | // Withdraw vested amount for user that hasn't been withdrawn yetWe will never withdraw more than the contract balance/ | function withdraw() public notContract nonReentrant whenNotPaused {
require(isUserInfo(msg.sender), 'TeslaSafeVesting: User has no rewards');
require(!userInfo[msg.sender].hasSold, "TeslaSafeVesting: User has sold and no longer qualifies");
uint256 vested = vestedAmount(msg.sender);
... | function withdraw() public notContract nonReentrant whenNotPaused {
require(isUserInfo(msg.sender), 'TeslaSafeVesting: User has no rewards');
require(!userInfo[msg.sender].hasSold, "TeslaSafeVesting: User has sold and no longer qualifies");
uint256 vested = vestedAmount(msg.sender);
... | 13,446 |
0 | // Contract for object that have an owner / | contract Owned {
/**
* Contract owner address
*/
address public owner;
/**
* @dev Store owner on creation
*/
function Owned() { owner = msg.sender; }
/**
* @dev Delegate contract to another person
* @param _owner is another person address
*/
function delegate... | contract Owned {
/**
* Contract owner address
*/
address public owner;
/**
* @dev Store owner on creation
*/
function Owned() { owner = msg.sender; }
/**
* @dev Delegate contract to another person
* @param _owner is another person address
*/
function delegate... | 17,998 |
312 | // Release the amount to beneficiary, but with reward subtracted. | stakeVault.releaseTo(beneficiary, unstakeAmount_);
| stakeVault.releaseTo(beneficiary, unstakeAmount_);
| 28,668 |
12 | // Transfer the NFT back to the user | DCO_NFT(nftContract).transferFrom(address(this), returnAddress, nftId);
| DCO_NFT(nftContract).transferFrom(address(this), returnAddress, nftId);
| 4,415 |
18 | // enables or disables address to be sender of EUR-T | function setAllowedTransferFrom(address from, bool allowed)
public
only(ROLE_EURT_DEPOSIT_MANAGER)
| function setAllowedTransferFrom(address from, bool allowed)
public
only(ROLE_EURT_DEPOSIT_MANAGER)
| 29,862 |
14 | // : return the pairs (attribute=>value) required for Receiver in order to transfer tokens / | function getReceiverRequirements() public view returns (bytes32[], bytes32[]) {
uint256 numberOfPairs = receiverRequirements.length;
if (numberOfPairs != 0) {
bytes32[] memory attributes = new bytes32[](numberOfPairs);
bytes32[] memory values = new bytes32[](numberOfPairs);
for(uint i = 0; i... | function getReceiverRequirements() public view returns (bytes32[], bytes32[]) {
uint256 numberOfPairs = receiverRequirements.length;
if (numberOfPairs != 0) {
bytes32[] memory attributes = new bytes32[](numberOfPairs);
bytes32[] memory values = new bytes32[](numberOfPairs);
for(uint i = 0; i... | 14,196 |
241 | // Gets the exchange rate from the underlying to the DMM token, such that `DMM: Token = underlying / exchangeRate` returnThe current exchange rate, represented using 18 decimals. Meaning, `200000000000000000` is 0.2. / | function getExchangeRateByUnderlying(address underlyingToken) external view returns (uint);
| function getExchangeRateByUnderlying(address underlyingToken) external view returns (uint);
| 6,272 |
1 | // 构造函数中创建t_asset表 | tf = KVTable(0x1009);
| tf = KVTable(0x1009);
| 22,222 |
51 | // allocate token for contributors Address | function allocateAngelWheelFinanceToken(address[] _angelWheelFinancingAddress, uint256[] _amount) public onlyOwner {
//require(balances[contributorsAddress] == 0);
angelWheelFinancing = mintMultiToken(_angelWheelFinancingAddress, _amount, angelWheelFinancing);
require (angelWheelFinancing <=... | function allocateAngelWheelFinanceToken(address[] _angelWheelFinancingAddress, uint256[] _amount) public onlyOwner {
//require(balances[contributorsAddress] == 0);
angelWheelFinancing = mintMultiToken(_angelWheelFinancingAddress, _amount, angelWheelFinancing);
require (angelWheelFinancing <=... | 11,590 |
1 | // events | event NFTCreated(
uint256 indexed tokenId,
address indexed recipient,
address token,
uint256 amount,
uint256 unlock
);
event NFTRedeemed(uint256 indexed tokenId, address indexed holder, address token, uint256 amount);
event URISet(string _uri);
event MinterAdded(address newMinter);
| event NFTCreated(
uint256 indexed tokenId,
address indexed recipient,
address token,
uint256 amount,
uint256 unlock
);
event NFTRedeemed(uint256 indexed tokenId, address indexed holder, address token, uint256 amount);
event URISet(string _uri);
event MinterAdded(address newMinter);
| 7,154 |
9 | // ---------------------------------------------------------------------------------- onlyApproved | function validateTransactionProofV2(uint16 _srcChainId, address _dstAddress, uint _gasLimit, bytes32 _blockHash, bytes calldata _transactionProof, address payable _to) external payable onlyApproved nonReentrant {
(bool sent, ) = _to.call{value: msg.value}("");
//require(sent, "Relayer: failed to sen... | function validateTransactionProofV2(uint16 _srcChainId, address _dstAddress, uint _gasLimit, bytes32 _blockHash, bytes calldata _transactionProof, address payable _to) external payable onlyApproved nonReentrant {
(bool sent, ) = _to.call{value: msg.value}("");
//require(sent, "Relayer: failed to sen... | 35,146 |
88 | // sets the payees for transmitting addresses _transmitters addresses oracles use to transmit the reports _payees addresses of payees corresponding to list of transmitters must be called by owner cannot be used to change payee addresses, only to initially populate them / | function setPayees(
| function setPayees(
| 28,359 |
101 | // Returns the information about a position by the position's key/key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper/ return _liquidity The amount of liquidity in the position,/ Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/bur... | function positions(bytes32 key)
external
view
returns (
uint128 _liquidity,
uint256 feeGrowthInside0LastX128,
uint256 feeGrowthInside1LastX128,
uint128 tokensOwed0,
uint128 tokensOwed1
);
| function positions(bytes32 key)
external
view
returns (
uint128 _liquidity,
uint256 feeGrowthInside0LastX128,
uint256 feeGrowthInside1LastX128,
uint128 tokensOwed0,
uint128 tokensOwed1
);
| 5,244 |
2 | // Max and min signed integer value | int256 constant internal MAX_INT_256 = type(int256).max;
int256 constant internal MIN_INT_256 = type(int256).min;
| int256 constant internal MAX_INT_256 = type(int256).max;
int256 constant internal MIN_INT_256 = type(int256).min;
| 8,645 |
6 | // BG | TIERS[5] = [555, 825, 1046, 1480, 1884, 1884, 2326];
| TIERS[5] = [555, 825, 1046, 1480, 1884, 1884, 2326];
| 24,065 |
84 | // subtract amount from tokensLocked | }
| }
| 10,659 |
70 | // 1% fee is taken on the ETH | uint256 fee = SafeMath.div(msg.value, FEE);
fees = SafeMath.add(fees, fee);
| uint256 fee = SafeMath.div(msg.value, FEE);
fees = SafeMath.add(fees, fee);
| 3,478 |
69 | // Give the winner the reward for rounds he might not have been able to contribute to. Challenger, who ultimately wins, will be able to get the deposit of the requester, even if he didn't participate in the initial dispute. Requester, if wins a dispute, will be able to get the deposit of the challenger of said dispute,... | if (_round == 0 && ((_beneficiary == request.ultimateChallenger && _challengeID == 0) ||
(_beneficiary == request.requester && _challengeID > 0 && request.rulings[_challengeID] == uint(Party.Requester)))) {
reward = round.feeRewards;
round.feeRewards = 0;
| if (_round == 0 && ((_beneficiary == request.ultimateChallenger && _challengeID == 0) ||
(_beneficiary == request.requester && _challengeID > 0 && request.rulings[_challengeID] == uint(Party.Requester)))) {
reward = round.feeRewards;
round.feeRewards = 0;
| 39,105 |
4 | // Address of feeTo | function feeTo() external view returns (address);
| function feeTo() external view returns (address);
| 30,080 |
24 | // 映射:每个地址对应每个董事会席位,即一个地址对应一个董事(结构体) | mapping(address => Boardseat) private directors;
| mapping(address => Boardseat) private directors;
| 17,669 |
42 | // Internal to calculate total value of all assets held in Vault.return value Total value in ETH (1e18) / | function _totalValueInVault() internal view returns (uint256 value) {
for (uint256 y = 0; y < allAssets.length; y++) {
IERC20 asset = IERC20(allAssets[y]);
uint256 assetDecimals = Helpers.getDecimals(allAssets[y]);
uint256 balance = asset.balanceOf(address(this));
... | function _totalValueInVault() internal view returns (uint256 value) {
for (uint256 y = 0; y < allAssets.length; y++) {
IERC20 asset = IERC20(allAssets[y]);
uint256 assetDecimals = Helpers.getDecimals(allAssets[y]);
uint256 balance = asset.balanceOf(address(this));
... | 33,533 |
75 | // Based on "@openzeppelin<2.5.1>/contracts/drafts/TokenVesting.sol"; | contract MonthlyTokenVesting is IReleaser, Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
event TokensReleased(address token, uint256 amount);
address public _beneficiary;
bool public _beneficiaryIsReleaser;
// Durations and timestamps are expressed in UNIX time, the same units as bloc... | contract MonthlyTokenVesting is IReleaser, Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
event TokensReleased(address token, uint256 amount);
address public _beneficiary;
bool public _beneficiaryIsReleaser;
// Durations and timestamps are expressed in UNIX time, the same units as bloc... | 42,465 |
178 | // Base URL | string private _baseUri;
| string private _baseUri;
| 40,602 |
393 | // GLOBAL STATE FUNCTIONS // Premature contract settlement under emergency circumstances. Only the governor can call this function as they are permissioned within the `FinancialContractAdmin`.Upon emergency shutdown, the contract settlement time is set to the shutdown time. This enables withdrawalto occur via the `sett... | function emergencyShutdown() external override notEmergencyShutdown() fees() nonReentrant() {
// Note: revert reason removed to save bytecode.
require(msg.sender == _getFinancialContractsAdminAddress());
emergencyShutdownTimestamp = getCurrentTime();
_requestOraclePrice(emergencyShu... | function emergencyShutdown() external override notEmergencyShutdown() fees() nonReentrant() {
// Note: revert reason removed to save bytecode.
require(msg.sender == _getFinancialContractsAdminAddress());
emergencyShutdownTimestamp = getCurrentTime();
_requestOraclePrice(emergencyShu... | 5,760 |
46 | // hago una aprobacion para que el contrato creador pueda gastar lo que existe en la pool token[Token0].approve(contractCreator,BalancePool[Token0].amount0);apruebo que el contrato creado pueda gastarse todos el token0 token[Token1].approve(contractCreator,BalancePool[Token1].amount1);apruebo que el contrato creado pue... |
emit WithdrawTokenPool( _user, _amount0, _amount1);
|
emit WithdrawTokenPool( _user, _amount0, _amount1);
| 9,325 |
0 | // The balance of a given account in the Bank. Zero by default. | mapping(address => uint256) public balanceOf;
| mapping(address => uint256) public balanceOf;
| 9,104 |
0 | // Each TORIX image is hashed using SHA-256.These hashes are then, in order 1 - 9999, concatenated into a string which is then hashed using SHA-256 into provenceHash./ | string public provenanceHash = "ea7f691c1a1a95a617805076904035dcbf8e1f0878f47caa53c51ad309d1c062";
string public notRevealedURI;
bool public revealed;
bool public mintStatus;
bool public mintWhitelistStatus;
bool public secondSale;
bytes32 internal keyHash;
mapping(address => bool) ... | string public provenanceHash = "ea7f691c1a1a95a617805076904035dcbf8e1f0878f47caa53c51ad309d1c062";
string public notRevealedURI;
bool public revealed;
bool public mintStatus;
bool public mintWhitelistStatus;
bool public secondSale;
bytes32 internal keyHash;
mapping(address => bool) ... | 22,902 |
17 | // pagar (virtualmente) dividendos | address _customerAddress = msg.sender;
payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude);
| address _customerAddress = msg.sender;
payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude);
| 19,335 |
59 | // add new user rollover amount to total | trackTotalActiveRollOvers[trackId][saleCount] += userCp.stakeWeight;
| trackTotalActiveRollOvers[trackId][saleCount] += userCp.stakeWeight;
| 30,303 |
7 | // Reset Last Voted | s.info[invokerId].can_admire_after = block.timestamp + 86400;
| s.info[invokerId].can_admire_after = block.timestamp + 86400;
| 17,233 |
184 | // See {IERC721-safeTransferFrom}. / | function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, '');
}
| function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, '');
}
| 6,476 |
0 | // triggered when relay of deposit from HomeBridge is complete | event RelayedMessage(address recipient, uint value, bytes32 transactionHash);
function onExecuteMessage(address, uint256) internal returns(bool);
| event RelayedMessage(address recipient, uint value, bytes32 transactionHash);
function onExecuteMessage(address, uint256) internal returns(bool);
| 20,100 |
10 | // A distinct URI (RFC 3986) for a given NFT. _tokenId Id for which we want uri.return URI of _tokenId. / | function tokenURI(
uint256 _tokenId
)
external
view
validNFToken(_tokenId)
returns (string memory)
| function tokenURI(
uint256 _tokenId
)
external
view
validNFToken(_tokenId)
returns (string memory)
| 8,473 |
5 | // Given a tranche, looks up the collateral balance backing the tranche supply./t Address of the tranche token./ return The collateral balance and the tranche token supply. | function getTrancheCollateralization(ITranche t) internal view returns (uint256, uint256) {
IBondController bond = IBondController(t.bond());
TrancheData memory td;
uint256[] memory collateralBalances;
uint256[] memory trancheSupplies;
(td, collateralBalances, trancheSupplies... | function getTrancheCollateralization(ITranche t) internal view returns (uint256, uint256) {
IBondController bond = IBondController(t.bond());
TrancheData memory td;
uint256[] memory collateralBalances;
uint256[] memory trancheSupplies;
(td, collateralBalances, trancheSupplies... | 13,767 |
74 | // Update token fees (max set to initial fee)/ | function updateFees(uint256 marketingFee, uint256 liquidityFee, uint256 protocolFee) external onlyOwner {
_marketingFee = marketingFee;
_liquidityFee = liquidityFee;
_protocolFee = protocolFee;
totalFees = _marketingFee + _liquidityFee + _protocolFee;
require(totalFees <= 1... | function updateFees(uint256 marketingFee, uint256 liquidityFee, uint256 protocolFee) external onlyOwner {
_marketingFee = marketingFee;
_liquidityFee = liquidityFee;
_protocolFee = protocolFee;
totalFees = _marketingFee + _liquidityFee + _protocolFee;
require(totalFees <= 1... | 33,887 |
8 | // Emitted when a source vault authorization status changes. | event UpdateSourceVaultAuthorization(address vault, bool isAuthorized);
| event UpdateSourceVaultAuthorization(address vault, bool isAuthorized);
| 38,584 |
26 | // Emitted in `withdraw` when the user withdrew his locked tokens from the contract / | event TokensWithdrawed(
| event TokensWithdrawed(
| 67,167 |
40 | // This function returns an array of the Hashes Collectionscreated through this registry for a particular implementation address. _implementationAddress The implementation address. _start The array start index (inclusive). _end The array end index (exclusive).return An array of Collection addresses. / | function getCollections(
address _implementationAddress,
uint256 _start,
uint256 _end
| function getCollections(
address _implementationAddress,
uint256 _start,
uint256 _end
| 30,289 |
143 | // Mint equal amount of HFLY to contract | _mint(address(this), _amountMaggot);
| _mint(address(this), _amountMaggot);
| 16,826 |
202 | // Stake SMOL tokens to MasterChef | function enterStaking(uint256 _amount) public {
PoolInfo storage pool = poolInfo[0];
UserInfo storage user = userInfo[0][msg.sender];
updatePool(0);
if (user.amount > 0) {
uint256 pending = user.amount.mul(pool.accSmolPerShare).div(1e12).sub(user.rewardDebt);
... | function enterStaking(uint256 _amount) public {
PoolInfo storage pool = poolInfo[0];
UserInfo storage user = userInfo[0][msg.sender];
updatePool(0);
if (user.amount > 0) {
uint256 pending = user.amount.mul(pool.accSmolPerShare).div(1e12).sub(user.rewardDebt);
... | 23,346 |
285 | // Get the ETH Price PRECISE_PRICE_PRECISION | ( , , uint256 eth_price) = getTokenPrice(token_address);
| ( , , uint256 eth_price) = getTokenPrice(token_address);
| 30,163 |
48 | // Repayment from pushMan or otherMaker, generate repayment prooffromAddresstoAddressamountchainIDproofID/ function RepaymentTokenByPushMan( address fromAddress, address toAddress,address TokenAddress; uint256 amount, uint256 chainID, uint256 proofID | // ) public {
// // LoanProof is found according to the proofID, and it is determined that the LoanProof has not been processed
// // Here to judge whether the relevant information such as the amount, address, etc. is consistent
// // Authorize the contract to process fromAddress's tokens, t... | // ) public {
// // LoanProof is found according to the proofID, and it is determined that the LoanProof has not been processed
// // Here to judge whether the relevant information such as the amount, address, etc. is consistent
// // Authorize the contract to process fromAddress's tokens, t... | 17,212 |
9 | // SPDX-License-Identifier: MIT | library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtr... | library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtr... | 5,010 |
73 | // update total deposits till today | users[msg.sender][_tokenAddress].totalDeposits += _amount;
| users[msg.sender][_tokenAddress].totalDeposits += _amount;
| 980 |
181 | // AETH contract address. / | address constant private AETH_CONTRACT = 0x3a3A65aAb0dd2A17E3F1947bA16138cd37d08c04;
| address constant private AETH_CONTRACT = 0x3a3A65aAb0dd2A17E3F1947bA16138cd37d08c04;
| 64,792 |
33 | // Ensure the provided reward amount is not more than the balance in the contract. This keeps the reward rate in the right range, preventing overflows due to very high values of rewardRate in the earned and rewardsPerToken functions; Reward + leftover must be less than 2^256 / 10^18 to avoid overflow. | uint256 balance = rewardsToken.balanceOf(address(this));
if (block.timestamp >= periodFinish) {
rewardsDuration = _rewardsDuration;
rewardRate = reward.div(rewardsDuration);
require(
rewardRate <= balance.div(rewardsDuration),
"Provided... | uint256 balance = rewardsToken.balanceOf(address(this));
if (block.timestamp >= periodFinish) {
rewardsDuration = _rewardsDuration;
rewardRate = reward.div(rewardsDuration);
require(
rewardRate <= balance.div(rewardsDuration),
"Provided... | 17,206 |
77 | // |/ Transfers amount amount of an _id from the _from address to the _to address specified _fromSource address _toTarget address _idID of the token type _amountTransfered amount _dataAdditional data with no specified format, sent in call to `_to` / | function safeTransferFrom(address _from, address _to, uint256 _id, uint256 _amount, bytes memory _data)
public
| function safeTransferFrom(address _from, address _to, uint256 _id, uint256 _amount, bytes memory _data)
public
| 15,948 |
3 | // Adding user to the users list | if (userEvents[msg.sender].length == 1) { // this means it's the user's first event
users.push(msg.sender);
eventCreators.push(msg.sender); // Add the creator to the list of event creators
}
| if (userEvents[msg.sender].length == 1) { // this means it's the user's first event
users.push(msg.sender);
eventCreators.push(msg.sender); // Add the creator to the list of event creators
}
| 34,270 |
6 | // A bool to indicate if the contract is paused, stored with 'fees bond' | bool public paused;
| bool public paused;
| 34,291 |
6 | // Get the address of the sibling contract that tracks trust score. / | function getMarketGovernanceContractAddress() external view returns(address) {
return address(marketTokenContract);
}
| function getMarketGovernanceContractAddress() external view returns(address) {
return address(marketTokenContract);
}
| 9,990 |
3 | // URI for all assets created under this collection | string private _contractURI =
| string private _contractURI =
| 20,949 |
122 | // Implementation of royalties for 721s / | interface IERC2981 {
// ERC165 bytes to add to interface array - set in parent contract
// implementing this standard
//
// bytes4(keccak256("royaltyInfo(uint256)")) == 0xcef6d368
// bytes4(keccak256("onRoyaltiesReceived(address,address,uint256,address,uint256,bytes32)")) == 0xe8cb9d99
// bytes4... | interface IERC2981 {
// ERC165 bytes to add to interface array - set in parent contract
// implementing this standard
//
// bytes4(keccak256("royaltyInfo(uint256)")) == 0xcef6d368
// bytes4(keccak256("onRoyaltiesReceived(address,address,uint256,address,uint256,bytes32)")) == 0xe8cb9d99
// bytes4... | 58,396 |
106 | // The last claimant might be owed slightly more or less than the actual remaining deposit / | if ((_bid == totalBids && _bid != 0) || supply == 0) {
return supply;
}
| if ((_bid == totalBids && _bid != 0) || supply == 0) {
return supply;
}
| 36,868 |
98 | // Function to get is claim flag by id id stake id for the stake / | function getIsClaimById(uint256 id)public view returns(bool){
require(id <= _stakingCount,"Unable to reterive data on specified id, Please try again!!");
return _isClaim[id];
}
| function getIsClaimById(uint256 id)public view returns(bool){
require(id <= _stakingCount,"Unable to reterive data on specified id, Please try again!!");
return _isClaim[id];
}
| 34,637 |
63 | // Returns the downcasted int8 from int256, reverting onoverflow (when the input is less than smallest int8 orgreater than largest int8). Counterpart to Solidity's `int8` operator. Requirements: - input must fit into 8 bits _Available since v3.1._ / | function toInt8(int256 value) internal pure returns (int8 downcasted) {
downcasted = int8(value);
require(downcasted == value, "SafeCast: value doesn't fit in 8 bits");
}
| function toInt8(int256 value) internal pure returns (int8 downcasted) {
downcasted = int8(value);
require(downcasted == value, "SafeCast: value doesn't fit in 8 bits");
}
| 28,721 |
5 | // Thrown when a custom checkRole function is used and the caller does not have the required role | error MissingRole(bytes32 _role, address _account);
| error MissingRole(bytes32 _role, address _account);
| 27,109 |
23 | // set public information/ | function setInformation(string _information) external onlyMasters {
information = _information;
}
| function setInformation(string _information) external onlyMasters {
information = _information;
}
| 54,083 |
89 | // Retreive value from oracle based on timestamp _requestId being requested _timestamp to retreive data/value fromreturn value for timestamp submitted / | function retrieveData(uint256 _requestId, uint256 _timestamp)
| function retrieveData(uint256 _requestId, uint256 _timestamp)
| 28,045 |
228 | // mapping to track claims for a given address | mapping(address => uint256) private _claims;
| mapping(address => uint256) private _claims;
| 16,889 |
251 | // 8. Store the loan | state.updateLoan(loan);
| state.updateLoan(loan);
| 30,001 |
91 | // File: contracts/token/AWX.sol/ AWX ERC20 token implementation./ | contract AWX is ERC20Pausable, Ownable {
/**
* @dev Fired when an @param account is whitelisted.
*/
event WhitelistAdded(address indexed account);
/**
* @dev Fired when an @param account is removed from whitelist.
*/
event WhitelistRemoved(address indexed account);
/**... | contract AWX is ERC20Pausable, Ownable {
/**
* @dev Fired when an @param account is whitelisted.
*/
event WhitelistAdded(address indexed account);
/**
* @dev Fired when an @param account is removed from whitelist.
*/
event WhitelistRemoved(address indexed account);
/**... | 16,463 |
189 | // account Address to give the {role} to. Requirements: - Sender must be role admin. / | function grantRole(bytes32 role, address account)
external
authorized(ADMIN, msg.sender)
{
RolesLib.grantRole(role, account);
}
| function grantRole(bytes32 role, address account)
external
authorized(ADMIN, msg.sender)
{
RolesLib.grantRole(role, account);
}
| 44,278 |
342 | // we do a flash loan to give us a big gap. from here on out it is cheaper to use normal deleverage. Use Aave for extremely large loans | if (DyDxActive) {
position = position.sub(doDyDxFlashLoan(deficit, position));
}
| if (DyDxActive) {
position = position.sub(doDyDxFlashLoan(deficit, position));
}
| 38,323 |
0 | // Make sure player trying to bid places at least the minimum bid | require(msg.value >= currentBid + minimumBid, "Minimum bid not met");
| require(msg.value >= currentBid + minimumBid, "Minimum bid not met");
| 14,878 |
52 | // validate msg.value | require(msg.value == _amount, "ERR_ETH_AMOUNT_MISMATCH");
| require(msg.value == _amount, "ERR_ETH_AMOUNT_MISMATCH");
| 54,911 |
19 | // Enables royaltiy functionality at the ERC721 level when ether is sent with no calldata. See implementation of _royaltiesFallback. / | receive() external payable {
_royaltiesFallback();
}
| receive() external payable {
_royaltiesFallback();
}
| 58,528 |
59 | // Event created on money withdraw. | event Withdraw(address recipient, uint256 value, uint256 homeGasPrice);
| event Withdraw(address recipient, uint256 value, uint256 homeGasPrice);
| 41,452 |
25 | // Implementation of the {IERC20} interface.that a supply mechanism has to be added in a derived contract using {_mint}.For a generic mechanism see {ERC20PresetMinterPauser}.Additionally, an {Approval} event is emitted on calls to {transferFrom}.Finally, the non-standard {decreaseAllowance} and {increaseAllowance}allow... | function _initERC20(string memory name_, string memory symbol_) internal {
require(!_initialized, "ERC20: token has already been initialized!");
_name = name_;
_symbol = symbol_;
_decimals = 18;
uint256 chainId;
assembly {
chainId := chainid()
}
| function _initERC20(string memory name_, string memory symbol_) internal {
require(!_initialized, "ERC20: token has already been initialized!");
_name = name_;
_symbol = symbol_;
_decimals = 18;
uint256 chainId;
assembly {
chainId := chainid()
}
| 23 |
8 | // ETH LongTerm Vault LongTerm Finance Contract in charge of handling the ALTS Vault and stake using ETH and WETH / | contract ETHVaultHandler is IVaultHandler {
/// @notice Open Zeppelin libraries
using SafeMath for uint256;
/**
* @notice Constructor
* @param _orchestrator address
* @param _divisor uint256
* @param _ratio uint256
* @param _burnFee uint256
* @param _liquidationPenalty uint256
* @param _alts... | contract ETHVaultHandler is IVaultHandler {
/// @notice Open Zeppelin libraries
using SafeMath for uint256;
/**
* @notice Constructor
* @param _orchestrator address
* @param _divisor uint256
* @param _ratio uint256
* @param _burnFee uint256
* @param _liquidationPenalty uint256
* @param _alts... | 31,598 |
1 | // Address where funds are collected | address payable private _wallet;
| address payable private _wallet;
| 4,320 |
13 | // Returns current ticket price from the main Etheraffle contract / | function getTktPrice() public view returns (uint) {
return etheraffleContract.tktPrice();
}
| function getTktPrice() public view returns (uint) {
return etheraffleContract.tktPrice();
}
| 34,134 |
14 | // withdraw ether from contract./only owner function | function withdraw() public onlyOwner nonReentrant{
(bool owner, ) = payable(owner()).call{value: address(this).balance}('');
require(owner);
}
| function withdraw() public onlyOwner nonReentrant{
(bool owner, ) = payable(owner()).call{value: address(this).balance}('');
require(owner);
}
| 25,490 |
230 | // Approves another address to transfer the given token IDThe zero address indicates there is no approved address.There can only be one approved address per token at a given time.Can only be called by the token owner or an approved operator. to address to be approved for the given token ID tokenId uint256 ID of the tok... | function approve(address to, uint256 tokenId) public {
address owner = ownerOf(tokenId);
require(to != owner);
require(msg.sender == owner || isApprovedForAll(owner, msg.sender));
_tokenApprovals[tokenId] = to;
emit Approval(owner, to, tokenId);
}
| function approve(address to, uint256 tokenId) public {
address owner = ownerOf(tokenId);
require(to != owner);
require(msg.sender == owner || isApprovedForAll(owner, msg.sender));
_tokenApprovals[tokenId] = to;
emit Approval(owner, to, tokenId);
}
| 5,251 |
5 | // ALTS Token Address | ALTS public immutable ALTSToken;
| ALTS public immutable ALTSToken;
| 49,463 |
53 | // amount: Unlocked tokens, total: Total locked tokens | event TokensUnlocked(uint256 amount, uint256 total);
TokenPool private _stakingPool;
TokenPool private _unlockedPool;
TokenPool private _lockedPool;
| event TokensUnlocked(uint256 amount, uint256 total);
TokenPool private _stakingPool;
TokenPool private _unlockedPool;
TokenPool private _lockedPool;
| 57,686 |
18 | // 兑换成investTokenTODO::当Farm数量大于50时先从uniV2换成ETH然后再从curve换 | uint256 balanceBeforeSwap = IERC20(baseToken).balanceOf(address(this));
if(amount>10**15){
swapFarm2UsdtInUniswapV2(amount,0,1800);
uint256 balanceAfterSwap = IERC20(baseToken).balanceOf(address(this));
return balanceAfterSwap - balanceBeforeSwap;
}
| uint256 balanceBeforeSwap = IERC20(baseToken).balanceOf(address(this));
if(amount>10**15){
swapFarm2UsdtInUniswapV2(amount,0,1800);
uint256 balanceAfterSwap = IERC20(baseToken).balanceOf(address(this));
return balanceAfterSwap - balanceBeforeSwap;
}
| 50,969 |
37 | // ======= AUXILLIARY ======= //allow anyone to send lost tokens (excluding principle or OHM) to the DAO return bool / | function recoverLostToken(address _token) external returns (bool) {
require(_token != OHM);
require(_token != principle);
IERC20(_token).safeTransfer(DAO, IERC20(_token).balanceOf(address(this)));
return true;
}
| function recoverLostToken(address _token) external returns (bool) {
require(_token != OHM);
require(_token != principle);
IERC20(_token).safeTransfer(DAO, IERC20(_token).balanceOf(address(this)));
return true;
}
| 2,800 |
48 | // Get ether balance in USD and reset demand count | balances[0] = this.balance * etherUSDRate;
tokenDemand[address(this)] = 0;
| balances[0] = this.balance * etherUSDRate;
tokenDemand[address(this)] = 0;
| 36,958 |
29 | // The standard ERC 20 transferFrom functionality | if (allowed[_from][msg.sender] < _amount)
return false;
allowed[_from][msg.sender] -= _amount;
| if (allowed[_from][msg.sender] < _amount)
return false;
allowed[_from][msg.sender] -= _amount;
| 26,222 |
0 | // Initializes the contract setting the initial owner. / | constructor (address _owner) public {
owner = _owner;
emit OwnershipTransferred(address(0), _owner);
}
| constructor (address _owner) public {
owner = _owner;
emit OwnershipTransferred(address(0), _owner);
}
| 17,095 |
12 | // This is only to be used with special purpose community accounts like Treasury, DEX. Those accounts help to represent the total supply correctly. | function transferInternal(address _from, address _to, uint256 _value) private returns (bool success) {
require(balances[_from] >= _value, "Insufficient balance");
require(balances[_to] + _value > balances[_to]);
balances[_to] += _value;
balances[_from] -= _value;
emit Transfer(_from, _to, _value);... | function transferInternal(address _from, address _to, uint256 _value) private returns (bool success) {
require(balances[_from] >= _value, "Insufficient balance");
require(balances[_to] + _value > balances[_to]);
balances[_to] += _value;
balances[_from] -= _value;
emit Transfer(_from, _to, _value);... | 28,726 |
11 | // Payments to this contract require a bit of gas. 100k should be enough. | function() payable public {
execute_transfer(msg.value);
}
| function() payable public {
execute_transfer(msg.value);
}
| 5,878 |
29 | // Contracts that should be able to recover tokens or ethers Ilan Doron This allows to recover any tokens or Ethers received in a contract.This will prevent any accidental loss of tokens. / | contract Withdrawable is PermissionGroups {
event TokenWithdraw(ERC20 token, uint amount, address sendTo);
/**
* @dev Withdraw all ERC20 compatible tokens
* @param token ERC20 The address of the token contract
*/
function withdrawToken(ERC20 token, uint amount, address sendTo) external only... | contract Withdrawable is PermissionGroups {
event TokenWithdraw(ERC20 token, uint amount, address sendTo);
/**
* @dev Withdraw all ERC20 compatible tokens
* @param token ERC20 The address of the token contract
*/
function withdrawToken(ERC20 token, uint amount, address sendTo) external only... | 17,797 |
16 | // Delegate votes to the crowd proposal | IComp(comp_).delegate(address(this));
| IComp(comp_).delegate(address(this));
| 35,970 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.