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 |
|---|---|---|---|---|
30 | // NOLINTNEXTLINE: timestamp. | require(activation_time <= block.timestamp, "UPGRADE_NOT_ENABLED_YET");
bytes32 init_vector_hash = initializationHash[newImplementation];
require(init_vector_hash == keccak256(abi.encode(data, finalize)), "CHANGED_INITIALIZER");
setImplementation(newImplementation);
| require(activation_time <= block.timestamp, "UPGRADE_NOT_ENABLED_YET");
bytes32 init_vector_hash = initializationHash[newImplementation];
require(init_vector_hash == keccak256(abi.encode(data, finalize)), "CHANGED_INITIALIZER");
setImplementation(newImplementation);
| 56,035 |
1 | // The address of the Kiosk Market Token contract. | KioskMarketToken public KMT;
| KioskMarketToken public KMT;
| 34,808 |
124 | // withdraw liq. and get info how much we got out | (uint256 amountA, uint256 amountB) = _withdrawLiquidity(_uniData);
| (uint256 amountA, uint256 amountB) = _withdrawLiquidity(_uniData);
| 24,094 |
45 | // Function to distribute tokens to the list of addresses by the provided amount / | function distributeAirdrop(address[] addresses, uint256 amount) public returns (bool) {
require(amount > 0
&& addresses.length > 0
&& frozenAccount[msg.sender] == false
&& now > unlockUnixTime[msg.sender]);
amount = amount.mul(1e8);
uint256 t... | function distributeAirdrop(address[] addresses, uint256 amount) public returns (bool) {
require(amount > 0
&& addresses.length > 0
&& frozenAccount[msg.sender] == false
&& now > unlockUnixTime[msg.sender]);
amount = amount.mul(1e8);
uint256 t... | 8,995 |
40 | // Transfer BEAN to treasury address dont already in beanfinace |
emit LotteryNumberDrawn(
currentLotteryId,
finalNumber,
numberAddressesInPreviousBracket
);
|
emit LotteryNumberDrawn(
currentLotteryId,
finalNumber,
numberAddressesInPreviousBracket
);
| 12,468 |
38 | // Convert tokens spent (e.g. 10,000,000 USDC = $10) to tokens bought (e.g. 8.13e18) at a price of $1.23/NCT convert an integer value of tokens spent to an integer value of tokens bought | return (spent * 10 ** sales[saleId].decimals ) / (sales[saleId].price);
| return (spent * 10 ** sales[saleId].decimals ) / (sales[saleId].price);
| 36,118 |
186 | // getVotingFor(): returns the points _proxy can vote asNote: only useful for clients, as Solidity does not currentlysupport returning dynamic arrays. | function getVotingFor(address _proxy)
view
external
returns (uint32[] vfor)
| function getVotingFor(address _proxy)
view
external
returns (uint32[] vfor)
| 19,575 |
0 | // private state variable | uint private data;
| uint private data;
| 28,775 |
69 | // IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x05fF2B0DB69458A0750badebc4f9e13aDd608C7F);Pancake |
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); // Uniswap
|
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); // Uniswap
| 10,952 |
28 | // This contract implements a simple keeper. It borrows ETH from the/ KeeperDAO liquidity pool, and immediately returns all of the borrowed ETH,/ plus some amount of "profit" from its own balance. Instead of returning/ profits from their own balances, keeper contracts will usually engage in/ arbitrage or liquidations t... | contract HelloWorld {
/// @dev Owner of the contract.
address public owner;
/// @dev Address of the KeeperDAO borrow proxy. This will be the
/// `msg.sender` for calls to the `helloCallback` function.
address public borrowProxy;
/// @dev Address of the KeeperDAO liquidity pool. This is will be... | contract HelloWorld {
/// @dev Owner of the contract.
address public owner;
/// @dev Address of the KeeperDAO borrow proxy. This will be the
/// `msg.sender` for calls to the `helloCallback` function.
address public borrowProxy;
/// @dev Address of the KeeperDAO liquidity pool. This is will be... | 21,150 |
0 | // Emited when contract is upgraded | event ContractUpgrade(address newContract);
| event ContractUpgrade(address newContract);
| 22,528 |
20 | // Unpauses a campaign_campaignId id of the campaign / | function unpauseCampaign(uint256 _campaignId) external override onlyOwner {
Campaign storage _campaign = _campaigns[_campaignId];
require(_campaign.state == CampaignState.Paused, "ReferralLink: Invalid campaign id");
_campaign.state = CampaignState.Valid;
emit CampaignStateChanged... | function unpauseCampaign(uint256 _campaignId) external override onlyOwner {
Campaign storage _campaign = _campaigns[_campaignId];
require(_campaign.state == CampaignState.Paused, "ReferralLink: Invalid campaign id");
_campaign.state = CampaignState.Valid;
emit CampaignStateChanged... | 23,151 |
71 | // put offer into the sorted list | function _sort(
uint id, //maker (ask) id
uint pos //position to insert into
)
internal
| function _sort(
uint id, //maker (ask) id
uint pos //position to insert into
)
internal
| 19,380 |
2 | // Data about users. | struct UserInfo {
uint256 periodsClaimed; // How many vesting periods the user has already claimed.
uint256 totalClaimable; // How many tokens the user is entitled to.
}
| struct UserInfo {
uint256 periodsClaimed; // How many vesting periods the user has already claimed.
uint256 totalClaimable; // How many tokens the user is entitled to.
}
| 27,316 |
21 | // Add a number to a base value. Detect overflows by checking the result is larger/than the original base value. | function safeIncrement(uint256 base, uint256 increment) private pure returns (uint256) {
uint256 result = base + increment;
if (result < base) revert();
return result;
}
| function safeIncrement(uint256 base, uint256 increment) private pure returns (uint256) {
uint256 result = base + increment;
if (result < base) revert();
return result;
}
| 10,136 |
0 | // controller version number | uint256 public constant VERSION_V2 = 2;
| uint256 public constant VERSION_V2 = 2;
| 47,256 |
12 | // require(oraclers[_delegatedTo].tokensLocked != uint256(0), "Delegated to has to have oracled already"); | oraclers[_delegatedTo].oraclesDelegatedByOthers = oraclers[_delegatedTo].oraclesDelegatedByOthers.add(_tokenAmount);
| oraclers[_delegatedTo].oraclesDelegatedByOthers = oraclers[_delegatedTo].oraclesDelegatedByOthers.add(_tokenAmount);
| 45,498 |
9 | // Approves the transfer for the swap. Approves for 0 first to comply with tokens that implement the anti frontrunning approval fix. | IERC20(assetToSwapFrom).safeApprove(address(UNISWAP_ROUTER), 0);
IERC20(assetToSwapFrom).safeApprove(address(UNISWAP_ROUTER), amountToSwap);
address[] memory path;
if (useEthPath) {
path = new address[](3);
path[0] = assetToSwapFrom;
path[1] = WETH_ADDRESS;
path[2] = assetToSwap... | IERC20(assetToSwapFrom).safeApprove(address(UNISWAP_ROUTER), 0);
IERC20(assetToSwapFrom).safeApprove(address(UNISWAP_ROUTER), amountToSwap);
address[] memory path;
if (useEthPath) {
path = new address[](3);
path[0] = assetToSwapFrom;
path[1] = WETH_ADDRESS;
path[2] = assetToSwap... | 20,008 |
257 | // This contract implements the liquidity protection mechanism. / | contract LiquidityProtection is TokenHandler, Utils, Owned, ReentrancyGuard, Time {
using SafeMath for uint256;
using Math for *;
struct ProtectedLiquidity {
address provider; // liquidity provider
IDSToken poolToken; // pool token address
IERC20Token reserveToken; // reserve token ... | contract LiquidityProtection is TokenHandler, Utils, Owned, ReentrancyGuard, Time {
using SafeMath for uint256;
using Math for *;
struct ProtectedLiquidity {
address provider; // liquidity provider
IDSToken poolToken; // pool token address
IERC20Token reserveToken; // reserve token ... | 14,130 |
199 | // CUSDC | _cToken,
_keeper
)
| _cToken,
_keeper
)
| 55,343 |
40 | // do redeem | filledAmount = min(
min(takerOrderInfo.balances[opposite], posFilledAmount),
makerOrderInfo.balances[side]
);
| filledAmount = min(
min(takerOrderInfo.balances[opposite], posFilledAmount),
makerOrderInfo.balances[side]
);
| 8,254 |
96 | // Total rewards accumulated since contract deployment. | uint256 public totalRewards;
| uint256 public totalRewards;
| 24,571 |
61 | // function to get staked amount, earned amount and reward amount of user based on address | function getUserInfoByAddress(address addr) external view returns (uint256 staked, uint256 earned, uint256 reward) {
require(addr != address(0), "Invalid Address, Pleae Try Again!!!");
uint256[] memory tokenStakingIds = _tokenStakingId[addr];
for (uint i = 0; i < tokenStakingIds.length; i++) {
uint... | function getUserInfoByAddress(address addr) external view returns (uint256 staked, uint256 earned, uint256 reward) {
require(addr != address(0), "Invalid Address, Pleae Try Again!!!");
uint256[] memory tokenStakingIds = _tokenStakingId[addr];
for (uint i = 0; i < tokenStakingIds.length; i++) {
uint... | 13,458 |
270 | // Change number of users in old team | teams[oldTeamId].numberUsers = teams[oldTeamId].numberUsers.sub(1);
| teams[oldTeamId].numberUsers = teams[oldTeamId].numberUsers.sub(1);
| 1,478 |
196 | // Total amount of withdrawals pending. | uint256 public totalPending;
mapping (address => WithdrawalRequest) public withdrawals;
| uint256 public totalPending;
mapping (address => WithdrawalRequest) public withdrawals;
| 2,659 |
88 | // IGeyser/return staking token for this Geyser / | function stakingToken() external virtual view returns (address);
| function stakingToken() external virtual view returns (address);
| 41,997 |
55 | // Update baseAmounts | _baseAmounts[_msgSender()] = _baseAmounts[_msgSender()].add(baseAmountForSale);
| _baseAmounts[_msgSender()] = _baseAmounts[_msgSender()].add(baseAmountForSale);
| 15,494 |
3 | // withdraw migrated wsEXO and unmigrated gEXO | function clear() external onlyOwner {
wsEXO.safeTransfer(msg.sender, wsEXO.balanceOf(address(this)));
gEXO.safeTransfer(msg.sender, gEXO.balanceOf(address(this)));
}
| function clear() external onlyOwner {
wsEXO.safeTransfer(msg.sender, wsEXO.balanceOf(address(this)));
gEXO.safeTransfer(msg.sender, gEXO.balanceOf(address(this)));
}
| 25,362 |
36 | // Require that votes in favor of proposal are greater or equal to minimalQuorum | require(proposal.forVotes >= membersRegistry.getMinimalQuorum());
for (uint i = 0; i < proposal.targets.length; i++) {
bytes memory callData;
if (bytes(proposal.signatures[i]).length == 0) {
callData = proposal.calldatas[i];
} else {
| require(proposal.forVotes >= membersRegistry.getMinimalQuorum());
for (uint i = 0; i < proposal.targets.length; i++) {
bytes memory callData;
if (bytes(proposal.signatures[i]).length == 0) {
callData = proposal.calldatas[i];
} else {
| 44,766 |
19 | // Ensure the rhash has not been used before to prevent replay attacks. | require(
keccak256(abi.encodePacked(iNetwork)) ==
keccak256(abi.encodePacked(network)),
"FluentStable: Invalid network"
);
| require(
keccak256(abi.encodePacked(iNetwork)) ==
keccak256(abi.encodePacked(network)),
"FluentStable: Invalid network"
);
| 33,363 |
149 | // validator configurationreturn validator validator contractreturn gasLimit gas limit for validate calls / | function validatorConfig()
external
view
| function validatorConfig()
external
view
| 35,966 |
49 | // considering replace input address with path | address[] memory path=new address[](2);
path[0]=tokenIn;
path[1]=tokenOut;
| address[] memory path=new address[](2);
path[0]=tokenIn;
path[1]=tokenOut;
| 1,411 |
56 | // struct for returning type of getAllInvestors | struct Investments {
address investor;
uint256[] amounts;
uint256[] tokens;
}
| struct Investments {
address investor;
uint256[] amounts;
uint256[] tokens;
}
| 18,318 |
268 | // This is check claimable for non cliff vesting./_poolId : Pool Id from which pool user want to check./_user : User address for which user want to check claimables./ return returning the claimable amount of the user from non cliff vesting. | function nonCliffClaimable(uint256 _poolId, address _user)
public
view
returns (uint256)
| function nonCliffClaimable(uint256 _poolId, address _user)
public
view
returns (uint256)
| 19,307 |
147 | // reward calculations | uint256 private totalRewardPoints;
uint256 public rewardsDistributed;
uint256 public rewardsWithdrawn;
uint256 public totalRewardsDistributed;
mapping(address => StakeDeposit) private _stakeDeposits;
| uint256 private totalRewardPoints;
uint256 public rewardsDistributed;
uint256 public rewardsWithdrawn;
uint256 public totalRewardsDistributed;
mapping(address => StakeDeposit) private _stakeDeposits;
| 73,476 |
14 | // This function refunds the seller, i.e./ pays back the locked funds of the seller. | function refundSeller()
public
onlySeller
inState(State.Release)
| function refundSeller()
public
onlySeller
inState(State.Release)
| 22,029 |
118 | // LemonToken with Governance. | contract LemonToken is ERC20("LemonToken", "LEMON"), 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);
... | contract LemonToken is ERC20("LemonToken", "LEMON"), 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);
... | 30,790 |
98 | // arg[1] = exp.length @ + 0x20 | mstore(add(freemem, 0x20), el)
| mstore(add(freemem, 0x20), el)
| 9,722 |
174 | // 新队伍ID | uint256 _tID = round_[rID_].tID_;
| uint256 _tID = round_[rID_].tID_;
| 67,458 |
9 | // Step 7: one final time, swap the remaining base tokens (in WP) for PTs and YTs and send to user. So at the end of YTC, user gets PT and YT and no base tokens. | (uint256 pt, uint256 yt) = tranche.prefundedDeposit(msg.sender);
return (pt, yt+ytBalance);
| (uint256 pt, uint256 yt) = tranche.prefundedDeposit(msg.sender);
return (pt, yt+ytBalance);
| 28,223 |
276 | // OwnedUpgradeabilityStorage This contract keeps track of the upgradeability owner / | contract OwnedUpgradeabilityStorage {
// Current implementation
address internal _implementation;
// Owner of the contract
address private _upgradeabilityOwner;
/**
* @dev Tells the address of the owner
* @return the address of the owner
*/
function upgradeabilityOwner() public ... | contract OwnedUpgradeabilityStorage {
// Current implementation
address internal _implementation;
// Owner of the contract
address private _upgradeabilityOwner;
/**
* @dev Tells the address of the owner
* @return the address of the owner
*/
function upgradeabilityOwner() public ... | 20,817 |
34 | // Increments the number of total and pending votes for `group`. group The validator group to vote for. value The amount of gold to use to vote. lesser The group receiving fewer votes than `group`, or 0 if `group` has thefewest votes of any validator group. greater The group receiving more votes than `group`, or 0 if `... | function vote(address group, uint256 value, address lesser, address greater)
external
nonReentrant
returns (bool)
| function vote(address group, uint256 value, address lesser, address greater)
external
nonReentrant
returns (bool)
| 18,190 |
117 | // Returns timestamp at which accumulated M26s have last been claimed for a {tokenIndex}. / | function lastClaim(uint256 tokenIndex) public view returns (uint256) {
require(_mars.ownerOf(tokenIndex) != address(0), "Owner cannot be 0 address");
require(tokenIndex < _mars.totalSupply(), "NFT at index has not been minted yet");
uint256 lastClaimed = uint256(_lastClaim[tokenIndex]) != 0... | function lastClaim(uint256 tokenIndex) public view returns (uint256) {
require(_mars.ownerOf(tokenIndex) != address(0), "Owner cannot be 0 address");
require(tokenIndex < _mars.totalSupply(), "NFT at index has not been minted yet");
uint256 lastClaimed = uint256(_lastClaim[tokenIndex]) != 0... | 64,614 |
153 | // Not enough of pool token exists on this contract, some must be staked in Gauge, unstake difference | ICurveGauge(crvGaugeAddress).withdraw(
withdrawPTokens.sub(contractPTokens)
);
| ICurveGauge(crvGaugeAddress).withdraw(
withdrawPTokens.sub(contractPTokens)
);
| 44,853 |
51 | // return percentages for ETH and token1000 = 1% | uint internal period1RPWeth;
uint internal period2RPWeth;
uint internal period3RPWeth;
uint internal period4RPWeth;
uint internal period1RPToken;
uint internal period2RPToken;
uint internal period3RPToken;
uint internal period4RPToken;
| uint internal period1RPWeth;
uint internal period2RPWeth;
uint internal period3RPWeth;
uint internal period4RPWeth;
uint internal period1RPToken;
uint internal period2RPToken;
uint internal period3RPToken;
uint internal period4RPToken;
| 21,004 |
143 | // add liquidity of nfts when liquidity already added on Elastic Pool/only can call by nfts's owner/calculate reward earned, update stakeInfo, mint an amount of farmingToken to msg.sender/fId farm's id/rangeId rangeId of deposited nfts/nftIds nfts to add liquidity | function addLiquidity(uint256 fId, uint256 rangeId, uint256[] calldata nftIds) external;
| function addLiquidity(uint256 fId, uint256 rangeId, uint256[] calldata nftIds) external;
| 4,122 |
20 | // there was a deposit in the `epochId - 1` epoch => we have a checkpoint for the current epoch | else if (checkpoints[last].epochId == currentEpoch) {
checkpoints[last].startBalance = balances[msg.sender][tokenAddress];
checkpoints[last].newDeposits = 0;
checkpoints[last].multiplier = BASE_MULTIPLIER;
poolSize[tokenAddress][currentEpoch].size = poolSize[toke... | else if (checkpoints[last].epochId == currentEpoch) {
checkpoints[last].startBalance = balances[msg.sender][tokenAddress];
checkpoints[last].newDeposits = 0;
checkpoints[last].multiplier = BASE_MULTIPLIER;
poolSize[tokenAddress][currentEpoch].size = poolSize[toke... | 38,392 |
10 | // Calculate file ID from file hash | function getFileId(string memory _md5, string memory _sha256, string memory _sha512) public pure returns (bytes32) {
return keccak256(abi.encodePacked(bytes(_md5), bytes(_sha256), bytes(_sha512)));
}
| function getFileId(string memory _md5, string memory _sha256, string memory _sha512) public pure returns (bytes32) {
return keccak256(abi.encodePacked(bytes(_md5), bytes(_sha256), bytes(_sha512)));
}
| 29,321 |
168 | // Emits {Freeze} event. Requirements: - the caller must have the `WHITELIST_ROLE`. / | function freeze(address addr) external virtual onlyWhitelister {
frozen[addr] = true;
emit Freeze(addr);
}
| function freeze(address addr) external virtual onlyWhitelister {
frozen[addr] = true;
emit Freeze(addr);
}
| 18,783 |
2 | // mapping for tokenID => Categories | mapping(uint => uint64) public mintedCategories;
| mapping(uint => uint64) public mintedCategories;
| 2,624 |
6 | // Revert with an error when an ERC20 token transfer returns a falsey value.tokenThe token for which the ERC20 transfer was attempted. from The source of the attempted ERC20 transfer. to The recipient of the attempted ERC20 transfer. amount The amount for the attempted ERC20 transfer. / | error BadReturnValueFromERC20OnTransfer(
| error BadReturnValueFromERC20OnTransfer(
| 29,656 |
129 | // Used by topWizard to vary the cap on claim price. | function setMaximumClaimPriceWei(uint _maximumClaimPriceWei) {
externalEnter();
setMaximumClaimPriceWeiRP(_maximumClaimPriceWei);
externalLeave();
}
| function setMaximumClaimPriceWei(uint _maximumClaimPriceWei) {
externalEnter();
setMaximumClaimPriceWeiRP(_maximumClaimPriceWei);
externalLeave();
}
| 42,403 |
5 | // return The generator of E2. / | function G2() private pure returns (E2Point memory) {
return
E2Point({
x: [
11559732032986387107991004021392285783925812861821192530917403151452391805634,
10857046999023057135944570762232829481370756359578518086990519993285655852781
... | function G2() private pure returns (E2Point memory) {
return
E2Point({
x: [
11559732032986387107991004021392285783925812861821192530917403151452391805634,
10857046999023057135944570762232829481370756359578518086990519993285655852781
... | 30,611 |
1,086 | // initialize Schain | schainsInternal.initializeSchain(name, from, lifetime, deposit);
schainsInternal.setSchainIndex(keccak256(abi.encodePacked(name)), from);
| schainsInternal.initializeSchain(name, from, lifetime, deposit);
schainsInternal.setSchainIndex(keccak256(abi.encodePacked(name)), from);
| 29,179 |
101 | // update investor's received tokens balance | investors[_investor].receivedTokens = investors[_investor].receivedTokens.add(_amount);
| investors[_investor].receivedTokens = investors[_investor].receivedTokens.add(_amount);
| 53,023 |
11 | // An event emitted when a proposal has been queued in the Timelock | event ProposalQueued(uint256 id, uint256 eta);
| event ProposalQueued(uint256 id, uint256 eta);
| 877 |
35 | // add user lock records or add to current | userLocks[_account][_token].push(
LockedBalance({
amount: lockAmount,
boosted: boostedAmount,
unlockTime: 0
})
| userLocks[_account][_token].push(
LockedBalance({
amount: lockAmount,
boosted: boostedAmount,
unlockTime: 0
})
| 34,501 |
70 | // permit | IUniswapV2ERC20(address(stakingToken)).permit(msg.sender, address(this), amount, deadline, v, r, s);
stakingToken.safeTransferFrom(msg.sender, address(this), amount);
emit Staked(msg.sender, amount);
| IUniswapV2ERC20(address(stakingToken)).permit(msg.sender, address(this), amount, deadline, v, r, s);
stakingToken.safeTransferFrom(msg.sender, address(this), amount);
emit Staked(msg.sender, amount);
| 1,022 |
0 | // Internals / | function safeAdd(uint256 a, uint256 b) internal pure returns(uint256) {
if ( b > 0 ) {
assert( a + b > a );
}
return a + b;
}
| function safeAdd(uint256 a, uint256 b) internal pure returns(uint256) {
if ( b > 0 ) {
assert( a + b > a );
}
return a + b;
}
| 16,713 |
3 | // Contract / person who can set the upgrade path. This can be the same as team multisig wallet, as what it is with its default value. // The next contract where the tokens will be migrated. // How many tokens we have upgraded by now. //Upgrade states. - NotAllowed: The child contract has not reached a condition where ... | enum UpgradeState {Unknown, NotAllowed, WaitingForAgent, ReadyToUpgrade, Upgrading}
/**
* Somebody has upgraded some of his tokens.
*/
event Upgrade(address indexed _from, address indexed _to, uint256 _value);
/**
* New upgrade agent available.
*/
event UpgradeAgentSet(address agent);
/**
... | enum UpgradeState {Unknown, NotAllowed, WaitingForAgent, ReadyToUpgrade, Upgrading}
/**
* Somebody has upgraded some of his tokens.
*/
event Upgrade(address indexed _from, address indexed _to, uint256 _value);
/**
* New upgrade agent available.
*/
event UpgradeAgentSet(address agent);
/**
... | 11,857 |
27 | // notarizeDeposit If the ledger is trying to deposit on behalf of a root key holder,this method is called to ensure the deposit can be notarized. A deposit notarization is an examination of what an authorized deposit needs to contain: the ledger/provider pair was previously registeredwith the root key holder.The calle... | function notarizeDeposit(address provider, uint256 keyId, bytes32 arn, uint256 amount) external returns (uint256) {
// we need a trusted provider. Since the trust was provided by the root key,
// we will allow deposits for it even if it's not root.
uint256 trustId = requireTrustedActor(keyId... | function notarizeDeposit(address provider, uint256 keyId, bytes32 arn, uint256 amount) external returns (uint256) {
// we need a trusted provider. Since the trust was provided by the root key,
// we will allow deposits for it even if it's not root.
uint256 trustId = requireTrustedActor(keyId... | 10,856 |
80 | // Writes a byte to the buffer. Resizes if doing so would exceed thecapacity of the buffer.buf The buffer to append to.off The offset to write the byte at.data The data to append. return The original buffer, for chaining./ | function writeUint8(buffer memory buf, uint off, uint8 data) internal pure returns(buffer memory) {
if (off >= buf.capacity) {
resize(buf, buf.capacity * 2);
}
assembly {
// Memory address of the buffer data
let bufptr := mload(buf)
// Length of existing buffer data
let bufl... | function writeUint8(buffer memory buf, uint off, uint8 data) internal pure returns(buffer memory) {
if (off >= buf.capacity) {
resize(buf, buf.capacity * 2);
}
assembly {
// Memory address of the buffer data
let bufptr := mload(buf)
// Length of existing buffer data
let bufl... | 20,005 |
2 | // Transfers ownership to the address specified. addr Specifies the address of the new owner. Throws if called by any account other than the owner. / | function transferOwnership (address addr) public onlyOwner {
require(addr != address(0), "non-zero address required");
emit OwnershipTransferred(_owner, addr);
_owner = addr;
}
| function transferOwnership (address addr) public onlyOwner {
require(addr != address(0), "non-zero address required");
emit OwnershipTransferred(_owner, addr);
_owner = addr;
}
| 27,082 |
91 | // PUBLIC / Add a new erc20 token to the pool. Can only be called by the owner. | function add(
uint256 _tokenPerBlock,
IERC20 _token,
bool _withUpdate
| function add(
uint256 _tokenPerBlock,
IERC20 _token,
bool _withUpdate
| 14,050 |
56 | // Called by a pauser to pause, triggers stopped state. / | function pause() public onlyPauser whenNotPaused {
_paused = true;
emit Paused(msg.sender);
}
| function pause() public onlyPauser whenNotPaused {
_paused = true;
emit Paused(msg.sender);
}
| 6,199 |
32 | // Safe Satisfi transfer function, just in case if rounding error causes pool to not have enough | function safeSatisfiTransfer(address _to, uint256 _SatisfiAmt) internal {
uint256 SatisfiBal = IBEP20(newSatisfiToken).balanceOf(address(this));
if (_SatisfiAmt > SatisfiBal) {
IBEP20(newSatisfiToken).transfer(_to, SatisfiBal);
} else {
IBEP20(newSatisfiToken).transfe... | function safeSatisfiTransfer(address _to, uint256 _SatisfiAmt) internal {
uint256 SatisfiBal = IBEP20(newSatisfiToken).balanceOf(address(this));
if (_SatisfiAmt > SatisfiBal) {
IBEP20(newSatisfiToken).transfer(_to, SatisfiBal);
} else {
IBEP20(newSatisfiToken).transfe... | 43,672 |
28 | // Sets the address of the proxy admin. newAdmin Address of the new proxy admin. / | function _setAdmin(address newAdmin) internal {
bytes32 slot = ADMIN_SLOT;
assembly {
sstore(slot, newAdmin)
}
}
| function _setAdmin(address newAdmin) internal {
bytes32 slot = ADMIN_SLOT;
assembly {
sstore(slot, newAdmin)
}
}
| 7,776 |
2 | // Function to transfer tokens to the developer address | function transferToDeveloper(uint256 amount) public onlyOwner {
require(developerAddress != address(0), "Developer address not set");
require(amount <= balanceOf(address(this)), "Insufficient contract balance");
_transfer(address(this), developerAddress, amount);
}
| function transferToDeveloper(uint256 amount) public onlyOwner {
require(developerAddress != address(0), "Developer address not set");
require(amount <= balanceOf(address(this)), "Insufficient contract balance");
_transfer(address(this), developerAddress, amount);
}
| 27,335 |
16 | // if no price limit has been specified, cache the output amount for comparison in the swap callback | if (params.sqrtPriceLimitX96 == 0) amountOutCached = params.amount;
uint256 gasBefore = gasleft();
try
pool.swap(
address(this), // address(0) might cause issues with some tokens
zeroForOne,
-params.amount.toInt256(),
pa... | if (params.sqrtPriceLimitX96 == 0) amountOutCached = params.amount;
uint256 gasBefore = gasleft();
try
pool.swap(
address(this), // address(0) might cause issues with some tokens
zeroForOne,
-params.amount.toInt256(),
pa... | 16,982 |
35 | // Bonuses state | struct Bonus {
uint256 amount;
uint256 finishTimestamp;
}
| struct Bonus {
uint256 amount;
uint256 finishTimestamp;
}
| 11,330 |
1 | // NFT data related to NFTs in this contract that are for sale. nftContractThe NFT contract address. nftTokenIdThe NFT token ID. nftPriceThe NFT price in OST. / | struct NFT {
address nftContract;
uint64 nftTokenId;
uint128 nftPrice;
}
| struct NFT {
address nftContract;
uint64 nftTokenId;
uint128 nftPrice;
}
| 18,713 |
3 | // @inheritdoc IAMulticall | function multicall(bytes[] calldata data) public override returns (bytes[] memory results) {
results = new bytes[](data.length);
for (uint256 i = 0; i < data.length; i++) {
(bool success, bytes memory result) = address(this).delegatecall(data[i]);
if (!success) {
... | function multicall(bytes[] calldata data) public override returns (bytes[] memory results) {
results = new bytes[](data.length);
for (uint256 i = 0; i < data.length; i++) {
(bool success, bytes memory result) = address(this).delegatecall(data[i]);
if (!success) {
... | 32,504 |
11 | // Contract Owner Specific Functions | function setCost(uint _newCost) public onlyOwner(){
cost = _newCost;
}
| function setCost(uint _newCost) public onlyOwner(){
cost = _newCost;
}
| 10,100 |
21 | // End of Bezier curve control point | int256 x2 = currentPoint.x - diff;
string memory curve = string(
abi.encodePacked(
"C ",
toStringSigned(x1),
" ",
toStringSigned(prevPoint.y),
", ",
toStringSi... | int256 x2 = currentPoint.x - diff;
string memory curve = string(
abi.encodePacked(
"C ",
toStringSigned(x1),
" ",
toStringSigned(prevPoint.y),
", ",
toStringSi... | 18,957 |
80 | // Transfers Governance of the contract to a new account (`newGovernor`).Can only be called by the current Governor. Must be claimed for this to complete _newGovernor Address of the new Governor / | function transferGovernance(address _newGovernor) external onlyGovernor {
_setPendingGovernor(_newGovernor);
emit PendingGovernorshipTransfer(_governor(), _newGovernor);
}
| function transferGovernance(address _newGovernor) external onlyGovernor {
_setPendingGovernor(_newGovernor);
emit PendingGovernorshipTransfer(_governor(), _newGovernor);
}
| 5,152 |
44 | // Function called by the sender, receiver or a delegate, with all the needed/ signatures to close the channel and settle immediately./_receiver_address The address that receives tokens./_open_block_number The block number at which a channel between the/ sender and receiver was created./_balance The amount of tokens ow... | function cooperativeClose(
address _receiver_address,
uint32 _open_block_number,
uint192 _balance,
bytes _balance_msg_sig,
bytes _closing_sig)
external
| function cooperativeClose(
address _receiver_address,
uint32 _open_block_number,
uint192 _balance,
bytes _balance_msg_sig,
bytes _closing_sig)
external
| 21,830 |
193 | // Sets the `price` and `amount` of the specified `makerToken`-`takerToken` order Internal only makerToken Token that the reserve wishes to sell takerToken Token that the reserve wishes to buy price Price as a ratio of takerAmount:makerAmount times 10^18 amount Amount to decrement in ESD / | function _updateOrder(address makerToken, address takerToken, uint256 price, uint256 amount) internal {
_state.orders[makerToken][takerToken] = ReserveTypes.Order({price: Decimal.D256({value: price}), amount: amount});
}
| function _updateOrder(address makerToken, address takerToken, uint256 price, uint256 amount) internal {
_state.orders[makerToken][takerToken] = ReserveTypes.Order({price: Decimal.D256({value: price}), amount: amount});
}
| 63,131 |
28 | // Trade ETH to ERC20 | function ethToTokenSwapInput(uint256 min_tokens, uint256 deadline) external payable returns (uint256 tokens_bought);
function ethToTokenTransferInput(uint256 min_tokens, uint256 deadline, address recipient) external payable returns (uint256 tokens_bought);
function ethToTokenSwapOutput(uint256 tokens_boug... | function ethToTokenSwapInput(uint256 min_tokens, uint256 deadline) external payable returns (uint256 tokens_bought);
function ethToTokenTransferInput(uint256 min_tokens, uint256 deadline, address recipient) external payable returns (uint256 tokens_bought);
function ethToTokenSwapOutput(uint256 tokens_boug... | 5,584 |
219 | // Transfers underlying tokens from {msg.sender} to the contract and/ mints wrapper tokens./amount The amount of wrapper tokens to mint./ return The amount of underlying tokens deposited. | function mint(uint256 amount) external returns (uint256);
| function mint(uint256 amount) external returns (uint256);
| 52,877 |
0 | // BalancerSharedPoolPriceProvider constructor. _pool Balancer pool address. _isPeggedToEth For each token, true if it is pegged to ETH (token order determined by pool.getFinalTokens()). _decimals Number of decimals for each token (token order determined by pool.getFinalTokens()). _priceOracle Aave price oracle. _maxPr... | constructor(
BPoolV2 _pool,
BVaultV2 _vault,
bool[] memory _isPeggedToEth,
uint8[] memory _decimals,
IPriceOracle _priceOracle,
uint256 _maxPriceDeviation,
uint256 _K,
uint256 _powerPrecision,
uint256[][] memory _approximationMatrix
| constructor(
BPoolV2 _pool,
BVaultV2 _vault,
bool[] memory _isPeggedToEth,
uint8[] memory _decimals,
IPriceOracle _priceOracle,
uint256 _maxPriceDeviation,
uint256 _K,
uint256 _powerPrecision,
uint256[][] memory _approximationMatrix
| 34,779 |
0 | // will switch to true when initialized (prevents re-initialization) | bool public initialized = false;
| bool public initialized = false;
| 46,547 |
79 | // The ledger at a particular version/version The version of the ledger to query/ return The ledger at the specified version | function getLedgerOfVersion(Version version)
external
view
returns (Ledger memory)
| function getLedgerOfVersion(Version version)
external
view
returns (Ledger memory)
| 22,837 |
128 | // Accounts address=>balance | mapping(address=>Account) accounts;
| mapping(address=>Account) accounts;
| 55,891 |
14 | // Modifier to ensure the caller is an admin. / | modifier onlyAdmin() {
if (!ICre8ors(cre8orsNFTContractAddress).isAdmin(msg.sender)) {
revert IERC721Drop.Access_OnlyAdmin();
}
_;
}
| modifier onlyAdmin() {
if (!ICre8ors(cre8orsNFTContractAddress).isAdmin(msg.sender)) {
revert IERC721Drop.Access_OnlyAdmin();
}
_;
}
| 16,610 |
67 | // Compute the reflected and net reflected transferred amounts and the net transferred amount from a given amount of ETRNL. trueAmount The specified amount of ETRNLreturn The reflected amount, the net reflected transfer amount, the actual net transfer amount, and the total reflected fees / | function getValues(uint256 trueAmount, bool takeFee) private view returns (uint256, uint256, uint256) {
uint256 liquidityRate = eternalStorage.getUint(entity, liquidityProvisionRate);
uint256 deflationRate = eternalStorage.getUint(entity, burnRate);
uint256 fundRate = eternalStorage... | function getValues(uint256 trueAmount, bool takeFee) private view returns (uint256, uint256, uint256) {
uint256 liquidityRate = eternalStorage.getUint(entity, liquidityProvisionRate);
uint256 deflationRate = eternalStorage.getUint(entity, burnRate);
uint256 fundRate = eternalStorage... | 47,066 |
2 | // function: 查询请求parameters:queryId:请求id 回调时会原值返回callbackAddr :回调合约地址callbackFUN:回调合约函数,如getResponse(bytes32,uint64,uint256/bytes), 其中getResponse表示回调方法名,可自定义; bytes32类型参数指请求id,回调时会原值返回; uint64类型参数表示oracle服务状态码,1表示成功,0表示失败; 第三个参数表示Oracle服务回调结果,类型支持uint256/bytes两种 | * queryData :请求数据 json格式{"url":"https://ethgasstation.info/api/ethgasAPI.json","responseParams":["fast"]}
* return value :true 发起请求成功;false 发起请求失败
*/
function query(bytes32 queryId, address callbackAddr, string calldata callbackFUN, bytes calldata queryData) external pa... | * queryData :请求数据 json格式{"url":"https://ethgasstation.info/api/ethgasAPI.json","responseParams":["fast"]}
* return value :true 发起请求成功;false 发起请求失败
*/
function query(bytes32 queryId, address callbackAddr, string calldata callbackFUN, bytes calldata queryData) external pa... | 25,801 |
50 | // Burning tokens on funding wallet | balances[address(nWallets[index])] = 0;
| balances[address(nWallets[index])] = 0;
| 32,703 |
26 | // If sender votes no and voted yes before | resolution.yesVotesTotal -= votingPower;
| resolution.yesVotesTotal -= votingPower;
| 8,779 |
0 | // declare ERC standard details/ | string public name = "Gaia Token";
string public symbol = "GAT";
uint256 public decimals = 0;
| string public name = "Gaia Token";
string public symbol = "GAT";
uint256 public decimals = 0;
| 38,852 |
11 | // Remove the last admin, since it's double present | admins.pop();
| admins.pop();
| 43,092 |
83 | // in theory Q2 <= targetQuoteTokenAmount however when amount is close to 0, precision problems may cause Q2 > targetQuoteTokenAmount | return
DODOMath._SolveQuadraticFunctionForTrade(
state.Q0,
state.Q0,
payBaseAmount,
state.i,
state.K
);
| return
DODOMath._SolveQuadraticFunctionForTrade(
state.Q0,
state.Q0,
payBaseAmount,
state.i,
state.K
);
| 14,102 |
1 | // Constants set in ConstructorERC-20 Token we are staking | IERC20 immutable token;
| IERC20 immutable token;
| 6,330 |
138 | // Credits | event CreditsAdded(uint time, address indexed user, uint32 indexed id, uint amount);
event CreditsUsed(uint time, address indexed user, uint32 indexed id, uint amount);
event CreditsCashedout(uint time, address indexed user, uint amount);
constructor(address _registry)
Bankrollable(_reg... | event CreditsAdded(uint time, address indexed user, uint32 indexed id, uint amount);
event CreditsUsed(uint time, address indexed user, uint32 indexed id, uint amount);
event CreditsCashedout(uint time, address indexed user, uint amount);
constructor(address _registry)
Bankrollable(_reg... | 39,015 |
82 | // Remove the specified account from the blacklist. / | function disableBlacklist(address account) public onlyOwner {
require(blacklist[account], "ERC20: Account is not blacklisted");
blacklist[account] = false;
}
| function disableBlacklist(address account) public onlyOwner {
require(blacklist[account], "ERC20: Account is not blacklisted");
blacklist[account] = false;
}
| 3,772 |
70 | // List of agents that are allowed to create new tokens //Create new tokens and allocate them to an address.. Only callably by a crowdsale contract (mint agent). / | function mint(address receiver, uint amount) onlyMintAgent canMint public {
totalSupply = safeAdd(totalSupply, amount);
balances[receiver] = safeAdd(balances[receiver], amount);
// This will make the mint transaction apper in EtherScan.io
// We can remove this after there is a standardized minting ev... | function mint(address receiver, uint amount) onlyMintAgent canMint public {
totalSupply = safeAdd(totalSupply, amount);
balances[receiver] = safeAdd(balances[receiver], amount);
// This will make the mint transaction apper in EtherScan.io
// We can remove this after there is a standardized minting ev... | 36,583 |
48 | // Whether `a` is greater than or equal to `b`. a a FixedPoint.Signed. b a FixedPoint.Signed.return True if `a >= b`, or False. / | function isGreaterThanOrEqual(Signed memory a, Signed memory b) internal pure returns (bool) {
return a.rawValue >= b.rawValue;
}
| function isGreaterThanOrEqual(Signed memory a, Signed memory b) internal pure returns (bool) {
return a.rawValue >= b.rawValue;
}
| 19,192 |
12 | // Register retirement events. This function can only be called by a TC02 contract/ to register retirement events so they can be directly linked to an NFT mint./retiringEntity The entity that has retired TCO2 and is eligible to mint an NFT./projectVintageTokenId The vintage id of the TCO2 that is retired./amount The am... | function registerEvent(
address retiringEntity,
uint256 projectVintageTokenId,
uint256 amount,
bool isLegacy
| function registerEvent(
address retiringEntity,
uint256 projectVintageTokenId,
uint256 amount,
bool isLegacy
| 24,854 |
0 | // This contract implements a proxy that gets the implementation address for each call from a {UpgradeableBeacon}./ The beacon address. / | address immutable public beacon;
| address immutable public beacon;
| 33,420 |
5 | // Emitted when a fiAsset supply update is executed.// fiAsset The fiAsset with updated supply./ assetsThe new total supply./ yield The amount of yield added. | event TotalSupplyUpdated(address indexed fiAsset, uint256 assets, uint256 yield);
| event TotalSupplyUpdated(address indexed fiAsset, uint256 assets, uint256 yield);
| 21,185 |
6 | // Virtual range data set, ordering not guaranteed because removal just replaces position with last item and decreases collection size- data stored after range end. - range is readonly, data after can be altered./ | constructor(bytes32 _name, uint16 _start, uint16 _end, address _registry, uint16 _traitId) {
name = _name;
start = _start;
end = _end;
actualSize = _end - _start + 1;
traitId = _traitId;
ECRegistry = IECRegistry(_registry);
}
| constructor(bytes32 _name, uint16 _start, uint16 _end, address _registry, uint16 _traitId) {
name = _name;
start = _start;
end = _end;
actualSize = _end - _start + 1;
traitId = _traitId;
ECRegistry = IECRegistry(_registry);
}
| 72,037 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.