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 |
|---|---|---|---|---|
104 | // Returns the fee as a percentage with 2 decimals of percision | function getFee() external view returns (uint256) {
return fee;
}
| function getFee() external view returns (uint256) {
return fee;
}
| 57,627 |
591 | // Auto-generated via 'PrintLambertArray.py' | uint256[128] private lambertArray;
| uint256[128] private lambertArray;
| 41,132 |
90 | // Validates parameters and starts crowdsale | function start(uint256 _startTimestamp, uint256 _endTimestamp, address _fundingAddress)
public onlyManager() hasntStarted() hasntStopped();
| function start(uint256 _startTimestamp, uint256 _endTimestamp, address _fundingAddress)
public onlyManager() hasntStarted() hasntStopped();
| 14,658 |
104 | // add 1 to get the next payment | uint256 nNextUserPayment = nLastPayment.add(1);
| uint256 nNextUserPayment = nLastPayment.add(1);
| 20,386 |
14 | // Returns the integer division of two unsigned integers. Reverts with custom message ondivision by zero. The result is rounded towards zero. Counterpart to Solidity's `/` operator. Note: this function uses a`revert` opcode (which leaves remaining gas untouched) while Solidityuses an invalid opcode to revert (consuming... | function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
... | function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
... | 938 |
104 | // Applies `scalingFactor` to `amount`, resulting in a larger or equal value depending on whether it neededscaling or not. / | function _upscale(uint256 amount, uint256 scalingFactor) internal pure returns (uint256) {
return GyroFixedPoint.mulDown(amount, scalingFactor);
}
| function _upscale(uint256 amount, uint256 scalingFactor) internal pure returns (uint256) {
return GyroFixedPoint.mulDown(amount, scalingFactor);
}
| 17,686 |
21 | // Update admin fee Total fees cannot be greater than BIPS_DIVISOR (100%) newValue specified in BIPS / | function updateAdminFee(uint newValue) external onlyOwner {
require(newValue.add(REINVEST_REWARD_BIPS) <= BIPS_DIVISOR, "admin fee too high");
emit UpdateAdminFee(ADMIN_FEE_BIPS, newValue);
ADMIN_FEE_BIPS = newValue;
}
| function updateAdminFee(uint newValue) external onlyOwner {
require(newValue.add(REINVEST_REWARD_BIPS) <= BIPS_DIVISOR, "admin fee too high");
emit UpdateAdminFee(ADMIN_FEE_BIPS, newValue);
ADMIN_FEE_BIPS = newValue;
}
| 5,498 |
215 | // Set the entropy used to shuffle the token IDs. / | function setEntropy(
uint256 _entropy
| function setEntropy(
uint256 _entropy
| 31,822 |
57 | // Unfreeze the account _accounts Given accounts / | function unfreeze(address[] _accounts) public onlyOwnerOrManager {
assert(phase_i != PHASE_NOT_STARTED && phase_i != PHASE_FINISHED);
uint i;
for (i = 0; i < _accounts.length; i++) {
require(_accounts[i] != address(0), "Zero address");
require(_accounts[i] != base_wal... | function unfreeze(address[] _accounts) public onlyOwnerOrManager {
assert(phase_i != PHASE_NOT_STARTED && phase_i != PHASE_FINISHED);
uint i;
for (i = 0; i < _accounts.length; i++) {
require(_accounts[i] != address(0), "Zero address");
require(_accounts[i] != base_wal... | 46,363 |
5 | // ERC777MintFee Rafael Kallis <rk@rafaelkallis.com> / | contract ERC777MintFee is ERC777FeeIncome {
using SafeMath for uint256;
uint256 private _mintFee;
constructor(uint256 mintFee) public {
_mintFee = mintFee;
}
/**
* @dev Returns the mint fee.
*/
function mintFee() public view returns (uint256) {
return _mintFee;
}
/**
* @dev Returns ... | contract ERC777MintFee is ERC777FeeIncome {
using SafeMath for uint256;
uint256 private _mintFee;
constructor(uint256 mintFee) public {
_mintFee = mintFee;
}
/**
* @dev Returns the mint fee.
*/
function mintFee() public view returns (uint256) {
return _mintFee;
}
/**
* @dev Returns ... | 34,857 |
14 | // require(amount>=1e18,"vote amount should large than 1"); |
BXH.safeTransferFrom(msg.sender,address(this),amount);
if(userPhaseVotes[msg.sender][_phaseId]==0){
phases[_phaseId].totalAddrCount = phases[_phaseId].totalAddrCount.add(1);
projectVotes[_phaseId][_projectAddr].addressCount = projectVotes[_phaseId][_projectAddr].addressC... |
BXH.safeTransferFrom(msg.sender,address(this),amount);
if(userPhaseVotes[msg.sender][_phaseId]==0){
phases[_phaseId].totalAddrCount = phases[_phaseId].totalAddrCount.add(1);
projectVotes[_phaseId][_projectAddr].addressCount = projectVotes[_phaseId][_projectAddr].addressC... | 22,190 |
305 | // Set some tokens aside. / | function reserveTokens(uint256 number) public onlyOwner {
require(
totalSupply().add(number) <= MAX_TOKENS,
'Reservation would exceed max supply'
);
uint256 supply = totalSupply();
uint256 i;
for (i = 0; i < number; i++) {
_safeMint(msg.sen... | function reserveTokens(uint256 number) public onlyOwner {
require(
totalSupply().add(number) <= MAX_TOKENS,
'Reservation would exceed max supply'
);
uint256 supply = totalSupply();
uint256 i;
for (i = 0; i < number; i++) {
_safeMint(msg.sen... | 11,738 |
5 | // Łukasiewicz logic values | enum TriState {
Unset,
Allow,
Deny
}
| enum TriState {
Unset,
Allow,
Deny
}
| 21,643 |
10 | // allow dev to choose for isOptional the user is ask to choose isSelectableByUser to avoid the function signature collision between build(AuthType authType, bool isOptional) and build(AuthType authType, bool isAnon) |
function build(
AuthType authType,
bool isOptional,
bool isSelectableByUser
|
function build(
AuthType authType,
bool isOptional,
bool isSelectableByUser
| 1,182 |
13 | // a utilitary that removes by value from an array target - targeted array value - value that needs to be removedreturn new array without the value / | function removeByValue(uint256[] memory target, uint256 value) internal pure returns (uint256[] memory) {
uint256[] memory newTarget = new uint256[](target.length - 1);
uint256 k = 0;
unchecked {
for (uint256 j; j < target.length; j++) {
if (target[j] == value) co... | function removeByValue(uint256[] memory target, uint256 value) internal pure returns (uint256[] memory) {
uint256[] memory newTarget = new uint256[](target.length - 1);
uint256 k = 0;
unchecked {
for (uint256 j; j < target.length; j++) {
if (target[j] == value) co... | 22,486 |
5 | // id serial starts at | uint256 firstReservedToken;
| uint256 firstReservedToken;
| 15,118 |
405 | // cancels a withdrawal request requirements: - the caller must be the network contract- the provider must have already initiated a withdrawal and received the specified id / | function cancelWithdrawal(address provider, uint256 id) external;
| function cancelWithdrawal(address provider, uint256 id) external;
| 66,171 |
75 | // Called by the delegator on a delegate to initialize it for duty Should revert if any issues arise which make it unfit for delegation data The encoded bytes data for any initialization / | function _becomeImplementation(bytes memory data) public;
| function _becomeImplementation(bytes memory data) public;
| 36,993 |
148 | // Holder count simply returns the total number of token holder addresses. / | function holderCount() public view returns (uint) {
return shareholders.length;
}
| function holderCount() public view returns (uint) {
return shareholders.length;
}
| 68,300 |
28 | // Address blacklisted check. Function to check address whether get blacklisted, Only callable by contract owner. addr The address that will check whether get blacklisted / | function getBlacklist(address addr) public onlyGuardian view returns(bool) {
return isBlackListed[addr];
}
| function getBlacklist(address addr) public onlyGuardian view returns(bool) {
return isBlackListed[addr];
}
| 21,564 |
476 | // BootySendFailed event. Emitted every time address.send() function failed to transfer Ether to recipient in this case recipient Ether is recorded to ownerToBooty mapping, so recipient can withdraw their booty manuallyrecipient address for whom send failedamount number of WEI we failed to send / | event BootySendFailed(address recipient, uint256 amount);
| event BootySendFailed(address recipient, uint256 amount);
| 24,205 |
27 | // require(nftAddress.exists(_tokenId)); | address tokenSeller = nftAddress.ownerOf(_tokenId);
nftAddress.safeTransferFrom(tokenSeller, msg.sender, _tokenId);
emit Received(msg.sender, _tokenId, msg.value, address(this).balance);
| address tokenSeller = nftAddress.ownerOf(_tokenId);
nftAddress.safeTransferFrom(tokenSeller, msg.sender, _tokenId);
emit Received(msg.sender, _tokenId, msg.value, address(this).balance);
| 75,745 |
48 | // case 2. | msg.sender == address(_currentTerminal) ||
| msg.sender == address(_currentTerminal) ||
| 28,271 |
197 | // |/ Mint _amount of tokens of a given id _toThe address to mint tokens to _idToken id to mint _amountThe amount to be minted _dataData to pass if receiver is contract / | function _mint(address _to, uint256 _id, uint256 _amount, bytes memory _data)
internal
| function _mint(address _to, uint256 _id, uint256 _amount, bytes memory _data)
internal
| 9,694 |
155 | // max 30% so it is always sellable with 49% slippage on Uniswap | if(sellFee >= 3000) {
sellFee = 3000;
}
| if(sellFee >= 3000) {
sellFee = 3000;
}
| 10,299 |
12 | // properties for each token | function svgForToken(uint256 tokenId_)
public
view
returns (string memory)
| function svgForToken(uint256 tokenId_)
public
view
returns (string memory)
| 2,306 |
50 | // Stores a new address in the EIP1967 admin slot. / | function _setAdmin(address newAdmin) private {
require(newAdmin != address(0), "ERC1967: new admin is the zero address");
StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;
}
| function _setAdmin(address newAdmin) private {
require(newAdmin != address(0), "ERC1967: new admin is the zero address");
StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;
}
| 993 |
176 | // set copyright info | uint256 copyrightLen = _copyrightInfos.length;
require(copyrightLen <= 1,
"ERC721Base: the length of copyrights must be <= 1");
if (copyrightLen == 1) {
require(_copyrightInfos[0].author != address(0),
"ERC721Base: the author in copyright can't be zero"
... | uint256 copyrightLen = _copyrightInfos.length;
require(copyrightLen <= 1,
"ERC721Base: the length of copyrights must be <= 1");
if (copyrightLen == 1) {
require(_copyrightInfos[0].author != address(0),
"ERC721Base: the author in copyright can't be zero"
... | 7,906 |
19 | // Change Governance of the contract to a new account (`newGovernor`). _newGovernor Address of the new Governor / | function _changeGovernor(address _newGovernor) internal {
require(_newGovernor != address(0), "New Governor is address(0)");
emit GovernorshipTransferred(_governor(), _newGovernor);
_setGovernor(_newGovernor);
}
| function _changeGovernor(address _newGovernor) internal {
require(_newGovernor != address(0), "New Governor is address(0)");
emit GovernorshipTransferred(_governor(), _newGovernor);
_setGovernor(_newGovernor);
}
| 28,302 |
5 | // This is a function that if called will toggle the circuit breaker and halt entire contract from progressing. Only admin can call this function. | function toggleCircuitBreaker() external onlyAdmin() {
isStopped = !isStopped;
}
| function toggleCircuitBreaker() external onlyAdmin() {
isStopped = !isStopped;
}
| 8,088 |
12 | // maps branch with id to check for duplicacy | mapping(string => mapping(uint128 => bool)) checkSubInBranch;
| mapping(string => mapping(uint128 => bool)) checkSubInBranch;
| 24,558 |
139 | // Returns the balance amount of the Contract address./ | function getBalanceOfContract() external view returns (uint256) {
return address(this).balance;
}
| function getBalanceOfContract() external view returns (uint256) {
return address(this).balance;
}
| 28,849 |
25 | // Subtract from the sender | balanceOf[_from] -= _value;
| balanceOf[_from] -= _value;
| 5,976 |
134 | // Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance atreturn The number of votes the account had as ... | function getPriorVotes(address account, uint256 blockNumber)
public
view
returns (uint256)
| function getPriorVotes(address account, uint256 blockNumber)
public
view
returns (uint256)
| 22,081 |
28 | // ERC223 fallback function, make sure to check the msg.sender is from target token contracts _from - person who transfer token in for deposits or claim deposit with penalty KTON. _amount - amount of token. _data - data which indicate the operations. / | function tokenFallback(
address _from,
uint256 _amount,
bytes _data
| function tokenFallback(
address _from,
uint256 _amount,
bytes _data
| 67,704 |
274 | // Emits a {ClaimPaused} event. / | function setClaimPaused(bool state) public onlyOwner {
_claimPaused = state;
emit ClaimPaused(state);
}
| function setClaimPaused(bool state) public onlyOwner {
_claimPaused = state;
emit ClaimPaused(state);
}
| 7,447 |
392 | // Enables a bitmap type portfolio for an account. A bitmap type portfolio allows/ an account to hold more fCash than a normal portfolio, except only in a single currency./ Once enabled, it cannot be disabled or changed. An account can only enable a bitmap if/ it has no assets or debt so that we ensure no assets are le... | function enableBitmapForAccount(
AccountContext memory accountContext,
uint16 currencyId,
uint256 blockTime
| function enableBitmapForAccount(
AccountContext memory accountContext,
uint16 currencyId,
uint256 blockTime
| 35,510 |
497 | // Performs a deep copy of a byte array onto another byte array of greater than or equal length./dest Byte array that will be overwritten with source bytes./source Byte array to copy onto dest bytes. | function deepCopyBytes(bytes memory dest, bytes memory source) internal pure {
uint256 sourceLen = source.length;
// Dest length must be >= source length, or some bytes would not be copied.
require(dest.length >= sourceLen, "GREATER_OR_EQUAL_TO_SOURCE_BYTES_LENGTH_REQUIRED");
memCopy... | function deepCopyBytes(bytes memory dest, bytes memory source) internal pure {
uint256 sourceLen = source.length;
// Dest length must be >= source length, or some bytes would not be copied.
require(dest.length >= sourceLen, "GREATER_OR_EQUAL_TO_SOURCE_BYTES_LENGTH_REQUIRED");
memCopy... | 8,082 |
181 | // Bools | bool public paused = true;
bool public revealed = false;
bool public onlyWhitelisted = true;
| bool public paused = true;
bool public revealed = false;
bool public onlyWhitelisted = true;
| 20,368 |
63 | // price in ICO: first week: 1 ETH = 2400 NAC second week: 1 ETH = 23000 NAC 3rd week: 1 ETH = 2200 NAC 4th week: 1 ETH = 2100 NAC 5th week: 1 ETH = 2000 NAC 6th week: 1 ETH = 1900 NAC 7th week: 1 ETH = 1800 NAC 8th week: 1 ETH = 1700 nac time:1517443200: Thursday, February 1, 2018 12:00:00 AM 1518048000: Thursday, Feb... | function getPrice() public view returns (uint price) {
if (now < 1517443200) {
// presale
return 3450;
} else if (1517443200 < now && now <= 1518048000) {
// 1st week
return 2400;
} else if (1518048000 < now && now <= 1518652800) {
... | function getPrice() public view returns (uint price) {
if (now < 1517443200) {
// presale
return 3450;
} else if (1517443200 < now && now <= 1518048000) {
// 1st week
return 2400;
} else if (1518048000 < now && now <= 1518652800) {
... | 25,513 |
36 | // delete liquidation | delete auctions_.liquidations[borrower_];
| delete auctions_.liquidations[borrower_];
| 40,280 |
5 | // amount must be non zero | require(_bsnAmount > 0, "Invalid amount");
dripSchedule = BSNSchedule({
start: _bsnDripStart,
end: _bsnDripEnd,
amount: _bsnAmount
});
| require(_bsnAmount > 0, "Invalid amount");
dripSchedule = BSNSchedule({
start: _bsnDripStart,
end: _bsnDripEnd,
amount: _bsnAmount
});
| 35,470 |
70 | // Setup behavior check | bool result = false;
| bool result = false;
| 17,314 |
63 | // Update last bid time | loan.lastBidTime = block.timestamp;
| loan.lastBidTime = block.timestamp;
| 8,941 |
1 | // Function to calculate the interest accumulated using a linear interest rate formula rate The interest rate, in ray lastUpdateTimestamp The timestamp of the last update of the interestreturn The interest rate linearly accumulated during the timeDelta, in ray /solium-disable-next-line | uint256 timeDifference = block.timestamp.sub(uint256(lastUpdateTimestamp));
return (rate.mul(timeDifference) / SECONDS_PER_YEAR).add(WadRayMath.ray());
| uint256 timeDifference = block.timestamp.sub(uint256(lastUpdateTimestamp));
return (rate.mul(timeDifference) / SECONDS_PER_YEAR).add(WadRayMath.ray());
| 40,922 |
214 | // quietEndingPeriod | if (proposal.state != ProposalState.QuietEndingPeriod) {
proposal.currentBoostedVotePeriodLimit = params.quietEndingPeriod;
proposal.state = ProposalState.QuietEndingPeriod;
}
| if (proposal.state != ProposalState.QuietEndingPeriod) {
proposal.currentBoostedVotePeriodLimit = params.quietEndingPeriod;
proposal.state = ProposalState.QuietEndingPeriod;
}
| 23,489 |
26 | // called after deployment so that the contract whitelist addresses can mint in low price addressesToAdd the address of the Shelter / | function addToWhitelist(address[] calldata addressesToAdd)
public
onlyOwner
| function addToWhitelist(address[] calldata addressesToAdd)
public
onlyOwner
| 65,598 |
0 | // This is the max mint batch size for the optimized ERC721ACH mint contract | uint256 internal constant MAX_MINT_BATCH_SIZE = 8;
| uint256 internal constant MAX_MINT_BATCH_SIZE = 8;
| 17,200 |
46 | // Weeks in UTC |
uint public StageTwo;
uint public StageThree;
uint public StageFour;
|
uint public StageTwo;
uint public StageThree;
uint public StageFour;
| 47,736 |
341 | // redeemCollateralFresh emits redeem-collaterals-specific logs on errors, so we don't need to | return redeemCollateralFresh(msg.sender, redeemAmount);
| return redeemCollateralFresh(msg.sender, redeemAmount);
| 35,327 |
68 | // multiplier duplicated from QuestManager | uint8 questMultiplier;
| uint8 questMultiplier;
| 13,638 |
6 | // Constructor function / | constructor (string memory name, string memory symbol) public {
_name = name;
_symbol = symbol;
// register the supported interfaces to conform to ERC721 via ERC165
_registerInterface(_INTERFACE_ID_ERC721_METADATA);
}
| constructor (string memory name, string memory symbol) public {
_name = name;
_symbol = symbol;
// register the supported interfaces to conform to ERC721 via ERC165
_registerInterface(_INTERFACE_ID_ERC721_METADATA);
}
| 2,897 |
27 | // Updates the boost for a given address, after the rest of the function has executed / | modifier updateBoost(address _account) {
_;
_setBoost(_account);
}
| modifier updateBoost(address _account) {
_;
_setBoost(_account);
}
| 40,919 |
1 | // ERC20 wallet = new ERC20(owner, address(store)); | ERC20 wallet = new ERC20("t", "t");
wallets[msg.sender].push(address(wallet));
walletToOwner[address(wallet)] = msg.sender;
numWallets++;
| ERC20 wallet = new ERC20("t", "t");
wallets[msg.sender].push(address(wallet));
walletToOwner[address(wallet)] = msg.sender;
numWallets++;
| 17,773 |
60 | // The possible vote types. Abstention: not participating in a motion; This is the default value. Yea: voting in favour of a motion. Nay: voting against a motion. | enum Vote {Abstention, Yea, Nay}
// A given account's vote in some confiscation motion.
// This requires the default value of the Vote enum to correspond to an abstention.
mapping(address => mapping(uint => Vote)) public vote;
/* ========== CONSTRUCTOR ========== */
function Court(Havven ... | enum Vote {Abstention, Yea, Nay}
// A given account's vote in some confiscation motion.
// This requires the default value of the Vote enum to correspond to an abstention.
mapping(address => mapping(uint => Vote)) public vote;
/* ========== CONSTRUCTOR ========== */
function Court(Havven ... | 571 |
17 | // commit to storage | _hypervisor.stakingToken = stakingToken;
_hypervisor.rewardToken = rewardToken;
_hypervisor.rewardPool = rewardPool;
_hypervisor.rewardScaling = rewardScaling;
stakeLimit = _stakeLimit;
| _hypervisor.stakingToken = stakingToken;
_hypervisor.rewardToken = rewardToken;
_hypervisor.rewardPool = rewardPool;
_hypervisor.rewardScaling = rewardScaling;
stakeLimit = _stakeLimit;
| 11,557 |
96 | // 获取用户轮数 | function getUserRounds(
uint256 ledgerType,
address user,
uint256 cursor,
uint256 size
| function getUserRounds(
uint256 ledgerType,
address user,
uint256 cursor,
uint256 size
| 26,705 |
2 | // a key-value pair to store addresses and their account balances | event Transfer(address _from, address _to, uint256 _value);
| event Transfer(address _from, address _to, uint256 _value);
| 14,229 |
5 | // 50% get a kind response to greeting | answer = AnswerType.Kind;
| answer = AnswerType.Kind;
| 43,782 |
133 | // we get lp tokens | require(pair.totalSupply() == 0, "Somehow total supply is higher, sanity fail");
pair.mint(address(this));
require(pair.totalSupply() > 0, "We didn't create tokens!");
totalLPCreated = pair.balanceOf(address(this));
LPPerCOREUnitContributed = totalLPCreated.mul(1e18).div(totalCO... | require(pair.totalSupply() == 0, "Somehow total supply is higher, sanity fail");
pair.mint(address(this));
require(pair.totalSupply() > 0, "We didn't create tokens!");
totalLPCreated = pair.balanceOf(address(this));
LPPerCOREUnitContributed = totalLPCreated.mul(1e18).div(totalCO... | 45,557 |
44 | // swapTarget => approval status | mapping(address => bool) public approvedTargets;
address internal constant ETHAddress =
0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
| mapping(address => bool) public approvedTargets;
address internal constant ETHAddress =
0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
| 63,425 |
104 | // Wallet where funds will be sent | address public wallet;
MintableToken public token;
DisbursementHandler public disbursementHandler;
function Sale(
address _wallet,
uint256 _contributionCap
)
| address public wallet;
MintableToken public token;
DisbursementHandler public disbursementHandler;
function Sale(
address _wallet,
uint256 _contributionCap
)
| 27,154 |
507 | // Valuate the debt amount in loanManagerToken | uint256 obligationTokens = _toToken(_debtId, obligation, _oracleData);
| uint256 obligationTokens = _toToken(_debtId, obligation, _oracleData);
| 25,739 |
8 | // transfer the balance to the winner | winnerAddress.transfer(address(this).balance);
| winnerAddress.transfer(address(this).balance);
| 7,398 |
64 | // convert to ETH | swapTokensForETH(balanceOf(address(this)));
return amount.sub(feeAmount);
| swapTokensForETH(balanceOf(address(this)));
return amount.sub(feeAmount);
| 15,271 |
39 | // check if SM active | if (shieldMining.getShieldTokenAddress(address(policyBook)) != address(0)) {
shieldMining.updateTotalSupply(address(policyBook), address(0), liquidityProvider);
}
| if (shieldMining.getShieldTokenAddress(address(policyBook)) != address(0)) {
shieldMining.updateTotalSupply(address(policyBook), address(0), liquidityProvider);
}
| 24,352 |
14 | // pause or restart the circulaton | function pause() public onlyManager() {
paused = !paused;
}
| function pause() public onlyManager() {
paused = !paused;
}
| 28,756 |
1 | // The instance of the refund safe which holds all ETH funds until the fundraiser/ is finalized. | RefundSafe public refundSafe;
| RefundSafe public refundSafe;
| 24,354 |
1 | // Address where funds are collected | address public wallet;
| address public wallet;
| 4,035 |
14 | // OWNER DATA | address public owner;
address public proposedOwner;
| address public owner;
address public proposedOwner;
| 21,059 |
81 | // Use updated allowance if token and paymentToken are the same |
Allowance memory paymentAllowance = paymentToken == token ? allowance : getAllowance(address(safe), delegate, paymentToken);
newSpent = paymentAllowance.spent + payment;
|
Allowance memory paymentAllowance = paymentToken == token ? allowance : getAllowance(address(safe), delegate, paymentToken);
newSpent = paymentAllowance.spent + payment;
| 5,797 |
192 | // Check that the system will allow for the specified amount to be minted. | _checkMintingLimit(amount);
| _checkMintingLimit(amount);
| 15,233 |
4 | // Add a value to set. O(1). Returns true if the value was added to the set, that is if it was notalready present. / | function insert(Map storage map, address account) internal returns (bool) {
if (!contains(map, account)) {
map._accounts.push(account);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
map._indexes[account] = map... | function insert(Map storage map, address account) internal returns (bool) {
if (!contains(map, account)) {
map._accounts.push(account);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
map._indexes[account] = map... | 27,695 |
449 | // approve cDai to compound contract | cDaiContract.approve(NEW_CDAI_ADDRESS, uint(-1));
| cDaiContract.approve(NEW_CDAI_ADDRESS, uint(-1));
| 55,052 |
9 | // now we can save proposal |
blocks[blockHeight].uniqueBlindedProposals[_blindedProposal] = true;
voter.blindedProposal = _blindedProposal;
voter.shard = shard;
voter.balance = balance;
emit LogPropose(msg.sender, blockHeight, _blindedProposal, shard, balance);
return true;
|
blocks[blockHeight].uniqueBlindedProposals[_blindedProposal] = true;
voter.blindedProposal = _blindedProposal;
voter.shard = shard;
voter.balance = balance;
emit LogPropose(msg.sender, blockHeight, _blindedProposal, shard, balance);
return true;
| 11,679 |
2 | // A contract for managing the creation of new fundraising projects/Nathan Thomas/This contract is not audited - use at your own risk | contract Manager is Ownable {
Project[] public projects;
mapping(address => uint256[]) public ownerToProjects;
event ProjectCreated(
address indexed creator,
address indexed projectAddress,
uint256 indexed projectIndex
);
/// @notice Creates a new fundraising project with ownership of the msg.se... | contract Manager is Ownable {
Project[] public projects;
mapping(address => uint256[]) public ownerToProjects;
event ProjectCreated(
address indexed creator,
address indexed projectAddress,
uint256 indexed projectIndex
);
/// @notice Creates a new fundraising project with ownership of the msg.se... | 19,998 |
10 | // This method relies on extcodesize, which returns 0 for contracts in construction, since the code is only stored at the end of the constructor execution. |
uint256 size;
|
uint256 size;
| 385 |
43 | // _tokenIds - 1 to get the current number of minted tokens (token IDs start at 1) | uint256 currentSupply = _tokenIds.current() - 1;
config.doubleBurnTokens = derivativeParams.maxTotalSupply - currentSupply;
require(config.doubleBurnTokens >= amount, "SP:NOT_ENOUGH_ORPHANS");
require(currentSupply + amount <= params.maxTotalSupply, "NilPass:MAX_ALLOCATION_REACHED");
... | uint256 currentSupply = _tokenIds.current() - 1;
config.doubleBurnTokens = derivativeParams.maxTotalSupply - currentSupply;
require(config.doubleBurnTokens >= amount, "SP:NOT_ENOUGH_ORPHANS");
require(currentSupply + amount <= params.maxTotalSupply, "NilPass:MAX_ALLOCATION_REACHED");
... | 5,527 |
280 | // Transfers ownership of the contract to a new account (`newOwner`).Can only be called by the current owner. / | function transferOwnership(address newOwner) public only(DEFAULT_ADMIN_ROLE) {
_transferOwnership(newOwner);
}
| function transferOwnership(address newOwner) public only(DEFAULT_ADMIN_ROLE) {
_transferOwnership(newOwner);
}
| 3,503 |
79 | // The SOCX token | contract Token is ERC20, Ownable {
using SafeMath for uint;
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals; // How many decimals to show.
string public version = "v0.1";
uint public initialSupply;
uint public totalSupply;
bo... | contract Token is ERC20, Ownable {
using SafeMath for uint;
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals; // How many decimals to show.
string public version = "v0.1";
uint public initialSupply;
uint public totalSupply;
bo... | 48,068 |
14 | // Returns the number of decimals used to represent fees / | function feeDecimals() external override view returns (uint8) {
return _feeDecimals;
}
| function feeDecimals() external override view returns (uint8) {
return _feeDecimals;
}
| 56,924 |
2 | // ERC20Basic.sol // ERC20.sol // ERC20 interface / | contract ERC20 is ERC20Basic {
function allowance(address owner, address spender)
public view returns (uint256);
function transferFrom(address from, address to, uint256 value)
public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(
... | contract ERC20 is ERC20Basic {
function allowance(address owner, address spender)
public view returns (uint256);
function transferFrom(address from, address to, uint256 value)
public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(
... | 49,854 |
8 | // marks a token as staked, can only be performed by delegated staking controller contract. By calling this function you disable the ability to transfer the token. / | function stakeFromController(uint256 tokenId, address originator) public {
require(
msg.sender == stakingController,
"Function can only be called from staking controller contract"
);
require(
ownerOf(tokenId) == originator,
"Originator is not t... | function stakeFromController(uint256 tokenId, address originator) public {
require(
msg.sender == stakingController,
"Function can only be called from staking controller contract"
);
require(
ownerOf(tokenId) == originator,
"Originator is not t... | 37,908 |
72 | // Mint as bridge/owner / | function mint(
address account,
uint256 id,
uint256 value
) external;
| function mint(
address account,
uint256 id,
uint256 value
) external;
| 21,235 |
35 | // Assign the return values. | totalMintedForTokenId = tokenSupply.totalMinted;
maxSupply = tokenSupply.maxSupply;
minterNumMinted = _totalMintedByUser[minter];
minterNumMintedForTokenId = _totalMintedByUserPerToken[minter][tokenId];
| totalMintedForTokenId = tokenSupply.totalMinted;
maxSupply = tokenSupply.maxSupply;
minterNumMinted = _totalMintedByUser[minter];
minterNumMintedForTokenId = _totalMintedByUserPerToken[minter][tokenId];
| 12,590 |
123 | // Modifier to ensure only depositor calls / | modifier onlyDepositor(uint256 depositNumber) {
require(deposits[depositNumber].user == msg.sender, Errors.ONLY_DEPOSITOR);
_;
}
| modifier onlyDepositor(uint256 depositNumber) {
require(deposits[depositNumber].user == msg.sender, Errors.ONLY_DEPOSITOR);
_;
}
| 13,348 |
64 | // Repay variable amount of USD, given exact amount of token input | function repayExactIn(address token, uint inExact, uint outMin) external {
IERC20(token).safeTransferFrom(msg.sender, address(this), inExact);
IERC20(this).safeApprove(address(UNI), 0);
IERC20(this).safeApprove(address(UNI), inExact);
address[] memory _path = new ad... | function repayExactIn(address token, uint inExact, uint outMin) external {
IERC20(token).safeTransferFrom(msg.sender, address(this), inExact);
IERC20(this).safeApprove(address(UNI), 0);
IERC20(this).safeApprove(address(UNI), inExact);
address[] memory _path = new ad... | 21,171 |
141 | // Emits event for multicall start - used in analytics to track actions within multicalls | emit MultiCallStarted(borrower); // F:[FA-26]
| emit MultiCallStarted(borrower); // F:[FA-26]
| 20,679 |
28 | // TODO: validate IPFS CID format for descriptionCid | require(proposalType < ProposalType.Last, "PollenDAO: invalid proposal type");
require(assetTokenType < TokenType.Last, "PollenDAO: invalid asset type");
require(_assets.contains(assetTokenAddress), "PollenDAO: unsupported asset");
require(
assetTokenAddress != _getPollenAddr... | require(proposalType < ProposalType.Last, "PollenDAO: invalid proposal type");
require(assetTokenType < TokenType.Last, "PollenDAO: invalid asset type");
require(_assets.contains(assetTokenAddress), "PollenDAO: unsupported asset");
require(
assetTokenAddress != _getPollenAddr... | 30,309 |
52 | // funder列表去重 | if(!steps[currentStep].funder[msg.sender].isFunder){
steps[currentStep].funders.push(msg.sender);
}
| if(!steps[currentStep].funder[msg.sender].isFunder){
steps[currentStep].funders.push(msg.sender);
}
| 53,046 |
31 | // Compute the protocol fee that should be paid for a single fill. In this case this should be made the protocol fee for both the left and right orders. | uint256 protocolFee = gasPrice.safeMul(protocolFeeMultiplier);
matchedFillResults.left.protocolFeePaid = protocolFee;
matchedFillResults.right.protocolFeePaid = protocolFee;
| uint256 protocolFee = gasPrice.safeMul(protocolFeeMultiplier);
matchedFillResults.left.protocolFeePaid = protocolFee;
matchedFillResults.right.protocolFeePaid = protocolFee;
| 47,935 |
296 | // Skip the transfer and return true as long as the balance check worked. | success = balanceCheckWorked;
| success = balanceCheckWorked;
| 82,688 |
337 | // Validate taker is allowed to fill this order | if (order.takerAddress != address(0)) {
if (order.takerAddress != takerAddress) {
LibRichErrors.rrevert(LibExchangeRichErrors.ExchangeInvalidContextError(
LibExchangeRichErrors.ExchangeContextErrorCodes.INVALID_TAKER,
orderInfo.orderHash,
... | if (order.takerAddress != address(0)) {
if (order.takerAddress != takerAddress) {
LibRichErrors.rrevert(LibExchangeRichErrors.ExchangeInvalidContextError(
LibExchangeRichErrors.ExchangeContextErrorCodes.INVALID_TAKER,
orderInfo.orderHash,
... | 12,315 |
16 | // beneficiary.transfer(msg.value);refund money to contributor Refunded(beneficiary, msg.value); | } else { // contributor has not gone through the KYC process yet
| } else { // contributor has not gone through the KYC process yet
| 8,811 |
4 | // Compute square root of x return sqrt(x)/ | function sqrt(uint256 x) internal pure returns (uint256) {
uint256 n = x / 2;
uint256 lstX = 0;
while (n != lstX){
lstX = n;
n = (n + x/n) / 2;
}
return uint256(n);
}
| function sqrt(uint256 x) internal pure returns (uint256) {
uint256 n = x / 2;
uint256 lstX = 0;
while (n != lstX){
lstX = n;
n = (n + x/n) / 2;
}
return uint256(n);
}
| 36,057 |
203 | // 查询用户已收益 | function earned(address token, address userAddress) external view returns (uint256) {
(uint256 reward,) = pending(getPoolId(token), userAddress);
return reward;
}
| function earned(address token, address userAddress) external view returns (uint256) {
(uint256 reward,) = pending(getPoolId(token), userAddress);
return reward;
}
| 43,993 |
53 | // get deposit cap amountsreturn callTokenCapAmount call pool deposit capreturn putTokenCapAmount put pool deposit cap / | function getCapAmounts()
| function getCapAmounts()
| 67,859 |
140 | // if user does not want to stake | IERC20(ASG).transfer(_recipient, _amount); // send payout
| IERC20(ASG).transfer(_recipient, _amount); // send payout
| 72,570 |
31 | // SETTERS FOR MAXMINTAMOUNT | function setMaxMintAmountWhitelistFF(uint16 _newMaxMintAmountWhitelistFF) public onlyOwner {
maxMintAmountWhitelistFF = _newMaxMintAmountWhitelistFF;
}
| function setMaxMintAmountWhitelistFF(uint16 _newMaxMintAmountWhitelistFF) public onlyOwner {
maxMintAmountWhitelistFF = _newMaxMintAmountWhitelistFF;
}
| 16,856 |
4 | // Returns the total number of vaults managed by the Controller. / | function numVaults() external view returns (uint256);
| function numVaults() external view returns (uint256);
| 23,103 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.