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
|
---|---|---|---|---|
29 | // Returns the integer division of two unsigned integers, reverting 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 all remaining gas). Requirements: - The divisor cannot be zero. / | function div(
uint256 a,
uint256 b,
string memory errorMessage
| function div(
uint256 a,
uint256 b,
string memory errorMessage
| 50,648 |
239 | // 0% collateral-backed | function mintAlgorithmicFRAX(uint256 fxs_amount_d18, uint256 FRAX_out_min) external notMintPaused {
uint256 fxs_price = FRAX.fxs_price();
require(FRAX.global_collateral_ratio() == 0, "Collateral ratio must be 0");
(uint256 frax_amount_d18) = FraxPoolLibrary.calcMintAlgorithmicFRAX(
fxs_price, // X FXS / 1 USD
fxs_amount_d18
);
frax_amount_d18 = (frax_amount_d18.mul(uint(1e6).sub(minting_fee))).div(1e6);
require(FRAX_out_min <= frax_amount_d18, "Slippage limit reached");
FXS.pool_burn_from(msg.sender, fxs_amount_d18);
FRAX.pool_mint(msg.sender, frax_amount_d18);
}
| function mintAlgorithmicFRAX(uint256 fxs_amount_d18, uint256 FRAX_out_min) external notMintPaused {
uint256 fxs_price = FRAX.fxs_price();
require(FRAX.global_collateral_ratio() == 0, "Collateral ratio must be 0");
(uint256 frax_amount_d18) = FraxPoolLibrary.calcMintAlgorithmicFRAX(
fxs_price, // X FXS / 1 USD
fxs_amount_d18
);
frax_amount_d18 = (frax_amount_d18.mul(uint(1e6).sub(minting_fee))).div(1e6);
require(FRAX_out_min <= frax_amount_d18, "Slippage limit reached");
FXS.pool_burn_from(msg.sender, fxs_amount_d18);
FRAX.pool_mint(msg.sender, frax_amount_d18);
}
| 22,902 |
1,073 | // Buys a _destAmount of tokens at UniswapV2/_srcAddr From token/_destAddr To token/_destAmount To amount/ return uint srcAmount | function buy(address _srcAddr, address _destAddr, uint _destAmount, bytes memory _additionalData) external override payable returns(uint) {
_srcAddr = ethToWethAddr(_srcAddr);
_destAddr = ethToWethAddr(_destAddr);
uint[] memory amounts;
address[] memory path = abi.decode(_additionalData, (address[]));
ERC20(_srcAddr).safeApprove(address(router), uint(-1));
// if we are buying ether
if (_destAddr == WETH_ADDRESS) {
amounts = router.swapTokensForExactETH(_destAmount, uint(-1), path, msg.sender, block.timestamp + 1);
}
// if we are buying token to token
else {
amounts = router.swapTokensForExactTokens(_destAmount, uint(-1), path, msg.sender, block.timestamp + 1);
}
// Send the leftover from the source token back
sendLeftOver(_srcAddr);
return amounts[0];
}
| function buy(address _srcAddr, address _destAddr, uint _destAmount, bytes memory _additionalData) external override payable returns(uint) {
_srcAddr = ethToWethAddr(_srcAddr);
_destAddr = ethToWethAddr(_destAddr);
uint[] memory amounts;
address[] memory path = abi.decode(_additionalData, (address[]));
ERC20(_srcAddr).safeApprove(address(router), uint(-1));
// if we are buying ether
if (_destAddr == WETH_ADDRESS) {
amounts = router.swapTokensForExactETH(_destAmount, uint(-1), path, msg.sender, block.timestamp + 1);
}
// if we are buying token to token
else {
amounts = router.swapTokensForExactTokens(_destAmount, uint(-1), path, msg.sender, block.timestamp + 1);
}
// Send the leftover from the source token back
sendLeftOver(_srcAddr);
return amounts[0];
}
| 13,235 |
140 | // See `GSNRecipient._approveRelayedCall`. This overload forwards `context` to _preRelayedCall and _postRelayedCall. / | function _approveRelayedCall(bytes memory context) internal pure returns (uint256, bytes memory) {
return (_RELAYED_CALL_ACCEPTED, context);
}
| function _approveRelayedCall(bytes memory context) internal pure returns (uint256, bytes memory) {
return (_RELAYED_CALL_ACCEPTED, context);
}
| 32,752 |
40 | // Withdraw the owner's Ether | function ownerWithdraw() public onlyOwner {
uint amount = ownerBalance;
ownerBalance = 0;
owner.transfer(amount);
}
| function ownerWithdraw() public onlyOwner {
uint amount = ownerBalance;
ownerBalance = 0;
owner.transfer(amount);
}
| 28,375 |
69 | // Saves Credential Item name._id Ontology record ID._name Credential Item name./ | function setName(bytes32 _id, string _name) internal {
// records[_id].name = _name;
stringStorage[keccak256(abi.encodePacked("records.", _id, ".name"))] = _name;
}
| function setName(bytes32 _id, string _name) internal {
// records[_id].name = _name;
stringStorage[keccak256(abi.encodePacked("records.", _id, ".name"))] = _name;
}
| 43,746 |
178 | // Allows SkaleManager to change a node's last reward date. / | function changeNodeLastRewardDate(uint nodeIndex)
external
checkNodeExists(nodeIndex)
allow("SkaleManager")
| function changeNodeLastRewardDate(uint nodeIndex)
external
checkNodeExists(nodeIndex)
allow("SkaleManager")
| 31,885 |
22 | // A method to allow a stakeholder to check his rewards. _stakeholder The stakeholder to check rewards for. / | function rewardOf(address _stakeholder) public view returns(uint256)
| function rewardOf(address _stakeholder) public view returns(uint256)
| 26,667 |
13 | // we cannot allow for CDOGEDOLA unbonds during expansions, to enforce the pro-rata redemptions | require(_state13.price.lessThan(Decimal.one()), "Market: not in contraction");
_unbondCDOGEDOLA(amount);
| require(_state13.price.lessThan(Decimal.one()), "Market: not in contraction");
_unbondCDOGEDOLA(amount);
| 8,964 |
6 | // 100 = 1% | uint32 public lenderFee = 100;
| uint32 public lenderFee = 100;
| 40,383 |
4 | // Structure animales | string name; // Nom de l'animal
string dateBirth; // Date de naissance de l'animal
string sexe; // Sexe de l'animal
bool vaccin; // Si il est vacciné ou non
Animals animals; // Enumération de chien chat furret
| string name; // Nom de l'animal
string dateBirth; // Date de naissance de l'animal
string sexe; // Sexe de l'animal
bool vaccin; // Si il est vacciné ou non
Animals animals; // Enumération de chien chat furret
| 39,009 |
68 | // if not correctly abi-encoded array of address[] | !LSP2Utils.isEncodedArrayOfAddresses(allowedAddresses)
) return;
address[] memory allowedAddressesList = abi.decode(allowedAddresses, (address[]));
for (uint256 ii = 0; ii < allowedAddressesList.length; ii++) {
if (_to == allowedAddressesList[ii]) return;
}
| !LSP2Utils.isEncodedArrayOfAddresses(allowedAddresses)
) return;
address[] memory allowedAddressesList = abi.decode(allowedAddresses, (address[]));
for (uint256 ii = 0; ii < allowedAddressesList.length; ii++) {
if (_to == allowedAddressesList[ii]) return;
}
| 48,467 |
86 | // Notify status update | BoardStatusUpdated(boardId, newStatus);
| BoardStatusUpdated(boardId, newStatus);
| 33,014 |
211 | // 8. This fee is denominated in the currency of the loan | uint issueFee = amount.multiplyDecimalRound(issueFeeRate);
| uint issueFee = amount.multiplyDecimalRound(issueFeeRate);
| 47,812 |
97 | // Admin methods. | function setMintFeeBps(uint256 _mintFeeBps) external onlyOwner {
require(_mintFeeBps <= MAX_BPS, "badger-ren-adapter/excessive-mint-fee");
mintFeeBps = _mintFeeBps;
}
| function setMintFeeBps(uint256 _mintFeeBps) external onlyOwner {
require(_mintFeeBps <= MAX_BPS, "badger-ren-adapter/excessive-mint-fee");
mintFeeBps = _mintFeeBps;
}
| 11,548 |
17 | // this contract gives owner the ability to allow tokens. for pairs in which both tokens are allowed, fees may be collected on that pair and send to feeRecipient, though only after burning all fees up to that point | contract FeeTo {
address public owner;
address public feeRecipient;
struct TokenAllowState {
bool allowed;
uint128 disallowCount;
}
mapping(address => TokenAllowState) public tokenAllowStates;
struct PairAllowState {
uint128 token0DisallowCount;
uint128 token1DisallowCount;
}
mapping(address => PairAllowState) public pairAllowStates;
constructor(address owner_) public {
owner = owner_;
}
function setOwner(address owner_) public {
require(msg.sender == owner, 'FeeTo::setOwner: not allowed');
owner = owner_;
}
function setFeeRecipient(address feeRecipient_) public {
require(msg.sender == owner, 'FeeTo::setFeeRecipient: not allowed');
feeRecipient = feeRecipient_;
}
function updateTokenAllowState(address token, bool allowed) public {
require(msg.sender == owner, 'FeeTo::updateTokenAllowState: not allowed');
TokenAllowState storage tokenAllowState = tokenAllowStates[token];
// if allowed is not changing, the function is a no-op
if (allowed != tokenAllowState.allowed) {
tokenAllowState.allowed = allowed;
// this condition will only be true on the first call to this function (regardless of the value of allowed)
// by effectively initializing disallowCount to 1,
// we force renounce to be called for all pairs including newly allowed token
if (tokenAllowState.disallowCount == 0) {
tokenAllowState.disallowCount = 1;
} else if (allowed == false) {
tokenAllowState.disallowCount += 1;
}
}
}
function updateTokenAllowStates(address[] memory tokens, bool allowed) public {
for (uint i; i < tokens.length; i++) {
updateTokenAllowState(tokens[i], allowed);
}
}
function renounce(address pair) public returns (uint value) {
PairAllowState storage pairAllowState = pairAllowStates[pair];
TokenAllowState storage token0AllowState = tokenAllowStates[IValueswapV2Pair(pair).token0()];
TokenAllowState storage token1AllowState = tokenAllowStates[IValueswapV2Pair(pair).token1()];
// we must renounce if any of the following four conditions are true:
// 1) token0 is currently disallowed
// 2) token1 is currently disallowed
// 3) token0 was disallowed at least once since the last time renounce was called
// 4) token1 was disallowed at least once since the last time renounce was called
if (
token0AllowState.allowed == false ||
token1AllowState.allowed == false ||
token0AllowState.disallowCount > pairAllowState.token0DisallowCount ||
token1AllowState.disallowCount > pairAllowState.token1DisallowCount
) {
value = IValueswapV2Pair(pair).balanceOf(address(this));
if (value > 0) {
// burn balance into the pair, effectively redistributing underlying tokens pro-rata back to LPs
// (assert because transfer cannot fail with value as balanceOf)
assert(IValueswapV2Pair(pair).transfer(pair, value));
IValueswapV2Pair(pair).burn(pair);
}
// if token0 is allowed, we can now update the pair's disallow count to match the token's
if (token0AllowState.allowed) {
pairAllowState.token0DisallowCount = token0AllowState.disallowCount;
}
// if token1 is allowed, we can now update the pair's disallow count to match the token's
if (token1AllowState.allowed) {
pairAllowState.token1DisallowCount = token1AllowState.disallowCount;
}
}
}
function claim(address pair) public returns (uint value) {
PairAllowState storage pairAllowState = pairAllowStates[pair];
TokenAllowState storage token0AllowState = tokenAllowStates[IValueswapV2Pair(pair).token0()];
TokenAllowState storage token1AllowState = tokenAllowStates[IValueswapV2Pair(pair).token1()];
// we may claim only if each of the following five conditions are true:
// 1) token0 is currently allowed
// 2) token1 is currently allowed
// 3) renounce was not called since the last time token0 was disallowed
// 4) renounce was not called since the last time token1 was disallowed
// 5) feeHandler is not the 0 address
if (
token0AllowState.allowed &&
token1AllowState.allowed &&
token0AllowState.disallowCount == pairAllowState.token0DisallowCount &&
token1AllowState.disallowCount == pairAllowState.token1DisallowCount &&
feeRecipient != address(0)
) {
value = IValueswapV2Pair(pair).balanceOf(address(this));
if (value > 0) {
// transfer tokens to the handler (assert because transfer cannot fail with value as balanceOf)
assert(IValueswapV2Pair(pair).transfer(feeRecipient, value));
}
}
}
}
| contract FeeTo {
address public owner;
address public feeRecipient;
struct TokenAllowState {
bool allowed;
uint128 disallowCount;
}
mapping(address => TokenAllowState) public tokenAllowStates;
struct PairAllowState {
uint128 token0DisallowCount;
uint128 token1DisallowCount;
}
mapping(address => PairAllowState) public pairAllowStates;
constructor(address owner_) public {
owner = owner_;
}
function setOwner(address owner_) public {
require(msg.sender == owner, 'FeeTo::setOwner: not allowed');
owner = owner_;
}
function setFeeRecipient(address feeRecipient_) public {
require(msg.sender == owner, 'FeeTo::setFeeRecipient: not allowed');
feeRecipient = feeRecipient_;
}
function updateTokenAllowState(address token, bool allowed) public {
require(msg.sender == owner, 'FeeTo::updateTokenAllowState: not allowed');
TokenAllowState storage tokenAllowState = tokenAllowStates[token];
// if allowed is not changing, the function is a no-op
if (allowed != tokenAllowState.allowed) {
tokenAllowState.allowed = allowed;
// this condition will only be true on the first call to this function (regardless of the value of allowed)
// by effectively initializing disallowCount to 1,
// we force renounce to be called for all pairs including newly allowed token
if (tokenAllowState.disallowCount == 0) {
tokenAllowState.disallowCount = 1;
} else if (allowed == false) {
tokenAllowState.disallowCount += 1;
}
}
}
function updateTokenAllowStates(address[] memory tokens, bool allowed) public {
for (uint i; i < tokens.length; i++) {
updateTokenAllowState(tokens[i], allowed);
}
}
function renounce(address pair) public returns (uint value) {
PairAllowState storage pairAllowState = pairAllowStates[pair];
TokenAllowState storage token0AllowState = tokenAllowStates[IValueswapV2Pair(pair).token0()];
TokenAllowState storage token1AllowState = tokenAllowStates[IValueswapV2Pair(pair).token1()];
// we must renounce if any of the following four conditions are true:
// 1) token0 is currently disallowed
// 2) token1 is currently disallowed
// 3) token0 was disallowed at least once since the last time renounce was called
// 4) token1 was disallowed at least once since the last time renounce was called
if (
token0AllowState.allowed == false ||
token1AllowState.allowed == false ||
token0AllowState.disallowCount > pairAllowState.token0DisallowCount ||
token1AllowState.disallowCount > pairAllowState.token1DisallowCount
) {
value = IValueswapV2Pair(pair).balanceOf(address(this));
if (value > 0) {
// burn balance into the pair, effectively redistributing underlying tokens pro-rata back to LPs
// (assert because transfer cannot fail with value as balanceOf)
assert(IValueswapV2Pair(pair).transfer(pair, value));
IValueswapV2Pair(pair).burn(pair);
}
// if token0 is allowed, we can now update the pair's disallow count to match the token's
if (token0AllowState.allowed) {
pairAllowState.token0DisallowCount = token0AllowState.disallowCount;
}
// if token1 is allowed, we can now update the pair's disallow count to match the token's
if (token1AllowState.allowed) {
pairAllowState.token1DisallowCount = token1AllowState.disallowCount;
}
}
}
function claim(address pair) public returns (uint value) {
PairAllowState storage pairAllowState = pairAllowStates[pair];
TokenAllowState storage token0AllowState = tokenAllowStates[IValueswapV2Pair(pair).token0()];
TokenAllowState storage token1AllowState = tokenAllowStates[IValueswapV2Pair(pair).token1()];
// we may claim only if each of the following five conditions are true:
// 1) token0 is currently allowed
// 2) token1 is currently allowed
// 3) renounce was not called since the last time token0 was disallowed
// 4) renounce was not called since the last time token1 was disallowed
// 5) feeHandler is not the 0 address
if (
token0AllowState.allowed &&
token1AllowState.allowed &&
token0AllowState.disallowCount == pairAllowState.token0DisallowCount &&
token1AllowState.disallowCount == pairAllowState.token1DisallowCount &&
feeRecipient != address(0)
) {
value = IValueswapV2Pair(pair).balanceOf(address(this));
if (value > 0) {
// transfer tokens to the handler (assert because transfer cannot fail with value as balanceOf)
assert(IValueswapV2Pair(pair).transfer(feeRecipient, value));
}
}
}
}
| 20,341 |
3 | // Approve `amount` stablecoin to lendingPool | stablecoin.safeIncreaseAllowance(address(lendingPool), amount);
| stablecoin.safeIncreaseAllowance(address(lendingPool), amount);
| 33,710 |
13 | // No need to check for dividing by 0 -- Solidity automatically throws on division by 0 | int256 c = a / b;
return c;
| int256 c = a / b;
return c;
| 1,067 |
758 | // ensure that message has not been proven or processed | require(messages[_leaf] == MessageStatus.None, "!MessageStatus.None");
| require(messages[_leaf] == MessageStatus.None, "!MessageStatus.None");
| 22,612 |
99 | // Returns true if and only if the function is running in the constructor | function isConstructor() private view returns (bool) {
// extcodesize checks the size of the code stored in an address, and
// address returns the current address. Since the code is still not
// deployed when running a constructor, any checks on its code size will
// yield zero, making it an effective way to detect if a contract is
// under construction or not.
address self = address(this);
uint256 cs;
assembly { cs := extcodesize(self) }
return cs == 0;
}
| function isConstructor() private view returns (bool) {
// extcodesize checks the size of the code stored in an address, and
// address returns the current address. Since the code is still not
// deployed when running a constructor, any checks on its code size will
// yield zero, making it an effective way to detect if a contract is
// under construction or not.
address self = address(this);
uint256 cs;
assembly { cs := extcodesize(self) }
return cs == 0;
}
| 10,821 |
61 | // Function returns timestamp when pool entered or will enter provisional default at given interest rate/interestRate Borrows interest rate at current period/ return Timestamp of entering provisional default (0 if won't ever enter) | function _entranceOfProvisionalDefault(uint256 interestRate) internal view returns (uint256) {
/// @dev If pool is already in provisional default, return its timestamp
if (_info.enteredProvisionalDefault != 0) {
return _info.enteredProvisionalDefault;
}
if (_info.borrows == 0 || interestRate == 0) {
return 0;
}
// Consider:
// IFPD - Interest for provisional default
// PSPD = Pool size at provisional default
// IRPD = Reserves & insurance at provisional default
// IR = Current reserves and insurance
// PDU = Provisional default utilization
// We have: Borrows + IFPD = PDU * PSPD
// => Borrows + IFPD = PDU * (Principal + Cash + IRPD)
// => Borrows + IFPD = PDU * (Principal + Cash + IR + IFPD * (insuranceFactor + reserveFactor))
// => IFPD * (1 + PDU * (reserveFactor + insuranceFactor)) = PDU * PoolSize - Borrows
// => IFPD = (PDU * PoolSize - Borrows) / (1 + PDU * (reserveFactor + insuranceFactor))
uint256 numerator = _poolSize(_info).mulDecimal(provisionalDefaultUtilization) - _info.borrows;
uint256 denominator = Decimal.ONE +
provisionalDefaultUtilization.mulDecimal(reserveFactor + insuranceFactor);
uint256 interestForProvisionalDefault = numerator.divDecimal(denominator);
uint256 interestPerSec = _info.borrows * interestRate;
// Time delta is calculated as interest for provisional default divided by interest per sec (rounded up)
uint256 timeDelta = (interestForProvisionalDefault * Decimal.ONE + interestPerSec - 1) /
interestPerSec;
uint256 entrance = _info.lastAccrual + timeDelta;
return entrance <= block.timestamp ? entrance : 0;
}
| function _entranceOfProvisionalDefault(uint256 interestRate) internal view returns (uint256) {
/// @dev If pool is already in provisional default, return its timestamp
if (_info.enteredProvisionalDefault != 0) {
return _info.enteredProvisionalDefault;
}
if (_info.borrows == 0 || interestRate == 0) {
return 0;
}
// Consider:
// IFPD - Interest for provisional default
// PSPD = Pool size at provisional default
// IRPD = Reserves & insurance at provisional default
// IR = Current reserves and insurance
// PDU = Provisional default utilization
// We have: Borrows + IFPD = PDU * PSPD
// => Borrows + IFPD = PDU * (Principal + Cash + IRPD)
// => Borrows + IFPD = PDU * (Principal + Cash + IR + IFPD * (insuranceFactor + reserveFactor))
// => IFPD * (1 + PDU * (reserveFactor + insuranceFactor)) = PDU * PoolSize - Borrows
// => IFPD = (PDU * PoolSize - Borrows) / (1 + PDU * (reserveFactor + insuranceFactor))
uint256 numerator = _poolSize(_info).mulDecimal(provisionalDefaultUtilization) - _info.borrows;
uint256 denominator = Decimal.ONE +
provisionalDefaultUtilization.mulDecimal(reserveFactor + insuranceFactor);
uint256 interestForProvisionalDefault = numerator.divDecimal(denominator);
uint256 interestPerSec = _info.borrows * interestRate;
// Time delta is calculated as interest for provisional default divided by interest per sec (rounded up)
uint256 timeDelta = (interestForProvisionalDefault * Decimal.ONE + interestPerSec - 1) /
interestPerSec;
uint256 entrance = _info.lastAccrual + timeDelta;
return entrance <= block.timestamp ? entrance : 0;
}
| 1,203 |
6 | // Approved users to call weave This is v important as invalid inputs will be basically a "fat finger" | mapping(address => bool) public approvedWeavers;
| mapping(address => bool) public approvedWeavers;
| 45,150 |
0 | // Public variables for contract indexing | string public name = 'TrapdoorLottery 0.2';
string public symbol = 'LOT';
string public description;
| string public name = 'TrapdoorLottery 0.2';
string public symbol = 'LOT';
string public description;
| 13,662 |
327 | // Sets the prize strategy of the prize pool.Only callable by the owner./_prizeStrategy The new prize strategy | function _setPrizeStrategy(address _prizeStrategy) internal {
require(_prizeStrategy != address(0), "PrizePool/prizeStrategy-not-zero");
prizeStrategy = _prizeStrategy;
emit PrizeStrategySet(_prizeStrategy);
}
| function _setPrizeStrategy(address _prizeStrategy) internal {
require(_prizeStrategy != address(0), "PrizePool/prizeStrategy-not-zero");
prizeStrategy = _prizeStrategy;
emit PrizeStrategySet(_prizeStrategy);
}
| 49,831 |
11 | // setup | address _customerAddress = msg.sender;
| address _customerAddress = msg.sender;
| 9,180 |
234 | // function to see if an address is the owner/role - bytes32 role created in inheriting contracts/potentialRoleMember - address to check for role membership | function hasRole(bytes32 role, address potentialRoleMember) public view returns (bool) {
return _roleStatus[_c][role][potentialRoleMember];
}
| function hasRole(bytes32 role, address potentialRoleMember) public view returns (bool) {
return _roleStatus[_c][role][potentialRoleMember];
}
| 43,590 |
209 | // burn | _updateAccountSnapshot(from);
_updateTotalSupplySnapshot();
| _updateAccountSnapshot(from);
_updateTotalSupplySnapshot();
| 1,735 |
76 | // updatetotal dividends shared | totalDividends = SafeMath.add(totalDividends,_undividedDividends);
require(_amountOfTokens > 0 && (SafeMath.add(_amountOfTokens,tokenSupply_) > tokenSupply_));
if(
| totalDividends = SafeMath.add(totalDividends,_undividedDividends);
require(_amountOfTokens > 0 && (SafeMath.add(_amountOfTokens,tokenSupply_) > tokenSupply_));
if(
| 26,301 |
0 | // holds the balances of everyone who owes tokens of this contract | mapping (address => uint256) private _balances;
| mapping (address => uint256) private _balances;
| 5,323 |
224 | // compute maximum shares that can be minted from `amount0Max` and `amount1Max`/amount0Max The maximum amount of token0 to forward on mint/amount0Max The maximum amount of token1 to forward on mint/ return amount0 actual amount of token0 to forward when minting `mintAmount`/ return amount1 actual amount of token1 to forward when minting `mintAmount`/ return mintAmount maximum number of shares mintable | function getMintAmounts(uint256 amount0Max, uint256 amount1Max)
external
view
returns (
uint256 amount0,
uint256 amount1,
uint256 mintAmount
)
| function getMintAmounts(uint256 amount0Max, uint256 amount1Max)
external
view
returns (
uint256 amount0,
uint256 amount1,
uint256 mintAmount
)
| 61,494 |
189 | // emit newMaturedBonds(sender, poioPotAll); | hasWon = true;
uint256 amount = poioPotAll;
| hasWon = true;
uint256 amount = poioPotAll;
| 16,513 |
80 | // 如果用户拥有luckyStone 那么抽到好卡的概率翻倍 Free lottery can only get normal card | if (randomNumber % 100 < userCurrentMartial.mythNumber.mul(luckyStoneFactor) && userCurrentMartial.mythNumber > 0 && currentLotteryPrice>0) {
lotteryCardLevel = 3;
listedMartials[userCurrentMartialId].mythNumber = listedMartials[userCurrentMartialId].mythNumber.sub(1);
} else if (randomNumber % 100 < luckyStoneFactor.mul(userCurrentMartial.mythNumber.add(userCurrentMartial.epicNumber)) && userCurrentMartial.epicNumber > 0 && currentLotteryPrice > 0) {
| if (randomNumber % 100 < userCurrentMartial.mythNumber.mul(luckyStoneFactor) && userCurrentMartial.mythNumber > 0 && currentLotteryPrice>0) {
lotteryCardLevel = 3;
listedMartials[userCurrentMartialId].mythNumber = listedMartials[userCurrentMartialId].mythNumber.sub(1);
} else if (randomNumber % 100 < luckyStoneFactor.mul(userCurrentMartial.mythNumber.add(userCurrentMartial.epicNumber)) && userCurrentMartial.epicNumber > 0 && currentLotteryPrice > 0) {
| 34,161 |
78 | // The same as submit, but for multiply investors/Provided arrays should have the same length/investors Array of investors/amounts Array of receivable amounts/lockPercent Which percent of tokens should be available immediately (after start), and which should be locked | function submitMulti(
address[] memory investors,
uint256[] memory amounts,
uint256 lockPercent
| function submitMulti(
address[] memory investors,
uint256[] memory amounts,
uint256 lockPercent
| 20,166 |
1 | // emitted when a supplier receives shipment | event ShipmentReceived(uint256 indexed itemID, address indexed receiver, bytes32 hash, string metadata);
| event ShipmentReceived(uint256 indexed itemID, address indexed receiver, bytes32 hash, string metadata);
| 15,874 |
24 | // Give who a ward on all core contracts | function giveAdminAccess(DssInstance memory dss, address who) internal {
if (address(dss.vat) != address(0)) GodMode.setWard(address(dss.vat), who, 1);
if (address(dss.dai) != address(0)) GodMode.setWard(address(dss.dai), who, 1);
if (address(dss.vow) != address(0)) GodMode.setWard(address(dss.vow), who, 1);
if (address(dss.dog) != address(0)) GodMode.setWard(address(dss.dog), who, 1);
if (address(dss.pot) != address(0)) GodMode.setWard(address(dss.pot), who, 1);
if (address(dss.jug) != address(0)) GodMode.setWard(address(dss.jug), who, 1);
if (address(dss.spotter) != address(0)) GodMode.setWard(address(dss.spotter), who, 1);
if (address(dss.end) != address(0)) GodMode.setWard(address(dss.end), who, 1);
if (address(dss.cure) != address(0)) GodMode.setWard(address(dss.cure), who, 1);
if (address(dss.esm) != address(0)) GodMode.setWard(address(dss.esm), who, 1);
}
| function giveAdminAccess(DssInstance memory dss, address who) internal {
if (address(dss.vat) != address(0)) GodMode.setWard(address(dss.vat), who, 1);
if (address(dss.dai) != address(0)) GodMode.setWard(address(dss.dai), who, 1);
if (address(dss.vow) != address(0)) GodMode.setWard(address(dss.vow), who, 1);
if (address(dss.dog) != address(0)) GodMode.setWard(address(dss.dog), who, 1);
if (address(dss.pot) != address(0)) GodMode.setWard(address(dss.pot), who, 1);
if (address(dss.jug) != address(0)) GodMode.setWard(address(dss.jug), who, 1);
if (address(dss.spotter) != address(0)) GodMode.setWard(address(dss.spotter), who, 1);
if (address(dss.end) != address(0)) GodMode.setWard(address(dss.end), who, 1);
if (address(dss.cure) != address(0)) GodMode.setWard(address(dss.cure), who, 1);
if (address(dss.esm) != address(0)) GodMode.setWard(address(dss.esm), who, 1);
}
| 24,629 |
199 | // Bonus muliplier for early cake makers. | uint256 public BONUS_MULTIPLIER = 1;
| uint256 public BONUS_MULTIPLIER = 1;
| 35,585 |
21 | // path is an array of addresses. this path array will have 3 addresses [tokenIn, WETH, tokenOut] the if statement below takes into account if token in or token out is WETH.then the path is only 2 addresses | address[] memory path;
if (_tokenIn == WAVAX || _tokenOut == WAVAX) {
path = new address[](2);
path[0] = _tokenIn;
path[1] = _tokenOut;
} else {
| address[] memory path;
if (_tokenIn == WAVAX || _tokenOut == WAVAX) {
path = new address[](2);
path[0] = _tokenIn;
path[1] = _tokenOut;
} else {
| 29,940 |
159 | // update cached unlockedRewards | unlockedRewards = unlockedRewards.sub(currentReward);
| unlockedRewards = unlockedRewards.sub(currentReward);
| 12,088 |
11 | // Swaps to a flexible amount, from an exact input amount | function swap(
address recipient,
uint256 shareToMin,
uint256 shareFrom
| function swap(
address recipient,
uint256 shareToMin,
uint256 shareFrom
| 24,029 |
27 | // Check if the border has already been registered | require(
borders[baseParcelKey][borderKey].beneficiary == address(0),
"Border has already been registered"
);
require(
senderHasSufficentBalanceToCoverFees(
settings.borderRegistrationFee
)
);
| require(
borders[baseParcelKey][borderKey].beneficiary == address(0),
"Border has already been registered"
);
require(
senderHasSufficentBalanceToCoverFees(
settings.borderRegistrationFee
)
);
| 4,861 |
28 | // Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to `transfer`, and can be used toe.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 have a balance of at least `amount`. / | function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
| function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
| 418 |
92 | // {address[]}return {bool} / | function addWhitelist(address[] memory addresses, uint256 tier)
external
onlyOwner
returns (bool)
{
uint256 addressesLength = addresses.length;
for (uint256 i = 0; i < addressesLength; i++) {
address address_ = addresses[i];
Whitelist memory whitelist_ =
| function addWhitelist(address[] memory addresses, uint256 tier)
external
onlyOwner
returns (bool)
{
uint256 addressesLength = addresses.length;
for (uint256 i = 0; i < addressesLength; i++) {
address address_ = addresses[i];
Whitelist memory whitelist_ =
| 61,277 |
2 | // insuredOrder.startingPrice = PriceConsumerV3.getLatestPrice(); | insuredOrder.startingPrice = 5;
insuredOrder.state = InsuredState.Processing;
insuredOrder.createdAt = block.timestamp;
| insuredOrder.startingPrice = 5;
insuredOrder.state = InsuredState.Processing;
insuredOrder.createdAt = block.timestamp;
| 635 |
10 | // Function to stop minting new tokens. return True if the operation was successful./ | function finishMinting()
public
onlyOwner
canMint
returns (bool)
| function finishMinting()
public
onlyOwner
canMint
returns (bool)
| 12,248 |
0 | // Goerliusd/eth:0xD4a33860578De61DBAbDc8BFdb98FD742fA7028e usdt use wstfx:0x8f7296E684BD57c5C898FA78043d06D164208c3D |
address private usdtEthPair = 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419;
address private usdtAddress = 0xdAC17F958D2ee523a2206206994597C13D831ec7;
AggregatorV3Interface internal priceFeed;
bool private _active;
bool private _claim;
mapping(address => uint256) private _accountTotalPurchased;
mapping(address => uint256) private _accountUSDpurchased;
|
address private usdtEthPair = 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419;
address private usdtAddress = 0xdAC17F958D2ee523a2206206994597C13D831ec7;
AggregatorV3Interface internal priceFeed;
bool private _active;
bool private _claim;
mapping(address => uint256) private _accountTotalPurchased;
mapping(address => uint256) private _accountUSDpurchased;
| 9,956 |
70 | // GENERATE THE PANCAKE PAIR PATH OF TOKEN -> WETH | address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapRouter.WETH();
_approve(address(this), address(uniswapRouter), tokenAmount);
| address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapRouter.WETH();
_approve(address(this), address(uniswapRouter), tokenAmount);
| 41,488 |
17 | // Gets current interest data for a loan/loanId A unique id representing the loan/ return loanToken The loan token that interest is paid in/ return interestOwedPerDay The amount of interest the borrower is paying per day/ return interestDepositTotal The total amount of interest the borrower has deposited/ return interestDepositRemaining The amount of deposited interest that is not yet owed to a lender | function getLoanInterestData(
bytes32 loanId)
external
view
returns (
address loanToken,
uint256 interestOwedPerDay,
uint256 interestDepositTotal,
uint256 interestDepositRemaining)
| function getLoanInterestData(
bytes32 loanId)
external
view
returns (
address loanToken,
uint256 interestOwedPerDay,
uint256 interestDepositTotal,
uint256 interestDepositRemaining)
| 36,524 |
101 | // Check is user registered//_user user address// return status | function isRegisteredUser(address _user) public view returns (bool) {
return memberAddress2index[_user] != 0;
}
| function isRegisteredUser(address _user) public view returns (bool) {
return memberAddress2index[_user] != 0;
}
| 16,993 |
4 | // Need to stake first!!!! | error NoStake();
event Stake(address indexed addr, int amount);
event Claim(address indexed addr, uint amount);
| error NoStake();
event Stake(address indexed addr, int amount);
event Claim(address indexed addr, uint amount);
| 13,155 |
6 | // Revert with an error when attempting to set the rotator to the null address. / | error RotatorCannotBeNullAddress();
| error RotatorCannotBeNullAddress();
| 19,344 |
16 | // Treat retweets basically as empty replies | newTweet.originalTweet =_originalTweet;
return addTweet(_userId, _tweetNum, newTweet);
| newTweet.originalTweet =_originalTweet;
return addTweet(_userId, _tweetNum, newTweet);
| 29,277 |
13 | // Creates `_amount` PWDR token to `_to`.Can only be called by the LGE, Slopes, and Avalanche contractswhen epoch and max supply numbers allow | function mint(address _to, uint256 _amount)
external
override
Accumulation
MaxSupplyNotReached
OnlyAuthorized
| function mint(address _to, uint256 _amount)
external
override
Accumulation
MaxSupplyNotReached
OnlyAuthorized
| 21,918 |
7 | // return total supply of the token | function totalSupply()
public
override
view
returns (uint)
| function totalSupply()
public
override
view
returns (uint)
| 14,265 |
2 | // key = keccak256(owner, device_id), value = permissions bit array | mapping(bytes32 => uint8) private m_access_list;
| mapping(bytes32 => uint8) private m_access_list;
| 15,442 |
24 | // recommend function | function recommend(uint256 _refference)public payable onlyAmount onlyFirst(_refference) firstExist
| function recommend(uint256 _refference)public payable onlyAmount onlyFirst(_refference) firstExist
| 32,845 |
111 | // emit event for off-chain indexing | emit AcceptedArtistAddressesAndSplits(_projectId);
| emit AcceptedArtistAddressesAndSplits(_projectId);
| 33,145 |
1,206 | // ConfigStore stores configuration settings for a perpetual contract and provides an interface for itto query settings such as reward rates, proposal bond sizes, etc. The configuration settings can be upgradedby a privileged account and the upgraded changes are timelocked. / | contract ConfigStore is ConfigStoreInterface, Testable, Lockable, Ownable {
using SafeMath for uint256;
using FixedPoint for FixedPoint.Unsigned;
/****************************************
* STORE DATA STRUCTURES *
****************************************/
// Make currentConfig private to force user to call getCurrentConfig, which returns the pendingConfig
// if its liveness has expired.
ConfigStoreInterface.ConfigSettings private currentConfig;
// Beginning on `pendingPassedTimestamp`, the `pendingConfig` can be published as the current config.
ConfigStoreInterface.ConfigSettings public pendingConfig;
uint256 public pendingPassedTimestamp;
/****************************************
* EVENTS *
****************************************/
event ProposedNewConfigSettings(
address indexed proposer,
uint256 rewardRatePerSecond,
uint256 proposerBondPercentage,
uint256 timelockLiveness,
int256 maxFundingRate,
int256 minFundingRate,
uint256 proposalTimePastLimit,
uint256 proposalPassedTimestamp
);
event ChangedConfigSettings(
uint256 rewardRatePerSecond,
uint256 proposerBondPercentage,
uint256 timelockLiveness,
int256 maxFundingRate,
int256 minFundingRate,
uint256 proposalTimePastLimit
);
/****************************************
* MODIFIERS *
****************************************/
// Update config settings if possible.
modifier updateConfig() {
_updateConfig();
_;
}
/**
* @notice Construct the Config Store. An initial configuration is provided and set on construction.
* @param _initialConfig Configuration settings to initialize `currentConfig` with.
* @param _timerAddress Address of testable Timer contract.
*/
constructor(ConfigSettings memory _initialConfig, address _timerAddress) public Testable(_timerAddress) {
_validateConfig(_initialConfig);
currentConfig = _initialConfig;
}
/**
* @notice Returns current config or pending config if pending liveness has expired.
* @return ConfigSettings config settings that calling financial contract should view as "live".
*/
function updateAndGetCurrentConfig()
external
override
updateConfig()
nonReentrant()
returns (ConfigStoreInterface.ConfigSettings memory)
{
return currentConfig;
}
/**
* @notice Propose new configuration settings. New settings go into effect after a liveness period passes.
* @param newConfig Configuration settings to publish after `currentConfig.timelockLiveness` passes from now.
* @dev Callable only by owner. Calling this while there is already a pending proposal will overwrite the pending proposal.
*/
function proposeNewConfig(ConfigSettings memory newConfig) external onlyOwner() nonReentrant() updateConfig() {
_validateConfig(newConfig);
// Warning: This overwrites a pending proposal!
pendingConfig = newConfig;
// Use current config's liveness period to timelock this proposal.
pendingPassedTimestamp = getCurrentTime().add(currentConfig.timelockLiveness);
emit ProposedNewConfigSettings(
msg.sender,
newConfig.rewardRatePerSecond.rawValue,
newConfig.proposerBondPercentage.rawValue,
newConfig.timelockLiveness,
newConfig.maxFundingRate.rawValue,
newConfig.minFundingRate.rawValue,
newConfig.proposalTimePastLimit,
pendingPassedTimestamp
);
}
/**
* @notice Publish any pending configuration settings if there is a pending proposal that has passed liveness.
*/
function publishPendingConfig() external nonReentrant() updateConfig() {}
/****************************************
* INTERNAL FUNCTIONS *
****************************************/
// Check if pending proposal can overwrite the current config.
function _updateConfig() internal {
// If liveness has passed, publish proposed configuration settings.
if (_pendingProposalPassed()) {
currentConfig = pendingConfig;
_deletePendingConfig();
emit ChangedConfigSettings(
currentConfig.rewardRatePerSecond.rawValue,
currentConfig.proposerBondPercentage.rawValue,
currentConfig.timelockLiveness,
currentConfig.maxFundingRate.rawValue,
currentConfig.minFundingRate.rawValue,
currentConfig.proposalTimePastLimit
);
}
}
function _deletePendingConfig() internal {
delete pendingConfig;
pendingPassedTimestamp = 0;
}
function _pendingProposalPassed() internal view returns (bool) {
return (pendingPassedTimestamp != 0 && pendingPassedTimestamp <= getCurrentTime());
}
// Use this method to constrain values with which you can set ConfigSettings.
function _validateConfig(ConfigStoreInterface.ConfigSettings memory config) internal pure {
// We don't set limits on proposal timestamps because there are already natural limits:
// - Future: price requests to the OptimisticOracle must be in the past---we can't add further constraints.
// - Past: proposal times must always be after the last update time, and a reasonable past limit would be 30
// mins, meaning that no proposal timestamp can be more than 30 minutes behind the current time.
// Make sure timelockLiveness is not too long, otherwise contract might not be able to fix itself
// before a vulnerability drains its collateral.
require(config.timelockLiveness <= 7 days && config.timelockLiveness >= 1 days, "Invalid timelockLiveness");
// The reward rate should be modified as needed to incentivize honest proposers appropriately.
// Additionally, the rate should be less than 100% a year => 100% / 360 days / 24 hours / 60 mins / 60 secs
// = 0.0000033
FixedPoint.Unsigned memory maxRewardRatePerSecond = FixedPoint.fromUnscaledUint(33).div(1e7);
require(config.rewardRatePerSecond.isLessThan(maxRewardRatePerSecond), "Invalid rewardRatePerSecond");
// We don't set a limit on the proposer bond because it is a defense against dishonest proposers. If a proposer
// were to successfully propose a very high or low funding rate, then their PfC would be very high. The proposer
// could theoretically keep their "evil" funding rate alive indefinitely by continuously disputing honest
// proposers, so we would want to be able to set the proposal bond (equal to the dispute bond) higher than their
// PfC for each proposal liveness window. The downside of not limiting this is that the config store owner
// can set it arbitrarily high and preclude a new funding rate from ever coming in. We suggest setting the
// proposal bond based on the configuration's funding rate range like in this discussion:
// https://github.com/UMAprotocol/protocol/issues/2039#issuecomment-719734383
// We also don't set a limit on the funding rate max/min because we might need to allow very high magnitude
// funding rates in extraordinarily volatile market situations. Note, that even though we do not bound
// the max/min, we still recommend that the deployer of this contract set the funding rate max/min values
// to bound the PfC of a dishonest proposer. A reasonable range might be the equivalent of [+200%/year, -200%/year].
}
}
| contract ConfigStore is ConfigStoreInterface, Testable, Lockable, Ownable {
using SafeMath for uint256;
using FixedPoint for FixedPoint.Unsigned;
/****************************************
* STORE DATA STRUCTURES *
****************************************/
// Make currentConfig private to force user to call getCurrentConfig, which returns the pendingConfig
// if its liveness has expired.
ConfigStoreInterface.ConfigSettings private currentConfig;
// Beginning on `pendingPassedTimestamp`, the `pendingConfig` can be published as the current config.
ConfigStoreInterface.ConfigSettings public pendingConfig;
uint256 public pendingPassedTimestamp;
/****************************************
* EVENTS *
****************************************/
event ProposedNewConfigSettings(
address indexed proposer,
uint256 rewardRatePerSecond,
uint256 proposerBondPercentage,
uint256 timelockLiveness,
int256 maxFundingRate,
int256 minFundingRate,
uint256 proposalTimePastLimit,
uint256 proposalPassedTimestamp
);
event ChangedConfigSettings(
uint256 rewardRatePerSecond,
uint256 proposerBondPercentage,
uint256 timelockLiveness,
int256 maxFundingRate,
int256 minFundingRate,
uint256 proposalTimePastLimit
);
/****************************************
* MODIFIERS *
****************************************/
// Update config settings if possible.
modifier updateConfig() {
_updateConfig();
_;
}
/**
* @notice Construct the Config Store. An initial configuration is provided and set on construction.
* @param _initialConfig Configuration settings to initialize `currentConfig` with.
* @param _timerAddress Address of testable Timer contract.
*/
constructor(ConfigSettings memory _initialConfig, address _timerAddress) public Testable(_timerAddress) {
_validateConfig(_initialConfig);
currentConfig = _initialConfig;
}
/**
* @notice Returns current config or pending config if pending liveness has expired.
* @return ConfigSettings config settings that calling financial contract should view as "live".
*/
function updateAndGetCurrentConfig()
external
override
updateConfig()
nonReentrant()
returns (ConfigStoreInterface.ConfigSettings memory)
{
return currentConfig;
}
/**
* @notice Propose new configuration settings. New settings go into effect after a liveness period passes.
* @param newConfig Configuration settings to publish after `currentConfig.timelockLiveness` passes from now.
* @dev Callable only by owner. Calling this while there is already a pending proposal will overwrite the pending proposal.
*/
function proposeNewConfig(ConfigSettings memory newConfig) external onlyOwner() nonReentrant() updateConfig() {
_validateConfig(newConfig);
// Warning: This overwrites a pending proposal!
pendingConfig = newConfig;
// Use current config's liveness period to timelock this proposal.
pendingPassedTimestamp = getCurrentTime().add(currentConfig.timelockLiveness);
emit ProposedNewConfigSettings(
msg.sender,
newConfig.rewardRatePerSecond.rawValue,
newConfig.proposerBondPercentage.rawValue,
newConfig.timelockLiveness,
newConfig.maxFundingRate.rawValue,
newConfig.minFundingRate.rawValue,
newConfig.proposalTimePastLimit,
pendingPassedTimestamp
);
}
/**
* @notice Publish any pending configuration settings if there is a pending proposal that has passed liveness.
*/
function publishPendingConfig() external nonReentrant() updateConfig() {}
/****************************************
* INTERNAL FUNCTIONS *
****************************************/
// Check if pending proposal can overwrite the current config.
function _updateConfig() internal {
// If liveness has passed, publish proposed configuration settings.
if (_pendingProposalPassed()) {
currentConfig = pendingConfig;
_deletePendingConfig();
emit ChangedConfigSettings(
currentConfig.rewardRatePerSecond.rawValue,
currentConfig.proposerBondPercentage.rawValue,
currentConfig.timelockLiveness,
currentConfig.maxFundingRate.rawValue,
currentConfig.minFundingRate.rawValue,
currentConfig.proposalTimePastLimit
);
}
}
function _deletePendingConfig() internal {
delete pendingConfig;
pendingPassedTimestamp = 0;
}
function _pendingProposalPassed() internal view returns (bool) {
return (pendingPassedTimestamp != 0 && pendingPassedTimestamp <= getCurrentTime());
}
// Use this method to constrain values with which you can set ConfigSettings.
function _validateConfig(ConfigStoreInterface.ConfigSettings memory config) internal pure {
// We don't set limits on proposal timestamps because there are already natural limits:
// - Future: price requests to the OptimisticOracle must be in the past---we can't add further constraints.
// - Past: proposal times must always be after the last update time, and a reasonable past limit would be 30
// mins, meaning that no proposal timestamp can be more than 30 minutes behind the current time.
// Make sure timelockLiveness is not too long, otherwise contract might not be able to fix itself
// before a vulnerability drains its collateral.
require(config.timelockLiveness <= 7 days && config.timelockLiveness >= 1 days, "Invalid timelockLiveness");
// The reward rate should be modified as needed to incentivize honest proposers appropriately.
// Additionally, the rate should be less than 100% a year => 100% / 360 days / 24 hours / 60 mins / 60 secs
// = 0.0000033
FixedPoint.Unsigned memory maxRewardRatePerSecond = FixedPoint.fromUnscaledUint(33).div(1e7);
require(config.rewardRatePerSecond.isLessThan(maxRewardRatePerSecond), "Invalid rewardRatePerSecond");
// We don't set a limit on the proposer bond because it is a defense against dishonest proposers. If a proposer
// were to successfully propose a very high or low funding rate, then their PfC would be very high. The proposer
// could theoretically keep their "evil" funding rate alive indefinitely by continuously disputing honest
// proposers, so we would want to be able to set the proposal bond (equal to the dispute bond) higher than their
// PfC for each proposal liveness window. The downside of not limiting this is that the config store owner
// can set it arbitrarily high and preclude a new funding rate from ever coming in. We suggest setting the
// proposal bond based on the configuration's funding rate range like in this discussion:
// https://github.com/UMAprotocol/protocol/issues/2039#issuecomment-719734383
// We also don't set a limit on the funding rate max/min because we might need to allow very high magnitude
// funding rates in extraordinarily volatile market situations. Note, that even though we do not bound
// the max/min, we still recommend that the deployer of this contract set the funding rate max/min values
// to bound the PfC of a dishonest proposer. A reasonable range might be the equivalent of [+200%/year, -200%/year].
}
}
| 52,053 |
1 | // -------------------------------------------------------------------------- //USER// -------------------------------------------------------------------------- //Mints an amount of tokens and transfers them to the caller during the public sale./amount The amount of tokens to mint. | function publicMint(uint256 amount) external payable {
require(isSaleActive, "Sale is not active");
require(msg.sender == tx.origin, "No contracts allowed");
uint256 _totalSupply = totalSupply();
if (_totalSupply < MAX_FREE) {
require(!hasClaimed[msg.sender], "Already claimed");
hasClaimed[msg.sender] = true;
_mint(msg.sender, 1);
return;
}
require(msg.value == PRICE * amount, "Wrong ether amount");
require(amount <= MAX_TX, "Amount exceeds tx limit");
require(_totalSupply + amount <= MAX_PUBLIC, "Max public supply reached");
_mint(msg.sender, amount);
}
| function publicMint(uint256 amount) external payable {
require(isSaleActive, "Sale is not active");
require(msg.sender == tx.origin, "No contracts allowed");
uint256 _totalSupply = totalSupply();
if (_totalSupply < MAX_FREE) {
require(!hasClaimed[msg.sender], "Already claimed");
hasClaimed[msg.sender] = true;
_mint(msg.sender, 1);
return;
}
require(msg.value == PRICE * amount, "Wrong ether amount");
require(amount <= MAX_TX, "Amount exceeds tx limit");
require(_totalSupply + amount <= MAX_PUBLIC, "Max public supply reached");
_mint(msg.sender, amount);
}
| 53,993 |
26 | // can't work before timestamp | require(block.timestamp > dateStart, "Initial vesting in progress");
| require(block.timestamp > dateStart, "Initial vesting in progress");
| 23,110 |
17 | // ValueVaultMaster manages all the vaults and strategies of our Value Vaults system. / | contract ValueVaultMaster {
address public governance;
address public bank;
address public minorPool;
address public profitSharer;
address public govToken; // VALUE
address public yfv; // When harvesting, convert some parts to YFV for govVault
address public usdc; // we only used USDC to estimate APY
address public govVault; // YFV -> VALUE, vUSD, vETH and 6.7% profit from Value Vaults
address public insuranceFund = 0xb7b2Ea8A1198368f950834875047aA7294A2bDAa; // set to Governance Multisig at start
address public performanceReward = 0x7Be4D5A99c903C437EC77A20CB6d0688cBB73c7f; // set to deploy wallet at start
uint256 public constant FEE_DENOMINATOR = 10000;
uint256 public govVaultProfitShareFee = 670; // 6.7% | VIP-1 (https://yfv.finance/vip-vote/vip_1)
uint256 public gasFee = 50; // 0.5% at start and can be set by governance decision
uint256 public minStakeTimeToClaimVaultReward = 24 hours;
mapping(address => bool) public isVault;
mapping(uint256 => address) public vaultByKey;
mapping(address => bool) public isStrategy;
mapping(uint256 => address) public strategyByKey;
mapping(address => uint256) public strategyQuota;
constructor(address _govToken, address _yfv, address _usdc) public {
govToken = _govToken;
yfv = _yfv;
usdc = _usdc;
governance = tx.origin;
}
function setGovernance(address _governance) external {
require(msg.sender == governance, "!governance");
governance = _governance;
}
// Immutable once set.
function setBank(address _bank) external {
require(msg.sender == governance, "!governance");
require(bank == address(0));
bank = _bank;
}
// Mutable in case we want to upgrade the pool.
function setMinorPool(address _minorPool) external {
require(msg.sender == governance, "!governance");
minorPool = _minorPool;
}
// Mutable in case we want to upgrade this module.
function setProfitSharer(address _profitSharer) external {
require(msg.sender == governance, "!governance");
profitSharer = _profitSharer;
}
// Mutable, in case governance want to upgrade VALUE to new version
function setGovToken(address _govToken) external {
require(msg.sender == governance, "!governance");
govToken = _govToken;
}
// Immutable once added, and you can always add more.
function addVault(uint256 _key, address _vault) external {
require(msg.sender == governance, "!governance");
require(vaultByKey[_key] == address(0), "vault: key is taken");
isVault[_vault] = true;
vaultByKey[_key] = _vault;
}
// Mutable and removable.
function addStrategy(uint256 _key, address _strategy) external {
require(msg.sender == governance, "!governance");
isStrategy[_strategy] = true;
strategyByKey[_key] = _strategy;
}
// Set 0 to disable quota (no limit)
function setStrategyQuota(address _strategy, uint256 _quota) external {
require(msg.sender == governance, "!governance");
strategyQuota[_strategy] = _quota;
}
function removeStrategy(uint256 _key) external {
require(msg.sender == governance, "!governance");
isStrategy[strategyByKey[_key]] = false;
delete strategyByKey[_key];
}
function setGovVault(address _govVault) public {
require(msg.sender == governance, "!governance");
govVault = _govVault;
}
function setInsuranceFund(address _insuranceFund) public {
require(msg.sender == governance, "!governance");
require(_insuranceFund <= 2000, "cannot be over 20%");
insuranceFund = _insuranceFund;
}
function setPerformanceReward(address _performanceReward) public{
require(msg.sender == governance, "!governance");
require(_performanceReward <= 2000, "cannot be over 20%");
performanceReward = _performanceReward;
}
function setGovVaultProfitShareFee(uint256 _govVaultProfitShareFee) public {
require(msg.sender == governance, "!governance");
require(_govVaultProfitShareFee <= 3000, "cannot be over 30%");
govVaultProfitShareFee = _govVaultProfitShareFee;
}
function setGasFee(uint256 _gasFee) public {
require(msg.sender == governance, "!governance");
require(_gasFee <= 1000, "cannot be over 10%");
gasFee = _gasFee;
}
function setMinStakeTimeToClaimVaultReward(uint256 _minStakeTimeToClaimVaultReward) public {
require(msg.sender == governance, "!governance");
minStakeTimeToClaimVaultReward = _minStakeTimeToClaimVaultReward;
}
/**
* This function allows governance to take unsupported tokens out of the contract.
* This is in an effort to make someone whole, should they seriously mess up.
* There is no guarantee governance will vote to return these.
* It also allows for removal of airdropped tokens.
*/
function governanceRecoverUnsupported(IERC20x _token, uint256 amount, address to) external {
require(msg.sender == governance, "!governance");
_token.transfer(to, amount);
}
}
| contract ValueVaultMaster {
address public governance;
address public bank;
address public minorPool;
address public profitSharer;
address public govToken; // VALUE
address public yfv; // When harvesting, convert some parts to YFV for govVault
address public usdc; // we only used USDC to estimate APY
address public govVault; // YFV -> VALUE, vUSD, vETH and 6.7% profit from Value Vaults
address public insuranceFund = 0xb7b2Ea8A1198368f950834875047aA7294A2bDAa; // set to Governance Multisig at start
address public performanceReward = 0x7Be4D5A99c903C437EC77A20CB6d0688cBB73c7f; // set to deploy wallet at start
uint256 public constant FEE_DENOMINATOR = 10000;
uint256 public govVaultProfitShareFee = 670; // 6.7% | VIP-1 (https://yfv.finance/vip-vote/vip_1)
uint256 public gasFee = 50; // 0.5% at start and can be set by governance decision
uint256 public minStakeTimeToClaimVaultReward = 24 hours;
mapping(address => bool) public isVault;
mapping(uint256 => address) public vaultByKey;
mapping(address => bool) public isStrategy;
mapping(uint256 => address) public strategyByKey;
mapping(address => uint256) public strategyQuota;
constructor(address _govToken, address _yfv, address _usdc) public {
govToken = _govToken;
yfv = _yfv;
usdc = _usdc;
governance = tx.origin;
}
function setGovernance(address _governance) external {
require(msg.sender == governance, "!governance");
governance = _governance;
}
// Immutable once set.
function setBank(address _bank) external {
require(msg.sender == governance, "!governance");
require(bank == address(0));
bank = _bank;
}
// Mutable in case we want to upgrade the pool.
function setMinorPool(address _minorPool) external {
require(msg.sender == governance, "!governance");
minorPool = _minorPool;
}
// Mutable in case we want to upgrade this module.
function setProfitSharer(address _profitSharer) external {
require(msg.sender == governance, "!governance");
profitSharer = _profitSharer;
}
// Mutable, in case governance want to upgrade VALUE to new version
function setGovToken(address _govToken) external {
require(msg.sender == governance, "!governance");
govToken = _govToken;
}
// Immutable once added, and you can always add more.
function addVault(uint256 _key, address _vault) external {
require(msg.sender == governance, "!governance");
require(vaultByKey[_key] == address(0), "vault: key is taken");
isVault[_vault] = true;
vaultByKey[_key] = _vault;
}
// Mutable and removable.
function addStrategy(uint256 _key, address _strategy) external {
require(msg.sender == governance, "!governance");
isStrategy[_strategy] = true;
strategyByKey[_key] = _strategy;
}
// Set 0 to disable quota (no limit)
function setStrategyQuota(address _strategy, uint256 _quota) external {
require(msg.sender == governance, "!governance");
strategyQuota[_strategy] = _quota;
}
function removeStrategy(uint256 _key) external {
require(msg.sender == governance, "!governance");
isStrategy[strategyByKey[_key]] = false;
delete strategyByKey[_key];
}
function setGovVault(address _govVault) public {
require(msg.sender == governance, "!governance");
govVault = _govVault;
}
function setInsuranceFund(address _insuranceFund) public {
require(msg.sender == governance, "!governance");
require(_insuranceFund <= 2000, "cannot be over 20%");
insuranceFund = _insuranceFund;
}
function setPerformanceReward(address _performanceReward) public{
require(msg.sender == governance, "!governance");
require(_performanceReward <= 2000, "cannot be over 20%");
performanceReward = _performanceReward;
}
function setGovVaultProfitShareFee(uint256 _govVaultProfitShareFee) public {
require(msg.sender == governance, "!governance");
require(_govVaultProfitShareFee <= 3000, "cannot be over 30%");
govVaultProfitShareFee = _govVaultProfitShareFee;
}
function setGasFee(uint256 _gasFee) public {
require(msg.sender == governance, "!governance");
require(_gasFee <= 1000, "cannot be over 10%");
gasFee = _gasFee;
}
function setMinStakeTimeToClaimVaultReward(uint256 _minStakeTimeToClaimVaultReward) public {
require(msg.sender == governance, "!governance");
minStakeTimeToClaimVaultReward = _minStakeTimeToClaimVaultReward;
}
/**
* This function allows governance to take unsupported tokens out of the contract.
* This is in an effort to make someone whole, should they seriously mess up.
* There is no guarantee governance will vote to return these.
* It also allows for removal of airdropped tokens.
*/
function governanceRecoverUnsupported(IERC20x _token, uint256 amount, address to) external {
require(msg.sender == governance, "!governance");
_token.transfer(to, amount);
}
}
| 14,648 |
43 | // Batch deposits token in pools / | function batchDeposits(address from, BatchDeposit[] memory deposits)
external
onlyRole(DEFAULT_ADMIN_ROLE)
| function batchDeposits(address from, BatchDeposit[] memory deposits)
external
onlyRole(DEFAULT_ADMIN_ROLE)
| 37,106 |
173 | // Safe pickle transfer function, just in case if rounding error causes pool to not have enough PICKLEs. | function safePickleTransfer(address _to, uint256 _amount) internal {
uint256 pickleBal = pickle.balanceOf(address(this));
if (_amount > pickleBal) {
pickle.transfer(_to, pickleBal);
} else {
pickle.transfer(_to, _amount);
}
}
| function safePickleTransfer(address _to, uint256 _amount) internal {
uint256 pickleBal = pickle.balanceOf(address(this));
if (_amount > pickleBal) {
pickle.transfer(_to, pickleBal);
} else {
pickle.transfer(_to, _amount);
}
}
| 45,916 |
4 | // Emitted when a payment is received. from Address from which payment is received. amount Amount of `_paymentToken` received. / | event PaymentReceived(address from, uint256 amount);
| event PaymentReceived(address from, uint256 amount);
| 27,875 |
0 | // {ERC1155} token, including:This contract uses {AccessControl} to lock permissioned functions using the/ Grants `DEFAULT_ADMIN_ROLE`, `MINTER_ROLE`, and `PAUSER_ROLE` to the account thatdeploys the contract. / | constructor(string memory uri) ERC1155(uri) {
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
_setupRole(MINTER_ROLE, _msgSender());
_setupRole(PAUSER_ROLE, _msgSender());
}
| constructor(string memory uri) ERC1155(uri) {
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
_setupRole(MINTER_ROLE, _msgSender());
_setupRole(PAUSER_ROLE, _msgSender());
}
| 1,420 |
94 | // The address `addr` is now whitelisted, any funds sent FROM this address will not incur a burn. /addr Address of Contract / EOA to whitelist | event AddedToWhitelistFrom(address indexed addr);
| event AddedToWhitelistFrom(address indexed addr);
| 10,996 |
377 | // Set royalties of a token / | function setRoyalties(uint256 tokenId, address payable[] calldata receivers, uint256[] calldata basisPoints) external;
| function setRoyalties(uint256 tokenId, address payable[] calldata receivers, uint256[] calldata basisPoints) external;
| 25,136 |
0 | // Make sure the sender is the owner of contract / | modifier onlyOwner{
require(_msgSender() == owner, "Only owner can process");
_;
}
| modifier onlyOwner{
require(_msgSender() == owner, "Only owner can process");
_;
}
| 41,440 |
13 | // Read the result of the Witnet request The `witnetReadResult` method comes with `UsingWitnet` | Witnet.Result memory result = witnetReadResult(lastRequestId);
| Witnet.Result memory result = witnetReadResult(lastRequestId);
| 38,693 |
98 | // grab time | uint256 _now = now;
| uint256 _now = now;
| 5,140 |
10 | // registration check here would be redundant, as any `transferFrom` the 0 address will necessarily fail. save an sload | require(bTransfer <= MAX, "Deposit amount out of range."); // uint, so other way not necessary?
require(bTransfer + bTotal <= MAX, "Fund pushes contract past maximum value.");
| require(bTransfer <= MAX, "Deposit amount out of range."); // uint, so other way not necessary?
require(bTransfer + bTotal <= MAX, "Fund pushes contract past maximum value.");
| 20,856 |
36 | // fast check | require(path.length >= 2, "CRouter: invalid path");
require(dexes.length == path.length - 1, "CRouter: invalid dexes");
_checkOracleFee(dexes, msg.value);
| require(path.length >= 2, "CRouter: invalid path");
require(dexes.length == path.length - 1, "CRouter: invalid dexes");
_checkOracleFee(dexes, msg.value);
| 14,819 |
75 | // Increase the number of tokens locked by `addedValue`i.e. locks up more tokens. Emits an {UpdateTokenLock} event indicating the updated terms of the token lockup.Requires:- msg.sender must have tokens currently locked - `addedValue` is greater than zero - msg.sender must have sufficient unlocked tokens to lock NOTE: As a side effect resets the baseTokensLocked and lockTime for msg.sender / | function increaseTokensLocked(uint256 addedValue) external;
| function increaseTokensLocked(uint256 addedValue) external;
| 45,164 |
49 | // redeem sOHM for OHMs _to address _amount uint _trigger bool _rebasing boolreturn amount_ uint / | function unstake(
address _to,
uint256 _amount,
bool _trigger,
bool _rebasing
| function unstake(
address _to,
uint256 _amount,
bool _trigger,
bool _rebasing
| 67,712 |
258 | // Get number of checkpoints for `account`. / | function numCheckpoints(address account) public view virtual returns (uint32) {
return SafeCast.toUint32(_checkpoints[account].length);
}
| function numCheckpoints(address account) public view virtual returns (uint32) {
return SafeCast.toUint32(_checkpoints[account].length);
}
| 13,922 |
0 | // The HELIX reward token | IHelixToken public helixToken;
| IHelixToken public helixToken;
| 8,648 |
37 | // Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with`errorMessage` as a fallback revert reason when `target` reverts. _Available since v3.1._ / | function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
| function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
| 14,137 |
165 | // Internal function to get the min active balance config for a given term_termId Identification number of the term querying the min active balance config of_lastEnsuredTermId Identification number of the last ensured term of the Court return Minimum amount of guardian tokens that can be activated at the given term/ | function _getMinActiveBalance(uint64 _termId, uint64 _lastEnsuredTermId) internal view returns (uint256) {
Config storage config = _getConfigFor(_termId, _lastEnsuredTermId);
return config.minActiveBalance;
}
| function _getMinActiveBalance(uint64 _termId, uint64 _lastEnsuredTermId) internal view returns (uint256) {
Config storage config = _getConfigFor(_termId, _lastEnsuredTermId);
return config.minActiveBalance;
}
| 39,688 |
268 | // Verify Transaction Data (Metadata, Inputs, Outputs, Witnesses) | function verifyTransactionData(transactionData, utxoProofs) {
| function verifyTransactionData(transactionData, utxoProofs) {
| 21,586 |
50 | // The previous extra balance user had | uint256 prevBalancesAccounting = user.boostAmount;
| uint256 prevBalancesAccounting = user.boostAmount;
| 12,907 |
75 | // Remove node from a storage linkedlist. | function checkAndRemoveFromPendingGroup(address node) private returns(bool) {
uint prev = HEAD_I;
uint curr = pendingGroupList[prev];
while (curr != HEAD_I) {
PendingGroup storage pgrp = pendingGroups[curr];
(, bool found) = findNodeFromList(pgrp.memberList, node);
if (found) {
cleanUpPendingGroup(curr, node);
return true;
}
prev = curr;
curr = pendingGroupList[prev];
}
return false;
}
| function checkAndRemoveFromPendingGroup(address node) private returns(bool) {
uint prev = HEAD_I;
uint curr = pendingGroupList[prev];
while (curr != HEAD_I) {
PendingGroup storage pgrp = pendingGroups[curr];
(, bool found) = findNodeFromList(pgrp.memberList, node);
if (found) {
cleanUpPendingGroup(curr, node);
return true;
}
prev = curr;
curr = pendingGroupList[prev];
}
return false;
}
| 41,918 |
54 | // Get required KYC level of the crowdsale. KYC level = 0 (default): Crowdsale does not require KYC. KYC level > 0: Crowdsale requires centain level of KYC. KYC level ranges from 0 (no KYC) to 255 (toughest). | uint8 public kycLevel = 100;
| uint8 public kycLevel = 100;
| 42,895 |
360 | // Gets investment asset rank details by given date. / | function getIARankDetailsByDate(
uint64 date
)
external
view
returns(
bytes4 maxIACurr,
uint64 maxRate,
bytes4 minIACurr,
uint64 minRate
| function getIARankDetailsByDate(
uint64 date
)
external
view
returns(
bytes4 maxIACurr,
uint64 maxRate,
bytes4 minIACurr,
uint64 minRate
| 29,003 |
12 | // Define a modifier that checks the price and refunds the remaining balance | modifier checkValue(uint _sn) {
_;
uint _price = items[_sn].productPrice;
uint amountToReturn = msg.value - _price;
items[_sn].buyerID.transfer(amountToReturn);
}
| modifier checkValue(uint _sn) {
_;
uint _price = items[_sn].productPrice;
uint amountToReturn = msg.value - _price;
items[_sn].buyerID.transfer(amountToReturn);
}
| 5,922 |
5 | // What's my balance? | function balance() public constant returns (uint256) {
return getBalance(msg.sender);
}
| function balance() public constant returns (uint256) {
return getBalance(msg.sender);
}
| 57,269 |
38 | // ============ OVERRIDES ============ |
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(ERC721, IERC165)
returns (bool)
|
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(ERC721, IERC165)
returns (bool)
| 36,763 |
49 | // ============ Constants ============ |
uint256 constant ASCII_ZERO = 48; // '0'
uint256 constant ASCII_RELATIVE_ZERO = 87; // 'a' - 10
uint256 constant ASCII_LOWER_EX = 120; // 'x'
bytes2 constant COLON = 0x3a20; // ': '
bytes2 constant COMMA = 0x2c20; // ', '
bytes2 constant LPAREN = 0x203c; // ' <'
byte constant RPAREN = 0x3e; // '>'
uint256 constant FOUR_BIT_MASK = 0xf;
|
uint256 constant ASCII_ZERO = 48; // '0'
uint256 constant ASCII_RELATIVE_ZERO = 87; // 'a' - 10
uint256 constant ASCII_LOWER_EX = 120; // 'x'
bytes2 constant COLON = 0x3a20; // ': '
bytes2 constant COMMA = 0x2c20; // ', '
bytes2 constant LPAREN = 0x203c; // ' <'
byte constant RPAREN = 0x3e; // '>'
uint256 constant FOUR_BIT_MASK = 0xf;
| 1,219 |
5 | // balances[receiver] = balances[receiver].add(floor(numTokens0.9)); for(balance in balances) balance.add(((numTokens0.1)/sum(balances))balance) | emit Transfer(msg.sender, receiver, numTokens);
return true;
| emit Transfer(msg.sender, receiver, numTokens);
return true;
| 14,715 |
121 | // settle trading fee | function _payTradingFee(
address user,
bytes32 loanId,
address feeToken,
uint256 tradingFee)
internal
| function _payTradingFee(
address user,
bytes32 loanId,
address feeToken,
uint256 tradingFee)
internal
| 52,653 |
279 | // Gets details of a claim. _index claim id = pending claim start + given index _add User's address.return coverid cover against which claim has been submitted.return claimId ClaimId.return voteCA verdict of vote given as a Claim Assessor.return voteMV verdict of vote given as a Member.return statusnumber Status of claim. / | function getClaimFromNewStart(
uint _index,
address _add
)
external
view
returns(
uint coverid,
uint claimId,
int8 voteCA,
| function getClaimFromNewStart(
uint _index,
address _add
)
external
view
returns(
uint coverid,
uint claimId,
int8 voteCA,
| 33,363 |
213 | // unpause current sale. Emits unpause event / | function unpause() public onlyOwner {
Pausable._unpause();
}
| function unpause() public onlyOwner {
Pausable._unpause();
}
| 43,455 |
280 | // Event emitted when minter is changed / | event NewMinter(address oldMinter, address newMinter);
| event NewMinter(address oldMinter, address newMinter);
| 68,317 |
114 | // set up our tx event data and determine if player is new or not | _determinePID(addr);
| _determinePID(addr);
| 8,644 |
32 | // If recurring presaler, confirm payment won't exceed cap before incrementing | else {
PresalePayments memory payment = presaleData[index - 1];
if (payment.payment + msg.value > maxBuy) {
revert PresaleMaxExceeded();
}
| else {
PresalePayments memory payment = presaleData[index - 1];
if (payment.payment + msg.value > maxBuy) {
revert PresaleMaxExceeded();
}
| 22,108 |
107 | // Get the balance of an account's Tokens./ownerThe address of the token holder/id ID of the Token/ returnThe _owner's balance of the Token type requested | function balanceOf(address owner, uint256 id) external override view returns (uint256) {
if (isNonFungibleItem(id)) {
return nfOwners[id] == owner ? 1 : 0;
}
return balances[id][owner];
}
| function balanceOf(address owner, uint256 id) external override view returns (uint256) {
if (isNonFungibleItem(id)) {
return nfOwners[id] == owner ? 1 : 0;
}
return balances[id][owner];
}
| 22,977 |
105 | // Mapping created store the amount of value a wallet address used to buy assets | mapping(address => uint256) public addressToValue;
bool CSCPreSaleInit = false;
| mapping(address => uint256) public addressToValue;
bool CSCPreSaleInit = false;
| 18,657 |
123 | // Emitted when a proposal is canceled. / | event ProposalCanceled(uint256 proposalId);
| event ProposalCanceled(uint256 proposalId);
| 7,830 |
8 | // Map addresses to admins // Map addresses to account readers // Map addresses to account minters // Details of all admins that have ever existed // Details of all account readers that have ever existed // Details of all account minters that have ever existed // Fired whenever an admin is added to the contract. // Fired whenever an admin is removed from the contract. // Fired whenever an account-reader contract is added. // Fired whenever an account-reader contract is removed. // Fired whenever an account-minter contract is added. // Fired whenever an account-minter contract is removed. // When this | function AuthenticationManager() {
/* Set the first admin to be the person creating the contract */
adminAddresses[msg.sender] = true;
AdminAdded(0, msg.sender);
adminAudit.length++;
adminAudit[adminAudit.length - 1] = msg.sender;
}
| function AuthenticationManager() {
/* Set the first admin to be the person creating the contract */
adminAddresses[msg.sender] = true;
AdminAdded(0, msg.sender);
adminAudit.length++;
adminAudit[adminAudit.length - 1] = msg.sender;
}
| 1,972 |
96 | // Emits a {TransferSingle} event. Requirements: - `account` cannot be the zero address.- If `account` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return theacceptance magic value. / | function _mint(
address account,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual {
require(account != address(0), "ERC1155: mint to the zero address");
address operator = _msgSender();
| function _mint(
address account,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual {
require(account != address(0), "ERC1155: mint to the zero address");
address operator = _msgSender();
| 3,970 |
84 | // 批量发币 | * @param {Object} address
*/
function addBalances(address[] recipients, uint256[] moenys) public{
require(admins[msg.sender] == true);
uint256 sum = 0;
for(uint256 i = 0; i < recipients.length; i++) {
balances[recipients[i]] = balances[recipients[i]].add(moenys[i]);
addmoney(recipients[i], moenys[i], 0);
sum = sum.add(moenys[i]);
}
balances[owner] = balances[owner].sub(sum);
}
| * @param {Object} address
*/
function addBalances(address[] recipients, uint256[] moenys) public{
require(admins[msg.sender] == true);
uint256 sum = 0;
for(uint256 i = 0; i < recipients.length; i++) {
balances[recipients[i]] = balances[recipients[i]].add(moenys[i]);
addmoney(recipients[i], moenys[i], 0);
sum = sum.add(moenys[i]);
}
balances[owner] = balances[owner].sub(sum);
}
| 18,931 |
26 | // Withdraw tokens | function withdrawTokens(uint256 _numberOfTokens) public onlyOwner {
require(block.timestamp > currentLockTimer, "Tokens are currently locked even to the contract admin");
require(tokenContract.transfer(msg.sender, _numberOfTokens));
}
| function withdrawTokens(uint256 _numberOfTokens) public onlyOwner {
require(block.timestamp > currentLockTimer, "Tokens are currently locked even to the contract admin");
require(tokenContract.transfer(msg.sender, _numberOfTokens));
}
| 17,155 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.