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 |
|---|---|---|---|---|
130 | // EIP1884 fix | (bool success, ) = _arbitrator.call.value(arbitratorValue)("");
require(success, "Transfer failed.");
if (destinationValue > 0) {
| (bool success, ) = _arbitrator.call.value(arbitratorValue)("");
require(success, "Transfer failed.");
if (destinationValue > 0) {
| 31,793 |
72 | // should allow contract's owner add more tranches _tranchesAmount amount of tranches want to add: 1, 2, 3 ... / | function addTranches(uint256 _tranchesAmount) external onlyOwner {
uint256 lastTranches = _tranches[_tranches.length - 1];
for (uint256 i = 0; i < _tranchesAmount; i++) {
_tranches.push(lastTranches.add(_trancheDuration));
lastTranches = _tranches[_tranches.length - 1];
... | function addTranches(uint256 _tranchesAmount) external onlyOwner {
uint256 lastTranches = _tranches[_tranches.length - 1];
for (uint256 i = 0; i < _tranchesAmount; i++) {
_tranches.push(lastTranches.add(_trancheDuration));
lastTranches = _tranches[_tranches.length - 1];
... | 4,262 |
120 | // The proven stETH balance of the pool. / | uint256 public stethBalance;
| uint256 public stethBalance;
| 15,396 |
322 | // Get exact ticks depending on Sorbetto's balances | (tickLower, tickUpper) = pool.getPositionTicks(balance0, balance1, baseThreshold, tickSpacing);
| (tickLower, tickUpper) = pool.getPositionTicks(balance0, balance1, baseThreshold, tickSpacing);
| 4,739 |
3 | // minimum amount of time a proposal can live/ after this time it can be forcefully invoked or killed by anyone | uint256 constant proposalLife = 7 days;
| uint256 constant proposalLife = 7 days;
| 13,961 |
28 | // How much gas to pass down to innerRelayCall. must be lower than the default 63/64 actually, min(gasleft63/64, gasleft-GAS_RESERVE) might be enough. | uint256 innerGasLimit = gasleft()*63/64- config.gasReserve;
vars.gasBeforeInner = aggregateGasleft();
| uint256 innerGasLimit = gasleft()*63/64- config.gasReserve;
vars.gasBeforeInner = aggregateGasleft();
| 5,251 |
62 | // Validation of an executed purchase. Observe state and use revert statements to undo rollback when valid conditions are not met. _beneficiary Address performing the token purchase _weiAmount Value in wei involved in the purchase / | function _postValidatePurchase(address _beneficiary, uint256 _weiAmount) internal {
// optional override
}
| function _postValidatePurchase(address _beneficiary, uint256 _weiAmount) internal {
// optional override
}
| 33,383 |
29 | // withdraws underlying from vault using vault shares burns shares, sends underlying to user, sends withdrawal fee to withdrawal fee recepient _share is the number of vault shares to be burned / | function withdrawUnderlying(uint256 _share) external nonReentrant {
notEmergency();
actionsInitialized();
// keep track of underlying balance before
IERC20 underlyingToken = IERC20(underlying);
uint256 totalUnderlyingBeforeWithdrawal = totalUnderlyingAsset();
// withdraw underlying from vaul... | function withdrawUnderlying(uint256 _share) external nonReentrant {
notEmergency();
actionsInitialized();
// keep track of underlying balance before
IERC20 underlyingToken = IERC20(underlying);
uint256 totalUnderlyingBeforeWithdrawal = totalUnderlyingAsset();
// withdraw underlying from vaul... | 56,161 |
50 | // Set the number of tokens to hold from transferring for a list of token holders. _account list of account holders _value list of token amounts to hold / | function setHolds (address [] _account, uint256 [] _value) public {
require (owners[msg.sender]);
require (_account.length == _value.length);
for (uint256 i=0; i < _account.length; i++){
holds[_account[i]] = _value[i];
}
}
| function setHolds (address [] _account, uint256 [] _value) public {
require (owners[msg.sender]);
require (_account.length == _value.length);
for (uint256 i=0; i < _account.length; i++){
holds[_account[i]] = _value[i];
}
}
| 52,512 |
358 | // Redeems the underlying amount of assets requested by _user. This function is executed by the overlying aToken contract in response to a redeem action._reserve the address of the reserve_user the address of the user performing the action_amount the underlying amount to be redeemed/ | {
uint256 currentAvailableLiquidity = core.getReserveAvailableLiquidity(_reserve);
require(
currentAvailableLiquidity >= _amount,
"There is not enough liquidity available to redeem"
);
core.updateStateOnRedeem(_reserve, _user, _amount, _aTokenBalanceAfterRede... | {
uint256 currentAvailableLiquidity = core.getReserveAvailableLiquidity(_reserve);
require(
currentAvailableLiquidity >= _amount,
"There is not enough liquidity available to redeem"
);
core.updateStateOnRedeem(_reserve, _user, _amount, _aTokenBalanceAfterRede... | 81,082 |
25 | // push goalId | userToGoalIds[msg.sender].push(goalId);
| userToGoalIds[msg.sender].push(goalId);
| 16,397 |
132 | // snowDaq registry contract | address public snowDaqRegistryContract = 0x8FC05c79D7D725D425e0c9Fe2EE6dE48E57AE792;
| address public snowDaqRegistryContract = 0x8FC05c79D7D725D425e0c9Fe2EE6dE48E57AE792;
| 18,051 |
15 | // L2 block gas limit. | uint64 public gasLimit;
| uint64 public gasLimit;
| 41,080 |
298 | // Performs a transfer in, reverting upon failure. Returns the amount actually transferred to the protocol, in case of a fee. This may revert due to insufficient balance or insufficient allowance. / | function doTransferIn(address from, uint amount) internal virtual returns (uint);
| function doTransferIn(address from, uint amount) internal virtual returns (uint);
| 911 |
114 | // bondLib | IERC659(bond_contract).writeInfo(_ERC20Loan);
for (uint256 i = 0; i < idToERC20Loan.length; i++) {
if (idToERC20Loan[i].seller == _ERC20Loan.seller) {
idToERC20Loan[i].auctionStatus = false;
_ERC20Loan.buyer = msg.sender;
| IERC659(bond_contract).writeInfo(_ERC20Loan);
for (uint256 i = 0; i < idToERC20Loan.length; i++) {
if (idToERC20Loan[i].seller == _ERC20Loan.seller) {
idToERC20Loan[i].auctionStatus = false;
_ERC20Loan.buyer = msg.sender;
| 8,002 |
24 | // the starting time of the crowdsale // the ending time of the crowdsale // How many wei of funding we have received so far // How many distinct addresses have invested // How many total investments have been made // Address of pre-ico contract// How much ETH each address has invested to this crowdsale // State machin... | enum State{PreFunding, Funding, Closed}
// A new investment was made
event Invested(uint index, address indexed investor, uint weiAmount);
// Funds transfer to other address
event Transfer(address indexed receiver, uint weiAmount);
// Crowdsale end time has been changed
event EndsAtChanged(uint endTime... | enum State{PreFunding, Funding, Closed}
// A new investment was made
event Invested(uint index, address indexed investor, uint weiAmount);
// Funds transfer to other address
event Transfer(address indexed receiver, uint weiAmount);
// Crowdsale end time has been changed
event EndsAtChanged(uint endTime... | 48,478 |
186 | // Called to `msg.sender` after minting liquidity to a position from IUniswapV3Poolmint./In the implementation you must pay the pool tokens owed for the minted liquidity./ The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory./amount0Owed The amount of token0 due to ... | function uniswapV3MintCallback(
uint256 amount0Owed,
uint256 amount1Owed,
bytes calldata data
) external;
| function uniswapV3MintCallback(
uint256 amount0Owed,
uint256 amount1Owed,
bytes calldata data
) external;
| 22,966 |
65 | // Updates license for project `_projectId`. / | function updateProjectLicense(
uint256 _projectId,
string memory _projectLicense
| function updateProjectLicense(
uint256 _projectId,
string memory _projectLicense
| 11,207 |
8 | // Gets the owner of the specified token ID _tokenId uint ID of the token to query the owner ofreturn owner address currently marked as the owner of the given token ID / | function ownerOf(uint _tokenId) public constant returns (address) {
address owner = tokenOwner[_tokenId];
require(owner != address(0));
return owner;
}
| function ownerOf(uint _tokenId) public constant returns (address) {
address owner = tokenOwner[_tokenId];
require(owner != address(0));
return owner;
}
| 41,686 |
3 | // Modifier to make a function callable only when the contract is not paused. Requirements: - The contract must not be paused. / | modifier whenNotPaused() {
_requireNotPaused();
_;
}
| modifier whenNotPaused() {
_requireNotPaused();
_;
}
| 8,380 |
13 | // keccak function over calldata. copy calldata into memory, do keccak and drop allocated memory. Strangely, this is more efficient than letting solidity do it. / | function calldataKeccak(bytes calldata data) pure returns (bytes32 ret) {
assembly {
let mem := mload(0x40)
let len := data.length
calldatacopy(mem, data.offset, len)
ret := keccak256(mem, len)
}
}
| function calldataKeccak(bytes calldata data) pure returns (bytes32 ret) {
assembly {
let mem := mload(0x40)
let len := data.length
calldatacopy(mem, data.offset, len)
ret := keccak256(mem, len)
}
}
| 10,306 |
77 | // All joins are disabled while the contract is paused. |
uint256[] memory normalizedWeights = _normalizedWeights();
|
uint256[] memory normalizedWeights = _normalizedWeights();
| 1,558 |
66 | // first 30m | return (_amount * 5) / 100;
| return (_amount * 5) / 100;
| 23,145 |
28 | // Compute a unique hash for an action used in this channel application/turnTaker The address of the user taking the action/previousState The hash of a state this action is being taken on/action The ABI encoded version of the action being taken/setStateNonce The nonce of the state this action is being taken on/disputeN... | function computeActionHash(
address turnTaker,
bytes32 previousState,
bytes action,
uint256 setStateNonce,
uint256 disputeNonce
)
internal
pure
returns (bytes32)
| function computeActionHash(
address turnTaker,
bytes32 previousState,
bytes action,
uint256 setStateNonce,
uint256 disputeNonce
)
internal
pure
returns (bytes32)
| 4,130 |
23 | // Shows that the sale has been given approval to sell tokens by the token owner | function hasApproval() public view returns(bool) {
return approval;
}
| function hasApproval() public view returns(bool) {
return approval;
}
| 37,664 |
20 | // Issusable The Issusable contract has an owner address, and provides basic authorization controlfunctions, this simplifies the implementation of "user permissions". / | contract Issusable is Ownable {
address public Issuser;
uint IssuseAmount;
uint LastIssuseTime = 0;
uint PreIssuseTime=0;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() internal {
Issuser = msg.sen... | contract Issusable is Ownable {
address public Issuser;
uint IssuseAmount;
uint LastIssuseTime = 0;
uint PreIssuseTime=0;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() internal {
Issuser = msg.sen... | 13,385 |
67 | // we may have reached rock bottom - don't continue | if (invitationFee == 0) return;
| if (invitationFee == 0) return;
| 36,250 |
19 | // Set the curation percentage of query fees sent to curators. This function can only be called by the governor. _percentage Percentage of query fees sent to curators / | function setCurationPercentage(uint32 _percentage) external;
| function setCurationPercentage(uint32 _percentage) external;
| 25,651 |
17 | // view real balance of each account | function balanceOf(address account) public view override returns (uint256) {
return _baseToMoney(_balances[account]);
}
| function balanceOf(address account) public view override returns (uint256) {
return _baseToMoney(_balances[account]);
}
| 29,212 |
7 | // index of reward token address in the _rewardTokenList array, for the reward token, for the holder contract | mapping(address => mapping(address => uint256))
public _rewardTokenListIndex;
| mapping(address => mapping(address => uint256))
public _rewardTokenListIndex;
| 43,237 |
3 | // ==================== DATA STRUCTURES ================== | struct FleetStats {
bool exists;
uint256 totalConnections;
uint256 totalBytes;
| struct FleetStats {
bool exists;
uint256 totalConnections;
uint256 totalBytes;
| 52,660 |
138 | // contract status |
bool public contractStatus;
|
bool public contractStatus;
| 7,709 |
8 | // Clonable contract must have an empty constructor | // constructor() {
// }
| // constructor() {
// }
| 14,505 |
10 | // See {IERC721-balanceOf}. / | function balanceOf(address owner)
public
view
virtual
override
returns (uint256)
{
require(owner != address(0), "ERC721: balance query for the zero address");
return _balances[owner];
}
| function balanceOf(address owner)
public
view
virtual
override
returns (uint256)
{
require(owner != address(0), "ERC721: balance query for the zero address");
return _balances[owner];
}
| 5,770 |
239 | // Allows to send to the other network the amount of locked tokens that can be forced into the contract without the invocation of the required methods. (e. g. regular transfer without a call to onTokenTransfer)_token address of the token contract._receiver the address that will receive the tokens on the other network./ | function fixMediatorBalance(address _token, address _receiver) public onlyIfUpgradeabilityOwner {
require(isTokenRegistered(_token));
uint256 balance = ERC677(_token).balanceOf(address(this));
uint256 expectedBalance = mediatorBalance(_token);
require(balance > expectedBalance);
... | function fixMediatorBalance(address _token, address _receiver) public onlyIfUpgradeabilityOwner {
require(isTokenRegistered(_token));
uint256 balance = ERC677(_token).balanceOf(address(this));
uint256 expectedBalance = mediatorBalance(_token);
require(balance > expectedBalance);
... | 2,378 |
7 | // kill | if(wishes>0){
wishes = 0;
blockGenieWasKilledOnByCarpetRider = block.number;
uint soulecules = Resolve.balanceOf(THIS)/2;
if (soulecules>0) Resolve.transfer( address(PiZZa), soulecules);
Resolve.transfer( CarpetRider, soulecules );
emit KillGenie(CarpetRider, GEN... | if(wishes>0){
wishes = 0;
blockGenieWasKilledOnByCarpetRider = block.number;
uint soulecules = Resolve.balanceOf(THIS)/2;
if (soulecules>0) Resolve.transfer( address(PiZZa), soulecules);
Resolve.transfer( CarpetRider, soulecules );
emit KillGenie(CarpetRider, GEN... | 47,560 |
40 | // set token Amounts/tokens token address set/tokenAmounts token amounts set, each number pack one token all amounts.Each format is the same with amountSetAndK/ [ask amounts(16) | ask amounts decimal(8) | bid amounts(16) | bid amounts decimal(8) ] | function setTokensAmounts(
address[] calldata tokens,
uint64[] calldata tokenAmounts
| function setTokensAmounts(
address[] calldata tokens,
uint64[] calldata tokenAmounts
| 17,217 |
6 | // The Vault contract needs to be approved by the token holder before this transaction takes place. ERC20(_token).approve(address(this), _value) | require(ERC20(_token).transferFrom(_sender, address(this), _value), "Vault::_vaultDeposit - Reverted ERC20 token transfer");
| require(ERC20(_token).transferFrom(_sender, address(this), _value), "Vault::_vaultDeposit - Reverted ERC20 token transfer");
| 46,954 |
0 | // 0x150b7a02 == bytes4(keccak256('onERC721Received(address,address,uint256,bytes)')) | bytes4 private constant _ERC721_RECEIVED = 0x150b7a02;
| bytes4 private constant _ERC721_RECEIVED = 0x150b7a02;
| 7,618 |
19 | // proposal id to bid information | mapping(uint256 => uint256) internal bidIdToProposalId;
| mapping(uint256 => uint256) internal bidIdToProposalId;
| 5,931 |
5 | // Only allowed by financial officer | modifier onlyFinancialOfficer() {
require(msg.sender == financialOfficerAddress);
_;
}
| modifier onlyFinancialOfficer() {
require(msg.sender == financialOfficerAddress);
_;
}
| 23,293 |
151 | // Returns the FRAX value in collateral tokens | function getFRAXInCollateral(uint256 col_idx, uint256 frax_amount) public view returns (uint256) {
return frax_amount.mul(PRICE_PRECISION).div(10 ** missing_decimals[col_idx]).div(collateral_prices[col_idx]);
}
| function getFRAXInCollateral(uint256 col_idx, uint256 frax_amount) public view returns (uint256) {
return frax_amount.mul(PRICE_PRECISION).div(10 ** missing_decimals[col_idx]).div(collateral_prices[col_idx]);
}
| 46,837 |
10 | // return value is 95 % of two people. | uint[11] returnValues = [0.2375 ether, 0.475 ether, 0.950 ether, 1.90 ether, 3.80 ether, 7.60 ether, 15.20 ether, 30.40 ether, 60.80 ether, 121.60 ether];
| uint[11] returnValues = [0.2375 ether, 0.475 ether, 0.950 ether, 1.90 ether, 3.80 ether, 7.60 ether, 15.20 ether, 30.40 ether, 60.80 ether, 121.60 ether];
| 5,110 |
65 | // Allows the pendingOwner address to finalize the transfer. / | function claimOwnership() public onlyPendingOwner {
emit OwnershipTransferred(owner, pendingOwner);
owner = pendingOwner;
pendingOwner = address(0);
}
| function claimOwnership() public onlyPendingOwner {
emit OwnershipTransferred(owner, pendingOwner);
owner = pendingOwner;
pendingOwner = address(0);
}
| 8,210 |
27 | // tethys | if (proto == 384) {
return 65003;
}
| if (proto == 384) {
return 65003;
}
| 39,366 |
51 | // 2 - the inital arrival time | uint arrivalTime;
| uint arrivalTime;
| 17,693 |
26 | // If `self` starts with `needle`, `needle` is removed from the beginning of `self`. Otherwise, `self` is unmodified. self The slice to operate on. needle The slice to search for.return `self` / | function beyond(slice memory self, slice memory needle) internal pure returns (slice memory) {
if (self._len < needle._len) {
return self;
}
bool equal = true;
if (self._ptr != needle._ptr) {
assembly {
let length := mload(needle)
... | function beyond(slice memory self, slice memory needle) internal pure returns (slice memory) {
if (self._len < needle._len) {
return self;
}
bool equal = true;
if (self._ptr != needle._ptr) {
assembly {
let length := mload(needle)
... | 1,040 |
200 | // SnowToken with Governance. | contract SnowToken is BEP20 {
// antiBot, default to true. True allowed to cut the maximum transfer tax rate in order to prevent bot to buy at the launch.
// If antiBot is set to 0, is it not possible to re set at 1, only one time.
uint256 public antiBot = 1;
// Max transfer tax rate: 10%.
uint16 pu... | contract SnowToken is BEP20 {
// antiBot, default to true. True allowed to cut the maximum transfer tax rate in order to prevent bot to buy at the launch.
// If antiBot is set to 0, is it not possible to re set at 1, only one time.
uint256 public antiBot = 1;
// Max transfer tax rate: 10%.
uint16 pu... | 4,646 |
31 | // Returns the number of the first codepoint in the slice. self The slice to operate on.return The number of the first codepoint in the slice. / | function ord(slice self) internal pure returns (uint ret) {
if (self._len == 0) {
return 0;
}
uint word;
uint length;
uint divisor = 2 ** 248;
// Load the rune into the MSBs of b
assembly { word:= mload(mload(add(self, 32))) }
uint b = wo... | function ord(slice self) internal pure returns (uint ret) {
if (self._len == 0) {
return 0;
}
uint word;
uint length;
uint divisor = 2 ** 248;
// Load the rune into the MSBs of b
assembly { word:= mload(mload(add(self, 32))) }
uint b = wo... | 15,578 |
15 | // Allows to remove an owner. Transaction has to be sent by wallet. _owner Address of owner. / | function removeOwner(address _owner)
public
onlyOwner
ownerExists(_owner)
| function removeOwner(address _owner)
public
onlyOwner
ownerExists(_owner)
| 46,801 |
67 | // Claim (auto-generated event)/ | event Claim(
| event Claim(
| 30,808 |
104 | // address => cardId => amountStaked | mapping(address => mapping(uint256 => uint256)) public balances;
| mapping(address => mapping(uint256 => uint256)) public balances;
| 30,096 |
13 | // not revealed URI | if(revealed == false) {
return bytes(notRevealedURI).length > 0
? string(abi.encodePacked(notRevealedURI, tokenId.toString(), baseExtension))
: "";
}
| if(revealed == false) {
return bytes(notRevealedURI).length > 0
? string(abi.encodePacked(notRevealedURI, tokenId.toString(), baseExtension))
: "";
}
| 65,606 |
315 | // This function allows for the manager to set their own arbitrary eligibility contract.Once eligiblity is set, it cannot be unset or changed. Disabled for launch. | // function setEligibilityStorage(address _newEligibility) public virtual {
// onlyPrivileged();
// require(
// address(eligibilityStorage) == address(0),
// "NFTXVault: eligibility already set"
// );
// eligibilityStorage = INFTXEligibility(_newEligibility);
... | // function setEligibilityStorage(address _newEligibility) public virtual {
// onlyPrivileged();
// require(
// address(eligibilityStorage) == address(0),
// "NFTXVault: eligibility already set"
// );
// eligibilityStorage = INFTXEligibility(_newEligibility);
... | 37,929 |
510 | // Rebalances funds between the pool and the asset manager to maintain target investment percentage. poolId - the poolId of the pool to be rebalanced force - a boolean representing whether a rebalance should be forced even when the pool is near balance / | function rebalance(bytes32 poolId, bool force) external;
| function rebalance(bytes32 poolId, bool force) external;
| 53,553 |
14 | // PretoFourMonthLockup PretoFourMonthLockup is a token holder contract that will allow abeneficiary to extract the tokens after a given release time / | contract PretoFourMonthLockup {
using SafeERC20 for ERC20Basic;
// ERC20 basic token contract being held
ERC20Basic public token;
// beneficiary of tokens after they are released
address public beneficiary;
// timestamp when token release is enabled
uint256 public releaseTime;
function PretoFourMont... | contract PretoFourMonthLockup {
using SafeERC20 for ERC20Basic;
// ERC20 basic token contract being held
ERC20Basic public token;
// beneficiary of tokens after they are released
address public beneficiary;
// timestamp when token release is enabled
uint256 public releaseTime;
function PretoFourMont... | 39,516 |
192 | // to avoid exploit in time lock | function checkLockTiming(uint256 _pid, address _user, uint256 _time) internal {
uint256 lpReleaseTime = userInfo[_pid][_user].lpReleaseTime;
require(lpReleaseTime <= block.timestamp.add(_time), "timing invalid");
}
| function checkLockTiming(uint256 _pid, address _user, uint256 _time) internal {
uint256 lpReleaseTime = userInfo[_pid][_user].lpReleaseTime;
require(lpReleaseTime <= block.timestamp.add(_time), "timing invalid");
}
| 45,896 |
98 | // userStakeBalance[account][balIndex.add(1)].startingTime is the end time for balIndex lastPeriodTime is the starting time for the period beyond the end of time index | if (balIndex < userStakeBalance[account].length.sub(1)) {
if (userStakeBalance[account][balIndex.add(1)].startingTime <= lastPeriodTime)
balIndex = balIndex.add(1);
}
| if (balIndex < userStakeBalance[account].length.sub(1)) {
if (userStakeBalance[account][balIndex.add(1)].startingTime <= lastPeriodTime)
balIndex = balIndex.add(1);
}
| 29,149 |
11 | // update delegatee value | require(nowTotalDelegated.sub(nowDelegatedToAddress).add(_percentage) <= 100, "Total delegation over 100%");
_updateValueAtNow(totalDelegated[msg.sender], nowTotalDelegated.sub(nowDelegatedToAddress).add(_percentage));
delegations[msg.sender][_delegatee] = _percentage;
| require(nowTotalDelegated.sub(nowDelegatedToAddress).add(_percentage) <= 100, "Total delegation over 100%");
_updateValueAtNow(totalDelegated[msg.sender], nowTotalDelegated.sub(nowDelegatedToAddress).add(_percentage));
delegations[msg.sender][_delegatee] = _percentage;
| 7,464 |
6 | // max curator fee | uint256 public override maxCuratorFee;
| uint256 public override maxCuratorFee;
| 28,128 |
74 | // usdt.safeTransfer(msg.sender, amount); | usdt.transfer(msg.sender, amount);
| usdt.transfer(msg.sender, amount);
| 23,228 |
49 | // updateWeight and pokeWeights are unavoidably long/ solhint-disable function-max-lines // Update the weight of an existing token Refactored to library to make CRPFactory deployable self - ConfigurableRightsPool instance calling the library bPool - Core BPool the CRP is wrapping token - token to be reweighted newWeigh... | function updateWeight(
IConfigurableRightsPool self,
IBPool bPool,
address token,
uint newWeight
)
external
| function updateWeight(
IConfigurableRightsPool self,
IBPool bPool,
address token,
uint newWeight
)
external
| 9,168 |
29 | // The code below implements the formula of the support criterion explained in the top of this file. `(1 - supportThreshold)N_yes > supportThreshold N_no` | return
(RATIO_BASE - proposal_.parameters.supportThreshold) * proposal_.tally.yes >
proposal_.parameters.supportThreshold * proposal_.tally.no;
| return
(RATIO_BASE - proposal_.parameters.supportThreshold) * proposal_.tally.yes >
proposal_.parameters.supportThreshold * proposal_.tally.no;
| 24,842 |
5 | // ACTIVATION / | function setSaleIsActive(bool saleIsActive_) external onlyOwner {
saleIsActive = saleIsActive_;
}
| function setSaleIsActive(bool saleIsActive_) external onlyOwner {
saleIsActive = saleIsActive_;
}
| 1,314 |
37 | // This function should be called only by money source_id id of the taskthis function change state of the task to complete and sets needed wei/ | function evaluateAndSetNeededWei(uint _id, uint _neededWei) public onlyByMoneySource(_id) {
require(getCurrentState(_id) == State.CompleteButNeedsEvaluation);
require(0==tasks[_id].neededWei);
tasks[_id].neededWei = _neededWei;
tasks[_id].state = State.Complete;
emit TaskTableStateChanged(tasks[_id].state);... | function evaluateAndSetNeededWei(uint _id, uint _neededWei) public onlyByMoneySource(_id) {
require(getCurrentState(_id) == State.CompleteButNeedsEvaluation);
require(0==tasks[_id].neededWei);
tasks[_id].neededWei = _neededWei;
tasks[_id].state = State.Complete;
emit TaskTableStateChanged(tasks[_id].state);... | 22,933 |
21 | // Debt settlement | function heal(uint rad) external note {
require(rad <= vat.dai(address(this)), "Vow/insufficient-surplus");
require(rad <= sub(sub(vat.sin(address(this)), Sin), Ash), "Vow/insufficient-debt");
vat.heal(rad);
}
| function heal(uint rad) external note {
require(rad <= vat.dai(address(this)), "Vow/insufficient-surplus");
require(rad <= sub(sub(vat.sin(address(this)), Sin), Ash), "Vow/insufficient-debt");
vat.heal(rad);
}
| 30,181 |
199 | // [MIT License]/Base64/Provides a function for encoding some bytes in base64/Brecht Devos <[email protected]> | library Base64 {
bytes internal constant TABLE =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
/// @notice Encodes some bytes to the base64 representation
function encode(bytes memory data) internal pure returns (string memory) {
uint256 len = data.length;
if (... | library Base64 {
bytes internal constant TABLE =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
/// @notice Encodes some bytes to the base64 representation
function encode(bytes memory data) internal pure returns (string memory) {
uint256 len = data.length;
if (... | 1,891 |
23 | // once started, this process requires a total of at least 4 separate executions. Each execution is limited to processing 200 subcontracts to avoid gas limits, so if there are more than 200 accounts in any step they will have to be executed multiple times eg, 555 new accounts would require 3 executions of that step/ |
function settleParts(address _lp)
external
returns (bool isComplete)
|
function settleParts(address _lp)
external
returns (bool isComplete)
| 47,108 |
23 | // From https:github.com/Arachnid/solidity-stringutils/blob/b9a6f6615cf18a87a823cbc461ce9e140a61c305/src/strings.sol | function _memcpy(
uint256 dest,
uint256 src,
uint256 len
| function _memcpy(
uint256 dest,
uint256 src,
uint256 len
| 26,006 |
545 | // Can by called by anyone to burn the stake of the exchange when certain/conditions are fulfilled.//Currently this will only burn the stake of the exchange if/the exchange is in withdrawal mode. | function burnExchangeStake()
external
virtual;
| function burnExchangeStake()
external
virtual;
| 29,250 |
95 | // Start fill in the values Creation 3x Long |
function getTokensCreatedByCash(
uint256 mintingPrice,
uint256 cash,
uint256 gasFee
|
function getTokensCreatedByCash(
uint256 mintingPrice,
uint256 cash,
uint256 gasFee
| 19,623 |
64 | // Move user's FPT to locked balance, when user redeem collateral.account user's account. amount amount of locked FPT. lockedWorth net worth of locked FPT. / | function addlockBalance(address /*account*/, uint256 /*amount*/,uint256 /*lockedWorth*/)public {
delegateAndReturn();
}
| function addlockBalance(address /*account*/, uint256 /*amount*/,uint256 /*lockedWorth*/)public {
delegateAndReturn();
}
| 38,260 |
62 | // рассчитать комиссию с пополнения для платёжной системы и суммы | function calcRefill(string _paySystem, uint256 _value) public view returns(uint256) {
uint256 _totalComission;
_totalComission = refillPaySystemInfo[_paySystem].stat + (_value / 100 ) * refillPaySystemInfo[_paySystem].perc;
return _totalComission;
}
| function calcRefill(string _paySystem, uint256 _value) public view returns(uint256) {
uint256 _totalComission;
_totalComission = refillPaySystemInfo[_paySystem].stat + (_value / 100 ) * refillPaySystemInfo[_paySystem].perc;
return _totalComission;
}
| 23,413 |
299 | // Roll over to the next fee period. | currentBalanceSum[account] = 0;
hasWithdrawnLastPeriodFees[account] = false;
lastTransferTimestamp[account] = feePeriodStartTime;
| currentBalanceSum[account] = 0;
hasWithdrawnLastPeriodFees[account] = false;
lastTransferTimestamp[account] = feePeriodStartTime;
| 35,886 |
5 | // Simple contract regulating the total supply of gold locked at any given time so that the Cache contract can't over mint tokens | contract LockedGoldOracle is Ownable {
using SafeMath for uint256;
uint256 private _lockedGold;
address private _cacheContract;
event LockEvent(uint256 amount);
event UnlockEvent(uint256 amount);
function setCacheContract(address cacheContract) external onlyOwner {
_cacheContract = cacheContract;
... | contract LockedGoldOracle is Ownable {
using SafeMath for uint256;
uint256 private _lockedGold;
address private _cacheContract;
event LockEvent(uint256 amount);
event UnlockEvent(uint256 amount);
function setCacheContract(address cacheContract) external onlyOwner {
_cacheContract = cacheContract;
... | 13,901 |
39 | // Checks if a segment was signed by a broadcaster address _streamId Stream ID for the segment _segmentNumber Sequence number of segment in the stream _dataHash Hash of segment data _broadcasterSig Broadcaster signature over h(streamId, segmentNumber, dataHash) _broadcaster Broadcaster address / | function validateBroadcasterSig(
string _streamId,
uint256 _segmentNumber,
bytes32 _dataHash,
bytes _broadcasterSig,
address _broadcaster
)
public
pure
returns (bool)
| function validateBroadcasterSig(
string _streamId,
uint256 _segmentNumber,
bytes32 _dataHash,
bytes _broadcasterSig,
address _broadcaster
)
public
pure
returns (bool)
| 50,827 |
18 | // Setting checquieOperator as default operatorrequire(ChequeOperator(_checqueOperator)); | mDefaultOperators.push(_checqueOperator);
mIsDefaultOperator[_checqueOperator] = true;
| mDefaultOperators.push(_checqueOperator);
mIsDefaultOperator[_checqueOperator] = true;
| 14,902 |
3 | // set decimals for ether | decimals[address(0)] = 18;
decimals[address(wethToken)] = 18;
| decimals[address(0)] = 18;
decimals[address(wethToken)] = 18;
| 22,845 |
6 | // returns the global network fee (in units of PPM) note that the network fee is a portion of the total fees from each pool / | function networkFee() external view override returns (uint32) {
return _networkFee;
}
| function networkFee() external view override returns (uint32) {
return _networkFee;
}
| 37,045 |
220 | // If some amount is owed, pay it back NOTE: Since debt is based on deposits, it makes sense to guard against large changes to the value from triggering a harvest directly through user behavior. This should ensure reasonable resistance to manipulation from user-initiated withdrawals as the outstanding debt fluctuates. | uint256 outstanding = vault.debtOutstanding();
if (outstanding > debtThreshold) return true;
| uint256 outstanding = vault.debtOutstanding();
if (outstanding > debtThreshold) return true;
| 6,608 |
24 | // Deposit LP tokens to LightMain for LIGHT allocation. | function deposit(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (user.amount > 0) {
uint256 pending = user.amount.mul(pool.accLightPerShare).div(1e12).sub(user.reward... | function deposit(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (user.amount > 0) {
uint256 pending = user.amount.mul(pool.accLightPerShare).div(1e12).sub(user.reward... | 37,642 |
0 | // https:docs.synthetix.io/contracts/source/interfaces/iexchanger | interface IExchanger {
function feeRateForExchange(bytes32 sourceCurrencyKey, bytes32 destinationCurrencyKey)
external
view
returns (uint exchangeFeeRate);
}
| interface IExchanger {
function feeRateForExchange(bytes32 sourceCurrencyKey, bytes32 destinationCurrencyKey)
external
view
returns (uint exchangeFeeRate);
}
| 15,737 |
3 | // move tokens to the team multisig walletadditional 770 000 tokens are generated for the bounty bonus campaign | token.mint(teamMultisig, allocatedBonus + 77000000000000);
| token.mint(teamMultisig, allocatedBonus + 77000000000000);
| 32,910 |
73 | // Getter function for the request with highest payout. This function is used within the getVariablesOnDeck function return uint _requestId of request with highest payout at the time the function is called/ | function getTopRequestID(TellorStorage.TellorStorageStruct storage self) internal view returns(uint _requestId){
uint _max;
uint _index;
(_max,_index) = Utilities.getMax(self.requestQ);
_requestId = self.requestIdByRequestQIndex[_index];
}
| function getTopRequestID(TellorStorage.TellorStorageStruct storage self) internal view returns(uint _requestId){
uint _max;
uint _index;
(_max,_index) = Utilities.getMax(self.requestQ);
_requestId = self.requestIdByRequestQIndex[_index];
}
| 2,309 |
57 | // Lp token staking | function stake(uint256 amount) public {
require(amount > 0, "Cannot stake 0");
uint256 cycleStartTime = government.getCycleStartTime();
uint256 withdrawingStartTime = government.getWithdrawingStartTime();
require(now > cycleStartTime && now < withdrawingStartTime, "Staking can be don... | function stake(uint256 amount) public {
require(amount > 0, "Cannot stake 0");
uint256 cycleStartTime = government.getCycleStartTime();
uint256 withdrawingStartTime = government.getWithdrawingStartTime();
require(now > cycleStartTime && now < withdrawingStartTime, "Staking can be don... | 11,223 |
31 | // ------------------------------------------------------------------------ Don't accept ETH ------------------------------------------------------------------------ | function () public payable {
revert();
}
| function () public payable {
revert();
}
| 14,872 |
315 | // Get total debt of given strategy _strategy Strategy address / | function totalDebtOf(address _strategy) public view returns (uint256) {
return IPoolAccountant(poolAccountant).totalDebtOf(_strategy);
}
| function totalDebtOf(address _strategy) public view returns (uint256) {
return IPoolAccountant(poolAccountant).totalDebtOf(_strategy);
}
| 23,015 |
2 | // Emit when a batch is sucessfully executed. executor - The address that called this function batch - The batch hash / | event Executed(address indexed executor, bytes32 batch);
| event Executed(address indexed executor, bytes32 batch);
| 17,461 |
24 | // allowance[_from][msg.sender] -= _value;Subtract from the sender's allowance | totalSupply -= _value; // Update totalSupply
Burn(_from, _value);
return true;
| totalSupply -= _value; // Update totalSupply
Burn(_from, _value);
return true;
| 5,277 |
170 | // DEBT_SWAP |
exchangeData.destAmount = (_amount + _fee);
_buy(exchangeData);
|
exchangeData.destAmount = (_amount + _fee);
_buy(exchangeData);
| 30,602 |
11 | // get kitten attributes | uint256 newDna = _mixDna(dad.genes, mum.genes, now);
uint256 newGeneration = _getKittenGeneration(dad, mum);
return _createKitty(_mumId, _dadId, newGeneration, newDna, msg.sender);
| uint256 newDna = _mixDna(dad.genes, mum.genes, now);
uint256 newGeneration = _getKittenGeneration(dad, mum);
return _createKitty(_mumId, _dadId, newGeneration, newDna, msg.sender);
| 14,790 |
28 | // set the nftQuestFee/nftQuestFee_ The value of the nftQuestFee | function setNftQuestFee(uint256 nftQuestFee_) external onlyOwner {
nftQuestFee = nftQuestFee_;
emit NftQuestFeeSet(nftQuestFee_);
}
| function setNftQuestFee(uint256 nftQuestFee_) external onlyOwner {
nftQuestFee = nftQuestFee_;
emit NftQuestFeeSet(nftQuestFee_);
}
| 22,887 |
7 | // This function is intended to be used only by Reserve team members and investors./ You can call it yourself, but you almost certainly don’t want to./ Anyone who calls this function will cause their own tokens to be subject to/ a long lockup. Reserve team members and some investors do this to commit/ ourselves to not ... | function lockMyTokensForever(string consent) public returns (bool) {
require(keccak256(abi.encodePacked(consent)) == keccak256(abi.encodePacked(
"I understand that I am locking my account forever, or at least until the next token upgrade."
)));
reserveTeamMemberOrEarlyInvestor[msg.sender] = true;
... | function lockMyTokensForever(string consent) public returns (bool) {
require(keccak256(abi.encodePacked(consent)) == keccak256(abi.encodePacked(
"I understand that I am locking my account forever, or at least until the next token upgrade."
)));
reserveTeamMemberOrEarlyInvestor[msg.sender] = true;
... | 49,824 |
90 | // coupon info | uint256 public couponSupply;
uint256 public couponIssued;
uint256 public couponClaimed;
| uint256 public couponSupply;
uint256 public couponIssued;
uint256 public couponClaimed;
| 20,201 |
14 | // Internal Mint / Burn Logic | function _mint(address to_, uint256 id_, uint256 amount_, bytes memory data_)
| function _mint(address to_, uint256 id_, uint256 amount_, bytes memory data_)
| 39,319 |
5 | // Constructor for RFT contract extended with metadata _name - Name for a set of NFTs _symbol - Symbol for a set of NFTs / | constructor (
string _name,
string _symbol
| constructor (
string _name,
string _symbol
| 8,299 |
13 | // Maps colony contract versions to respective resolvers | mapping (uint256 => address) colonyVersionResolver; // Storage slot 20
| mapping (uint256 => address) colonyVersionResolver; // Storage slot 20
| 47,047 |
2 | // This is cloned solution of @openzeppelin/contracts/security/ReentrancyGuard.sol | abstract contract LiquidationReentrancyGuard {
error LiquidationReentrancyCall();
uint256 private constant _LIQUIDATION_NOT_ENTERED = 1;
uint256 private constant _LIQUIDATION_ENTERED = 2;
uint256 private _liquidationStatus;
modifier liquidationNonReentrant() {
if (_liquidationStatus == _L... | abstract contract LiquidationReentrancyGuard {
error LiquidationReentrancyCall();
uint256 private constant _LIQUIDATION_NOT_ENTERED = 1;
uint256 private constant _LIQUIDATION_ENTERED = 2;
uint256 private _liquidationStatus;
modifier liquidationNonReentrant() {
if (_liquidationStatus == _L... | 26,943 |
0 | // The key used to sign whitelist signatures. We will check to ensure that the key that signed the signature is this one that we expect. | address whitelistSigningKey = address(0);
| address whitelistSigningKey = address(0);
| 4,490 |
27 | // Skip bidders whose bid quantity or unit price is already 0. | if (bidUnitPrice == 0 || bidQuantity == 0) {
continue;
}
| if (bidUnitPrice == 0 || bidQuantity == 0) {
continue;
}
| 58,615 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.