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 |
|---|---|---|---|---|
34 | // Total tokens should be more than user want's to buy | require(balances[owner]>safeMul(tokens, multiplier));
| require(balances[owner]>safeMul(tokens, multiplier));
| 37,379 |
120 | // called by oracles when they have witnessed a need to update _roundId is the ID of the round this submission pertains to _submission is the updated data that the oracle is submitting / | function submit(uint256 _roundId, int256 _submission)
external
| function submit(uint256 _roundId, int256 _submission)
external
| 23,872 |
46 | // Creates a new pool if it does not exist, then initializes if not initialized/This method can be bundled with others via IMulticall for the first action (e.g. mint) performed against a pool/token0 The contract address of token0 of the pool/token1 The contract address of token1 of the pool/fee The fee amount of the v3... | function createAndInitializePoolIfNecessary(
address token0,
address token1,
uint24 fee,
uint160 sqrtPriceX96
) external payable returns (address pool);
| function createAndInitializePoolIfNecessary(
address token0,
address token1,
uint24 fee,
uint160 sqrtPriceX96
) external payable returns (address pool);
| 1,866 |
27 | // send fails are ignored hence there is always a direct way to withdraw. | delete pendingWithdrawals[i];
bytes22 packedBalanceKey = packAddressAndTokenId(to, tokenId);
uint128 amount = balancesToWithdraw[packedBalanceKey].balanceToWithdraw;
| delete pendingWithdrawals[i];
bytes22 packedBalanceKey = packAddressAndTokenId(to, tokenId);
uint128 amount = balancesToWithdraw[packedBalanceKey].balanceToWithdraw;
| 29,663 |
105 | // Check if there is enough in the reserve | require(_updateInterest());
require(_amount <= underlyingBalance() && _amount <= totalReserve, Errors.RESERVE_FUNDS_INSUFFICIENT);
totalReserve = totalReserve.sub(_amount);
| require(_updateInterest());
require(_amount <= underlyingBalance() && _amount <= totalReserve, Errors.RESERVE_FUNDS_INSUFFICIENT);
totalReserve = totalReserve.sub(_amount);
| 27,515 |
2 | // An event emitted when a vote has been cast on a proposal/voter The address which casted a vote/proposalId The proposal id which was voted on/support Support value for the vote. 0=against, 1=for, 2=abstain/votes Number of votes which were cast by the voter/reason The reason given for the vote by the voter | event VoteCast(
address indexed voter,
uint256 proposalId,
uint8 support,
uint256 votes,
string reason
);
| event VoteCast(
address indexed voter,
uint256 proposalId,
uint8 support,
uint256 votes,
string reason
);
| 24,372 |
14 | // Grant / revoke a role from a given signer. | function changeRole(RoleRequest calldata _req, bytes calldata _signature) external virtual {
require(_req.role != bytes32(0), "AccountPermissions: role cannot be empty");
require(
_req.validityStartTimestamp < block.timestamp && block.timestamp < _req.validityEndTimestamp,
"A... | function changeRole(RoleRequest calldata _req, bytes calldata _signature) external virtual {
require(_req.role != bytes32(0), "AccountPermissions: role cannot be empty");
require(
_req.validityStartTimestamp < block.timestamp && block.timestamp < _req.validityEndTimestamp,
"A... | 4,768 |
66 | // Storage position of the owner and pendingOwner of the contract keccak256("OUSD.governor"); | bytes32
private constant governorPosition = 0x7bea13895fa79d2831e0a9e28edede30099005a50d652d8957cf8a607ee6ca4a;
| bytes32
private constant governorPosition = 0x7bea13895fa79d2831e0a9e28edede30099005a50d652d8957cf8a607ee6ca4a;
| 3,153 |
0 | // list of CLient Records | ClientRecord[] ClientRecords;
| ClientRecord[] ClientRecords;
| 16,219 |
10 | // The contract that stores splits for each project. | IJBSplitsStore public immutable override splitsStore;
| IJBSplitsStore public immutable override splitsStore;
| 14,259 |
82 | // This will get the slippage rate from configuration contract and calculate how much amount user can get after slippage. | uint256 sliprate= IPoolConfiguration(_poolConf).getslippagerate();
uint rate = _amount.mul(sliprate).div(100);
| uint256 sliprate= IPoolConfiguration(_poolConf).getslippagerate();
uint rate = _amount.mul(sliprate).div(100);
| 46,456 |
168 | // whitelist mint | function mintWhitelist(bytes32[] calldata proof, uint256 _mintAmount)
public
payable
| function mintWhitelist(bytes32[] calldata proof, uint256 _mintAmount)
public
payable
| 46,716 |
177 | // Insert an empty request so as to initialize the requests array with length > 0 | DataRequest memory request;
requests.push(request);
| DataRequest memory request;
requests.push(request);
| 29,128 |
3 | // copy | let ptr := start
| let ptr := start
| 28,325 |
29 | // Copies the balance of a single addresses from the legacy contract _holder Address to migrate balancereturn True if balance was copied, false if was already copied or address had no balance / | function migrateBalanceFromLegacyRep(address _holder, ERC20 _legacyRepToken) private whenMigratingFromLegacy afterInitialized returns (bool) {
if (balances[_holder] > 0) {
return false; // Already copied, move on
}
uint256 amount = _legacyRepToken.balanceOf(_holder);
if ... | function migrateBalanceFromLegacyRep(address _holder, ERC20 _legacyRepToken) private whenMigratingFromLegacy afterInitialized returns (bool) {
if (balances[_holder] > 0) {
return false; // Already copied, move on
}
uint256 amount = _legacyRepToken.balanceOf(_holder);
if ... | 46,281 |
21 | // To delete an element from the _values array in O(1), we swap the element to delete with the last one in the array, and then remove the last element (sometimes called as 'swap and pop'). This modifies the order of the array, as noted in {at}. |
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
|
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
| 1,305 |
49 | // This means the index itself is not an available token, but the val at that index is. | result = valAtIndex;
| result = valAtIndex;
| 12,195 |
31 | // Replacement for Solidity's `transfer`: sends `amount` wei to `recipient`, forwarding all available gas and reverting on errors. of certain opcodes, possibly making contracts go over the 2300 gas limit imposed by `transfer`, making them unable to receive funds via | * `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities... | * `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities... | 1,954 |
130 | // 转出操作 | function transferToken(
address _to,
uint _value,
address _erc20Addr
| function transferToken(
address _to,
uint _value,
address _erc20Addr
| 26,996 |
1 | // Maps an L2 ERC721 token address to a boolean that returns true if the token was createdwith the L2StandardERC721Factory. / | function isStandardERC721(address _account) external view returns (bool);
| function isStandardERC721(address _account) external view returns (bool);
| 19,505 |
154 | // token owner's balance must be enough to spend tokens | require (
coloredTokens[colorIndex].balances[from] >= tokens,
"Insufficient tokens to spend"
);
| require (
coloredTokens[colorIndex].balances[from] >= tokens,
"Insufficient tokens to spend"
);
| 14,710 |
45 | // Agile Connect ERC20 tokenImplemantation of the ABC token. / | contract ABCToken is MintableToken {
string public name = "ABCToken";
string public symbol = "ABC";
uint256 public decimals = 18;
/**
* This unnamed function is called whenever someone tries to send ether to it
*/
function() {
revert();
// Prevents accidental sending of eth... | contract ABCToken is MintableToken {
string public name = "ABCToken";
string public symbol = "ABC";
uint256 public decimals = 18;
/**
* This unnamed function is called whenever someone tries to send ether to it
*/
function() {
revert();
// Prevents accidental sending of eth... | 48,293 |
54 | // ark, round 27 | st0 := addmod(st0, 0x2b56973364c4c4f5c1a3ec4da3cdce038811eb116fb3e45bc1768d26fc0b3758, q)
st1 := addmod(st1, 0x123769dd49d5b054dcd76b89804b1bcb8e1392b385716a5d83feb65d437f29ef, q)
st2 := addmod(st2, 0x2147b424fc48c80a88ee52b91169aacea989f6446471150994257b2fb01c63e9, q)
| st0 := addmod(st0, 0x2b56973364c4c4f5c1a3ec4da3cdce038811eb116fb3e45bc1768d26fc0b3758, q)
st1 := addmod(st1, 0x123769dd49d5b054dcd76b89804b1bcb8e1392b385716a5d83feb65d437f29ef, q)
st2 := addmod(st2, 0x2147b424fc48c80a88ee52b91169aacea989f6446471150994257b2fb01c63e9, q)
| 8,287 |
443 | // reverts if the caller does not have access by the accessControllercontract or is the contract itself. / | modifier checkAccess() {
AccessControllerInterface ac = accessController;
require(address(ac) == address(0) || ac.hasAccess(msg.sender, msg.data), "No access");
_;
}
| modifier checkAccess() {
AccessControllerInterface ac = accessController;
require(address(ac) == address(0) || ac.hasAccess(msg.sender, msg.data), "No access");
_;
}
| 23,528 |
93 | // The bit mask of the 'burned' bit in packed ownership. | uint256 private constant _BITMASK_BURNED = 1 << 224;
| uint256 private constant _BITMASK_BURNED = 1 << 224;
| 36,337 |
0 | // IRewardsDistributor Aave Defines the basic interface for a Rewards Distributor. / | interface IRewardsDistributor {
/**
* @dev Emitted when the configuration of the rewards of an asset is updated.
* @param asset The address of the incentivized asset
* @param reward The address of the reward token
* @param oldEmission The old emissions per second value of the reward distribution
* @par... | interface IRewardsDistributor {
/**
* @dev Emitted when the configuration of the rewards of an asset is updated.
* @param asset The address of the incentivized asset
* @param reward The address of the reward token
* @param oldEmission The old emissions per second value of the reward distribution
* @par... | 49,087 |
0 | // SavingsCELO contract, | ISavingsCELO public savingsCELO;
| ISavingsCELO public savingsCELO;
| 48,031 |
91 | // the total amount claimed | uint256 public rewardClaimedTotal;
| uint256 public rewardClaimedTotal;
| 55,675 |
25 | // start from the right, effectively left-padding if less than 32 bytes in b | uint last = b.length;
if (b.length > 32) {
last = 32;
}
| uint last = b.length;
if (b.length > 32) {
last = 32;
}
| 19,043 |
18 | // Max wallet & Transaction | uint256 public _maxBuyTxAmount = _totalSupply / (100) * (2); // 2%
uint256 public _maxSellTxAmount = _totalSupply / (100) * (2); // 2%
uint256 public _maxWalletToken = _totalSupply / (100) * (2); // 2%
| uint256 public _maxBuyTxAmount = _totalSupply / (100) * (2); // 2%
uint256 public _maxSellTxAmount = _totalSupply / (100) * (2); // 2%
uint256 public _maxWalletToken = _totalSupply / (100) * (2); // 2%
| 3,832 |
137 | // The facet of the Ethernauts contract that manages ownership, ERC-721 compliant./This provides the methods required for basic non-fungible tokentransactions, following the draft ERC-721 spec (https:github.com/ethereum/EIPs/issues/721).It interfaces with EthernautsStorage provinding basic functions as create and list,... | contract EthernautsOwnership is EthernautsAccessControl, ERC721 {
/// @dev Contract holding only data.
EthernautsStorage public ethernautsStorage;
/*** CONSTANTS ***/
/// @notice Name and symbol of the non fungible token, as defined in ERC721.
string public constant name = "Ethernauts";
string... | contract EthernautsOwnership is EthernautsAccessControl, ERC721 {
/// @dev Contract holding only data.
EthernautsStorage public ethernautsStorage;
/*** CONSTANTS ***/
/// @notice Name and symbol of the non fungible token, as defined in ERC721.
string public constant name = "Ethernauts";
string... | 14,645 |
118 | // Allow withdraw funds from smart contract / | function withdraw() public onlyOwner {
uint256 returnAmount = this.balance;
wallet.transfer(returnAmount);
emit EtherWithdrawn(wallet, returnAmount);
}
| function withdraw() public onlyOwner {
uint256 returnAmount = this.balance;
wallet.transfer(returnAmount);
emit EtherWithdrawn(wallet, returnAmount);
}
| 61,167 |
90 | // disable adding to whitelist forever | function renounceWhitelist() public onlyOwner {
// adding to whitelist has been disabled forever:
canWhitelist = false;
}
| function renounceWhitelist() public onlyOwner {
// adding to whitelist has been disabled forever:
canWhitelist = false;
}
| 31,628 |
6 | // compute and send fees | uint256 fees = collectEstimation(totalExpectedAmounts);
require(fees == msg.value && collectForREQBurning(fees));
extractAndStoreBitcoinAddresses(requestId, _payeesIdAddress.length, _payeesPaymentAddress, _payerRefundAddress);
return requestId;
| uint256 fees = collectEstimation(totalExpectedAmounts);
require(fees == msg.value && collectForREQBurning(fees));
extractAndStoreBitcoinAddresses(requestId, _payeesIdAddress.length, _payeesPaymentAddress, _payerRefundAddress);
return requestId;
| 31,786 |
22 | // method to get the internal state of an envelope envelopeId id of the envelopereturn the envelope current state, containing if it has been confirmed and delivered / | function getEnvelopeState(bytes32 envelopeId) external view returns (EnvelopeState);
| function getEnvelopeState(bytes32 envelopeId) external view returns (EnvelopeState);
| 30,701 |
2 | // User Errors | error NotOwnerOfSpecialHoneyComb(uint256 bearId, uint256 honeycombId);
error Claim_IncorrectInput();
error Claim_InvalidProof();
error MekingTooManyHoneyCombs(uint256 bearId);
| error NotOwnerOfSpecialHoneyComb(uint256 bearId, uint256 honeycombId);
error Claim_IncorrectInput();
error Claim_InvalidProof();
error MekingTooManyHoneyCombs(uint256 bearId);
| 23,781 |
100 | // Returns the encryption public key of a given darknode. | function darknodePublicKey(address darknodeID) external view onlyOwner returns (bytes) {
return darknodeRegistry[darknodeID].publicKey;
}
| function darknodePublicKey(address darknodeID) external view onlyOwner returns (bytes) {
return darknodeRegistry[darknodeID].publicKey;
}
| 6,280 |
34 | // Check if requirements for next pool are met | if(users[adr].deposit >= pools[poolnum].minOwnInvestment && users[adr].referrals.length >= pools[poolnum].minDirects && sumDirects >= pools[poolnum].minSumDirects){
users[adr].qualifiedPools = poolnum + 1;
pools[poolnum].numUsers++;
emit PoolR... | if(users[adr].deposit >= pools[poolnum].minOwnInvestment && users[adr].referrals.length >= pools[poolnum].minDirects && sumDirects >= pools[poolnum].minSumDirects){
users[adr].qualifiedPools = poolnum + 1;
pools[poolnum].numUsers++;
emit PoolR... | 15,830 |
387 | // if there is debt, redeem at no cost | debt = value;
| debt = value;
| 44,876 |
9 | // Send message up to L1 bridge | sendCrossDomainMessage(l1TokenBridge, _l1Gas, message);
emit WithdrawalInitiated(l1Token, _l2Token, msg.sender, _to, _amount, _data);
| sendCrossDomainMessage(l1TokenBridge, _l1Gas, message);
emit WithdrawalInitiated(l1Token, _l2Token, msg.sender, _to, _amount, _data);
| 31,626 |
5 | // TODO: CLEAN UP | mapping(uint256 => mapping(uint256 => bool)) keyUnlockClaims;
| mapping(uint256 => mapping(uint256 => bool)) keyUnlockClaims;
| 50,781 |
163 | // Fallback function.Implemented entirely in `_fallback`. / | function() external payable {
_fallback();
}
| function() external payable {
_fallback();
}
| 23,864 |
17 | // Retrieve the size of the code on target address, this needs assembly . | codeLength := extcodesize(_partner)
| codeLength := extcodesize(_partner)
| 43,332 |
2 | // the {_flashFee} function which returns the fee applied when doing flashloans. token The token to be flash loaned. amount The amount of tokens to be loaned.return The fees applied to the corresponding flash loan. / | function flashFee(address token, uint256 amount) public view virtual override returns (uint256) {
require(token == address(this), "ERC20FlashMint: wrong token");
return _flashFee(token, amount);
}
| function flashFee(address token, uint256 amount) public view virtual override returns (uint256) {
require(token == address(this), "ERC20FlashMint: wrong token");
return _flashFee(token, amount);
}
| 6,905 |
38 | // Claim pending uPremia rewards | function claimUPremia() external {
uint256 amount = uPremiaBalance[msg.sender];
uPremiaBalance[msg.sender] = 0;
IERC20(address(uPremia)).safeTransfer(msg.sender, amount);
}
| function claimUPremia() external {
uint256 amount = uPremiaBalance[msg.sender];
uPremiaBalance[msg.sender] = 0;
IERC20(address(uPremia)).safeTransfer(msg.sender, amount);
}
| 50,516 |
11 | // Access modifier to allow access to development mode functions | modifier onlyUnderDevelopment() {
require(isDevelopment == true);
_;
}
| modifier onlyUnderDevelopment() {
require(isDevelopment == true);
_;
}
| 48,084 |
11 | // User Interface // Sender supplies assets into the market and receives cTokens in exchange Accrues interest whether or not the operation succeeds, unless reverted mintAmount The amount of the underlying asset to supplyreturn uint 0=success, otherwise a failure (see ErrorReporter.sol for details) / | function mint(uint mintAmount) external returns (uint) {
(uint err,) = mintInternal(mintAmount);
return err;
}
| function mint(uint mintAmount) external returns (uint) {
(uint err,) = mintInternal(mintAmount);
return err;
}
| 5,367 |
150 | // Replace opensea json link | function setOpenSeaJSONUri(string memory uri) public onlyOwner {
openSeaJSON = uri;
}
| function setOpenSeaJSONUri(string memory uri) public onlyOwner {
openSeaJSON = uri;
}
| 83,990 |
63 | // the owner can pay funds in at any time although this is not needed perhaps the contract needs to hold a certain balance in future for some external requirement | function treasuryIn() external payable onlyOwner {
}
| function treasuryIn() external payable onlyOwner {
}
| 13,901 |
91 | // There should never be any tokens in this contract | function rescueTokens(address token, uint256 amount) external onlyOwner {
if(token == address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)){
amount = Math.min(address(this).balance, amount);
msg.sender.transfer(amount);
}else{
IERC20 want = IERC20(token);
... | function rescueTokens(address token, uint256 amount) external onlyOwner {
if(token == address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)){
amount = Math.min(address(this).balance, amount);
msg.sender.transfer(amount);
}else{
IERC20 want = IERC20(token);
... | 2,607 |
129 | // to offer impeachment you should havevoting rights | if (votingRights[msg.sender] == 0) throw;
| if (votingRights[msg.sender] == 0) throw;
| 32,424 |
228 | // Sells our harvested CRV into the selected output. | function _sell(uint256 _amount) internal {
IUniswapV2Router02(sushiswap).swapExactTokensForTokens(
_amount,
uint256(0),
crvPath,
address(this),
block.timestamp
);
}
| function _sell(uint256 _amount) internal {
IUniswapV2Router02(sushiswap).swapExactTokensForTokens(
_amount,
uint256(0),
crvPath,
address(this),
block.timestamp
);
}
| 39,208 |
39 | // stop the crowdsale / | function stop() public onlyOwner {
isFinalized = true;
}
| function stop() public onlyOwner {
isFinalized = true;
}
| 35,271 |
653 | // Let orig_lo and orig_hi be the original values of lo and hi passed to partition. Then, hi < orig_hi, because hi decreases strictly monotonically in each loop iteration and - either list[orig_hi] > pivot, in which case the first loop iteration will achieve hi < orig_hi; - or list[orig_hi] <= pivot, in which case at l... | return hi;
| return hi;
| 13,350 |
68 | // Return price oracle response which consists the following information: oracle is broken or frozen, the/ price change between two rounds is more than max, and the price. | function getPriceOracleResponse() external returns (PriceOracleResponse memory);
| function getPriceOracleResponse() external returns (PriceOracleResponse memory);
| 35,769 |
123 | // UNI LP -> Curve LP Assume th | function convert(address _lp, uint256 _amount) public {
// Get LP Tokens
IERC20(_lp).safeTransferFrom(msg.sender, address(this), _amount);
// Get Uniswap pair
IUniswapV2Pair fromPair = IUniswapV2Pair(_lp);
// Only for WETH/<TOKEN> pairs
if (!(fromPair.token0() == we... | function convert(address _lp, uint256 _amount) public {
// Get LP Tokens
IERC20(_lp).safeTransferFrom(msg.sender, address(this), _amount);
// Get Uniswap pair
IUniswapV2Pair fromPair = IUniswapV2Pair(_lp);
// Only for WETH/<TOKEN> pairs
if (!(fromPair.token0() == we... | 49,917 |
35 | // Transfers the balance from msg.sender to an account/_to Recipient address/_value Transfered amount in unit/ return Transfer status Standard function transfer similar to ERC20 transfer with no _data . Added due to backwards compatibility reasons . | function transfer(address _to, uint _value)
public
isTradable
| function transfer(address _to, uint _value)
public
isTradable
| 13,454 |
62 | // emergency withdraw without caring about pending earnings pending earnings will be lost / set to 0 if used emergency withdraw | function emergencyWithdraw(uint amountToWithdraw) public {
require(amountToWithdraw > 0, "Cannot withdraw 0 Tokens");
require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw");
// set pending earnings to 0 here
lastClaimedTime[msg.sender] = now;
... | function emergencyWithdraw(uint amountToWithdraw) public {
require(amountToWithdraw > 0, "Cannot withdraw 0 Tokens");
require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw");
// set pending earnings to 0 here
lastClaimedTime[msg.sender] = now;
... | 20,056 |
62 | // - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.- If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. Emits a {Transfer} event. / | function safeTransferFrom(
| function safeTransferFrom(
| 39,170 |
84 | // Get exchange dynamic fee related keys/ return threshold, weight decay, rounds, and max fee | function getExchangeDynamicFeeConfig() internal view returns (DynamicFeeConfig memory) {
bytes32[] memory keys = new bytes32[](4);
keys[0] = SETTING_EXCHANGE_DYNAMIC_FEE_THRESHOLD;
keys[1] = SETTING_EXCHANGE_DYNAMIC_FEE_WEIGHT_DECAY;
keys[2] = SETTING_EXCHANGE_DYNAMIC_FEE_ROUNDS;
... | function getExchangeDynamicFeeConfig() internal view returns (DynamicFeeConfig memory) {
bytes32[] memory keys = new bytes32[](4);
keys[0] = SETTING_EXCHANGE_DYNAMIC_FEE_THRESHOLD;
keys[1] = SETTING_EXCHANGE_DYNAMIC_FEE_WEIGHT_DECAY;
keys[2] = SETTING_EXCHANGE_DYNAMIC_FEE_ROUNDS;
... | 27,920 |
7 | // Parameter validation | require(address(msg.sender) == _client, "Only the client can call this function and submit a job");
require(_client != _provider, "Client and provider addresses must be different");
require(address(msg.sender).balance >= _jobCost, "Caller does not have enough funds to pay for the job");
... | require(address(msg.sender) == _client, "Only the client can call this function and submit a job");
require(_client != _provider, "Client and provider addresses must be different");
require(address(msg.sender).balance >= _jobCost, "Caller does not have enough funds to pay for the job");
... | 18,801 |
1 | // This event will be emitted on cycle end to indicate the `emitInitiateChange` function needs to be called to apply a new validator set/ | event ShouldEmitInitiateChange();
| event ShouldEmitInitiateChange();
| 31,211 |
14 | // Perform a swap exact amount out using callback | function _swapExactOutputInternal(
uint256 amountOut,
address recipient,
uint160 limitSqrtP,
SwapCallbackData memory data
| function _swapExactOutputInternal(
uint256 amountOut,
address recipient,
uint160 limitSqrtP,
SwapCallbackData memory data
| 20,958 |
7 | // Entrants are stored as a list of addresses. | address[] private entrants_;
| address[] private entrants_;
| 37,692 |
151 | // Min amount to liquify. (default 500 FARMINGs) | uint256 public minAmountToLiquify = 500 ether;
| uint256 public minAmountToLiquify = 500 ether;
| 24,558 |
4 | // Count of all prints | uint256 private _totalPrintCount = 0;
| uint256 private _totalPrintCount = 0;
| 17,700 |
1 | // getChild function enables older contracts like cryptokitties to be transferred into a composable The _childContract must approve this contract. Then getChild can be called. | function getChild(address _from, uint256 _tokenId, address _childContract, uint256 _childTokenId) external;
| function getChild(address _from, uint256 _tokenId, address _childContract, uint256 _childTokenId) external;
| 9,781 |
19 | // Preserved for API compatibility with older version/ documented in bip143. many values are hardcoded here/_outpointthe bitcoin UTXO id (32-byte txid + 4-byte output index)/_inputPKHthe input pubkeyhash (hash160(sender_pubkey))/_inputValuethe value of the input in satoshi/_outputValue the value of the output in satosh... | function oneInputOneOutputSighash(
bytes memory _outpoint, // 36-byte UTXO id
bytes20 _inputPKH, // 20-byte hash160
bytes8 _inputValue, // 8-byte LE
bytes8 _outputValue, // 8-byte LE
bytes20 _outputPKH // 20-byte hash160
| function oneInputOneOutputSighash(
bytes memory _outpoint, // 36-byte UTXO id
bytes20 _inputPKH, // 20-byte hash160
bytes8 _inputValue, // 8-byte LE
bytes8 _outputValue, // 8-byte LE
bytes20 _outputPKH // 20-byte hash160
| 11,260 |
14 | // Trade susd to ibeur | function swap_out(uint amount, uint minOut) external returns (uint amountReceived) {
_safeTransferFrom(susd, msg.sender, address(this), amount);
synthetix _snx = synthetix(addresses.getAddress("Synthetix"));
erc20(susd).approve(address(_snx), amount);
amountReceived = _snx.exchangeAt... | function swap_out(uint amount, uint minOut) external returns (uint amountReceived) {
_safeTransferFrom(susd, msg.sender, address(this), amount);
synthetix _snx = synthetix(addresses.getAddress("Synthetix"));
erc20(susd).approve(address(_snx), amount);
amountReceived = _snx.exchangeAt... | 53,503 |
40 | // Recursively find the most recent address given a superseded one.addr The superseded address. return the verified address that ultimately holds the stock. / | function findCurrentFor(address addr)
internal
view
returns (address)
| function findCurrentFor(address addr)
internal
view
returns (address)
| 44,577 |
52 | // if token is already rUmb2 means swap started already |
if (token == rUmb1 && isSwapStarted) {
token = rUmb2;
acceptedTokenId = RUMB2_ID;
}
|
if (token == rUmb1 && isSwapStarted) {
token = rUmb2;
acceptedTokenId = RUMB2_ID;
}
| 52,035 |
68 | // Withdraws a certain amount of staked LRC for an exchange to the given address./This function is meant to be called only from within exchange contracts./ recipient The address to receive LRC/ requestedAmount The amount of LRC to withdraw/ return amountLRC The amount of LRC withdrawn | function withdrawExchangeStake(
address recipient,
uint requestedAmount
)
external
virtual
returns (uint amountLRC);
| function withdrawExchangeStake(
address recipient,
uint requestedAmount
)
external
virtual
returns (uint amountLRC);
| 30,476 |
175 | // NORMAL WHITELIST WALLETS | function isWalletWhiteListed(address account, bytes32[] calldata proof) internal view returns(bool) {
return _verifyWL(_leaf(account), proof);
}
| function isWalletWhiteListed(address account, bytes32[] calldata proof) internal view returns(bool) {
return _verifyWL(_leaf(account), proof);
}
| 63,195 |
97 | // WadRayMath library Aave Provides mul and div function for wads (decimal numbers with 18 digits precision) and rays (decimals with 27 digits) / | library WadRayMath {
uint256 internal constant WAD = 1e18;
uint256 internal constant halfWAD = WAD / 2;
uint256 internal constant RAY = 1e27;
uint256 internal constant halfRAY = RAY / 2;
uint256 internal constant WAD_RAY_RATIO = 1e9;
/**
* @return One ray, 1e27
**/
function ray(... | library WadRayMath {
uint256 internal constant WAD = 1e18;
uint256 internal constant halfWAD = WAD / 2;
uint256 internal constant RAY = 1e27;
uint256 internal constant halfRAY = RAY / 2;
uint256 internal constant WAD_RAY_RATIO = 1e9;
/**
* @return One ray, 1e27
**/
function ray(... | 20,585 |
295 | // HanfuClub contract Extends ERC721 Non-Fungible Token Standard basic implementation / | contract HanfuClub is ERC721, Ownable {
using SafeMath for uint256;
address payable busyWallet;
address payable busyWallet1;
address payable busyWallet2;
address payable busyWallet3;
address payable depWallet;
bytes32 public merkleRoot;
uint256 public constant hanfuPrice = 88000000000... | contract HanfuClub is ERC721, Ownable {
using SafeMath for uint256;
address payable busyWallet;
address payable busyWallet1;
address payable busyWallet2;
address payable busyWallet3;
address payable depWallet;
bytes32 public merkleRoot;
uint256 public constant hanfuPrice = 88000000000... | 78,706 |
270 | // Exit pool only with liquid tokensThis function will withdraw TUSD but with a small penaltyUses the sync() modifier to reduce gas costs of using curve amount amount of pool tokens to redeem for underlying tokens / | function liquidExit(uint256 amount) external nonReentrant sync {
require(block.number != latestJoinBlock[tx.origin], "TrueFiPool: Cannot join and exit in same block");
require(amount <= balanceOf(msg.sender), "TrueFiPool: Insufficient funds");
uint256 amountToWithdraw = poolValue().mul(amou... | function liquidExit(uint256 amount) external nonReentrant sync {
require(block.number != latestJoinBlock[tx.origin], "TrueFiPool: Cannot join and exit in same block");
require(amount <= balanceOf(msg.sender), "TrueFiPool: Insufficient funds");
uint256 amountToWithdraw = poolValue().mul(amou... | 22,106 |
461 | // kill starverd NFT and get fatalityPct of his points. | function fatality(uint256 _deadId, uint256 _tokenId) external notPaused {
require(
!isVnftAlive(_deadId),
"The vNFT has to be starved to claim his points"
);
vnftScore[_tokenId] = vnftScore[_tokenId].add(
(vnftScore[_deadId].mul(fatalityPct).div(100))
... | function fatality(uint256 _deadId, uint256 _tokenId) external notPaused {
require(
!isVnftAlive(_deadId),
"The vNFT has to be starved to claim his points"
);
vnftScore[_tokenId] = vnftScore[_tokenId].add(
(vnftScore[_deadId].mul(fatalityPct).div(100))
... | 10,714 |
249 | // 2. Eliminate debt | uint256 totalDebt = totalDebt();
if (newSupply > 0 && totalDebt > 0) {
lessDebt = totalDebt > newSupply ? newSupply : totalDebt;
decreaseDebt(lessDebt);
newSupply = newSupply.sub(lessDebt);
}
| uint256 totalDebt = totalDebt();
if (newSupply > 0 && totalDebt > 0) {
lessDebt = totalDebt > newSupply ? newSupply : totalDebt;
decreaseDebt(lessDebt);
newSupply = newSupply.sub(lessDebt);
}
| 15,130 |
27 | // After replace completed syncFlag set to 0 | syncFlag = 0;
snapshotAssets = tempAssets;
tempAssets = 0;
success = true;
| syncFlag = 0;
snapshotAssets = tempAssets;
tempAssets = 0;
success = true;
| 39,818 |
5 | // Extract ECDSA signature variables from `sig` | assembly {
r := mload(add(_sig, 32))
s := mload(add(_sig, 64))
v := byte(0, mload(add(_sig, 96)))
}
| assembly {
r := mload(add(_sig, 32))
s := mload(add(_sig, 64))
v := byte(0, mload(add(_sig, 96)))
}
| 6,809 |
2 | // Owner has power to abort, discount addresses, sweep successful funds, change owner, sweep alien tokens. | address public owner = 0xB353cF41A0CAa38D6597A7a1337debf0b09dd8ae; // Primary address checksummed
| address public owner = 0xB353cF41A0CAa38D6597A7a1337debf0b09dd8ae; // Primary address checksummed
| 38,977 |
17 | // Withdraw balance from the Guild/Only the guild owner can execute/_tokenAddress token asset to withdraw some balance/_amount amount to be withdraw in wei/_beneficiary beneficiary to send funds. If 0x is specified, funds will be sent to the guild owner | function withdraw(
address _tokenAddress,
uint256 _amount,
address _beneficiary
| function withdraw(
address _tokenAddress,
uint256 _amount,
address _beneficiary
| 25,304 |
2 | // constructor only runs when we deploy contract is created. | constructor() {
minter = msg.sender;
}
| constructor() {
minter = msg.sender;
}
| 22,135 |
58 | // 如果原来的CFO没有设置 则sender必须是owner 否则必须是原来的CFO | if(cfo == address(0)) {
require(msg.sender == owner);
}else{
| if(cfo == address(0)) {
require(msg.sender == owner);
}else{
| 23,426 |
21 | // user pays for specified num of tokens, address and qty are indexed for later use by minting contract | function prepayment(uint256 numTokens) external payable {
require (prepayActive, "round inactive");
require (msg.value >= prepayCost*numTokens, "Incorrect value sent");
require (numTokens + currentToken <= prepayLimit, "No more left");
require (numTokens <= prepay_txnLimit);
... | function prepayment(uint256 numTokens) external payable {
require (prepayActive, "round inactive");
require (msg.value >= prepayCost*numTokens, "Incorrect value sent");
require (numTokens + currentToken <= prepayLimit, "No more left");
require (numTokens <= prepay_txnLimit);
... | 9,600 |
50 | // Get the appropriate rate which applies | getCurrentVUPRate();
| getCurrentVUPRate();
| 30,160 |
4 | // TODO: More robust parsing that handles whitespace and multiple key/value pairs | if (str.readUint32(idx) != 0x613d3078) return (address(0x0), false); // 0x613d3078 == 'a=0x'
if (len < 44) return (address(0x0), false);
return hexToAddress(str, idx + 4);
| if (str.readUint32(idx) != 0x613d3078) return (address(0x0), false); // 0x613d3078 == 'a=0x'
if (len < 44) return (address(0x0), false);
return hexToAddress(str, idx + 4);
| 37,352 |
13 | // Allow _spender to withdraw from your account, multiple times, up to the _value amount. If this function is called again it overwrites the current allowance with _value. this function is required for some DEX functionality | function approve(address spender, uint256 value) public returns (bool);
| function approve(address spender, uint256 value) public returns (bool);
| 29,914 |
23 | // Set royalty for marketplaces complying with ERC2981 standard | function setDefaultRoyalty(address receiver, uint96 feeNumerator) public onlyAdmin {
_setDefaultRoyalty(receiver, feeNumerator);
}
| function setDefaultRoyalty(address receiver, uint96 feeNumerator) public onlyAdmin {
_setDefaultRoyalty(receiver, feeNumerator);
}
| 10,417 |
52 | // a mapping of interface id to whether or not it's supported / | mapping(bytes4 => bool) private _supportedInterfaces;
| mapping(bytes4 => bool) private _supportedInterfaces;
| 3,253 |
425 | // computes the largest integer smaller than or equal to the binary logarithm of the input. / | function floorLog2(uint256 _n) internal pure returns (uint8) {
uint8 res = 0;
if (_n < 256) {
// At most 8 iterations
while (_n > 1) {
_n >>= 1;
res += 1;
}
} else {
// Exactly 8 iterations
for (uint... | function floorLog2(uint256 _n) internal pure returns (uint8) {
uint8 res = 0;
if (_n < 256) {
// At most 8 iterations
while (_n > 1) {
_n >>= 1;
res += 1;
}
} else {
// Exactly 8 iterations
for (uint... | 33,217 |
91 | // Recursively distribute deposit fee between parents _node Parent address _prevPercentage The percentage for previous parent _depositsCount Count of depositer deposits _amount The amount of deposit / | function distribute(
address _node,
uint _prevPercentage,
uint8 _depositsCount,
uint _amount
)
private
| function distribute(
address _node,
uint _prevPercentage,
uint8 _depositsCount,
uint _amount
)
private
| 35,131 |
59 | // redeem underlying collateral | JErc20Interface(joinedAddresses.JTokenCollateralToSeize).redeem(retrnVals.earnedJToken);
| JErc20Interface(joinedAddresses.JTokenCollateralToSeize).redeem(retrnVals.earnedJToken);
| 25,054 |
38 | // add to points buyback and send user their share | pointsBuybackBalance = pointsBuybackBalance.add(feeAmount);
safeTokenTransfer(msg.sender, DeFiatPoints, remainingUserAmount);
emit EmergencyWithdraw(msg.sender, remainingUserAmount);
| pointsBuybackBalance = pointsBuybackBalance.add(feeAmount);
safeTokenTransfer(msg.sender, DeFiatPoints, remainingUserAmount);
emit EmergencyWithdraw(msg.sender, remainingUserAmount);
| 35,535 |
140 | // Increase rebasing credits, totalSupply remains unchanged so no adjustment necessary | rebasingCredits = rebasingCredits.add(_creditBalances[msg.sender]);
rebaseState[msg.sender] = RebaseOptions.OptIn;
| rebasingCredits = rebasingCredits.add(_creditBalances[msg.sender]);
rebaseState[msg.sender] = RebaseOptions.OptIn;
| 42,074 |
394 | // Setup Data Area / This area holds `assetData`. | let dataArea := add(cdStart, 132)
| let dataArea := add(cdStart, 132)
| 8,869 |
37 | // If account is frozen through a governance then only way to move out its balance is through governance. Data renting fees still run out from this account, but it cannot rent. | Frozen,
| Frozen,
| 38,644 |
311 | // if sumSupplies < sumBorrows, then the user is under collateralized and has account shortfall. else the user meets the collateral ratio and has account liquidity. | if (lessThanExp(sumSupplyValuesFinal, sumBorrowValuesFinal)) {
| if (lessThanExp(sumSupplyValuesFinal, sumBorrowValuesFinal)) {
| 12,226 |
174 | // function to calculate the interest using a linear interest rateformula _rate the interest rate, in ray _lastUpdateTimestamp the timestamp of the last update of theinterestreturn the interest rate linearly accumulated during the timeDelta, inray / | {
//solium-disable-next-line
uint256 timeDifference =
block.timestamp.sub(uint256(_lastUpdateTimestamp));
uint256 timeDelta =
timeDifference.wadToRay().rayDiv(SECONDS_PER_YEAR.wadToRay());
return _rate.rayMul(timeDelta).add(WadRayMath.ray());
}
| {
//solium-disable-next-line
uint256 timeDifference =
block.timestamp.sub(uint256(_lastUpdateTimestamp));
uint256 timeDelta =
timeDifference.wadToRay().rayDiv(SECONDS_PER_YEAR.wadToRay());
return _rate.rayMul(timeDelta).add(WadRayMath.ray());
}
| 9,558 |
213 | // safeTransfer constants | bytes4 internal constant ERC721O_RECEIVED = 0xf891ffe0;
bytes4 internal constant ERC721O_BATCH_RECEIVED = 0xd0e17c0b;
| bytes4 internal constant ERC721O_RECEIVED = 0xf891ffe0;
bytes4 internal constant ERC721O_BATCH_RECEIVED = 0xd0e17c0b;
| 47,015 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.