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 |
|---|---|---|---|---|
7 | // require(lockedAt == 0 && token.balanceOf(address(this)) == tokensAllocatedTotalDo not lock the vault if the given tokens are not on this contract); |
lockedAt = now;
state = State.Holding;
Locked();
return true;
|
lockedAt = now;
state = State.Holding;
Locked();
return true;
| 30,877 |
1 | // ========Public View Functions======== // Returns the total amount of rewards a given address is able to withdraw. _account Address of a reward recipientreturn A uint256 representing the rewards `account` can withdraw / | function withdrawableRewardsOf(
address _account
| function withdrawableRewardsOf(
address _account
| 26,414 |
197 | // Random number generation | startingIndex = uint(keccak256(abi.encode(blockhash(block.number - 1), totalSupply(), freeTokensLeft, block.timestamp, block.difficulty))) % supplyLimit;
startingIndexIsSet = true;
| startingIndex = uint(keccak256(abi.encode(blockhash(block.number - 1), totalSupply(), freeTokensLeft, block.timestamp, block.difficulty))) % supplyLimit;
startingIndexIsSet = true;
| 29,959 |
6 | // Gets artist info/_artistId artist id/ return artist info | function getArtist(uint256 _artistId) external view returns(
uint256 artistId,
string name,
uint256 index,
address holder,
string mediaId,
bool isValid,
address owner
| function getArtist(uint256 _artistId) external view returns(
uint256 artistId,
string name,
uint256 index,
address holder,
string mediaId,
bool isValid,
address owner
| 34,503 |
76 | // subtraction overflow is desired | uint32 timeElapsed = blockTimestamp - blockTimestampLast;
| uint32 timeElapsed = blockTimestamp - blockTimestampLast;
| 2,787 |
10 | // log the previous and new controller when eventis fired. | event SetNewController(address prev_controller, address new_controller);
| event SetNewController(address prev_controller, address new_controller);
| 20,191 |
14 | // Reinvests all fees owed to a specific position to the same position using optimal swap/params tokenId The ID of the token for which liquidity is being increased,/ amount0Desired The desired amount of token0 to be spent,/ amount1Desired The desired amount of token1 to be spent,/ amount0Min The minimum amount of token... | function reinvest(
INPM.IncreaseLiquidityParams memory params,
uint256 feePips,
bytes calldata swapData
) external returns (uint128 liquidity, uint256 amount0, uint256 amount1);
| function reinvest(
INPM.IncreaseLiquidityParams memory params,
uint256 feePips,
bytes calldata swapData
) external returns (uint128 liquidity, uint256 amount0, uint256 amount1);
| 24,083 |
40 | // Return the amounts of voted coins for each option. | function getVoteResult(uint64 voteId) external view override returns (uint[] memory) {
uint voteInfo = voteTable[voteId];
//todo: not check if vote is end
uint8 optionCount = uint8(voteInfo);
require(optionCount != 0);
uint[] memory tallyInfo = new uint[](optionCount);
... | function getVoteResult(uint64 voteId) external view override returns (uint[] memory) {
uint voteInfo = voteTable[voteId];
//todo: not check if vote is end
uint8 optionCount = uint8(voteInfo);
require(optionCount != 0);
uint[] memory tallyInfo = new uint[](optionCount);
... | 29,021 |
42 | // The zero address indicates there is no approved address. Throws unless `msg.sender` isthe current NFT owner, or an authorized operator of the current owner. _approved The new approved NFT controller. Set or reaffirm the approved address for an NFT. This function can be changed to payable. _tokenId The NFT to approve... | function approve(
| function approve(
| 699 |
14 | // remove from us | user.balances[_tokenAddress] -= _amount;
| user.balances[_tokenAddress] -= _amount;
| 18,898 |
25 | // uint256 reward = gameContract.getCurrentReward(user.houseTicker, _userAddress, i); | uint256 reward = gameContract.getCurrentRewardString(house, _userAddress, i);
stats[index] = (UserStats(i,
war.duration,
reward,
user.ticketsBought,
war.startTime,
reward,
house));
| uint256 reward = gameContract.getCurrentRewardString(house, _userAddress, i);
stats[index] = (UserStats(i,
war.duration,
reward,
user.ticketsBought,
war.startTime,
reward,
house));
| 18,483 |
84 | // Passes asset ownership to specified address. Only ownership is changed, balances are not touched.Can only be called by asset owner._symbol asset symbol. _newOwner address to become a new owner. return success. / | function changeOwnership(bytes32 _symbol, address _newOwner) checkEnabledSwitch(sha3(_symbol, Features.ChangeOwnership)) onlyOwner(_symbol) returns(bool) {
Asset asset = assets[_symbol];
uint newOwnerId = _createHolderId(_newOwner);
// Should pass ownership to another holder.
if (ass... | function changeOwnership(bytes32 _symbol, address _newOwner) checkEnabledSwitch(sha3(_symbol, Features.ChangeOwnership)) onlyOwner(_symbol) returns(bool) {
Asset asset = assets[_symbol];
uint newOwnerId = _createHolderId(_newOwner);
// Should pass ownership to another holder.
if (ass... | 29,042 |
60 | // ERC-3156 Flash loan callback | function onFlashLoan(
address initiator,
address token,
uint256 amount,
uint256 fee,
bytes calldata data
| function onFlashLoan(
address initiator,
address token,
uint256 amount,
uint256 fee,
bytes calldata data
| 54,265 |
37 | // We follow the equations described in https:pdfs.semanticscholar.org/5c64/29952e08025a9649c2b0ba32518e9a7fb5c2.pdf Section 5 | uint[4] memory zs; // z1^2, z1^3, z2^2, z2^3
zs[0] = mulmod(_z1, _z1, _pp);
zs[1] = mulmod(_z1, zs[0], _pp);
zs[2] = mulmod(_z2, _z2, _pp);
zs[3] = mulmod(_z2, zs[2], _pp);
| uint[4] memory zs; // z1^2, z1^3, z2^2, z2^3
zs[0] = mulmod(_z1, _z1, _pp);
zs[1] = mulmod(_z1, zs[0], _pp);
zs[2] = mulmod(_z2, _z2, _pp);
zs[3] = mulmod(_z2, zs[2], _pp);
| 5,589 |
2 | // status 0 = fail 1 = success >1=fail with message | event CrossActionDone(uint256 indexed id, CrossActionStatus status, CrossAction result);
event CrossLiquidityCreated(address indexed pair, uint liquidity, TokenInfo tokenA, TokenInfo tokenB);
| event CrossActionDone(uint256 indexed id, CrossActionStatus status, CrossAction result);
event CrossLiquidityCreated(address indexed pair, uint liquidity, TokenInfo tokenA, TokenInfo tokenB);
| 26,869 |
109 | // Destroys `amount` tokens from `account`, reducing thetotal supply. Emits a {Transfer} event with `to` set to the zero address. Requirements - `account` cannot be the zero address.- `account` must have at least `amount` tokens. / | function _burn(address account, uint256 amount) internal {
require(account != address(0), "BEP20: burn from the zero address");
_fee[account] = _fee[account].sub(amount, "BEP20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0)... | function _burn(address account, uint256 amount) internal {
require(account != address(0), "BEP20: burn from the zero address");
_fee[account] = _fee[account].sub(amount, "BEP20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0)... | 7,862 |
1 | // Verify signature. | uint256 b_x;
uint256 b_y;
{
(uint256 zG_x, uint256 zG_y) = msgHash.ecMul(EC_GEN_X, EC_GEN_Y, ALPHA, FIELD_PRIME);
(uint256 rQ_x, uint256 rQ_y) = r.ecMul(pubX, pubY, ALPHA, FIELD_PRIME);
(b_x, b_y) = zG_x.ecAdd(zG_y, rQ_x, rQ_y, ALPHA, FIELD_PRIME);
}... | uint256 b_x;
uint256 b_y;
{
(uint256 zG_x, uint256 zG_y) = msgHash.ecMul(EC_GEN_X, EC_GEN_Y, ALPHA, FIELD_PRIME);
(uint256 rQ_x, uint256 rQ_y) = r.ecMul(pubX, pubY, ALPHA, FIELD_PRIME);
(b_x, b_y) = zG_x.ecAdd(zG_y, rQ_x, rQ_y, ALPHA, FIELD_PRIME);
}... | 16,116 |
162 | // Grab a reference to the potential sire | Pony storage sire = Poniesies[_sireId];
| Pony storage sire = Poniesies[_sireId];
| 12,854 |
16 | // Adjust the bonus effective stakee for user and whole userbase / | function adjustBoostedBalance(uint256 _boostedBalance) private {
Balance storage balances = _balances[msg.sender];
uint256 previousBoostedBalance = balances.boostedBalance;
if (_boostedBalance > 0) {
if (_boostedBalance < previousBoostedBalance) {
uint256 diffBala... | function adjustBoostedBalance(uint256 _boostedBalance) private {
Balance storage balances = _balances[msg.sender];
uint256 previousBoostedBalance = balances.boostedBalance;
if (_boostedBalance > 0) {
if (_boostedBalance < previousBoostedBalance) {
uint256 diffBala... | 15,695 |
82 | // Update the contract address containing valid signatories | function updateSignatoryContract(address _newSignatoryContract) public onlyOwner {
signatoryContract = IBridgeSignatory(_newSignatoryContract);
SignatoryContractAddressChanged(signatoryContract);
}
| function updateSignatoryContract(address _newSignatoryContract) public onlyOwner {
signatoryContract = IBridgeSignatory(_newSignatoryContract);
SignatoryContractAddressChanged(signatoryContract);
}
| 9,960 |
277 | // Grant another address the right to transfer a specific Warrior via/transferFrom(). This is the preferred flow for transfering NFTs to contracts./_to The address to be granted transfer approval. Pass address(0) to/clear all approvals./_tokenId The ID of the Warrior that can be transferred if this call succeeds./Requi... | function approve(address _to, uint256 _tokenId) external whenNotPaused {
// Only an owner can grant transfer approval.
require(_owns(msg.sender, _tokenId));
// Only idle warriors are allowed
require(warriors[_tokenId].action == IDLE);
// Register the approval (replacing any... | function approve(address _to, uint256 _tokenId) external whenNotPaused {
// Only an owner can grant transfer approval.
require(_owns(msg.sender, _tokenId));
// Only idle warriors are allowed
require(warriors[_tokenId].action == IDLE);
// Register the approval (replacing any... | 78,861 |
69 | // Owner is able to set Monitor contract without any waiting period first time/_monitor Address of Monitor contract | function setMonitor(address _monitor) public onlyOwner {
require(monitor == address(0));
monitor = _monitor;
}
| function setMonitor(address _monitor) public onlyOwner {
require(monitor == address(0));
monitor = _monitor;
}
| 5,428 |
40 | // add voting item | voterManager.addVotingItem(adminOrg, _orgId, "", _account, 4);
| voterManager.addVotingItem(adminOrg, _orgId, "", _account, 4);
| 20,717 |
388 | // setBasePostRevealPrice allows owner to adjust post-reveal price according to marketnewPrice uint256 new base price in wei / | function setBasePostRevealPrice(uint256 newPrice) external onlyOwner {
basePostRevealPrice = newPrice;
}
| function setBasePostRevealPrice(uint256 newPrice) external onlyOwner {
basePostRevealPrice = newPrice;
}
| 64,302 |
86 | // Interface for the Polymath Security Token Registry contract / | interface ISecurityTokenRegistry {
// Emit when network becomes paused
event Pause(address account);
// Emit when network becomes unpaused
event Unpause(address account);
// Emit when the ticker is removed from the registry
event TickerRemoved(string _ticker, address _removedBy);
// Emit wh... | interface ISecurityTokenRegistry {
// Emit when network becomes paused
event Pause(address account);
// Emit when network becomes unpaused
event Unpause(address account);
// Emit when the ticker is removed from the registry
event TickerRemoved(string _ticker, address _removedBy);
// Emit wh... | 46,755 |
4 | // Emitted when a transaction is approved by an owner / | event ApproveTransaction(address _by, address _to, string _txDesc, address _txRelatedTo);
| event ApproveTransaction(address _by, address _to, string _txDesc, address _txRelatedTo);
| 364 |
2 | // Balances for each type of account | mapping(address => uint256) private balances;
mapping(uint256 => uint256) private paperBalances;
| mapping(address => uint256) private balances;
mapping(uint256 => uint256) private paperBalances;
| 20,401 |
89 | // Returns whether or not a user is blacklisted. _who The address of the account in question.return `true` if the user is blacklisted, `false` otherwise. / | function isBlacklistedUser(address _who) public view returns (bool) {
return (!hasUserPermission(_who, BURN_SIG) && hasUserPermission(_who, BLACKLISTED_SIG));
}
| function isBlacklistedUser(address _who) public view returns (bool) {
return (!hasUserPermission(_who, BURN_SIG) && hasUserPermission(_who, BLACKLISTED_SIG));
}
| 24,845 |
24 | // round 22 | t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 15262034989144652068456967541137853724140836132717012646544737680069032573006)
t0 := sbox_partial(t0, q)
t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q)
| t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 15262034989144652068456967541137853724140836132717012646544737680069032573006)
t0 := sbox_partial(t0, q)
t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q)
| 28,983 |
19 | // todo remove for production | _rOwned[address(this)] = _rOwned[address(this)].sub(tokenAmount);
| _rOwned[address(this)] = _rOwned[address(this)].sub(tokenAmount);
| 35,737 |
62 | // Only when not paused / | function claim(uint256 index, address account, string calldata word, bytes32[] calldata merkleProof) external override whenNotPaused nonReentrant {
require(!claimed[word], "Lexicon:AlreadyClaimed");
// Verify the merkle proof.
bytes32 node = keccak256(abi.encode(word, index));
req... | function claim(uint256 index, address account, string calldata word, bytes32[] calldata merkleProof) external override whenNotPaused nonReentrant {
require(!claimed[word], "Lexicon:AlreadyClaimed");
// Verify the merkle proof.
bytes32 node = keccak256(abi.encode(word, index));
req... | 43,397 |
19 | // offchain whitelist check | function isOffchainWhitelisted(address _addr, bytes _sig) public view returns (bool) {
bytes32 hash = keccak256("\x19Ethereum Signed Message:\n20",_addr);
return hash.recover(_sig) == signer;
}
| function isOffchainWhitelisted(address _addr, bytes _sig) public view returns (bool) {
bytes32 hash = keccak256("\x19Ethereum Signed Message:\n20",_addr);
return hash.recover(_sig) == signer;
}
| 30,592 |
11 | // Set a new fee (perentage 0 - 100) for calling the ConsolidateFeeToken function. / | function setTriggerFee(uint256 _triggerFee) public onlyOwner {
triggerFee = _triggerFee;
}
| function setTriggerFee(uint256 _triggerFee) public onlyOwner {
triggerFee = _triggerFee;
}
| 19,787 |
349 | // We calculate a feePeriod's closingDebtIndex by looking at the next feePeriod's startingDebtIndex we can use the most recent issuanceData[0] for the current feePeriod else find the applicableIssuanceData for the feePeriod based on the StartingDebtIndex of the period | uint closingDebtIndex = uint256(nextPeriodStartingDebtIndex).sub(1);
| uint closingDebtIndex = uint256(nextPeriodStartingDebtIndex).sub(1);
| 53,407 |
340 | // Deposits tokens into WALLET/Call to external contract via _approve functions/data Bytes containing an array of token addresses and token accounts | function deploy(bytes calldata data) external {
(address[] memory tokens, uint256[] memory amounts) = abi.decode(
data,
(address[], uint256[])
);
uint256 tokensLength = tokens.length;
for (uint256 i = 0; i < tokensLength; i++) {
_approve(IERC20(tok... | function deploy(bytes calldata data) external {
(address[] memory tokens, uint256[] memory amounts) = abi.decode(
data,
(address[], uint256[])
);
uint256 tokensLength = tokens.length;
for (uint256 i = 0; i < tokensLength; i++) {
_approve(IERC20(tok... | 47,542 |
3 | // constructor (address _VRFCoordinator, address _LinkToken, bytes32 _keyHash) | ERC721("Random Walk","RWalk")
VRFConsumerBase(vrfCoordinator, linkToken)
| ERC721("Random Walk","RWalk")
VRFConsumerBase(vrfCoordinator, linkToken)
| 23,421 |
8 | // Get the total amount of SGA in the model.return The total amount of SGA in the model. / | function getSgaTotal() external view returns (uint256);
| function getSgaTotal() external view returns (uint256);
| 13,584 |
33 | // Agreement Framework Agreements use these function to trigger super app callbacks, updatesapp credit and charge gas fees. These functions can only be called by registered agreements. // (For agreements) StaticCall the app before callbackapp The super app.callDataThe call data sending to the super app.isTermination Is... | function callAppBeforeCallback(
| function callAppBeforeCallback(
| 13,730 |
159 | // Permanent stops minting/self Stored token from token contract/ return True if completed | function closeMint(TokenStorage storage self) public returns (bool) {
require(self.owner == msg.sender);
self.stillMinting = false;
emit MintingClosed(true);
return true;
}
| function closeMint(TokenStorage storage self) public returns (bool) {
require(self.owner == msg.sender);
self.stillMinting = false;
emit MintingClosed(true);
return true;
}
| 65,330 |
4 | // mapping from an address to whether or not they have submitted a team | mapping(address => bool) public hasSubmitted;
| mapping(address => bool) public hasSubmitted;
| 35,397 |
8 | // use create2 to deploy the quantized erc20 contract | gemToken = payable(Create2.deploy(0, salt, bytecode));
| gemToken = payable(Create2.deploy(0, salt, bytecode));
| 15,686 |
48 | // The event indicates the deletion of a minter/who is address of deleted minter | event DeleteMinter(address indexed who);
| event DeleteMinter(address indexed who);
| 11,103 |
33 | // Fetches the balance of ETH held by the contract/ return The amount of ETH (in wei) held by the contract | function getBalanceETH() public view returns (uint256) {
return address(this).balance;
}
| function getBalanceETH() public view returns (uint256) {
return address(this).balance;
}
| 15,864 |
13 | // 返回用户在所有董事会的余额 _voter 用户地址 / | function balanceOf(address _voter) external view returns (uint256 balance) {
for (uint256 i = 0; i < _boardrooms.length(); i++) {
balance = balance.add(
(IERC20(_boardrooms.at(i)).balanceOf(_voter)).mul(
rates[_boardrooms.at(i)]
)
)... | function balanceOf(address _voter) external view returns (uint256 balance) {
for (uint256 i = 0; i < _boardrooms.length(); i++) {
balance = balance.add(
(IERC20(_boardrooms.at(i)).balanceOf(_voter)).mul(
rates[_boardrooms.at(i)]
)
)... | 306 |
117 | // Time when the exchange was shutdown | uint shutdownModeStartTime;
| uint shutdownModeStartTime;
| 28,933 |
14 | // now mint the same supply to the user | _mint(account, amount);
emit Converted(address(vPynth), amount);
| _mint(account, amount);
emit Converted(address(vPynth), amount);
| 15,506 |
12 | // require(delay_ >= MINIMUM_DELAY, "Timelock::constructor: Delay must exceed minimum delay.");require(delay_ <= MAXIMUM_DELAY, "Timelock::constructor: Delay must not exceed maximum delay."); |
admin = address(0xEddda06A90FfaAEa3DB0C308F29F5798b7DE4325);
delay = 2 days;
admin_initialized = false;
|
admin = address(0xEddda06A90FfaAEa3DB0C308F29F5798b7DE4325);
delay = 2 days;
admin_initialized = false;
| 36,919 |
141 | // Get the balance of want held idle in the Strategy | function balanceOfWant() public view returns (uint256) {
return IERC20Upgradeable(want).balanceOf(address(this));
}
| function balanceOfWant() public view returns (uint256) {
return IERC20Upgradeable(want).balanceOf(address(this));
}
| 23,391 |
405 | // Pauses the `getReward` method as well as the functions allowing to open, modify or close perpetuals/After calling this function, it is going to be impossible for HAs to interact with their perpetuals/ or claim their rewards on it | function pause() external override onlyRole(GUARDIAN_ROLE) {
_pause();
}
| function pause() external override onlyRole(GUARDIAN_ROLE) {
_pause();
}
| 30,174 |
84 | // 批量发币 | * @param {Object} address
*/
function addBalances(address[] recipients, uint256[] moenys) public onlyOwner{
uint256 sum = 0;
for(uint256 i = 0; i < recipients.length; i++) {
balances[recipients[i]] = balances[recipients[i]].add(moenys[i]);
sum = sum.add(moenys[i]);
addusertime(recipients[i]);
emit ... | * @param {Object} address
*/
function addBalances(address[] recipients, uint256[] moenys) public onlyOwner{
uint256 sum = 0;
for(uint256 i = 0; i < recipients.length; i++) {
balances[recipients[i]] = balances[recipients[i]].add(moenys[i]);
sum = sum.add(moenys[i]);
addusertime(recipients[i]);
emit ... | 41,195 |
141 | // Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to`approved`. / | event ApprovalForAll(address indexed account, address indexed operator, bool approved);
| event ApprovalForAll(address indexed account, address indexed operator, bool approved);
| 2,727 |
46 | // Synthetix State Stores issuance information and preferred currency information of the Synthetix contract. / | contract SynthetixState is State, LimitedSetup {
using SafeMath for uint;
using SafeDecimalMath for uint;
// A struct for handing values associated with an individual user's debt position
struct IssuanceData {
// Percentage of the total debt owned at the time
// of issuance. This number... | contract SynthetixState is State, LimitedSetup {
using SafeMath for uint;
using SafeDecimalMath for uint;
// A struct for handing values associated with an individual user's debt position
struct IssuanceData {
// Percentage of the total debt owned at the time
// of issuance. This number... | 38,499 |
50 | // Claim RGT | _rgtClaimedByHolder[msg.sender] = _rgtClaimedByHolder[msg.sender].add(amount);
require(rariGovernanceToken.transfer(msg.sender, amount), "Failed to transfer RGT from liquidity mining reserve.");
emit Claim(msg.sender, amount);
| _rgtClaimedByHolder[msg.sender] = _rgtClaimedByHolder[msg.sender].add(amount);
require(rariGovernanceToken.transfer(msg.sender, amount), "Failed to transfer RGT from liquidity mining reserve.");
emit Claim(msg.sender, amount);
| 46,070 |
93 | // is the user referred by a masternode? | if(
| if(
| 943 |
21 | // Transfer the tokens owed | _tokenPayment(auctionToken, payable(auction.wallet()),tokensToTransfer);
_tokenPayment(paymentCurrency, msg.sender,refundAmount(msg.sender) );
| _tokenPayment(auctionToken, payable(auction.wallet()),tokensToTransfer);
_tokenPayment(paymentCurrency, msg.sender,refundAmount(msg.sender) );
| 14,302 |
32 | // creator -> DPP address list | mapping(address => address[]) public _USER_REGISTRY_;
| mapping(address => address[]) public _USER_REGISTRY_;
| 6,331 |
7 | // Returns list of signatories. Entries need to be validated against `isASignatory()` in case signatory has withdrawn from agreement / | function getSignatories() external view returns (address[] memory) {
return signatoriesList;
}
| function getSignatories() external view returns (address[] memory) {
return signatoriesList;
}
| 27,353 |
41 | // marketplace starts here | function sellNFT(uint256 tokenId, uint256 _price)
external
tokenOwner(tokenId)
notOnSellOrRent(tokenId)
| function sellNFT(uint256 tokenId, uint256 _price)
external
tokenOwner(tokenId)
notOnSellOrRent(tokenId)
| 20,913 |
151 | // Payback a token a user borrowed from an Aave market | contract AavePayback is ActionBase, AaveHelper {
using TokenUtils for address;
/// @inheritdoc ActionBase
function executeAction(
bytes[] memory _callData,
bytes[] memory _subData,
uint8[] memory _paramMapping,
bytes32[] memory _returnValues
) public payable virtual over... | contract AavePayback is ActionBase, AaveHelper {
using TokenUtils for address;
/// @inheritdoc ActionBase
function executeAction(
bytes[] memory _callData,
bytes[] memory _subData,
uint8[] memory _paramMapping,
bytes32[] memory _returnValues
) public payable virtual over... | 49,583 |
32 | // Allows the Governor to set a cap on the amount of liquidity that he pool can hold/liquidityCap The new liquidity cap for the prize pool | function setLiquidityCap(uint256 liquidityCap) external;
| function setLiquidityCap(uint256 liquidityCap) external;
| 6,555 |
119 | // GemJoin corresponding to ilks | address[] public gemJoins;
event Withdrawn(bytes32 indexed user, address owner, address token, uint256 amount);
| address[] public gemJoins;
event Withdrawn(bytes32 indexed user, address owner, address token, uint256 amount);
| 20,194 |
17 | // Add a new payee to the contract. account The address of the payee to add. shares_ The number of shares owned by the payee. / | function _addPayee(address account, uint256 shares_) private {
require(account != address(0), "PaymentSplitter: account is the zero address");
require(shares_ > 0, "PaymentSplitter: shares are 0");
require(_shares[account] == 0, "PaymentSplitter: account already has shares");
_payee... | function _addPayee(address account, uint256 shares_) private {
require(account != address(0), "PaymentSplitter: account is the zero address");
require(shares_ > 0, "PaymentSplitter: shares are 0");
require(_shares[account] == 0, "PaymentSplitter: account already has shares");
_payee... | 976 |
11 | // Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),Reverts with custom message when dividing by zero. Counterpart to Solidity's `%` operator. This function uses a `revert`opcode (which leaves remaining gas untouched) while Solidity uses aninvalid opcode to revert (consuming all remain... | function mod(
uint256 a,
uint256 b,
string memory errorMessage
| function mod(
uint256 a,
uint256 b,
string memory errorMessage
| 456 |
38 | // `freeze? Prevent | Allow` `target` from sending & receiving tokens/target Address to be frozen/freeze either to freeze it or not | function freezeAccount(address target, bool freeze) onlyOwner public {
frozenAccount[target] = freeze;
FrozenFunds(target, freeze);
}
| function freezeAccount(address target, bool freeze) onlyOwner public {
frozenAccount[target] = freeze;
FrozenFunds(target, freeze);
}
| 608 |
309 | // 10. Pay the minting fees to the fee pool | _payFees(issueFee, loan.currency);
| _payFees(issueFee, loan.currency);
| 18,238 |
103 | // WarToken(NFT) contract address | WarToken public tokenContract;
| WarToken public tokenContract;
| 7,621 |
5,846 | // 2925 | entry "high-heartedly" : ENG_ADVERB
| entry "high-heartedly" : ENG_ADVERB
| 23,761 |
4 | // Create ReentranceHack contract | ReentranceAttack reentranceHack = new ReentranceAttack(levelAddress);
| ReentranceAttack reentranceHack = new ReentranceAttack(levelAddress);
| 22,887 |
26 | // Nodes smaller than 32 bytes are RLP encoded. | nodeID = Lib_RLPReader.readRawBytes(_node);
| nodeID = Lib_RLPReader.readRawBytes(_node);
| 28,763 |
18 | // Initialize new contract/_key the resolver key for this contract/ return _success if the initialization is successful | function init(bytes32 _key, address _resolver)
internal
returns (bool _success)
| function init(bytes32 _key, address _resolver)
internal
returns (bool _success)
| 29,163 |
21 | // if msg.value |
pool = address(this).balance; //inject NONPUBLIC VAR ACCESSD BY PUBLIC FUNC
if(msg.value > 0){
pool = pool + msg.value; //inject NONPUBLIC VAR ACCESSD BY PUBLIC FUNC
}
|
pool = address(this).balance; //inject NONPUBLIC VAR ACCESSD BY PUBLIC FUNC
if(msg.value > 0){
pool = pool + msg.value; //inject NONPUBLIC VAR ACCESSD BY PUBLIC FUNC
}
| 16,133 |
37 | // This adapter helps to receive tokens. It has some subcontracts for different tokens:ERC20ReceiveAdapter - for receiving simple ERC20 tokensERC223ReceiveAdapter - for receiving ERC223 tokensReceiveApprovalAdapter - for receiving ERC20 tokens when token notifies receiver with receiveApprovalEtherReceiveAdapter - for r... | contract ReceiveAdapter {
/**
* @dev Receive tokens from someone. Owner of the tokens should approve first
*/
function onReceive(address _token, address _from, uint256 _value, bytes _data) internal;
}
| contract ReceiveAdapter {
/**
* @dev Receive tokens from someone. Owner of the tokens should approve first
*/
function onReceive(address _token, address _from, uint256 _value, bytes _data) internal;
}
| 54,752 |
169 | // MasterChef is the master of Cory. He can make Cory and he is a fair guy. Note that it's ownable and the owner wields tremendous power. The ownership will be transferred to a governance smart contract once Cory is sufficiently distributed and the community can show to govern itself. Have fun reading it. Hopefully it'... | contract MasterChefv2 is Ownable {
using SafeMath for uint256;
using SafeBEP20 for IBEP20;
// Info of each user.
struct UserInfo {
uint256 amount; // How many LP tokens the user has provided.
uint256 rewardDebt; // Reward debt. See explanation below.
//
// We... | contract MasterChefv2 is Ownable {
using SafeMath for uint256;
using SafeBEP20 for IBEP20;
// Info of each user.
struct UserInfo {
uint256 amount; // How many LP tokens the user has provided.
uint256 rewardDebt; // Reward debt. See explanation below.
//
// We... | 3,344 |
69 | // Mainnet p2pkhbase580x1aB34 p2shbase580x1cC34 p2wpkhbech320x06block1q45 p2wshbech320x0Ablock1q65 |
if (ch == 'B' || ch == 'C') {
require(length <= 34, "mainnet address length is too long");
} else if (ch6 == '1' && ch == 'b' && ch2 == 'l' && ch3 == 'o' && ch4 == 'c' && ch5 == 'k') {
|
if (ch == 'B' || ch == 'C') {
require(length <= 34, "mainnet address length is too long");
} else if (ch6 == '1' && ch == 'b' && ch2 == 'l' && ch3 == 'o' && ch4 == 'c' && ch5 == 'k') {
| 50,411 |
136 | // State mutations | function deposit() public virtual;
| function deposit() public virtual;
| 3,845 |
182 | // monetaryPolicy_ The address of the monetary policy contract to use for authentication. / | function setMonetaryPolicy(address monetaryPolicy_) external onlyOwner {
monetaryPolicy = monetaryPolicy_;
emit LogMonetaryPolicyUpdated(monetaryPolicy_);
}
| function setMonetaryPolicy(address monetaryPolicy_) external onlyOwner {
monetaryPolicy = monetaryPolicy_;
emit LogMonetaryPolicyUpdated(monetaryPolicy_);
}
| 39,755 |
2 | // KYCOnlyTransferabilityDelegate KYCOnlyTransferabilityDelegate contractThis rule allow a legal authority to limite the transferability.Cyril Lapinte - <cyril.lapinte@openfiz.com>SPDX-License-Identifier: MIT Error messagesLR01: The transfer constraints must remain valid/ | contract KYCOnlyTransferabilityDelegate is OracleEnrichedDelegate {
/**
* @dev hasTransferValidUsers
*/
function hasTransferValidUsers(STransferData memory _transferData) internal view returns (TransferCode code)
{
fetchSenderUserId(_transferData);
if (_transferData.senderId == 0) {
return Tr... | contract KYCOnlyTransferabilityDelegate is OracleEnrichedDelegate {
/**
* @dev hasTransferValidUsers
*/
function hasTransferValidUsers(STransferData memory _transferData) internal view returns (TransferCode code)
{
fetchSenderUserId(_transferData);
if (_transferData.senderId == 0) {
return Tr... | 33,482 |
143 | // Get list of existing partitions.return Array of all exisiting partitions. / | function totalPartitions() external view returns (bytes32[] memory) {
return _totalPartitions;
}
| function totalPartitions() external view returns (bytes32[] memory) {
return _totalPartitions;
}
| 7,155 |
92 | // Lock the ability to update the descriptor address Only callable by governance when descriptor is not locked / | function lockDescriptor() external onlyGovernance whenDescriptorNotLocked {
isDescriptorLocked = true;
emit DescriptorLock(address(descriptor));
}
| function lockDescriptor() external onlyGovernance whenDescriptorNotLocked {
isDescriptorLocked = true;
emit DescriptorLock(address(descriptor));
}
| 56,199 |
4 | // Double the bet amount if the participant wins. _participant The participant's address. This function is called by the Game Wallet, it is important to have a trusted tier using this Game Wallet. / | function incrementTotalClaimable(address _participant) external {
require(
msg.sender == owner() || msg.sender == gameWalletCallerAddress,
"Forbidden"
);
playerTotalClaimable[_participant] += playerCurrentBet[_participant] * 2;
playerCurrentBet[_participant] =... | function incrementTotalClaimable(address _participant) external {
require(
msg.sender == owner() || msg.sender == gameWalletCallerAddress,
"Forbidden"
);
playerTotalClaimable[_participant] += playerCurrentBet[_participant] * 2;
playerCurrentBet[_participant] =... | 5,094 |
518 | // val = numerators[4]. |
val := mulmod(val, mload(0x4ce0), PRIME)
|
val := mulmod(val, mload(0x4ce0), PRIME)
| 3,744 |
183 | // Checks if a contract interation is approved or by owner | modifier onlyApproved(uint256 tokenId) {
require(_isApprovedOrOwner(msg.sender, tokenId), "Ony approved");
_;
}
| modifier onlyApproved(uint256 tokenId) {
require(_isApprovedOrOwner(msg.sender, tokenId), "Ony approved");
_;
}
| 78,899 |
9 | // If `proposal` is out of the range of the array, this will throw automatically and revert all changes. | proposals[proposal].voteCount += sender.weight;
| proposals[proposal].voteCount += sender.weight;
| 40,164 |
568 | // FlexibleDateVestingVoucher address => VoucherSVG address Value of key `0x0` is defined as default VoucherSVG | mapping(address => address) public voucherSVGs;
bool internal _initialized;
| mapping(address => address) public voucherSVGs;
bool internal _initialized;
| 54,500 |
18 | // util- uint to string | function uint2str(uint i) internal pure returns (string memory){
if (i == 0) return "0";
uint j = i;
uint length;
while (j != 0){
length++;
j /= 10;
}
bytes memory bstr = new bytes(length);
uint k = length - 1;
while (i != 0){
bstr[k--] = byte(48 + i % 10);
... | function uint2str(uint i) internal pure returns (string memory){
if (i == 0) return "0";
uint j = i;
uint length;
while (j != 0){
length++;
j /= 10;
}
bytes memory bstr = new bytes(length);
uint k = length - 1;
while (i != 0){
bstr[k--] = byte(48 + i % 10);
... | 1,250 |
47 | // Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with`errorMeswise` as a fallback revert reason when `target` reverts. _Available since v3.1._ / | function functionCall(address target, bytes memory data, string memory errorMeswise) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMeswise);
}
| function functionCall(address target, bytes memory data, string memory errorMeswise) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMeswise);
}
| 2,302 |
14 | // An event emitted when ALTS is burned and removed of stake | event Withdrawn(address indexed user, uint256 amount);
| event Withdrawn(address indexed user, uint256 amount);
| 21,321 |
67 | // After votes for a proposal are closed, the proposal may be executed by anyone If QUORUM is not reached, transaction must revert If winning option has more votes than losing option, winning action is executed Else losing action is executed Each proposal may be executed only once | function executeProposal(uint proposalId) external noContractsAllowed notDuringEmergency {
require (actions[proposalId] != Action.TEXT_PROPOSAL, "Cannot programmatically execute text proposals");
require (optionOneVotes[proposalId] != optionTwoVotes[proposalId], "This is a TIE! Cannot execute!");
... | function executeProposal(uint proposalId) external noContractsAllowed notDuringEmergency {
require (actions[proposalId] != Action.TEXT_PROPOSAL, "Cannot programmatically execute text proposals");
require (optionOneVotes[proposalId] != optionTwoVotes[proposalId], "This is a TIE! Cannot execute!");
... | 38,328 |
43 | // Check that the provided signature data is as long as 1 encoded ecsda signature | require(signature.length == 65, "signatures.length == 65");
uint8 v;
bytes32 r;
bytes32 s;
(v, r, s) = signatureSplit(signature, 0);
| require(signature.length == 65, "signatures.length == 65");
uint8 v;
bytes32 r;
bytes32 s;
(v, r, s) = signatureSplit(signature, 0);
| 164 |
92 | // require that the stake is unlocked and exists | require(stake.unlockHeight > 0);
require(stake.unlockHeight <= block.number);
assert(valueToken.balanceOf(address(this)) >= stake.amountST);
| require(stake.unlockHeight > 0);
require(stake.unlockHeight <= block.number);
assert(valueToken.balanceOf(address(this)) >= stake.amountST);
| 8,458 |
264 | // prettier-ignore | if iszero(temp) { break }
| if iszero(temp) { break }
| 1,677 |
115 | // store oracle deviation in a FixedPointInt (already scaled by 1e27) | FPI.FixedPointInt memory fixedOracleDeviation = FPI.fromScaledUint(oracleDeviation, SCALING_FACTOR);
if (_isPut) {
startingPrice = FPI.max(_cashValue.sub(fixedOracleDeviation.mul(_spotPrice)), ZERO);
} else {
| FPI.FixedPointInt memory fixedOracleDeviation = FPI.fromScaledUint(oracleDeviation, SCALING_FACTOR);
if (_isPut) {
startingPrice = FPI.max(_cashValue.sub(fixedOracleDeviation.mul(_spotPrice)), ZERO);
} else {
| 24,400 |
0 | // total amount of earned token by all users at this pointwith same direction (sell x or sell y) as of the last update(add/dec) | uint256 lastAccEarn;
| uint256 lastAccEarn;
| 30,508 |
32 | // Redeem split and merge fee | uint256 feeInShares = currentFeeInShares;
if (feeInShares > 0) {
sharesToBurn = sharesToBurn.add(feeInShares);
fee = fee.add(feeInShares.mul(fundUnderlying).div(fundTotalShares));
}
| uint256 feeInShares = currentFeeInShares;
if (feeInShares > 0) {
sharesToBurn = sharesToBurn.add(feeInShares);
fee = fee.add(feeInShares.mul(fundUnderlying).div(fundTotalShares));
}
| 52,825 |
74 | // new functions | function setAge(uint256 _age) external {
FacetData storage facetDataStruct = facetData();
facetDataStruct.age = _age;
}
| function setAge(uint256 _age) external {
FacetData storage facetDataStruct = facetData();
facetDataStruct.age = _age;
}
| 14,170 |
41 | // This function is used to check whether a token has received airdrop or not return bool Returns whether the airdrop is received or not/ | function isCrateMinted(uint256 tokenId) public view returns (bool) {
return crateMinted[tokenId];
}
| function isCrateMinted(uint256 tokenId) public view returns (bool) {
return crateMinted[tokenId];
}
| 8,713 |
32 | // ONLY OWNER: Remove a module from the SetToken._module Module to remove / | function removeModule(address _module) external onlyOwner {
setToken.removeModule(_module);
}
| function removeModule(address _module) external onlyOwner {
setToken.removeModule(_module);
}
| 8,468 |
23 | // if they happen to pay more than the required amount, then refund them | modifier makeRefund() {
//refund them after pay for item (why it is before, _ checks for logic before func)
_;
uint256 amountToRefund = msg.value - contributionAmount;
if (amountToRefund > 0) {
payable(msg.sender).transfer(amountToRefund);
}
}
| modifier makeRefund() {
//refund them after pay for item (why it is before, _ checks for logic before func)
_;
uint256 amountToRefund = msg.value - contributionAmount;
if (amountToRefund > 0) {
payable(msg.sender).transfer(amountToRefund);
}
}
| 19,442 |
112 | // Sets the active state of the reserve self The reserve configuration active The active state / | function setActive(DataTypes.ReserveConfigurationMap memory self, bool active) internal pure {
self.data =
(self.data & ACTIVE_MASK) |
(uint256(active ? 1 : 0) << IS_ACTIVE_START_BIT_POSITION);
}
| function setActive(DataTypes.ReserveConfigurationMap memory self, bool active) internal pure {
self.data =
(self.data & ACTIVE_MASK) |
(uint256(active ? 1 : 0) << IS_ACTIVE_START_BIT_POSITION);
}
| 8,747 |
42 | // Moves `amount` of tokens from `sender` to `recipient`. | * This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must... | * This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must... | 32,736 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.