Unnamed: 0 int64 0 7.36k | comments stringlengths 3 35.2k | code_string stringlengths 1 527k | code stringlengths 1 527k | __index_level_0__ int64 0 88.6k |
|---|---|---|---|---|
12 | // main | acceptedTokens[address(0x0000000000000000000000000000000000000000)] = 1; // BNB
acceptedTokens[address(0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c)] = 2; // BTC
acceptedTokens[address(0x2170Ed0880ac9A755fd29B2688956BD959F933F8)] = 3; // ETH
acceptedTokens[address(0xe9e7CEA3DedcA5984780Baf... | acceptedTokens[address(0x0000000000000000000000000000000000000000)] = 1; // BNB
acceptedTokens[address(0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c)] = 2; // BTC
acceptedTokens[address(0x2170Ed0880ac9A755fd29B2688956BD959F933F8)] = 3; // ETH
acceptedTokens[address(0xe9e7CEA3DedcA5984780Baf... | 28,680 |
42 | // Get total token balance token The token to checkreturn balance the total active balance of `token` / | function totalTokenBalance(address token) external view returns(TokenBalance memory balance){
for (uint256 i; i < numLocks; i++) {
Lock memory tokenLock = tokenLocks[i];
if(tokenLock.token == token && tokenLock.amount != tokenLock.amountClaimed){
balance.totalAmount =... | function totalTokenBalance(address token) external view returns(TokenBalance memory balance){
for (uint256 i; i < numLocks; i++) {
Lock memory tokenLock = tokenLocks[i];
if(tokenLock.token == token && tokenLock.amount != tokenLock.amountClaimed){
balance.totalAmount =... | 51,342 |
25 | // settle debug log / | event SettleLog (string name, uint strikePrice, uint etherPrice, uint totalProfit, uint totalOptionSold, uint premiumShare);
| event SettleLog (string name, uint strikePrice, uint etherPrice, uint totalProfit, uint totalOptionSold, uint premiumShare);
| 18,370 |
8 | // Public View Functions | function getBuildings() public view returns (Building[] memory) {
return buildings;
}
| function getBuildings() public view returns (Building[] memory) {
return buildings;
}
| 1,797 |
6 | // Deposit `amount` stablecoin to vault | vault.deposit(amount);
| vault.deposit(amount);
| 23,997 |
25 | // Kine's KErc20Delegator Contract KTokens which wrap an EIP-20 underlying and delegate to an implementation Kine / | contract KErc20Delegator is KTokenInterface, KErc20Interface, KDelegatorInterface {
/**
* @notice Construct a new money market
* @param underlying_ The address of the underlying asset
* @param controller_ The address of the Controller
* @param name_ ERC-20 name of this token
* @param symbol... | contract KErc20Delegator is KTokenInterface, KErc20Interface, KDelegatorInterface {
/**
* @notice Construct a new money market
* @param underlying_ The address of the underlying asset
* @param controller_ The address of the Controller
* @param name_ ERC-20 name of this token
* @param symbol... | 6,730 |
225 | // update alpaca energy | user.alpacaEnergy = _newEnergy;
| user.alpacaEnergy = _newEnergy;
| 15,501 |
172 | // Simple interest calculated per second Interest = Principalratetime | interestAmount = _loanAmount.multiplyDecimalRound(
interestPerSecond.mul(_seconds)
);
| interestAmount = _loanAmount.multiplyDecimalRound(
interestPerSecond.mul(_seconds)
);
| 15,745 |
14 | // percentage deducted to the advertising fund | uint projectPercent = 2;
| uint projectPercent = 2;
| 35,043 |
7 | // For miscellaneous variable(s) pertaining to the address (e.g. number of whitelist mint slots used). If there are multiple variables, please pack them into a uint64. | uint64 aux;
| uint64 aux;
| 1,067 |
180 | // числитель | сущ(
числитель,
МУЖ, НЕОДУШ,
"[\\&а\\&б\\&й]+ТЕЛЬ",
"[\\&а\\&б\\&й]+ТЕЛЯ",
"[\\&а\\&б\\&й]+ТЕЛЕМ",
"[\\&а\\&б\\&й]+ТЕЛЬ",
"[\\&а\\&б\\&й]+ТЕЛЮ",
"[\\&а\\&б\\&й]+ТЕЛЕ",
"[\\&а\\&б\\&й]+ТЕЛИ",
| сущ(
числитель,
МУЖ, НЕОДУШ,
"[\\&а\\&б\\&й]+ТЕЛЬ",
"[\\&а\\&б\\&й]+ТЕЛЯ",
"[\\&а\\&б\\&й]+ТЕЛЕМ",
"[\\&а\\&б\\&й]+ТЕЛЬ",
"[\\&а\\&б\\&й]+ТЕЛЮ",
"[\\&а\\&б\\&й]+ТЕЛЕ",
"[\\&а\\&б\\&й]+ТЕЛИ",
| 29,116 |
114 | // Admin Events // Event emitted when comptroller is changed / | event NewComptroller(IComptroller oldComptroller, IComptroller newComptroller);
| event NewComptroller(IComptroller oldComptroller, IComptroller newComptroller);
| 797 |
312 | // Add this to our running sum of borrows | (err, localResults.sumBorrows) = addExp(
localResults.borrowTotalValue,
localResults.sumBorrows
);
if (err != Error.NO_ERROR) {
return (err, Exp({mantissa: 0}), Exp({mantissa: 0}));
| (err, localResults.sumBorrows) = addExp(
localResults.borrowTotalValue,
localResults.sumBorrows
);
if (err != Error.NO_ERROR) {
return (err, Exp({mantissa: 0}), Exp({mantissa: 0}));
| 21,066 |
49 | // 2% fee if a user deposits and withdraws between after 1 day but before 3 days. | pool.lpToken.safeTransfer(
address(msg.sender),
_amount.mul(userFeeStage[3]).div(100)
);
pool.lpToken.safeTransfer(
address(devaddr),
_amount.mul(devFeeStage[3]).div(100)
);
| pool.lpToken.safeTransfer(
address(msg.sender),
_amount.mul(userFeeStage[3]).div(100)
);
pool.lpToken.safeTransfer(
address(devaddr),
_amount.mul(devFeeStage[3]).div(100)
);
| 17,136 |
34 | // Owner can set extentions. _whitelist Value in bool. True if using whitelist / | function setPoolExtentions(bool _whitelist) external onlyOwner {
useWhitelist = _whitelist;
emit PoolStatsChanged();
}
| function setPoolExtentions(bool _whitelist) external onlyOwner {
useWhitelist = _whitelist;
emit PoolStatsChanged();
}
| 24,214 |
15 | // return offset The offset of the packed immutable args in calldata | function _getImmutableArgsOffset() internal pure returns (uint256 offset) {
// solhint-disable-next-line no-inline-assembly
assembly {
offset := sub(
calldatasize(),
shr(0xf0, calldataload(sub(calldatasize(), 2)))
)
}
}
| function _getImmutableArgsOffset() internal pure returns (uint256 offset) {
// solhint-disable-next-line no-inline-assembly
assembly {
offset := sub(
calldatasize(),
shr(0xf0, calldataload(sub(calldatasize(), 2)))
)
}
}
| 29,835 |
98 | // return Returns the fundsAddress | function getFundsAddress() public view returns (address) {
return fundsAddress;
}
| function getFundsAddress() public view returns (address) {
return fundsAddress;
}
| 13,164 |
224 | // Get trade taker relative fee at given block number, possibly discounted by discount tier value/blockNumber The concerned block number/discountTier The concerned discount tier | function tradeTakerFee(uint256 blockNumber, int256 discountTier)
public
view
returns (int256)
| function tradeTakerFee(uint256 blockNumber, int256 discountTier)
public
view
returns (int256)
| 58,971 |
61 | // set the new price of the celebrity | celeb.price = _nextPrice(salePrice);
| celeb.price = _nextPrice(salePrice);
| 6,377 |
72 | // refund dust | if (hdcoreAmount > optimalHdcoreAmount)
IERC20(_hdcoreToken).transfer(to, hdcoreAmount.sub(optimalHdcoreAmount));
if (wethAmount > optimalWETHAmount) {
uint256 withdrawAmount = wethAmount.sub(optimalWETHAmount);
_WETH.withdraw(withdrawAmount);
to.transfer... | if (hdcoreAmount > optimalHdcoreAmount)
IERC20(_hdcoreToken).transfer(to, hdcoreAmount.sub(optimalHdcoreAmount));
if (wethAmount > optimalWETHAmount) {
uint256 withdrawAmount = wethAmount.sub(optimalWETHAmount);
_WETH.withdraw(withdrawAmount);
to.transfer... | 22,761 |
43 | // Note that there is no minimum amountOut parameter: this is handled by `IVault.exitPool`. |
_require(tokenIndex < balances.length, Errors.OUT_OF_BOUNDS);
uint256 amountOut = WeightedMath._calcTokenOutGivenExactBptIn(
balances[tokenIndex],
normalizedWeights[tokenIndex],
bptAmountIn,
totalSupply(),
getSwapFeePercentage()
);
|
_require(tokenIndex < balances.length, Errors.OUT_OF_BOUNDS);
uint256 amountOut = WeightedMath._calcTokenOutGivenExactBptIn(
balances[tokenIndex],
normalizedWeights[tokenIndex],
bptAmountIn,
totalSupply(),
getSwapFeePercentage()
);
| 4,093 |
271 | // Cap for total amount deposited into vault | uint256 public cap;
| uint256 public cap;
| 18,768 |
53 | // prepare our msg data.by storing this we are able to verify that all admins are approving the same argument input to be executed for the function.we hash it and store in bytes32 so its size is known and comparable | bytes32 _msgData = keccak256(msg.data);
| bytes32 _msgData = keccak256(msg.data);
| 227 |
15 | // Emitted when a new log was created author Author address contentHash Deterministic unique ID, hash of the content content Content string / | event Content(address indexed author, bytes32 indexed contentHash, string content);
| event Content(address indexed author, bytes32 indexed contentHash, string content);
| 9,426 |
6 | // Purchase oToken | (bool success,) = exchange.call{value: _0xFee}(_0xSwapData);
| (bool success,) = exchange.call{value: _0xFee}(_0xSwapData);
| 50,617 |
0 | // quando usa barra asterisco serve abrir e fazer comentários maiores com mais linhas e tem que terminar e termina o comentário com asterisco barra/ string = é igual a texto, uma variável, pode colocar o que quiser, mas temque colocar entre aspasuint256 = e igual a número inteiro de 0 até 256 caracteres quase infinito,... |
string public locatario;
string public locador;
uint256 private valor;
uint256 constant numeroMaximoLegalDeAlugieisParaMulta = 3;
constructor(string memory nomeLocador, string memory nomeLocatario, uint256 valorDoAluguel) public
|
string public locatario;
string public locador;
uint256 private valor;
uint256 constant numeroMaximoLegalDeAlugieisParaMulta = 3;
constructor(string memory nomeLocador, string memory nomeLocatario, uint256 valorDoAluguel) public
| 19,099 |
2 | // xpGainLose | uint8 public xpGainLose = 5;
| uint8 public xpGainLose = 5;
| 40,041 |
14 | // royalties by xrpant/junk | function supportsInterface(bytes4 interfaceID) public view override returns(bool) {
return interfaceID == type(IERC2981Royalties).interfaceId || super.supportsInterface(interfaceID);
}
| function supportsInterface(bytes4 interfaceID) public view override returns(bool) {
return interfaceID == type(IERC2981Royalties).interfaceId || super.supportsInterface(interfaceID);
}
| 25,396 |
9 | // Sets the `platformFeePBS`. Calling conditions:- The caller must be the owner of the contract.platformFeeBPS_ Platform fee amount in bps (basis points). / | function setPlatformFeeBPS(uint16 platformFeeBPS_) external;
| function setPlatformFeeBPS(uint16 platformFeeBPS_) external;
| 42,571 |
237 | // Set crowdsale address which can distribute tokens even when onlyWhenTransferAllowed is false.crowdsaleAddr Address of token offering contract./ | function setCrowdsaleAddress(
address crowdsaleAddr
)
external
onlyOwner()
| function setCrowdsaleAddress(
address crowdsaleAddr
)
external
onlyOwner()
| 25,146 |
80 | // divisor cannot be zero with existing outflow | return totalRewardLeft / totalGDAOutFlowrate > (liquidationPeriod - patricianPeriod).toInt256();
| return totalRewardLeft / totalGDAOutFlowrate > (liquidationPeriod - patricianPeriod).toInt256();
| 10,716 |
177 | // A descriptive name for a collection of NFTs in this contract return descriptive name./ | function name() external pure override returns (string memory) {
return NAME;
}
| function name() external pure override returns (string memory) {
return NAME;
}
| 20,317 |
1 | // Events / |
event ERC20DepositInitiated(
address indexed _l1Token,
address indexed _l2Token,
address indexed _from,
address _to,
uint256 _amount,
bytes _data
);
|
event ERC20DepositInitiated(
address indexed _l1Token,
address indexed _l2Token,
address indexed _from,
address _to,
uint256 _amount,
bytes _data
);
| 39,614 |
182 | // Math Library for non-standard Math functionsNOTE: This file is a clone of the dydx protocol's Decimal.sol contract.2d8454e02702fe5bc455b848556660629c3cad36. It has not been modified other than to use anewer solidity in the pragma to match the rest of the contract suite of this project. / | library Math {
| library Math {
| 41,934 |
0 | // using SafeERC20 for DAOToken; |
ProposalInterface proposalGate;
|
ProposalInterface proposalGate;
| 40,733 |
6 | // tokens addresses | address aTokenAddress;
address stableDebtTokenAddress;
address variableDebtTokenAddress;
| address aTokenAddress;
address stableDebtTokenAddress;
address variableDebtTokenAddress;
| 15,071 |
0 | // Initializing service contract address in constructor | constructor(){
serviceContractAddress = 0xA6Abc17819738299B3B2c1CE46d55c74f04E290C;
}
| constructor(){
serviceContractAddress = 0xA6Abc17819738299B3B2c1CE46d55c74f04E290C;
}
| 11,420 |
339 | // Reveal `_outcome` vote of `_voter` for vote `_voteId`_voteId ID of the vote instance to reveal a vote of_voter Address of the voter to reveal a vote for_outcome Outcome revealed by the voter_salt Salt to decrypt and validate the committed vote of the voter/ | function reveal(uint256 _voteId, address _voter, uint8 _outcome, bytes32 _salt) external voteExists(_voteId) {
Vote storage vote = voteRecords[_voteId];
CastVote storage castVote = vote.votes[_voter];
_checkValidSalt(castVote, _outcome, _salt);
require(_isValidOutcome(vote, _outcome)... | function reveal(uint256 _voteId, address _voter, uint8 _outcome, bytes32 _salt) external voteExists(_voteId) {
Vote storage vote = voteRecords[_voteId];
CastVote storage castVote = vote.votes[_voter];
_checkValidSalt(castVote, _outcome, _salt);
require(_isValidOutcome(vote, _outcome)... | 44,893 |
247 | // Balance of want + balance in AAVE | uint256 liquidBalance =
want.balanceOf(address(this)).add(deposited()).sub(borrowed());
| uint256 liquidBalance =
want.balanceOf(address(this)).add(deposited()).sub(borrowed());
| 11,086 |
114 | // Executed when a purchase has been validated and is ready to be executed. Doesn't necessarily emit/sendtokens. beneficiary Address receiving the tokens tokenAmount Number of tokens to be purchased / | function _processPurchase(address beneficiary, uint256 tokenAmount) internal {
_deliverTokens(beneficiary, tokenAmount);
}
| function _processPurchase(address beneficiary, uint256 tokenAmount) internal {
_deliverTokens(beneficiary, tokenAmount);
}
| 8,120 |
25 | // uint radius = calculateRadius(8, offset); | uint radius = calculateRadius(tokenAttributes[tokenId].intensity, offset);
pathItems = string.concat(pathItems,
"<g class='c' style='--n: ",
Strings.toString(offset),
";' >",
"<circle class='cs-c1' stroke-width='",
Strings.toString... | uint radius = calculateRadius(tokenAttributes[tokenId].intensity, offset);
pathItems = string.concat(pathItems,
"<g class='c' style='--n: ",
Strings.toString(offset),
";' >",
"<circle class='cs-c1' stroke-width='",
Strings.toString... | 7,756 |
97 | // organizationId => averageBoostDownstakes | mapping(bytes32 => uint256 ) public averagesDownstakesOfBoosted;
uint256 constant public NUM_OF_CHOICES = 2;
uint256 constant public NO = 2;
uint256 constant public YES = 1;
uint256 public proposalsCnt; // Total number of proposals
IERC20 public stakingToken;
address c... | mapping(bytes32 => uint256 ) public averagesDownstakesOfBoosted;
uint256 constant public NUM_OF_CHOICES = 2;
uint256 constant public NO = 2;
uint256 constant public YES = 1;
uint256 public proposalsCnt; // Total number of proposals
IERC20 public stakingToken;
address c... | 18,538 |
10 | // Internal function that removes the given `account` from `_mintLimiters`.Emits a MintLimiterRemoved event.account The account address having access removed from the mintLimiter role / | function _removeMintLimiter(address account) internal {
_mintLimiters.remove(account);
emit MintLimiterRemoved(account);
}
| function _removeMintLimiter(address account) internal {
_mintLimiters.remove(account);
emit MintLimiterRemoved(account);
}
| 8,682 |
111 | // `maxBatchSize` refers to how much a minter can mint at a time. `collectionSize_` refers to how many tokens are in the collection./ | constructor(
string memory name_,
string memory symbol_,
uint256 maxBatchSize_,
uint256 collectionSize_
| constructor(
string memory name_,
string memory symbol_,
uint256 maxBatchSize_,
uint256 collectionSize_
| 34,385 |
32 | // Checks if a given address is on the merkle tree allowlist/Merkle trees can be generated using https:github.com/OpenZeppelin/merkle-tree/account The address to check/merkleProof The merkle proof to check/ return Whether the address is on the allowlist or not | function isValidMerkleProof(
address account,
bytes32[] calldata merkleProof
| function isValidMerkleProof(
address account,
bytes32[] calldata merkleProof
| 7,228 |
17 | // import "Permissioned.sol";/Permissioned | contract Permissioned is Owned {
using SafeMath for uint;
struct Permission {
bool active;
uint maximum;
uint processed;
}
uint public constant ROLE_MINTER = 1;
// Don't need ROLE_BURNER at the moment
// uint public constant ROLE_BURNER = 2;
mapping(address => mappi... | contract Permissioned is Owned {
using SafeMath for uint;
struct Permission {
bool active;
uint maximum;
uint processed;
}
uint public constant ROLE_MINTER = 1;
// Don't need ROLE_BURNER at the moment
// uint public constant ROLE_BURNER = 2;
mapping(address => mappi... | 13,441 |
61 | // a matrix designating the legal state transitions for a promise (see constructor) |
mapping (uint => mapping(uint => bool)) stateTransitionMatrix;
|
mapping (uint => mapping(uint => bool)) stateTransitionMatrix;
| 14,689 |
190 | // _amount = 10000000000000000000000000 (mints 10M tokens right away) |
constructor(
address _vestingBeneficiary,
uint256 _amount
|
constructor(
address _vestingBeneficiary,
uint256 _amount
| 18,286 |
17 | // calculate amount of dai we need | uint256 requiredDAI;
{
requiredDAI = (toDAI(amount, token) * _COLLAT_RATIO_PRECISION) / collatRatioDAI;
uint256 requiredDAIToCloseLTVGap = 0;
if (depositToCloseLTVGap > 0) {
requiredDAIToCloseLTVGap = toDAI(depositToCloseLTVGap, token);
... | uint256 requiredDAI;
{
requiredDAI = (toDAI(amount, token) * _COLLAT_RATIO_PRECISION) / collatRatioDAI;
uint256 requiredDAIToCloseLTVGap = 0;
if (depositToCloseLTVGap > 0) {
requiredDAIToCloseLTVGap = toDAI(depositToCloseLTVGap, token);
... | 704 |
0 | // IERC725Y type variable representing the account from where to retrieve the keys / | IERC725Y public erc725Y;
| IERC725Y public erc725Y;
| 37,368 |
58 | // Check that there are funds to drain | uint256 balance = address(this).balance;
require(balance > 0, "No funds to drain");
uint256[] memory shares = new uint256[](recipients.length);
| uint256 balance = address(this).balance;
require(balance > 0, "No funds to drain");
uint256[] memory shares = new uint256[](recipients.length);
| 16,117 |
47 | // 8. Transfer token | obToken.transfer(buyer, rewardAmount);
| obToken.transfer(buyer, rewardAmount);
| 1,404 |
231 | // Ensures that only transactions with a trusted signature can be relayed through the GSN. / | function acceptRelayedCall(
address relay,
address from,
bytes memory encodedFunction,
uint256 transactionFee,
uint256 gasPrice,
uint256 gasLimit,
uint256 nonce,
bytes memory approvalData,
uint256 /* maxPossibleCharge */
| function acceptRelayedCall(
address relay,
address from,
bytes memory encodedFunction,
uint256 transactionFee,
uint256 gasPrice,
uint256 gasLimit,
uint256 nonce,
bytes memory approvalData,
uint256 /* maxPossibleCharge */
| 43,394 |
3 | // Retrieves the total supply at the time `snapshotId` was created. / | function totalSupplyAt(uint256 snapshotId)
public
view
virtual
returns (uint256)
| function totalSupplyAt(uint256 snapshotId)
public
view
virtual
returns (uint256)
| 8,529 |
199 | // Helper function to get the decimals of an asset. Will just hardcode for the time being. asset is the token which we want to know the decimals / | function assetDecimals(address asset) private view returns (uint256) {
// USDC
if (asset == USDC) {
return 6;
}
return 18;
}
| function assetDecimals(address asset) private view returns (uint256) {
// USDC
if (asset == USDC) {
return 6;
}
return 18;
}
| 28,690 |
27 | // openTrading | function kamehameha() external onlyOwner() {
require(!tradingOpen, "trading is already open");
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestam... | function kamehameha() external onlyOwner() {
require(!tradingOpen, "trading is already open");
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestam... | 77,982 |
9 | // solium-disable-next-line arg-overflow | return ecrecover(hash, v, r, s);
| return ecrecover(hash, v, r, s);
| 5,676 |
73 | // Finalizes the relay entry timeout notification reward/ multiplier update process./Can be called only by the contract owner, after the governance/delay elapses. | function finalizeRelayEntryTimeoutNotificationRewardMultiplierUpdate()
external
onlyOwner
onlyAfterGovernanceDelay(
relayEntryTimeoutNotificationRewardMultiplierChangeInitiated,
STANDARD_PARAMETER_GOVERNANCE_DELAY
)
| function finalizeRelayEntryTimeoutNotificationRewardMultiplierUpdate()
external
onlyOwner
onlyAfterGovernanceDelay(
relayEntryTimeoutNotificationRewardMultiplierChangeInitiated,
STANDARD_PARAMETER_GOVERNANCE_DELAY
)
| 35,590 |
133 | // returns the array of reserve tokens return array of reserve tokens / | function reserveTokens() public view returns (IERC20Token[] memory) {
return __reserveTokens;
}
| function reserveTokens() public view returns (IERC20Token[] memory) {
return __reserveTokens;
}
| 38,220 |
658 | // column21_row9/ mload(0x2e20), Numerator: 1. val = 1. val := mulmod(val, 1, PRIME). Denominator: point^(trace_length / 4096) - 1. val = denominator_invs[20]. | val := mulmod(val, mload(0x3de0), PRIME)
| val := mulmod(val, mload(0x3de0), PRIME)
| 59,079 |
0 | // used for representation of collateralization collateralization between 0 and 1 (1=100%)value might be larger when overcollateralization | uint256 public constant FULL_COLLATERALIZATION_LEVEL = 10**18;
string public constant DEFAULT_FILTER_DATA_STRUCTURE = "";
IInstanceService internal _instanceService;
IRiskpoolService internal _riskpoolService;
IERC721 internal _bundleToken;
| uint256 public constant FULL_COLLATERALIZATION_LEVEL = 10**18;
string public constant DEFAULT_FILTER_DATA_STRUCTURE = "";
IInstanceService internal _instanceService;
IRiskpoolService internal _riskpoolService;
IERC721 internal _bundleToken;
| 40,679 |
10 | // emit an event | emit TokensSold(msg.sender, address(token), _amount, rate);
| emit TokensSold(msg.sender, address(token), _amount, rate);
| 16,666 |
23 | // Sets `swapper` as an authorized address for swap operations.swapper Address of the swapper to allow/disallow. allowed "true" to allow, "false" to disallow.Requirements: - `swapper` must be a non-zero address. - `allowed` must be different the previously recorded for the same `swapper`. - Emits a `AllowSwapper` event... | function allowSwapper(address swapper, bool allowed) external onlyTimelock {
_checkInputIsNotZeroAddress(swapper);
if (allowedSwapper[swapper] == allowed) {
revert Chief__allowSwapper_noAllowChange();
}
allowedSwapper[swapper] = allowed;
emit AllowSwapper(swapper, allowed);
}
| function allowSwapper(address swapper, bool allowed) external onlyTimelock {
_checkInputIsNotZeroAddress(swapper);
if (allowedSwapper[swapper] == allowed) {
revert Chief__allowSwapper_noAllowChange();
}
allowedSwapper[swapper] = allowed;
emit AllowSwapper(swapper, allowed);
}
| 13,606 |
3 | // safe approve | IERC20(manager.stableSwapMetaPoolAddress()).safeApprove(
address(this),
amount
);
| IERC20(manager.stableSwapMetaPoolAddress()).safeApprove(
address(this),
amount
);
| 51,558 |
5 | // Get liquidity node at tick tick Tickreturn Liquidity node / | function liquidityNode(uint128 tick) external view returns (NodeInfo memory);
| function liquidityNode(uint128 tick) external view returns (NodeInfo memory);
| 13,627 |
35 | // Set the address mapping to false to indicate it is NOT an administrator account. | administrators[adminToRemove] = false;
| administrators[adminToRemove] = false;
| 9,067 |
64 | // Now remit any collected fees. Since the constructor enforces that creatorFee + poolFee < 1, the balance in the contract will be sufficient to cover these transfers. | IERC20 sUSD = _sUSD();
uint _deposited = deposited;
uint poolFees = _deposited.multiplyDecimalRound(fees.poolFee);
uint creatorFees = _deposited.multiplyDecimalRound(fees.creatorFee);
_decrementDeposited(creatorFees.add(poolFees));
sUSD.transfer(_feePool().FEE_ADDRESS(),... | IERC20 sUSD = _sUSD();
uint _deposited = deposited;
uint poolFees = _deposited.multiplyDecimalRound(fees.poolFee);
uint creatorFees = _deposited.multiplyDecimalRound(fees.creatorFee);
_decrementDeposited(creatorFees.add(poolFees));
sUSD.transfer(_feePool().FEE_ADDRESS(),... | 32,926 |
72 | // Worker with qualification "ONE" earn 1 token per minute, "TWO" earn 2 tokens, etc... | uint256 profitMinutes = uint256(SafeMath.div(SafeMath.sub(now, WorkerWorkStart[msg.sender]), 60));
if (profitMinutes > 0) {
uint8 qualification = WorkerQualification[msg.sender];
uint256 profitEFT = SafeMath.mul(uint256(qualification),profitMinutes);
require (profitEFT > 0);
mint(msg.sender,profitEFT... | uint256 profitMinutes = uint256(SafeMath.div(SafeMath.sub(now, WorkerWorkStart[msg.sender]), 60));
if (profitMinutes > 0) {
uint8 qualification = WorkerQualification[msg.sender];
uint256 profitEFT = SafeMath.mul(uint256(qualification),profitMinutes);
require (profitEFT > 0);
mint(msg.sender,profitEFT... | 30,389 |
305 | // Checks for rounding errors and returns value of potential partial amounts of a principal _principal Number fractional amount is derived from_numerator Numerator of fraction_denominator Denominator of fractionreturn uint256Fractional amount of principal calculated / | function getPartialAmount(
uint256 _principal,
uint256 _numerator,
uint256 _denominator
)
internal
pure
returns (uint256)
| function getPartialAmount(
uint256 _principal,
uint256 _numerator,
uint256 _denominator
)
internal
pure
returns (uint256)
| 12,397 |
263 | // 2. Encode arguments of functions and create action for calling it | bytes memory data = abi.encode(deficit, amountWant);
operations[1] = _getCallAction(
data
);
| bytes memory data = abi.encode(deficit, amountWant);
operations[1] = _getCallAction(
data
);
| 44,816 |
3 | // Check the the mint request wouldn't exceed the total supply. This must be performed here using whatever mechanism you use to track the token number | require(
(_tokenIdCounter.current() + quantityToMint_) <= maxSupply,
"Amount to mint exceeds supply"
);
| require(
(_tokenIdCounter.current() + quantityToMint_) <= maxSupply,
"Amount to mint exceeds supply"
);
| 28,082 |
224 | // get price for a currency | function getPrice(bytes32 currencyName) external view returns (uint);
| function getPrice(bytes32 currencyName) external view returns (uint);
| 10,445 |
89 | // Adds two exponentials, returning a new exponential. / | function addExp(Exp memory a, Exp memory b) pure internal returns (MathError, Exp memory) {
(MathError error, uint result) = addUInt(a.mantissa, b.mantissa);
return (error, Exp({mantissa: result}));
}
| function addExp(Exp memory a, Exp memory b) pure internal returns (MathError, Exp memory) {
(MathError error, uint result) = addUInt(a.mantissa, b.mantissa);
return (error, Exp({mantissa: result}));
}
| 17,295 |
118 | // sumCollateral += tokensToDenomjTokenBalance | vars.sumCollateral = mul_ScalarTruncateAddUInt(vars.tokensToDenom, vars.jTokenBalance, vars.sumCollateral);
| vars.sumCollateral = mul_ScalarTruncateAddUInt(vars.tokensToDenom, vars.jTokenBalance, vars.sumCollateral);
| 8,610 |
13 | // Burns the LiquidityCertificate.spender The account which is performing the burn. certificateId The id of the LiquidityCertificate. / | function burn(address spender, uint certificateId) external onlyLiquidityPool {
require(_isApprovedOrOwner(spender, certificateId), "attempted to burn nonexistent certificate, or not owner");
delete _certificateData[certificateId];
_burn(certificateId);
}
| function burn(address spender, uint certificateId) external onlyLiquidityPool {
require(_isApprovedOrOwner(spender, certificateId), "attempted to burn nonexistent certificate, or not owner");
delete _certificateData[certificateId];
_burn(certificateId);
}
| 16,718 |
20 | // TRANSFER FROM MSG.SENDER TO ADDRESS(THIS) | IERC20(token).transferFrom(msg.sender, address(this), msg.value);
| IERC20(token).transferFrom(msg.sender, address(this), msg.value);
| 19,043 |
33 | // Caps per token supply to 10 editions | require(
(_globalEditions[id] + amount) <= _editionLimit,
"ERC1155: exceeded token maximum editions"
);
address operator = _msgSender();
_beforeTokenTransfer(
operator,
address(0),
| require(
(_globalEditions[id] + amount) <= _editionLimit,
"ERC1155: exceeded token maximum editions"
);
address operator = _msgSender();
_beforeTokenTransfer(
operator,
address(0),
| 22,220 |
1 | // Function responsible for cross chain transfer from l2 to l1 or supported l2s. Called by the registry when the selected bridge is Hop bridge.Try to check for the liquidity on the other side before calling this._amount amount to be sent._from sender address_receiverAddress receiver address_toChainId Destination Chain ... | function outboundTransferTo(
uint256 _amount,
address _from,
address _receiverAddress,
address _token,
uint256 _toChainId,
bytes calldata _data
| function outboundTransferTo(
uint256 _amount,
address _from,
address _receiverAddress,
address _token,
uint256 _toChainId,
bytes calldata _data
| 17,475 |
599 | // _updateRole(_firstAB, uint(Role.Member), true); | launchedOn = 0;
| launchedOn = 0;
| 28,766 |
137 | // Tranche balance | uint256 deposit; // User deposit
uint256 capacity; // Capacity for user's intended tranche
uint256 change; // Change from deposit - capacity
| uint256 deposit; // User deposit
uint256 capacity; // Capacity for user's intended tranche
uint256 change; // Change from deposit - capacity
| 50,610 |
27 | // Returns the block coinbase | function getCurrentBlockCoinbase() public view returns (address coinbase) {
coinbase = block.coinbase;
}
| function getCurrentBlockCoinbase() public view returns (address coinbase) {
coinbase = block.coinbase;
}
| 10,718 |
79 | // Get target address from the serialized migration data ser_data Serialized migration datareturn target Target contract address / | function _getMigrationTarget(bytes memory ser_data) internal pure returns (address target) {
target = ser_data.toAddress(ser_data.length - 20);
}
| function _getMigrationTarget(bytes memory ser_data) internal pure returns (address target) {
target = ser_data.toAddress(ser_data.length - 20);
}
| 32,077 |
175 | // fee charged for flashloans (WAD, 100% == 1 WAD) | uint256 public flashLoanFee;
| uint256 public flashLoanFee;
| 50,562 |
2 | // Get the pool id of the maker address. | bytes32 poolId = poolIdByMaker[makerAddress];
| bytes32 poolId = poolIdByMaker[makerAddress];
| 21,917 |
154 | // Execute a transfer with a signed authorization fromPayer's address (Authorizer) toPayee's address value Amount to be transferred validAfterThe time after which this is valid (unix time) validBefore The time before which this is valid (unix time) nonce Unique nonce v v of the signature r r of the signature s s of the... | function transferWithAuthorization(
address from,
address to,
uint256 value,
uint256 validAfter,
uint256 validBefore,
bytes32 nonce,
uint8 v,
bytes32 r,
bytes32 s
| function transferWithAuthorization(
address from,
address to,
uint256 value,
uint256 validAfter,
uint256 validBefore,
bytes32 nonce,
uint8 v,
bytes32 r,
bytes32 s
| 20,254 |
52 | // See {IERC721Metadata-tokenURI}. The implementation of this method was taken from {ERC721URIStorage} butmade tweakings as necessary to the use case. / | function tokenURI(uint256 tokenId)
public
view
virtual
override
returns (string memory)
{
require(
_exists(tokenId),
"ERC721URIStorage: URI query for nonexistent token"
| function tokenURI(uint256 tokenId)
public
view
virtual
override
returns (string memory)
{
require(
_exists(tokenId),
"ERC721URIStorage: URI query for nonexistent token"
| 52,626 |
48 | // if there's no fee for the individual user then set it to the general fee | v = genFee;
| v = genFee;
| 80,928 |
1 | // Returns the current implementation of a proxy.This is needed because only the proxy admin can query it.return The address of the current implementation of the proxy. / | function getProxyImplementation(AdminUpgradeabilityProxy proxy) public view returns (address) {
// We need to manually run the static call since the getter cannot be flagged as view
// bytes4(keccak256("implementation()")) == 0x5c60da1b
(bool success, bytes memory returndata) = address(proxy).staticcall(h... | function getProxyImplementation(AdminUpgradeabilityProxy proxy) public view returns (address) {
// We need to manually run the static call since the getter cannot be flagged as view
// bytes4(keccak256("implementation()")) == 0x5c60da1b
(bool success, bytes memory returndata) = address(proxy).staticcall(h... | 31,227 |
50 | // Returns the pending YAXs for a given account _account The address to query / | function pendingYax(address _account) public view returns (uint _pending) {
UserInfo storage user = userInfo[_account];
uint _accYaxPerShare = accYaxPerShare;
uint lpSupply = balanceOf(address(this));
if (block.number > lastRewardBlock && lpSupply != 0) {
uint256 _multipl... | function pendingYax(address _account) public view returns (uint _pending) {
UserInfo storage user = userInfo[_account];
uint _accYaxPerShare = accYaxPerShare;
uint lpSupply = balanceOf(address(this));
if (block.number > lastRewardBlock && lpSupply != 0) {
uint256 _multipl... | 19,879 |
29 | // 清算线 | uint256 public constant KILL_FACTOR_MANTISSA = 1.1 * 1e18; //110%
| uint256 public constant KILL_FACTOR_MANTISSA = 1.1 * 1e18; //110%
| 48,831 |
67 | // how much ETH did we just swap into? | uint256 newBalance = address(this).balance.sub(initialBalance);
| uint256 newBalance = address(this).balance.sub(initialBalance);
| 29,700 |
43 | // If we check and the interest rate is no longer negative then we allow normal 1 to 1 withdraws [even if the speedbump was hit less than 48 hours ago, to prevent possible griefing] | if (holdings < localSupply) {
| if (holdings < localSupply) {
| 24,271 |
10 | // Returns the downcasted int32 from int256, reverting onoverflow (when the input is less than smallest int32 orgreater than largest int32). Counterpart to Solidity's `int32` operator. Requirements: - input must fit into 32 bits _Available since v3.1._ / | function toInt32(int256 value) internal pure returns (int32) {
require(
value >= type(int32).min && value <= type(int32).max,
"SafeCast: value doesn't fit in 32 bits"
);
return int32(value);
}
| function toInt32(int256 value) internal pure returns (int32) {
require(
value >= type(int32).min && value <= type(int32).max,
"SafeCast: value doesn't fit in 32 bits"
);
return int32(value);
}
| 7,822 |
161 | // only take fees on buys/sells, do not take on wallet transfers | if(takeFee){
| if(takeFee){
| 6,955 |
9 | // Super token factory interface Superfluid / | interface ISuperTokenFactory {
/**************************************************************************
* Errors
*************************************************************************/
error SUPER_TOKEN_FACTORY_ALREADY_EXISTS(); // 0x91d67972
error SUPER_TOKEN_FACTORY_DOES_N... | interface ISuperTokenFactory {
/**************************************************************************
* Errors
*************************************************************************/
error SUPER_TOKEN_FACTORY_ALREADY_EXISTS(); // 0x91d67972
error SUPER_TOKEN_FACTORY_DOES_N... | 13,774 |
39 | // / | function registerSubdomain(
uint256 parentId,
string memory label,
address owner
) external;
| function registerSubdomain(
uint256 parentId,
string memory label,
address owner
) external;
| 16,528 |
89 | // Send split amounts to respective balances | function _applyShare(address _seller, address _auctioneer, uint _cut) internal
returns (bool success)
| function _applyShare(address _seller, address _auctioneer, uint _cut) internal
returns (bool success)
| 40,087 |
160 | // Cancel a single RFQ order. The caller must be the maker or a valid order signer./Silently succeeds if the order has already been cancelled./order The RFQ order. | function cancelRfqOrder(LibNativeOrder.RfqOrder calldata order)
external;
| function cancelRfqOrder(LibNativeOrder.RfqOrder calldata order)
external;
| 47,461 |
16 | // Implementation of the {IERC20} interface.Additionally, an {Approval} event is emitted on calls to {transferFrom}./ Sets the values for {name}, {symbol} and {decimals} and mints {supply} to {mintAddress} All of these values are immutable: they can only be set once duringconstruction. / | constructor(
string memory name_,
string memory symbol_,
uint8 decimals_,
uint256 supply_,
address mintAddress_
) {
_name = name_;
_symbol = symbol_;
_decimals = decimals_;
| constructor(
string memory name_,
string memory symbol_,
uint8 decimals_,
uint256 supply_,
address mintAddress_
) {
_name = name_;
_symbol = symbol_;
_decimals = decimals_;
| 31,930 |
5 | // / | function distributeYieldToTreasury() external;
| function distributeYieldToTreasury() external;
| 21,755 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.