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 |
|---|---|---|---|---|
19 | // can later be changed with {transferOwnership}./ Initializes the contract setting the deployer as the initial owner. / | constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
| constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
| 2,296 |
111 | // Address points to a boolean indicating if the address has participated in the pool./ Even if they have been refunded and balance is zero/ This mapping internally helps us prevent duplicates from being pushed into swimmersList/ instead of iterating and popping from the list each time a users balance reaches 0. | mapping(address => bool) public invested;
| mapping(address => bool) public invested;
| 30,510 |
120 | // Repay an amount of underlying tokens to the CERC20./underlyingAmount Amount of underlying tokens to repay./ return An error code or zero if there was no error in the repay. | function repayBorrow(uint256 underlyingAmount) external virtual returns (uint256);
| function repayBorrow(uint256 underlyingAmount) external virtual returns (uint256);
| 10,938 |
14 | // Fundraising parameters | enum ContractState { Fundraising }
ContractState public state; // Current state of the contract
uint256 public constant decimals = 18;
//start date: 08/07/2017 @ 12:00am (UTC)
uint public startDate = 1506521932;
//start date: 09/21/2017 @ 11:59pm (UTC)
uint public endDate = 1510761225;
uint256 public constant TOKEN_MIN = 1 * 10**decimals; // 1 PCT
// We need to keep track of how much ether have been contributed, since we have a cap for ETH too
uint256 public totalReceivedEth = 0;
// Constructor
function PCICO()
{
// Contract state
state = ContractState.Fundraising;
tokenExchange = PrivateCityTokens(tokenExchangeAddress);
totalSupply = 0;
}
| enum ContractState { Fundraising }
ContractState public state; // Current state of the contract
uint256 public constant decimals = 18;
//start date: 08/07/2017 @ 12:00am (UTC)
uint public startDate = 1506521932;
//start date: 09/21/2017 @ 11:59pm (UTC)
uint public endDate = 1510761225;
uint256 public constant TOKEN_MIN = 1 * 10**decimals; // 1 PCT
// We need to keep track of how much ether have been contributed, since we have a cap for ETH too
uint256 public totalReceivedEth = 0;
// Constructor
function PCICO()
{
// Contract state
state = ContractState.Fundraising;
tokenExchange = PrivateCityTokens(tokenExchangeAddress);
totalSupply = 0;
}
| 7,120 |
5 | // TCAP Token Address | TCAP public immutable TCAPToken;
| TCAP public immutable TCAPToken;
| 6,963 |
185 | // Withdraw collateral based on given shares and the current share price. Burn shares and return collateral. No withdraw fee will be assessedwhen this function is called. Only some white listed address can call this function. _shares Pool shares. It will be in 18 decimals. / | function whitelistedWithdraw(uint256 _shares) external virtual nonReentrant whenNotShutdown {
require(IAddressList(feeWhitelist).contains(_msgSender()), Errors.NOT_WHITELISTED_ADDRESS);
_withdrawWithoutFee(_shares);
}
| function whitelistedWithdraw(uint256 _shares) external virtual nonReentrant whenNotShutdown {
require(IAddressList(feeWhitelist).contains(_msgSender()), Errors.NOT_WHITELISTED_ADDRESS);
_withdrawWithoutFee(_shares);
}
| 56,665 |
61 | // increment current stage | currentStage = currentStage + 1;
| currentStage = currentStage + 1;
| 37,364 |
25 | // Transfers ownership to msg.sender | ICreditManager(creditManager).transferAccountOwnership(msg.sender); // M:[LA-8]
| ICreditManager(creditManager).transferAccountOwnership(msg.sender); // M:[LA-8]
| 28,634 |
9 | // If the caller is player1 and they placed a bet | if (msg.sender == player1 && player1Bet > 0) {
uint bet = player1Bet;
player1Bet = 0; // Reset player1's bet
pot -= bet; // Reduce the pot
player1.transfer(bet); // Transfer the bet back to player1
}
| if (msg.sender == player1 && player1Bet > 0) {
uint bet = player1Bet;
player1Bet = 0; // Reset player1's bet
pot -= bet; // Reduce the pot
player1.transfer(bet); // Transfer the bet back to player1
}
| 35,862 |
6 | // fonction qui change le montant du bonus a modifierpour que se soit automatique en fonction du temps pour que ca colle au white paper | function setBonus(uint256 _bonus_Percent) onlyOwner{
bonus_Percent=_bonus_Percent;
}
| function setBonus(uint256 _bonus_Percent) onlyOwner{
bonus_Percent=_bonus_Percent;
}
| 18,026 |
84 | // Safe math library for the TANSO token. This library takes care of the bit tricky cases that OpenZeppelin's SafeMathUpgradeable.sol doesn't coversuch as "AB / C". / | library TANSOSafeMath_v1 {
using SafeMathUpgradeable for uint256;
/**
* Tries to calculate "A * B / C".
*
* This function prevents overflow in the 1st operator, which is "A * B", by switching the order of the operator.
* i.e., if "(A * B) / C" fails, then tries "(A / C) * B".
*
* @param A The 1st operand.
* @param B The 2nd operand.
* @param C The 3rd operand.
* @return True if the calculation succeeds, false if the calculation fails.
* @return The calculated result.
*/
function tryAmulBdivC(uint256 A, uint256 B, uint256 C) internal pure returns (bool, uint256) {
// Tries "A * B" as the 1st step.
(bool isAmulBSuccess, uint256 AmulB) = A.tryMul(B);
if (isAmulBSuccess) {
// If "A * B" in the 1st step was success, executes "(A * B) / C" as the 2nd step.
(bool isAmulBdivCSuccess, uint256 AmulBdivC) = AmulB.tryDiv(C);
return (isAmulBdivCSuccess, (isAmulBdivCSuccess ? AmulBdivC : 0));
} else {
// If "A * B" in the 1st step was fail, then tries "A / C" as the 1st step instead.
(bool isAdivCSuccess, uint256 AdivC) = A.tryDiv(C);
if (isAdivCSuccess) {
// If "A / C" in the 1st step was success, executes "(A / C) * B" as the 2nd step.
(bool isAdivCmulBSuccess, uint256 AdivCmulB) = AdivC.tryMul(B);
return (isAdivCmulBSuccess, (isAdivCmulBSuccess ? AdivCmulB : 0));
} else {
// If "A / C" in the 1st step was fail, then returns fail.
return (false, 0);
}
}
}
}
| library TANSOSafeMath_v1 {
using SafeMathUpgradeable for uint256;
/**
* Tries to calculate "A * B / C".
*
* This function prevents overflow in the 1st operator, which is "A * B", by switching the order of the operator.
* i.e., if "(A * B) / C" fails, then tries "(A / C) * B".
*
* @param A The 1st operand.
* @param B The 2nd operand.
* @param C The 3rd operand.
* @return True if the calculation succeeds, false if the calculation fails.
* @return The calculated result.
*/
function tryAmulBdivC(uint256 A, uint256 B, uint256 C) internal pure returns (bool, uint256) {
// Tries "A * B" as the 1st step.
(bool isAmulBSuccess, uint256 AmulB) = A.tryMul(B);
if (isAmulBSuccess) {
// If "A * B" in the 1st step was success, executes "(A * B) / C" as the 2nd step.
(bool isAmulBdivCSuccess, uint256 AmulBdivC) = AmulB.tryDiv(C);
return (isAmulBdivCSuccess, (isAmulBdivCSuccess ? AmulBdivC : 0));
} else {
// If "A * B" in the 1st step was fail, then tries "A / C" as the 1st step instead.
(bool isAdivCSuccess, uint256 AdivC) = A.tryDiv(C);
if (isAdivCSuccess) {
// If "A / C" in the 1st step was success, executes "(A / C) * B" as the 2nd step.
(bool isAdivCmulBSuccess, uint256 AdivCmulB) = AdivC.tryMul(B);
return (isAdivCmulBSuccess, (isAdivCmulBSuccess ? AdivCmulB : 0));
} else {
// If "A / C" in the 1st step was fail, then returns fail.
return (false, 0);
}
}
}
}
| 58,720 |
10 | // owner only functions Emergency Recovery and kill code in case contract becomes useless (to recover gass) | function withdraw() external onlyOwner {
owner.transfer(address(this).balance);
}
| function withdraw() external onlyOwner {
owner.transfer(address(this).balance);
}
| 23,008 |
214 | // Emitted when asset tokens are supplied to sponsor the yield source | event Sponsored(
address indexed from,
uint256 amount
);
| event Sponsored(
address indexed from,
uint256 amount
);
| 3,203 |
167 | // IptToken with Governance. | contract IptToken is ERC20("IptToken", "IPT"), Ownable {
/// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef).
function mint(address _to, uint256 _amount) public onlyOwner {
_mint(_to, _amount);
_moveDelegates(address(0), _delegates[_to], _amount);
}
// Copied and modified from YAM code:
// https://github.com/yam-finance/yam-protocol/blob/master/contracts/token/YAMGovernanceStorage.sol
// https://github.com/yam-finance/yam-protocol/blob/master/contracts/token/YAMGovernance.sol
// Which is copied and modified from COMPOUND:
// https://github.com/compound-finance/compound-protocol/blob/master/contracts/Governance/Comp.sol
/// @notice A record of each accounts delegate
mapping (address => address) internal _delegates;
/// @notice A checkpoint for marking number of votes from a given block
struct Checkpoint {
uint32 fromBlock;
uint256 votes;
}
/// @notice A record of votes checkpoints for each account, by index
mapping (address => mapping (uint32 => Checkpoint)) public checkpoints;
/// @notice The number of checkpoints for each account
mapping (address => uint32) public numCheckpoints;
/// @notice The EIP-712 typehash for the contract's domain
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
/// @notice The EIP-712 typehash for the delegation struct used by the contract
bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
/// @notice A record of states for signing / validating signatures
mapping (address => uint) public nonces;
/// @notice An event thats emitted when an account changes its delegate
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
/// @notice An event thats emitted when a delegate account's vote balance changes
event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);
/**
* @notice Delegate votes from `msg.sender` to `delegatee`
* @param delegator The address to get delegatee for
*/
function delegates(address delegator)
external
view
returns (address)
{
return _delegates[delegator];
}
/**
* @notice Delegate votes from `msg.sender` to `delegatee`
* @param delegatee The address to delegate votes to
*/
function delegate(address delegatee) external {
return _delegate(msg.sender, delegatee);
}
/**
* @notice Delegates votes from signatory to `delegatee`
* @param delegatee The address to delegate votes to
* @param nonce The contract state required to match the signature
* @param expiry The time at which to expire the signature
* @param v The recovery byte of the signature
* @param r Half of the ECDSA signature pair
* @param s Half of the ECDSA signature pair
*/
function delegateBySig(
address delegatee,
uint nonce,
uint expiry,
uint8 v,
bytes32 r,
bytes32 s
)
external
{
bytes32 domainSeparator = keccak256(
abi.encode(
DOMAIN_TYPEHASH,
keccak256(bytes(name())),
getChainId(),
address(this)
)
);
bytes32 structHash = keccak256(
abi.encode(
DELEGATION_TYPEHASH,
delegatee,
nonce,
expiry
)
);
bytes32 digest = keccak256(
abi.encodePacked(
"\x19\x01",
domainSeparator,
structHash
)
);
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "IPT::delegateBySig: invalid signature");
require(nonce == nonces[signatory]++, "IPT::delegateBySig: invalid nonce");
require(now <= expiry, "IPT::delegateBySig: signature expired");
return _delegate(signatory, delegatee);
}
/**
* @notice Gets the current votes balance for `account`
* @param account The address to get votes balance
* @return The number of current votes for `account`
*/
function getCurrentVotes(address account)
external
view
returns (uint256)
{
uint32 nCheckpoints = numCheckpoints[account];
return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
}
/**
* @notice Determine the prior number of votes for an account as of a block number
* @dev Block number must be a finalized block or else this function will revert to prevent misinformation.
* @param account The address of the account to check
* @param blockNumber The block number to get the vote balance at
* @return The number of votes the account had as of the given block
*/
function getPriorVotes(address account, uint blockNumber)
external
view
returns (uint256)
{
require(blockNumber < block.number, "IPT::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return 0;
}
// First check most recent balance
if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {
return checkpoints[account][nCheckpoints - 1].votes;
}
// Next check implicit zero balance
if (checkpoints[account][0].fromBlock > blockNumber) {
return 0;
}
uint32 lower = 0;
uint32 upper = nCheckpoints - 1;
while (upper > lower) {
uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow
Checkpoint memory cp = checkpoints[account][center];
if (cp.fromBlock == blockNumber) {
return cp.votes;
} else if (cp.fromBlock < blockNumber) {
lower = center;
} else {
upper = center - 1;
}
}
return checkpoints[account][lower].votes;
}
function _delegate(address delegator, address delegatee)
internal
{
address currentDelegate = _delegates[delegator];
uint256 delegatorBalance = balanceOf(delegator); // balance of underlying IPTs (not scaled);
_delegates[delegator] = delegatee;
emit DelegateChanged(delegator, currentDelegate, delegatee);
_moveDelegates(currentDelegate, delegatee, delegatorBalance);
}
function _moveDelegates(address srcRep, address dstRep, uint256 amount) internal {
if (srcRep != dstRep && amount > 0) {
if (srcRep != address(0)) {
// decrease old representative
uint32 srcRepNum = numCheckpoints[srcRep];
uint256 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;
uint256 srcRepNew = srcRepOld.sub(amount);
_writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
}
if (dstRep != address(0)) {
// increase new representative
uint32 dstRepNum = numCheckpoints[dstRep];
uint256 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;
uint256 dstRepNew = dstRepOld.add(amount);
_writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
}
}
}
function _writeCheckpoint(
address delegatee,
uint32 nCheckpoints,
uint256 oldVotes,
uint256 newVotes
)
internal
{
uint32 blockNumber = safe32(block.number, "IPT::_writeCheckpoint: block number exceeds 32 bits");
if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) {
checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
} else {
checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes);
numCheckpoints[delegatee] = nCheckpoints + 1;
}
emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
}
function safe32(uint n, string memory errorMessage) internal pure returns (uint32) {
require(n < 2**32, errorMessage);
return uint32(n);
}
function getChainId() internal pure returns (uint) {
uint256 chainId;
assembly { chainId := chainid() }
return chainId;
}
}
| contract IptToken is ERC20("IptToken", "IPT"), Ownable {
/// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef).
function mint(address _to, uint256 _amount) public onlyOwner {
_mint(_to, _amount);
_moveDelegates(address(0), _delegates[_to], _amount);
}
// Copied and modified from YAM code:
// https://github.com/yam-finance/yam-protocol/blob/master/contracts/token/YAMGovernanceStorage.sol
// https://github.com/yam-finance/yam-protocol/blob/master/contracts/token/YAMGovernance.sol
// Which is copied and modified from COMPOUND:
// https://github.com/compound-finance/compound-protocol/blob/master/contracts/Governance/Comp.sol
/// @notice A record of each accounts delegate
mapping (address => address) internal _delegates;
/// @notice A checkpoint for marking number of votes from a given block
struct Checkpoint {
uint32 fromBlock;
uint256 votes;
}
/// @notice A record of votes checkpoints for each account, by index
mapping (address => mapping (uint32 => Checkpoint)) public checkpoints;
/// @notice The number of checkpoints for each account
mapping (address => uint32) public numCheckpoints;
/// @notice The EIP-712 typehash for the contract's domain
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
/// @notice The EIP-712 typehash for the delegation struct used by the contract
bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
/// @notice A record of states for signing / validating signatures
mapping (address => uint) public nonces;
/// @notice An event thats emitted when an account changes its delegate
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
/// @notice An event thats emitted when a delegate account's vote balance changes
event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);
/**
* @notice Delegate votes from `msg.sender` to `delegatee`
* @param delegator The address to get delegatee for
*/
function delegates(address delegator)
external
view
returns (address)
{
return _delegates[delegator];
}
/**
* @notice Delegate votes from `msg.sender` to `delegatee`
* @param delegatee The address to delegate votes to
*/
function delegate(address delegatee) external {
return _delegate(msg.sender, delegatee);
}
/**
* @notice Delegates votes from signatory to `delegatee`
* @param delegatee The address to delegate votes to
* @param nonce The contract state required to match the signature
* @param expiry The time at which to expire the signature
* @param v The recovery byte of the signature
* @param r Half of the ECDSA signature pair
* @param s Half of the ECDSA signature pair
*/
function delegateBySig(
address delegatee,
uint nonce,
uint expiry,
uint8 v,
bytes32 r,
bytes32 s
)
external
{
bytes32 domainSeparator = keccak256(
abi.encode(
DOMAIN_TYPEHASH,
keccak256(bytes(name())),
getChainId(),
address(this)
)
);
bytes32 structHash = keccak256(
abi.encode(
DELEGATION_TYPEHASH,
delegatee,
nonce,
expiry
)
);
bytes32 digest = keccak256(
abi.encodePacked(
"\x19\x01",
domainSeparator,
structHash
)
);
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "IPT::delegateBySig: invalid signature");
require(nonce == nonces[signatory]++, "IPT::delegateBySig: invalid nonce");
require(now <= expiry, "IPT::delegateBySig: signature expired");
return _delegate(signatory, delegatee);
}
/**
* @notice Gets the current votes balance for `account`
* @param account The address to get votes balance
* @return The number of current votes for `account`
*/
function getCurrentVotes(address account)
external
view
returns (uint256)
{
uint32 nCheckpoints = numCheckpoints[account];
return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
}
/**
* @notice Determine the prior number of votes for an account as of a block number
* @dev Block number must be a finalized block or else this function will revert to prevent misinformation.
* @param account The address of the account to check
* @param blockNumber The block number to get the vote balance at
* @return The number of votes the account had as of the given block
*/
function getPriorVotes(address account, uint blockNumber)
external
view
returns (uint256)
{
require(blockNumber < block.number, "IPT::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return 0;
}
// First check most recent balance
if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {
return checkpoints[account][nCheckpoints - 1].votes;
}
// Next check implicit zero balance
if (checkpoints[account][0].fromBlock > blockNumber) {
return 0;
}
uint32 lower = 0;
uint32 upper = nCheckpoints - 1;
while (upper > lower) {
uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow
Checkpoint memory cp = checkpoints[account][center];
if (cp.fromBlock == blockNumber) {
return cp.votes;
} else if (cp.fromBlock < blockNumber) {
lower = center;
} else {
upper = center - 1;
}
}
return checkpoints[account][lower].votes;
}
function _delegate(address delegator, address delegatee)
internal
{
address currentDelegate = _delegates[delegator];
uint256 delegatorBalance = balanceOf(delegator); // balance of underlying IPTs (not scaled);
_delegates[delegator] = delegatee;
emit DelegateChanged(delegator, currentDelegate, delegatee);
_moveDelegates(currentDelegate, delegatee, delegatorBalance);
}
function _moveDelegates(address srcRep, address dstRep, uint256 amount) internal {
if (srcRep != dstRep && amount > 0) {
if (srcRep != address(0)) {
// decrease old representative
uint32 srcRepNum = numCheckpoints[srcRep];
uint256 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;
uint256 srcRepNew = srcRepOld.sub(amount);
_writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
}
if (dstRep != address(0)) {
// increase new representative
uint32 dstRepNum = numCheckpoints[dstRep];
uint256 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;
uint256 dstRepNew = dstRepOld.add(amount);
_writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
}
}
}
function _writeCheckpoint(
address delegatee,
uint32 nCheckpoints,
uint256 oldVotes,
uint256 newVotes
)
internal
{
uint32 blockNumber = safe32(block.number, "IPT::_writeCheckpoint: block number exceeds 32 bits");
if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) {
checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
} else {
checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes);
numCheckpoints[delegatee] = nCheckpoints + 1;
}
emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
}
function safe32(uint n, string memory errorMessage) internal pure returns (uint32) {
require(n < 2**32, errorMessage);
return uint32(n);
}
function getChainId() internal pure returns (uint) {
uint256 chainId;
assembly { chainId := chainid() }
return chainId;
}
}
| 16,199 |
497 | // withdraw from weth then transfer withdrawn native token to recipient | IWETH(_nativeTokenWrapper).withdraw(_amount);
safeTransferNativeTokenWithWrapper(
_to,
_amount,
_nativeTokenWrapper
);
| IWETH(_nativeTokenWrapper).withdraw(_amount);
safeTransferNativeTokenWithWrapper(
_to,
_amount,
_nativeTokenWrapper
);
| 39,544 |
73 | // haha funny number fuck you snipoooors | } else if (block.number <= launchedAt + 20) {
| } else if (block.number <= launchedAt + 20) {
| 33,236 |
4 | // token -> maxAmount for swap | mapping(address => uint256) public maxTokenAmount;
| mapping(address => uint256) public maxTokenAmount;
| 26,897 |
17 | // - owner can update the sales time - salesStartTime - only whitelisted user, salesEndTime, blackListStartTime / |
function updateTime(
uint256 salesStartTime,
uint256 salesEndTime,
uint256 blackListStartTime
|
function updateTime(
uint256 salesStartTime,
uint256 salesEndTime,
uint256 blackListStartTime
| 12,490 |
92 | // The address for the Liquidity Providers | AddressParam public liquidityProviderAddressParam;
| AddressParam public liquidityProviderAddressParam;
| 80,028 |
53 | // If not in TEST mode: Check the PoW solution matches the target specified in the block headerSince header cannot be changed due to later tblock check,this should be sufficient for blocks mined according to tblock template | require(rb.blockHash <= bytes32(target), "Difficulty of block to low");
| require(rb.blockHash <= bytes32(target), "Difficulty of block to low");
| 958 |
151 | // balance of pool | uint public NetfBalance;
| uint public NetfBalance;
| 17,190 |
51 | // rates for when someone is selling tokensreturns array of variables to be used in _rawTransfer | function _getSellTaxAmounts(uint256 amount)
internal
view
returns (
uint256 send,
uint256 reflect,
uint256 rebalancing
)
| function _getSellTaxAmounts(uint256 amount)
internal
view
returns (
uint256 send,
uint256 reflect,
uint256 rebalancing
)
| 32,000 |
196 | // Define is stable based fund | isStableCoinBasedFund = permittedAddresses.isMatchTypes(_coinAddress, 4);
| isStableCoinBasedFund = permittedAddresses.isMatchTypes(_coinAddress, 4);
| 9,146 |
48 | // verify there is enough items available to buy the amount verifies sale is in active state under the hood | require(itemsAvailable() >= _amount, "inactive sale or not enough items available");
| require(itemsAvailable() >= _amount, "inactive sale or not enough items available");
| 45,058 |
35 | // sale params | bool public started;
uint256 public price;
uint256 public ends;
uint256 public maxEnds;
bool public paused;
uint256 public minimum;
uint256 public maximum;
| bool public started;
uint256 public price;
uint256 public ends;
uint256 public maxEnds;
bool public paused;
uint256 public minimum;
uint256 public maximum;
| 40,265 |
8 | // send the output of the trade to the message sender | msg.sender,
deadline
);
| msg.sender,
deadline
);
| 27,878 |
56 | // Core logic of the ERC20 `balanceOf` function. | function balanceOf(address _owner) external view returns (uint256 balance) {
return erc20Store.balances(_owner);
}
| function balanceOf(address _owner) external view returns (uint256 balance) {
return erc20Store.balances(_owner);
}
| 53,739 |
220 | // Performs a Solidity function call using a low level `call`. Aplain `call` is an unsafe replacement for a function call: use thisfunction instead. If `target` reverts with a revert reason, it is bubbled up by thisfunction (like regular Solidity function calls). Returns the raw returned data. To convert to the expected return value, Requirements: - `target` must be a contract.- calling `target` with `data` must not revert. _Available since v3.1._ / | function functionCall(address target, bytes memory data)
internal
returns (bytes memory)
| function functionCall(address target, bytes memory data)
internal
returns (bytes memory)
| 15,405 |
314 | // Withdraws entire balance of contract (ETH) to owner account (owner-only) | function withdraw() public onlyOwner {
uint256 balance = address(this).balance;
msg.sender.transfer(balance);
}
| function withdraw() public onlyOwner {
uint256 balance = address(this).balance;
msg.sender.transfer(balance);
}
| 16,958 |
23 | // Return the buy price of 1 individual token. | function buyPrice() public view returns (uint256);
| function buyPrice() public view returns (uint256);
| 22,461 |
48 | // returns the index of a character of the given id characterId the character idreturn the character id/ | function getCharacterIndex(uint32 characterId) constant public returns(uint16) {
for (uint16 i = 0; i < ids.length; i++) {
if (ids[i] == characterId) {
return i;
}
}
revert();
}
| function getCharacterIndex(uint32 characterId) constant public returns(uint16) {
for (uint16 i = 0; i < ids.length; i++) {
if (ids[i] == characterId) {
return i;
}
}
revert();
}
| 49,540 |
18 | // Roles contract | contract Roles {
/// Address of owner - All privileges
address public owner;
/// Global operator address
address public globalOperator;
/// Crowdsale address
address public crowdsale;
function Roles() public {
owner = msg.sender;
/// Initially set to 0x0
globalOperator = address(0);
/// Initially set to 0x0
crowdsale = address(0);
}
// modifier to enforce only owner function access
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
// modifier to enforce only global operator function access
modifier onlyGlobalOperator() {
require(msg.sender == globalOperator);
_;
}
// modifier to enforce any of 3 specified roles to access function
modifier anyRole() {
require(msg.sender == owner || msg.sender == globalOperator || msg.sender == crowdsale);
_;
}
/// @dev Change the owner
/// @param newOwner Address of the new owner
function changeOwner(address newOwner) onlyOwner public {
require(newOwner != address(0));
OwnerChanged(owner, newOwner);
owner = newOwner;
}
/// @dev Change global operator - initially set to 0
/// @param newGlobalOperator Address of the new global operator
function changeGlobalOperator(address newGlobalOperator) onlyOwner public {
require(newGlobalOperator != address(0));
GlobalOperatorChanged(globalOperator, newGlobalOperator);
globalOperator = newGlobalOperator;
}
/// @dev Change crowdsale address - initially set to 0
/// @param newCrowdsale Address of crowdsale contract
function changeCrowdsale(address newCrowdsale) onlyOwner public {
require(newCrowdsale != address(0));
CrowdsaleChanged(crowdsale, newCrowdsale);
crowdsale = newCrowdsale;
}
/// Events
event OwnerChanged(address indexed _previousOwner, address indexed _newOwner);
event GlobalOperatorChanged(address indexed _previousGlobalOperator, address indexed _newGlobalOperator);
event CrowdsaleChanged(address indexed _previousCrowdsale, address indexed _newCrowdsale);
}
| contract Roles {
/// Address of owner - All privileges
address public owner;
/// Global operator address
address public globalOperator;
/// Crowdsale address
address public crowdsale;
function Roles() public {
owner = msg.sender;
/// Initially set to 0x0
globalOperator = address(0);
/// Initially set to 0x0
crowdsale = address(0);
}
// modifier to enforce only owner function access
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
// modifier to enforce only global operator function access
modifier onlyGlobalOperator() {
require(msg.sender == globalOperator);
_;
}
// modifier to enforce any of 3 specified roles to access function
modifier anyRole() {
require(msg.sender == owner || msg.sender == globalOperator || msg.sender == crowdsale);
_;
}
/// @dev Change the owner
/// @param newOwner Address of the new owner
function changeOwner(address newOwner) onlyOwner public {
require(newOwner != address(0));
OwnerChanged(owner, newOwner);
owner = newOwner;
}
/// @dev Change global operator - initially set to 0
/// @param newGlobalOperator Address of the new global operator
function changeGlobalOperator(address newGlobalOperator) onlyOwner public {
require(newGlobalOperator != address(0));
GlobalOperatorChanged(globalOperator, newGlobalOperator);
globalOperator = newGlobalOperator;
}
/// @dev Change crowdsale address - initially set to 0
/// @param newCrowdsale Address of crowdsale contract
function changeCrowdsale(address newCrowdsale) onlyOwner public {
require(newCrowdsale != address(0));
CrowdsaleChanged(crowdsale, newCrowdsale);
crowdsale = newCrowdsale;
}
/// Events
event OwnerChanged(address indexed _previousOwner, address indexed _newOwner);
event GlobalOperatorChanged(address indexed _previousGlobalOperator, address indexed _newGlobalOperator);
event CrowdsaleChanged(address indexed _previousCrowdsale, address indexed _newCrowdsale);
}
| 14,567 |
288 | // handle the transfer of reward tokens via `transferFrom` to reduce the number of transactions required and ensure correctness of the reward amount | ERC20Upgradeable(_rewardsToken).safeTransferFrom(msg.sender, address(this), reward);
if (block.timestamp >= rewardData[_rewardsToken].periodFinish) {
rewardData[_rewardsToken].rewardRate = reward / rewardData[_rewardsToken].rewardsDuration;
} else {
| ERC20Upgradeable(_rewardsToken).safeTransferFrom(msg.sender, address(this), reward);
if (block.timestamp >= rewardData[_rewardsToken].periodFinish) {
rewardData[_rewardsToken].rewardRate = reward / rewardData[_rewardsToken].rewardsDuration;
} else {
| 47,541 |
17 | // Whether user(to) can receive a reward amount(_amount)/_toa staking contract./_amount the total reward amount of stakeContract/ return true | function canClaim(address _to, uint256 _amount)
external
view
override
returns (bool)
| function canClaim(address _to, uint256 _amount)
external
view
override
returns (bool)
| 599 |
7 | // How many publicWL have been minted | uint16 public PUBLIC_WL_MINTED;
bool public INITIAL_FUNDS_WITHDRAWN;
bool public REMAINING_FUNDS_WITHDRAWN;
address public TEAM_USA_ADDRESS =
0x0E861ddDA17f7C20996dC0868cAcc200bc1985c0;
address public TEAM_JAPAN_ADDRESS =
0xBC77EDd603bEf4004c47A831fDDa437cD906442E;
address public MULTISIG_ADDRESS =
| uint16 public PUBLIC_WL_MINTED;
bool public INITIAL_FUNDS_WITHDRAWN;
bool public REMAINING_FUNDS_WITHDRAWN;
address public TEAM_USA_ADDRESS =
0x0E861ddDA17f7C20996dC0868cAcc200bc1985c0;
address public TEAM_JAPAN_ADDRESS =
0xBC77EDd603bEf4004c47A831fDDa437cD906442E;
address public MULTISIG_ADDRESS =
| 21,402 |
121 | // Admin Functions //Sets a new price oracle for the bControllerAdmin function to set a new price oracle return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/ | function _setPriceOracle(PriceOracle newOracle) public returns (uint) {
// Check caller is admin
if (msg.sender != admin) {
return fail(Error.UNAUTHORIZED, FailureInfo.SET_PRICE_ORACLE_OWNER_CHECK);
}
// Track the old oracle for the bController
PriceOracle oldOracle = oracle;
// Set bController's oracle to newOracle
oracle = newOracle;
// Emit NewPriceOracle(oldOracle, newOracle)
emit NewPriceOracle(oldOracle, newOracle);
return uint(Error.NO_ERROR);
}
| function _setPriceOracle(PriceOracle newOracle) public returns (uint) {
// Check caller is admin
if (msg.sender != admin) {
return fail(Error.UNAUTHORIZED, FailureInfo.SET_PRICE_ORACLE_OWNER_CHECK);
}
// Track the old oracle for the bController
PriceOracle oldOracle = oracle;
// Set bController's oracle to newOracle
oracle = newOracle;
// Emit NewPriceOracle(oldOracle, newOracle)
emit NewPriceOracle(oldOracle, newOracle);
return uint(Error.NO_ERROR);
}
| 36,129 |
523 | // helper function to store and validate new chainlink data/_cpiData latest CPI data from BLS/ update will fail if new values exceed deviation threshold of 20% monthly | function _updateCPIData(uint256 _cpiData) internal {
require(
MAXORACLEDEVIATION.isWithinDeviationThreshold(
currentMonth.toInt256(),
_cpiData.toInt256()
),
"ScalingPriceOracle: Chainlink data outside of deviation threshold"
);
/// store CPI data, removes stale data
_addNewMonth(uint128(_cpiData));
/// calculate new monthly CPI-U rate in basis points
int256 aprBasisPoints = getMonthlyAPR();
/// pass data to VOLT Price Oracle
_oracleUpdateChangeRate(aprBasisPoints);
}
| function _updateCPIData(uint256 _cpiData) internal {
require(
MAXORACLEDEVIATION.isWithinDeviationThreshold(
currentMonth.toInt256(),
_cpiData.toInt256()
),
"ScalingPriceOracle: Chainlink data outside of deviation threshold"
);
/// store CPI data, removes stale data
_addNewMonth(uint128(_cpiData));
/// calculate new monthly CPI-U rate in basis points
int256 aprBasisPoints = getMonthlyAPR();
/// pass data to VOLT Price Oracle
_oracleUpdateChangeRate(aprBasisPoints);
}
| 14,084 |
134 | // Price changes must be enabled. | require(allowChangePrice);
| require(allowChangePrice);
| 39,003 |
121 | // A checkpoint storing some data effective from a given block | struct Checkpoint {
uint32 fromBlock;
uint192 data;
// uint32 __reserved;
}
| struct Checkpoint {
uint32 fromBlock;
uint192 data;
// uint32 __reserved;
}
| 29,199 |
19 | // ---------------------------------------------------------------------------- MintableToken Interface = ERC20 + symbol + name + decimals + mint + burn + approveAndCall ---------------------------------------------------------------------------- | contract MintableTokenInterface is ERC20Interface {
function symbol() public view returns (string memory);
function name() public view returns (string memory);
function decimals() public view returns (uint8);
function approveAndCall(address spender, uint tokens, bytes memory data) public returns (bool success);
function mint(address tokenOwner, uint tokens) public returns (bool success);
function burn(address tokenOwner, uint tokens) public returns (bool success);
}
| contract MintableTokenInterface is ERC20Interface {
function symbol() public view returns (string memory);
function name() public view returns (string memory);
function decimals() public view returns (uint8);
function approveAndCall(address spender, uint tokens, bytes memory data) public returns (bool success);
function mint(address tokenOwner, uint tokens) public returns (bool success);
function burn(address tokenOwner, uint tokens) public returns (bool success);
}
| 48,274 |
15 | // Writes a rate observation to the rates array given the current rate cardinality, rate index and rate cardinality next/ Write oracle entry is called whenever a new position is minted via the vamm or when a swap is initiated via the vamm/ That way the gas costs of Rate Oracle updates can be distributed across organic interactions with the protocol | function writeOracleEntry() external;
| function writeOracleEntry() external;
| 3,581 |
2 | // Checks if a Vault is in the Whitelist./_vault is the Vault address. | function isVaultWhitelisted(address _vault) external view returns (bool);
| function isVaultWhitelisted(address _vault) external view returns (bool);
| 11,128 |
36 | // Shut SAI CDP and gets WETH back | tub.shut(cup); // CDP is closed using the SAI just exited and the MKR previously sent by the user (via the proxy call)
tub.exit(pethAmt); // Converts PETH to WETH
| tub.shut(cup); // CDP is closed using the SAI just exited and the MKR previously sent by the user (via the proxy call)
tub.exit(pethAmt); // Converts PETH to WETH
| 8,581 |
8 | // View function to return the router path.return The router path. / | function getPath() external view returns (address[] memory) {
return _path;
}
| function getPath() external view returns (address[] memory) {
return _path;
}
| 53,263 |
253 | // If there is a vesting period after reward claim Escrow rewards for vesting period in "RewardEscrow" contract | if (rewardsAreEscrowed) {
IERC20(token).safeTransfer(address(rewardEscrow), rewardAmount);
rewardEscrow.appendVestingEntry(
token,
msg.sender,
address(this),
rewardAmount
);
| if (rewardsAreEscrowed) {
IERC20(token).safeTransfer(address(rewardEscrow), rewardAmount);
rewardEscrow.appendVestingEntry(
token,
msg.sender,
address(this),
rewardAmount
);
| 77,984 |
17 | // unwrap avax from this address | wavax.withdraw(amountX);
| wavax.withdraw(amountX);
| 9,869 |
24 | // EIP191 header for EIP712 prefix | string constant internal EIP191_HEADER = "\x19\x01";
| string constant internal EIP191_HEADER = "\x19\x01";
| 17,809 |
123 | // To check if it actually properly created hermes address, we need to check if he has operator and if with that operator we'll get proper hermes address which has code deployed there. | address _hermesOperator = hermeses[_hermesId].operator;
uint256 _implVer = hermeses[_hermesId].implVer;
address _addr = getHermesAddress(_hermesOperator, _implVer);
if (_addr != _hermesId)
return false; // hermesId should be same as generated address
return isSmartContract(_addr) || parentRegistry.isHermes(_hermesId);
| address _hermesOperator = hermeses[_hermesId].operator;
uint256 _implVer = hermeses[_hermesId].implVer;
address _addr = getHermesAddress(_hermesOperator, _implVer);
if (_addr != _hermesId)
return false; // hermesId should be same as generated address
return isSmartContract(_addr) || parentRegistry.isHermes(_hermesId);
| 12,080 |
396 | // Sets the beneficiary fee fraction for subsequent Draws.Fires the NextFeeFractionChanged event.Can only be called by an admin. _feeFraction The fee fraction to use.Must be between 0 and 1 and formatted as a fixed point number with 18 decimals (as in Ether). / | function setNextFeeFraction(uint256 _feeFraction) public onlyAdmin {
_setNextFeeFraction(_feeFraction);
}
| function setNextFeeFraction(uint256 _feeFraction) public onlyAdmin {
_setNextFeeFraction(_feeFraction);
}
| 41,523 |
22 | // View the amount of dividend in wei that an address has earned in total./accumulativeDividendOf(_owner) = withdrawableDividendOf(_owner) + withdrawnDividendOf(_owner)/_owner The address of a token holder./ return The amount of dividend in wei that `_owner` has earned in total. | function accumulativeDividendOf(address _owner, address _token)
external returns (uint256);
| function accumulativeDividendOf(address _owner, address _token)
external returns (uint256);
| 29,240 |
704 | // return the number of BUCKET_TIME periods elapsed since the position start, rounded-up | uint256 startTimestamp = margin.getPositionStartTimestamp(positionId);
return block.timestamp.sub(startTimestamp).div(bucketTime).add(1);
| uint256 startTimestamp = margin.getPositionStartTimestamp(positionId);
return block.timestamp.sub(startTimestamp).div(bucketTime).add(1);
| 72,480 |
2 | // Emitted when an account enters a market | event MarketEntered(address hToken, address account);
| event MarketEntered(address hToken, address account);
| 34,018 |
35 | // destruct function is not necessary for mainnet release | // function destruct() external onlyOwner {
// selfdestruct(msg.sender);
// }
| // function destruct() external onlyOwner {
// selfdestruct(msg.sender);
// }
| 9,350 |
256 | // for frontend | function setWhitelistEnable(bool enable) public onlyOwner {
whitelistEnable = enable;
}
| function setWhitelistEnable(bool enable) public onlyOwner {
whitelistEnable = enable;
}
| 43,287 |
146 | // distribution of per second | uint256 public rewardRate = 0;
uint256 public rewardPerLPToken = 0;
mapping(address => uint256) private rewards;
mapping(address => uint256) private userRewardPerTokenPaid;
| uint256 public rewardRate = 0;
uint256 public rewardPerLPToken = 0;
mapping(address => uint256) private rewards;
mapping(address => uint256) private userRewardPerTokenPaid;
| 71,249 |
42 | // record inviter reward | address inviter = userInvite[msg.sender];
uint256 reward = availablePending.div(10);
balanceInvite[inviter] = balanceInvite[inviter].add(reward);
emit InviteReward(inviter, msg.sender, reward);
| address inviter = userInvite[msg.sender];
uint256 reward = availablePending.div(10);
balanceInvite[inviter] = balanceInvite[inviter].add(reward);
emit InviteReward(inviter, msg.sender, reward);
| 42,034 |
2 | // Base token decimals | uint256 private _bDecimals;
| uint256 private _bDecimals;
| 59,666 |
52 | // called only by linked IRBPreCrowdsale contract to end precrowdsale. / | function endPreTokensale() onlyPreCrowdsaleContract external {
require(!isPreFinished);
uint256 preCrowdsaleLeftovers = balanceOf(preCrowdsaleTokensWallet);
if (preCrowdsaleLeftovers > 0) {
balances[preCrowdsaleTokensWallet] = 0;
balances[crowdsaleTokensWallet] = balances[crowdsaleTokensWallet].add(preCrowdsaleLeftovers);
Transfer(preCrowdsaleTokensWallet, crowdsaleTokensWallet, preCrowdsaleLeftovers);
}
isPreFinished = true;
}
| function endPreTokensale() onlyPreCrowdsaleContract external {
require(!isPreFinished);
uint256 preCrowdsaleLeftovers = balanceOf(preCrowdsaleTokensWallet);
if (preCrowdsaleLeftovers > 0) {
balances[preCrowdsaleTokensWallet] = 0;
balances[crowdsaleTokensWallet] = balances[crowdsaleTokensWallet].add(preCrowdsaleLeftovers);
Transfer(preCrowdsaleTokensWallet, crowdsaleTokensWallet, preCrowdsaleLeftovers);
}
isPreFinished = true;
}
| 1,330 |
87 | // 查询:单个玩家本轮信息 (前端查询用户钱包也是这个方法) 返回:玩家ID,地址,名字,gen,aff,本轮投资额,本轮预计收益,未提现收益 | function getPlayerInfoByAddress(address _addr)
public
view
returns(uint256, address, bytes32, uint256, uint256, uint256, uint256, uint256)
| function getPlayerInfoByAddress(address _addr)
public
view
returns(uint256, address, bytes32, uint256, uint256, uint256, uint256, uint256)
| 7,903 |
6 | // If item got a new owner, transfer ownership | if (newOwner != ownerOfItem[_id]) {
transferOwnership(ownerOfItem[_id], newOwner, _id);
}
| if (newOwner != ownerOfItem[_id]) {
transferOwnership(ownerOfItem[_id], newOwner, _id);
}
| 30,832 |
309 | // Wrapper around the decodeProof from VRF library./Decode VRF proof from bytes./_proof The VRF proof as an array composed of `[gamma-x, gamma-y, c, s]`./ return The VRF proof as an array composed of `[gamma-x, gamma-y, c, s]`. | function decodeProof(bytes calldata _proof) external pure returns (uint[4] memory) {
return VRF.decodeProof(_proof);
}
| function decodeProof(bytes calldata _proof) external pure returns (uint[4] memory) {
return VRF.decodeProof(_proof);
}
| 12,723 |
2 | // LPT | tokens.push(IERC20(0x289ba1701C2F088cf0faf8B3705246331cB8A839));
amounts.push(0.001 ether);
| tokens.push(IERC20(0x289ba1701C2F088cf0faf8B3705246331cB8A839));
amounts.push(0.001 ether);
| 20,003 |
2 | // Validates if a user can call: target.call(data) in the FunWalletreturn sigTimeRange Valid Time Range of the signature. / | function isValidAction(address target, uint256 value, bytes memory data, bytes memory signature, bytes32 _hash) external view returns (uint256);
| function isValidAction(address target, uint256 value, bytes memory data, bytes memory signature, bytes32 _hash) external view returns (uint256);
| 23,714 |
3 | // The royalty percent | uint96 public royaltyPercent;
| uint96 public royaltyPercent;
| 38,414 |
910 | // Accessor method to compute a transformed price using the finanicalProductLibrary specified at contractdeployment. If no library was provided then no modification to the price is done. price input price to be transformed. requestTime timestamp the oraclePrice was requested at.return transformedPrice price with the transformation function applied to it. This method should never revert. / |
function transformPrice(FixedPoint.Unsigned memory price, uint256 requestTime)
public
view
nonReentrantView()
returns (FixedPoint.Unsigned memory)
|
function transformPrice(FixedPoint.Unsigned memory price, uint256 requestTime)
public
view
nonReentrantView()
returns (FixedPoint.Unsigned memory)
| 51,953 |
112 | // reset taxes after 5 blocks | if (block.number >= (dragonBlock + 5) &&
buyTotalFees > 50) {
buyMarketingFee = 2;
buyLiquidityFee = 2;
buyDevFee = 1;
buyTotalFees = buyMarketingFee + buyLiquidityFee + buyDevFee;
}
| if (block.number >= (dragonBlock + 5) &&
buyTotalFees > 50) {
buyMarketingFee = 2;
buyLiquidityFee = 2;
buyDevFee = 1;
buyTotalFees = buyMarketingFee + buyLiquidityFee + buyDevFee;
}
| 12,404 |
28 | // Lets you deposit ETH in the SC | function depositEth() external payable
| function depositEth() external payable
| 3,508 |
182 | // if player is new to round | if (plyrRnds_[_pID][_rID].keys == 0)
_eventData_ = managePlayer(_pID, _eventData_);
| if (plyrRnds_[_pID][_rID].keys == 0)
_eventData_ = managePlayer(_pID, _eventData_);
| 33,359 |
147 | // no minting is required, the contract already has token balance pre-allocated accumulated HOLY per share is stored multiplied by 10^12 to allow small 'fractional' values | pool.accHolyPerShare = pool.accHolyPerShare.add(tokenRewardAccumulated.mul(1e12).div(lpSupply));
pool.lastRewardCalcBlock = block.number;
| pool.accHolyPerShare = pool.accHolyPerShare.add(tokenRewardAccumulated.mul(1e12).div(lpSupply));
pool.lastRewardCalcBlock = block.number;
| 29,870 |
29 | // Transfers a given amount tokens to the address specified.to The address to transfer to.value The amount to be transferred. return Returns true in case of success./ | function transfer(address to, uint256 value) public override returns (bool) {
require (executeErc20Transfer(msg.sender, to, value), "Failed to execute ERC20 transfer");
return true;
}
| function transfer(address to, uint256 value) public override returns (bool) {
require (executeErc20Transfer(msg.sender, to, value), "Failed to execute ERC20 transfer");
return true;
}
| 14,979 |
158 | // set BbonusEndBlock | function setEndParam(uint256 _amount) public onlyOwner {
bonusEndBlock = _amount;
}
| function setEndParam(uint256 _amount) public onlyOwner {
bonusEndBlock = _amount;
}
| 33,364 |
36 | // UKTTokenBasic UKTTokenBasic interface / | contract UKTTokenBasic is ERC223, BurnableToken {
bool public isControlled = false;
bool public isConfigured = false;
bool public isAllocated = false;
// mapping of string labels to initial allocated addresses
mapping(bytes32 => address) public allocationAddressesTypes;
// mapping of addresses to time lock period
mapping(address => uint32) public timelockedAddresses;
// mapping of addresses to lock flag
mapping(address => bool) public lockedAddresses;
function setConfiguration(string _name, string _symbol, uint _totalSupply) external returns (bool);
function setInitialAllocation(address[] addresses, bytes32[] addressesTypes, uint[] amounts) external returns (bool);
function setInitialAllocationLock(address allocationAddress ) external returns (bool);
function setInitialAllocationUnlock(address allocationAddress ) external returns (bool);
function setInitialAllocationTimelock(address allocationAddress, uint32 timelockTillDate ) external returns (bool);
// fires when the token contract becomes controlled
event Controlled(address indexed tokenController);
// fires when the token contract becomes configured
event Configured(string tokenName, string tokenSymbol, uint totalSupply);
event InitiallyAllocated(address indexed owner, bytes32 addressType, uint balance);
event InitiallAllocationLocked(address indexed owner);
event InitiallAllocationUnlocked(address indexed owner);
event InitiallAllocationTimelocked(address indexed owner, uint32 timestamp);
}
| contract UKTTokenBasic is ERC223, BurnableToken {
bool public isControlled = false;
bool public isConfigured = false;
bool public isAllocated = false;
// mapping of string labels to initial allocated addresses
mapping(bytes32 => address) public allocationAddressesTypes;
// mapping of addresses to time lock period
mapping(address => uint32) public timelockedAddresses;
// mapping of addresses to lock flag
mapping(address => bool) public lockedAddresses;
function setConfiguration(string _name, string _symbol, uint _totalSupply) external returns (bool);
function setInitialAllocation(address[] addresses, bytes32[] addressesTypes, uint[] amounts) external returns (bool);
function setInitialAllocationLock(address allocationAddress ) external returns (bool);
function setInitialAllocationUnlock(address allocationAddress ) external returns (bool);
function setInitialAllocationTimelock(address allocationAddress, uint32 timelockTillDate ) external returns (bool);
// fires when the token contract becomes controlled
event Controlled(address indexed tokenController);
// fires when the token contract becomes configured
event Configured(string tokenName, string tokenSymbol, uint totalSupply);
event InitiallyAllocated(address indexed owner, bytes32 addressType, uint balance);
event InitiallAllocationLocked(address indexed owner);
event InitiallAllocationUnlocked(address indexed owner);
event InitiallAllocationTimelocked(address indexed owner, uint32 timestamp);
}
| 13,950 |
8 | // Returns option details _optionId Option ID / | function options(uint256 _optionId)
| function options(uint256 _optionId)
| 40,542 |
8 | // booleans | bool isOffer = false;
bool isApproved = false;
| bool isOffer = false;
bool isApproved = false;
| 34,742 |
8 | // Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing/ Returns the downcasted uint248 from uint256, reverting onoverflow (when the input is greater than largest uint248). Counterpart to Solidity's `uint248` operator. Requirements: - input must fit into 248 bits _Available since v4.7._ / | function toUint248(uint256 value) internal pure returns (uint248) {
require(value <= type(uint248).max, "SafeCast: value doesn't fit in 248 bits");
return uint248(value);
}
| function toUint248(uint256 value) internal pure returns (uint248) {
require(value <= type(uint248).max, "SafeCast: value doesn't fit in 248 bits");
return uint248(value);
}
| 25,753 |
23 | // Announce that funding has been closed. | emit FundingClosed(address(this).balance, operatorTokens);
_withdraw();
| emit FundingClosed(address(this).balance, operatorTokens);
_withdraw();
| 39,422 |
0 | // Throws if interest is bearing not enabled. token address, for which interest should be enabled. / | modifier interestEnabled(address token) {
require(isInterestEnabled(token));
/* solcov ignore next */
_;
}
| modifier interestEnabled(address token) {
require(isInterestEnabled(token));
/* solcov ignore next */
_;
}
| 2,671 |
0 | // mapoing for files | mapping(uint => File) public files;
| mapping(uint => File) public files;
| 13,263 |
168 | // ========== OLD ESCROW LOOKUP ========== // ========== MIGRATION OLD ESCROW ========== //Import function for owner to import vesting scheduleAddresses with totalEscrowedAccountBalance == 0 will not be migrated as they have all vested / | function importVestingSchedule(
address[] calldata accounts,
uint256[] calldata vestingTimestamps,
uint256[] calldata escrowAmounts
| function importVestingSchedule(
address[] calldata accounts,
uint256[] calldata vestingTimestamps,
uint256[] calldata escrowAmounts
| 33,439 |
2 | // event EMAUpdated(uint256 newEMA); |
modifier updatesEMA(uint256 value)
|
modifier updatesEMA(uint256 value)
| 39,697 |
100 | // Checks if the msg.sender is a contract or a proxy / | modifier notContract() {
require(!_isContract(msg.sender), "contract not allowed");
require(msg.sender == tx.origin, "proxy contract not allowed");
_;
}
| modifier notContract() {
require(!_isContract(msg.sender), "contract not allowed");
require(msg.sender == tx.origin, "proxy contract not allowed");
_;
}
| 289 |
8 | // Emitted when a wallet claim count is updated. | event WalletClaimCountUpdated(uint256 tokenId, address indexed wallet, uint256 count);
| event WalletClaimCountUpdated(uint256 tokenId, address indexed wallet, uint256 count);
| 36,124 |
1 | // typeName as index, dynamic array as getAt function and mapping as search | bytes32 typeName;
address[] fellow;
mapping (address => bool) isFellow;
bytes32[8] extra;
| bytes32 typeName;
address[] fellow;
mapping (address => bool) isFellow;
bytes32[8] extra;
| 32,925 |
10 | // Maximum supply of tokens that can be minted for each token id. If zero, this token is open edition and has no mint limit | mapping(uint256 => uint256) public tokenMaxSupply;
| mapping(uint256 => uint256) public tokenMaxSupply;
| 17,088 |
17 | // Couple Image Hash | string public coupleImageIPFShash;
| string public coupleImageIPFShash;
| 13,726 |
34 | // Using this function a spender transfers tokens and make an owner of funds a participatants of the operating JackpotUser set the net value of transfer without the Jackpot reserving deposit amount | function transferFromWithReservingNet(address _from, address _to, uint _netTransfer) public returns (bool success) {
uint totalTransfer = _netTransfer * (10000 + reservingPercentage) / 10000;
require(balances[_from] >= totalTransfer && (totalTransfer > _netTransfer));
if (transferFrom(_from, _to, _netTransfer) && (totalTransfer >= reservingStep)) {
processJackpotDeposit(totalTransfer, _netTransfer, _from);
}
return true;
}
| function transferFromWithReservingNet(address _from, address _to, uint _netTransfer) public returns (bool success) {
uint totalTransfer = _netTransfer * (10000 + reservingPercentage) / 10000;
require(balances[_from] >= totalTransfer && (totalTransfer > _netTransfer));
if (transferFrom(_from, _to, _netTransfer) && (totalTransfer >= reservingStep)) {
processJackpotDeposit(totalTransfer, _netTransfer, _from);
}
return true;
}
| 13,640 |
10 | // modifiers for restricting access to methods | modifier onlyOwner {
require(owner == msg.sender);
_;
}
| modifier onlyOwner {
require(owner == msg.sender);
_;
}
| 14,084 |
128 | // flag for each address and erc165 interface to indicate if it is cached. | mapping(address => mapping(bytes4 => bool)) internal erc165Cached;
| mapping(address => mapping(bytes4 => bool)) internal erc165Cached;
| 60,862 |
152 | // Teams' leaders info | uint256[] memory _idList = new uint256[](_tID);
uint256[] memory _leaderIDList = new uint256[](_tID);
bytes32[] memory _leaderNameList = new bytes32[](_tID);
address[] memory _leaderAddrList = new address[](_tID);
| uint256[] memory _idList = new uint256[](_tID);
uint256[] memory _leaderIDList = new uint256[](_tID);
bytes32[] memory _leaderNameList = new bytes32[](_tID);
address[] memory _leaderAddrList = new address[](_tID);
| 2,031 |
6 | // Tarot variables{usedPools} - A set of pool addresses which are the authorized lending pools that can be used{maxPools} - Sets the maximum amount of pools that can be added{depositPool} - Address of the pool that regular deposits will go to{sharePriceSnapshot} - Saves the pricePerFullShare to be compared between harvests to calculate profit{minProfitToChargeFees} - The minimum amount of profit for harvest to charge fees{withdrawSlippageTolerance} - Allows some very small slippage on withdraws to avoid reverts{minWantToDepositOrWithdraw} - A minimum amount to deposit or withdraw from a pool (to save gas on very small amounts){maxWantRemainingToRemovePool} - Sets the allowed amount for a pool | EnumerableSetUpgradeable.AddressSet private usedPools;
uint256 public maxPools;
| EnumerableSetUpgradeable.AddressSet private usedPools;
uint256 public maxPools;
| 20,671 |
0 | // Pool state that can change/These methods compose the pool's state, and can change with any frequency including multiple times/ per transaction | interface IPancakeV3PoolState {
/// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas
/// when accessed externally.
/// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value
/// tick The current tick of the pool, i.e. according to the last tick transition that was run.
/// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick
/// boundary.
/// observationIndex The index of the last oracle observation that was written,
/// observationCardinality The current maximum number of observations stored in the pool,
/// observationCardinalityNext The next maximum number of observations, to be updated when the observation.
/// feeProtocol The protocol fee for both tokens of the pool.
/// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0
/// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.
/// unlocked Whether the pool is currently locked to reentrancy
function slot0()
external
view
returns (
uint160 sqrtPriceX96,
int24 tick,
uint16 observationIndex,
uint16 observationCardinality,
uint16 observationCardinalityNext,
uint32 feeProtocol,
bool unlocked
);
/// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool
/// @dev This value can overflow the uint256
function feeGrowthGlobal0X128() external view returns (uint256);
/// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool
/// @dev This value can overflow the uint256
function feeGrowthGlobal1X128() external view returns (uint256);
/// @notice The amounts of token0 and token1 that are owed to the protocol
/// @dev Protocol fees will never exceed uint128 max in either token
function protocolFees() external view returns (uint128 token0, uint128 token1);
/// @notice The currently in range liquidity available to the pool
/// @dev This value has no relationship to the total liquidity across all ticks
function liquidity() external view returns (uint128);
/// @notice Look up information about a specific tick in the pool
/// @param tick The tick to look up
/// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or
/// tick upper,
/// liquidityNet how much liquidity changes when the pool price crosses the tick,
/// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,
/// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,
/// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick
/// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,
/// secondsOutside the seconds spent on the other side of the tick from the current tick,
/// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false.
/// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0.
/// In addition, these values are only relative and must be used only in comparison to previous snapshots for
/// a specific position.
function ticks(int24 tick)
external
view
returns (
uint128 liquidityGross,
int128 liquidityNet,
uint256 feeGrowthOutside0X128,
uint256 feeGrowthOutside1X128,
int56 tickCumulativeOutside,
uint160 secondsPerLiquidityOutsideX128,
uint32 secondsOutside,
bool initialized
);
/// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information
function tickBitmap(int16 wordPosition) external view returns (uint256);
/// @notice Returns the information about a position by the position's key
/// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper
/// @return _liquidity The amount of liquidity in the position,
/// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,
/// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,
/// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,
/// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke
function positions(bytes32 key)
external
view
returns (
uint128 _liquidity,
uint256 feeGrowthInside0LastX128,
uint256 feeGrowthInside1LastX128,
uint128 tokensOwed0,
uint128 tokensOwed1
);
/// @notice Returns data about a specific observation index
/// @param index The element of the observations array to fetch
/// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time
/// ago, rather than at a specific index in the array.
/// @return blockTimestamp The timestamp of the observation,
/// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,
/// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,
/// Returns initialized whether the observation has been initialized and the values are safe to use
function observations(uint256 index)
external
view
returns (
uint32 blockTimestamp,
int56 tickCumulative,
uint160 secondsPerLiquidityCumulativeX128,
bool initialized
);
}
| interface IPancakeV3PoolState {
/// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas
/// when accessed externally.
/// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value
/// tick The current tick of the pool, i.e. according to the last tick transition that was run.
/// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick
/// boundary.
/// observationIndex The index of the last oracle observation that was written,
/// observationCardinality The current maximum number of observations stored in the pool,
/// observationCardinalityNext The next maximum number of observations, to be updated when the observation.
/// feeProtocol The protocol fee for both tokens of the pool.
/// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0
/// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.
/// unlocked Whether the pool is currently locked to reentrancy
function slot0()
external
view
returns (
uint160 sqrtPriceX96,
int24 tick,
uint16 observationIndex,
uint16 observationCardinality,
uint16 observationCardinalityNext,
uint32 feeProtocol,
bool unlocked
);
/// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool
/// @dev This value can overflow the uint256
function feeGrowthGlobal0X128() external view returns (uint256);
/// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool
/// @dev This value can overflow the uint256
function feeGrowthGlobal1X128() external view returns (uint256);
/// @notice The amounts of token0 and token1 that are owed to the protocol
/// @dev Protocol fees will never exceed uint128 max in either token
function protocolFees() external view returns (uint128 token0, uint128 token1);
/// @notice The currently in range liquidity available to the pool
/// @dev This value has no relationship to the total liquidity across all ticks
function liquidity() external view returns (uint128);
/// @notice Look up information about a specific tick in the pool
/// @param tick The tick to look up
/// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or
/// tick upper,
/// liquidityNet how much liquidity changes when the pool price crosses the tick,
/// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,
/// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,
/// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick
/// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,
/// secondsOutside the seconds spent on the other side of the tick from the current tick,
/// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false.
/// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0.
/// In addition, these values are only relative and must be used only in comparison to previous snapshots for
/// a specific position.
function ticks(int24 tick)
external
view
returns (
uint128 liquidityGross,
int128 liquidityNet,
uint256 feeGrowthOutside0X128,
uint256 feeGrowthOutside1X128,
int56 tickCumulativeOutside,
uint160 secondsPerLiquidityOutsideX128,
uint32 secondsOutside,
bool initialized
);
/// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information
function tickBitmap(int16 wordPosition) external view returns (uint256);
/// @notice Returns the information about a position by the position's key
/// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper
/// @return _liquidity The amount of liquidity in the position,
/// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,
/// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,
/// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,
/// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke
function positions(bytes32 key)
external
view
returns (
uint128 _liquidity,
uint256 feeGrowthInside0LastX128,
uint256 feeGrowthInside1LastX128,
uint128 tokensOwed0,
uint128 tokensOwed1
);
/// @notice Returns data about a specific observation index
/// @param index The element of the observations array to fetch
/// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time
/// ago, rather than at a specific index in the array.
/// @return blockTimestamp The timestamp of the observation,
/// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,
/// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,
/// Returns initialized whether the observation has been initialized and the values are safe to use
function observations(uint256 index)
external
view
returns (
uint32 blockTimestamp,
int56 tickCumulative,
uint160 secondsPerLiquidityCumulativeX128,
bool initialized
);
}
| 30,530 |
197 | // Return the debt share of the given bank token for the given position id./positionId position id to get debt of/token ERC20 debt token to query | function getPositionDebtShareOf(uint positionId, address token) external view returns (uint) {
return positions[positionId].debtShareOf[token];
}
| function getPositionDebtShareOf(uint positionId, address token) external view returns (uint) {
return positions[positionId].debtShareOf[token];
}
| 15,187 |
4 | // Reschedule call the contract.Returns a boolean value indicating whether the operation succeeded. / | function rescheduleCall(
uint256 min_delay,
bytes memory task_id
| function rescheduleCall(
uint256 min_delay,
bytes memory task_id
| 49,728 |
4 | // Convert unsigned 256-bit integer number into signed 64.64-bit fixed pointnumber.Revert on overflow.x unsigned 256-bit integer numberreturn signed 64.64-bit fixed point number / | function fromUInt (uint256 x) internal pure returns (int128) {
unchecked {
require (x <= 0x7FFFFFFFFFFFFFFF);
return int128 (int256 (x << 64));
}
}
| function fromUInt (uint256 x) internal pure returns (int128) {
unchecked {
require (x <= 0x7FFFFFFFFFFFFFFF);
return int128 (int256 (x << 64));
}
}
| 51,852 |
71 | // adding this animal as a child to the parents who mated to produce this offspring | childrenIdAgainstAnimalId[parent1Id].push(uniqueAnimalId);
childrenIdAgainstAnimalId[parent2Id].push(uniqueAnimalId);
| childrenIdAgainstAnimalId[parent1Id].push(uniqueAnimalId);
childrenIdAgainstAnimalId[parent2Id].push(uniqueAnimalId);
| 1,260 |
5 | // Withdraw the given amount of LP tokens from the given pool | function withdraw(uint256 _pid, uint256 _amount) external;
| function withdraw(uint256 _pid, uint256 _amount) external;
| 40,483 |
4 | // Check if offer still valid | require(
block.timestamp <= offer.expiredAt,
"Cover Gateway: Offer expired"
);
require(
_buyCover.coverMonths >= offer.minCoverMonths,
"Cover Gateway: Requested Cover month smaller than minimal cover month"
);
| require(
block.timestamp <= offer.expiredAt,
"Cover Gateway: Offer expired"
);
require(
_buyCover.coverMonths >= offer.minCoverMonths,
"Cover Gateway: Requested Cover month smaller than minimal cover month"
);
| 19,227 |
18 | // currency events | event ExchangeRatesUpdated(uint timestamp, uint dataInUsd);
| event ExchangeRatesUpdated(uint timestamp, uint dataInUsd);
| 20,784 |
90 | // asyncDefiInteractionHashes[asyncArrayLen] = defiInteractionHash | mstore(0x00, asyncArrayLen)
mstore(0x20, asyncDefiInteractionHashes.slot)
sstore(keccak256(0x00, 0x40), defiInteractionHash)
| mstore(0x00, asyncArrayLen)
mstore(0x20, asyncDefiInteractionHashes.slot)
sstore(keccak256(0x00, 0x40), defiInteractionHash)
| 14,665 |
52 | // Execution | function swapCurve(address[] memory pools,address[] memory tokens, uint8[] memory metas, uint amount,uint out, uint i, address to) internal{
(int128 fromIndex, int128 toIndex, bool isUnderlying) = decodeCurveMetaData(metas[i]);
IERC20(tokens[i]).approve(pools[i], amount);
if(isUnderlying){
ICurve(pools[i]).exchange_underlying(fromIndex, toIndex, amount, 0);
} else {
ICurve(pools[i]).exchange(fromIndex, toIndex, amount, out);
}
if (address(this) != to && to != address(0x0)) {
IERC20(tokens[(i + 1) % pools.length]).transfer(to, out);
}
}
| function swapCurve(address[] memory pools,address[] memory tokens, uint8[] memory metas, uint amount,uint out, uint i, address to) internal{
(int128 fromIndex, int128 toIndex, bool isUnderlying) = decodeCurveMetaData(metas[i]);
IERC20(tokens[i]).approve(pools[i], amount);
if(isUnderlying){
ICurve(pools[i]).exchange_underlying(fromIndex, toIndex, amount, 0);
} else {
ICurve(pools[i]).exchange(fromIndex, toIndex, amount, out);
}
if (address(this) != to && to != address(0x0)) {
IERC20(tokens[(i + 1) % pools.length]).transfer(to, out);
}
}
| 18,647 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.