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 |
|---|---|---|---|---|
3 | // Active agreement bitmap | mapping(address => uint256) internal _inactiveAgreementBitmap;
| mapping(address => uint256) internal _inactiveAgreementBitmap;
| 36,107 |
5 | // Gets the address of the current implementation.return Current implementation address. / | function getImplementation()
public
returns (
address
)
| function getImplementation()
public
returns (
address
)
| 26,689 |
169 | // Require _from to own a specified quantity of the token / | function _ownsTokenAmount(address _from, uint256 _id, uint256 _quantity) internal view returns (bool) {
return balanceOf(_from, _id) >= _quantity;
}
| function _ownsTokenAmount(address _from, uint256 _id, uint256 _quantity) internal view returns (bool) {
return balanceOf(_from, _id) >= _quantity;
}
| 32,123 |
409 | // Returns the amount of tokens owned by an account (`tokenHolder`). / | function balanceOf(address tokenHolder) public view virtual override(IERC20Upgradeable, IERC777Upgradeable) returns (uint256) {
return _balances[tokenHolder];
}
| function balanceOf(address tokenHolder) public view virtual override(IERC20Upgradeable, IERC777Upgradeable) returns (uint256) {
return _balances[tokenHolder];
}
| 20,215 |
15 | // ========== EVENTS ========== // ========== CONSTRUCTOR ========== // _balancer see struct Balancer - balancer contract addresses _name PoolConfiguration.name _symbol PoolConfiguration.symbol _tokens PoolConfiguration.tokens _tokenAmounts PoolConfiguration.tokenAmounts _startWeights PoolConfiguration.startWeights _endWeights PoolConfiguration.endWeights _swapFee PoolConfiguration.swapFee _durationInSeconds PoolConfiguration.durationInSeconds _startTime PoolConfiguration.startTime _dao see struct DAO - DAO addresses / | constructor(
Balancer memory _balancer,
string memory _name,
string memory _symbol,
IERC20[] memory _tokens,
| constructor(
Balancer memory _balancer,
string memory _name,
string memory _symbol,
IERC20[] memory _tokens,
| 57,771 |
17 | // We shouldn't report the malicious validator as it has already been reported and banned | return false;
| return false;
| 32,354 |
124 | // Returns active guardians. | function guardians(address wallet)
public
view
returns (Data.Guardian[] memory _guardians)
| function guardians(address wallet)
public
view
returns (Data.Guardian[] memory _guardians)
| 34,635 |
41 | // The token controller contract must implement these functions / | interface TokenController {
/**
* @notice Called when `_owner` sends ether to the MiniMe Token contract
* @param _owner The address that sent the ether to create tokens
* @return True if the ether is accepted, false if it throws
*/
function proxyPayment(address _owner) external payable returns(bool);
/**
* @notice Notifies the controller about a token transfer allowing the
* controller to react if desired
* @param _from The origin of the transfer
* @param _to The destination of the transfer
* @param _amount The amount of the transfer
* @return False if the controller does not authorize the transfer
*/
function onTransfer(address _from, address _to, uint _amount) external returns(bool);
/**
* @notice Notifies the controller about an approval allowing the
* controller to react if desired
* @param _owner The address that calls `approve()`
* @param _spender The spender in the `approve()` call
* @param _amount The amount in the `approve()` call
* @return False if the controller does not authorize the approval
*/
function onApprove(address _owner, address _spender, uint _amount) external
returns(bool);
}
| interface TokenController {
/**
* @notice Called when `_owner` sends ether to the MiniMe Token contract
* @param _owner The address that sent the ether to create tokens
* @return True if the ether is accepted, false if it throws
*/
function proxyPayment(address _owner) external payable returns(bool);
/**
* @notice Notifies the controller about a token transfer allowing the
* controller to react if desired
* @param _from The origin of the transfer
* @param _to The destination of the transfer
* @param _amount The amount of the transfer
* @return False if the controller does not authorize the transfer
*/
function onTransfer(address _from, address _to, uint _amount) external returns(bool);
/**
* @notice Notifies the controller about an approval allowing the
* controller to react if desired
* @param _owner The address that calls `approve()`
* @param _spender The spender in the `approve()` call
* @param _amount The amount in the `approve()` call
* @return False if the controller does not authorize the approval
*/
function onApprove(address _owner, address _spender, uint _amount) external
returns(bool);
}
| 25,028 |
26 | // Allows the owner to set price set. | function setMintPrice(
uint256 _whitelist,
uint256 _public,
uint256 _sale
| function setMintPrice(
uint256 _whitelist,
uint256 _public,
uint256 _sale
| 4,787 |
29 | // THIS IS AN INTERNAL USE ONLY FUNCTION |
require(amount != 0);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
|
require(amount != 0);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
| 20,184 |
3 | // The metadata for an ask/seller The address of the seller placing the ask/sellerFundsRecipient The address to send funds after the ask is filled/askCurrency The address of the ERC-20, or address(0) for ETH, required to fill the ask/findersFeeBps The fee to the referrer of the ask/askPrice The price to fill the ask | struct Ask {
address seller;
address sellerFundsRecipient;
address askCurrency;
uint16 findersFeeBps;
uint256 askPrice;
}
| struct Ask {
address seller;
address sellerFundsRecipient;
address askCurrency;
uint16 findersFeeBps;
uint256 askPrice;
}
| 13,820 |
301 | // Do not mint directly using toMintAllocations check with totalRedeemd | uint256[] memory tempAllocations = new uint256[](toMintAllocations.length);
for (uint256 i = 0; i < toMintAllocations.length; i++) {
| uint256[] memory tempAllocations = new uint256[](toMintAllocations.length);
for (uint256 i = 0; i < toMintAllocations.length; i++) {
| 72,632 |
72 | // Reward. | degreeOfCoherence = disputeKit.getDegreeOfCoherence(_disputeID, _round, i % numberOfVotesInRound);
| degreeOfCoherence = disputeKit.getDegreeOfCoherence(_disputeID, _round, i % numberOfVotesInRound);
| 20,576 |
5 | // func to link token to metadata/ | function tokenURI(uint256 _id)
public
view
virtual
override
returns (string memory)
| function tokenURI(uint256 _id)
public
view
virtual
override
returns (string memory)
| 15,320 |
22 | // Amount of tokens in circulation | uint256 public totalSupply = 0;
| uint256 public totalSupply = 0;
| 33,271 |
4 | // ๋์ ์ง๋ถํ๊ณ ๋ ๋ฒจ์
ํฉ๋๋ค. | function levelUpFairy(uint256 fairyId) whenServiceRunning whenNotBlocked whenNotBlockedFairy(fairyId) onlyMasterOf(fairyId) payable public {
// ์์ ๋ ๋ฒจ์
๊ฐ๊ฒฉ๊ณผ ๋น๊ตํฉ๋๋ค.
require(msg.value == customLevelUpPrice);
// ์์ ์ ๋ ๋ฒจ์ ์ฌ๋ฆฝ๋๋ค.
Fairy storage fairy = fairies[fairyId];
fairy.appendedLevel = fairy.appendedLevel.add(1);
uint256 companyRevenue = msg.value.div(2);
uint256 designerRevenue = msg.value.div(2);
require(companyRevenue.add(designerRevenue) == msg.value);
// ํ์ฌ์๊ฒ ๊ธ์ก์ 50%๋ฅผ ์ง๊ธํฉ๋๋ค.
company.transfer(companyRevenue);
// ์์ ์ ๋์์ด๋์๊ฒ ๊ธ์ก์ 50%๋ฅผ ์ง๊ธํฉ๋๋ค.
fairy.designer.transfer(designerRevenue);
emit CustomLevelUp(fairyId);
}
| function levelUpFairy(uint256 fairyId) whenServiceRunning whenNotBlocked whenNotBlockedFairy(fairyId) onlyMasterOf(fairyId) payable public {
// ์์ ๋ ๋ฒจ์
๊ฐ๊ฒฉ๊ณผ ๋น๊ตํฉ๋๋ค.
require(msg.value == customLevelUpPrice);
// ์์ ์ ๋ ๋ฒจ์ ์ฌ๋ฆฝ๋๋ค.
Fairy storage fairy = fairies[fairyId];
fairy.appendedLevel = fairy.appendedLevel.add(1);
uint256 companyRevenue = msg.value.div(2);
uint256 designerRevenue = msg.value.div(2);
require(companyRevenue.add(designerRevenue) == msg.value);
// ํ์ฌ์๊ฒ ๊ธ์ก์ 50%๋ฅผ ์ง๊ธํฉ๋๋ค.
company.transfer(companyRevenue);
// ์์ ์ ๋์์ด๋์๊ฒ ๊ธ์ก์ 50%๋ฅผ ์ง๊ธํฉ๋๋ค.
fairy.designer.transfer(designerRevenue);
emit CustomLevelUp(fairyId);
}
| 22,397 |
1 | // Token and Contracts | IERC20 public layerZeroToken;
ILayerZeroTreasury public treasuryContract;
mapping(address => uint) public nativeFees;
uint public treasuryZROFees;
| IERC20 public layerZeroToken;
ILayerZeroTreasury public treasuryContract;
mapping(address => uint) public nativeFees;
uint public treasuryZROFees;
| 30,502 |
434 | // Mints `value` tokens to `recipient`, returning true on success. recipient address to mint to. value amount of tokens to mint.return True if the mint succeeded, or False. / | function mint(address recipient, uint256 value)
external
override
onlyRoleHolder(uint256(Roles.Minter))
returns (bool)
| function mint(address recipient, uint256 value)
external
override
onlyRoleHolder(uint256(Roles.Minter))
returns (bool)
| 21,429 |
12 | // Emitted when whitelist account expiration is set | event WhitelistAccountExpirationSet(address account, uint256 expiration);
| event WhitelistAccountExpirationSet(address account, uint256 expiration);
| 24,382 |
20 | // Draw a token from the remaining ids / | function drawIndex() internal returns (uint256 index) {
//RNG
uint randomness = coreContract.getRandomness(remaining, block.timestamp);
uint256 i = randomness % remaining;
// if there's a cache at cache[i] then use it
// otherwise use i itself
index = cache[i] == 0 ? i : cache[i];
// grab a number from the tail
cache[i] = cache[remaining - 1] == 0 ? remaining - 1 : cache[remaining - 1];
remaining = remaining - 1;
}
| function drawIndex() internal returns (uint256 index) {
//RNG
uint randomness = coreContract.getRandomness(remaining, block.timestamp);
uint256 i = randomness % remaining;
// if there's a cache at cache[i] then use it
// otherwise use i itself
index = cache[i] == 0 ? i : cache[i];
// grab a number from the tail
cache[i] = cache[remaining - 1] == 0 ? remaining - 1 : cache[remaining - 1];
remaining = remaining - 1;
}
| 42,291 |
251 | // Remove the fee from the reflections totals (this is how distribution happens). | contractData.reflectionsTotal -= refFee;
| contractData.reflectionsTotal -= refFee;
| 26,661 |
4 | // Returns the governance of the Strategy.Controller and its underlying vaults and strategies should share the same governance. / | function governance() external view returns (address);
| function governance() external view returns (address);
| 20,426 |
4 | // / |
function setIsPublicMintEnabled(bool isPublicMintEnabled_)
external
onlyOwner
|
function setIsPublicMintEnabled(bool isPublicMintEnabled_)
external
onlyOwner
| 7,930 |
111 | // Loop through the stored assets in reverse order. This ensures that we withdraw the longest dated liquidity tokens first. Longer dated liquidity tokens will generally have larger haircuts and therefore provide more benefit when withdrawn. | for (uint256 i = portfolioState.storedAssets.length; (i--) > 0;) {
PortfolioAsset memory asset = portfolioState.storedAssets[i];
| for (uint256 i = portfolioState.storedAssets.length; (i--) > 0;) {
PortfolioAsset memory asset = portfolioState.storedAssets[i];
| 61,851 |
129 | // There is no challenge against the proposal, and neither the appExpiry date nor the processBy date has passed. | revert();
| revert();
| 49,037 |
201 | // TODO switch to ySwapper when ready | function ethToWant(address _want, uint _amtInWei) external view returns (uint _wantAmount){
if (_amtInWei > 0) {
address[] memory path = new address[](2);
if (_want == address(weth)) {
return _amtInWei;
} else {
path[0] = address(weth);
path[1] = _want;
}
return uniswap.getAmountsOut(_amtInWei, path)[1];
} else {
return 0;
}
}
| function ethToWant(address _want, uint _amtInWei) external view returns (uint _wantAmount){
if (_amtInWei > 0) {
address[] memory path = new address[](2);
if (_want == address(weth)) {
return _amtInWei;
} else {
path[0] = address(weth);
path[1] = _want;
}
return uniswap.getAmountsOut(_amtInWei, path)[1];
} else {
return 0;
}
}
| 39,999 |
89 | // redeem effect sumBorrowPlusEffects += tokensToDenomredeemTokens | vars.sumBorrowPlusEffects = mul_ScalarTruncateAddUInt(vars.tokensToDenom, redeemTokens, vars.sumBorrowPlusEffects);
| vars.sumBorrowPlusEffects = mul_ScalarTruncateAddUInt(vars.tokensToDenom, redeemTokens, vars.sumBorrowPlusEffects);
| 6,147 |
325 | // the cap of the buffer that can be used at once | uint256 public bufferCap;
| uint256 public bufferCap;
| 9,290 |
16 | // Pause sale if active, make active if paused / | function setSaleState(bool newState) public onlyOwner whenNotPaused {
saleIsActive = newState;
}
| function setSaleState(bool newState) public onlyOwner whenNotPaused {
saleIsActive = newState;
}
| 20,958 |
56 | // /Query pools contract address/ return Pool's PoS address/ | function posAddress() public view onlyRegisted returns (bytes32) {
return _posAddressToIdentifier(address(this));
}
| function posAddress() public view onlyRegisted returns (bytes32) {
return _posAddressToIdentifier(address(this));
}
| 44,153 |
11 | // mint the token | super._safeMint(to, tokenId, data);
| super._safeMint(to, tokenId, data);
| 15,281 |
137 | // Buys up to `collateralAmount` of collateral from auction `auctionid` using/ FIAT from `from` and sending the bought collateral to `recipient`/The user needs to previously approve the UserProxy for spending collateral tokens or FIAT tokens/vault Address of the collateral's vault/tokenId ERC1155 or ERC721 style TokenId (leave at 0 for ERC20)/from Address which puts up the FIAT/auctionId Id of the auction to buy collateral from/maxCollateralToBuy Max. amount of collateral to buy [wad]/maxPrice Max. acceptable price to pay for collateral (Credit / collateral) [wad]/recipient Address which receives the bought collateral | function takeCollateral(
address vault,
uint256 tokenId,
address from,
uint256 auctionId,
uint256 maxCollateralToBuy,
uint256 maxPrice,
address recipient
| function takeCollateral(
address vault,
uint256 tokenId,
address from,
uint256 auctionId,
uint256 maxCollateralToBuy,
uint256 maxPrice,
address recipient
| 48,509 |
10 | // this allows someone else (a 3rd party) to transfer from my wallet to someone elses walletIf the 3rd party has an allowance of >0 and the value to transfer is >0 and the allowance is >= the value of the transferand it is not a contractperform the transfer by increasing the to account and decreasing the from accounts | function transferFrom(address _from, address _to, uint _value) public override returns (bool success) {
if (__allowances[_from][msg.sender] > 0 &&
_value >0 &&
__allowances[_from][msg.sender] >= _value
// the to address is not a contract
&& !isContract(_to)) {
__balanceOf[_from] -= _value;
__balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
return true;
}
return false;
}
| function transferFrom(address _from, address _to, uint _value) public override returns (bool success) {
if (__allowances[_from][msg.sender] > 0 &&
_value >0 &&
__allowances[_from][msg.sender] >= _value
// the to address is not a contract
&& !isContract(_to)) {
__balanceOf[_from] -= _value;
__balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
return true;
}
return false;
}
| 85,225 |
6 | // ERC20 //Returns the balance of a particular submission of the ProofOfHumanity contract. Note that this function takes the expiration date into account.submission The address of the submission. return The balance of the submission. / | function balanceOf(address submission) public view override returns (uint256) {
return isHuman(submission) ? MAX_INT : 0;
}
| function balanceOf(address submission) public view override returns (uint256) {
return isHuman(submission) ? MAX_INT : 0;
}
| 44,830 |
98 | // Holds the mapping from adID to its index in the above adIds array. If an ad gets released, we know which index to delete and being filled with the last element instead. | mapping (uint256 => uint256) adIdToIndex;
| mapping (uint256 => uint256) adIdToIndex;
| 26,415 |
8 | // Contract of MoonCatAcclimator | IERC721 private constant mca =
IERC721(0xc3f733ca98E0daD0386979Eb96fb1722A1A05E69);
| IERC721 private constant mca =
IERC721(0xc3f733ca98E0daD0386979Eb96fb1722A1A05E69);
| 15,577 |
21 | // Unfreeze account, make transfers from this account available _account Given account / | function unfreeze(address _account) public onlyOwner {
if (frozenAccounts[_account].frozen) {
delete frozenAccounts[_account];
}
}
| function unfreeze(address _account) public onlyOwner {
if (frozenAccounts[_account].frozen) {
delete frozenAccounts[_account];
}
}
| 32,964 |
269 | // Associete fee with a function call. If the caller sent too much, then is refunded, but only after the function body/This was dangerous before Solidity version 0.4.0, where it was possible to skip the part after `_;`./_amount Ether needed to call the function | modifier price(uint256 _amount)
| modifier price(uint256 _amount)
| 26,621 |
85 | // See {ERC20-_beforeTokenTransfer}. Requirements: - minted tokens must not cause the total supply to go over the cap. / | function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override {
super._beforeTokenTransfer(from, to, amount);
if (from == address(0)) { // When minting tokens
require(totalSupply().add(amount) <= _cap, "ERC20Capped: cap exceeded");
}
| function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override {
super._beforeTokenTransfer(from, to, amount);
if (from == address(0)) { // When minting tokens
require(totalSupply().add(amount) <= _cap, "ERC20Capped: cap exceeded");
}
| 5,097 |
75 | // Send to Marketing address | transferToAddressETH(marketingAddress, transferredBalance.div(_liquidityFee).mul(marketingDivisor));
| transferToAddressETH(marketingAddress, transferredBalance.div(_liquidityFee).mul(marketingDivisor));
| 1,945 |
912 | // Max collateral balance is stored as uint72, no overflow | require(internalPrecisionBalance <= SafeInt256.toInt(token.maxCollateralBalance)); // dev: over max collateral balance
| require(internalPrecisionBalance <= SafeInt256.toInt(token.maxCollateralBalance)); // dev: over max collateral balance
| 65,253 |
47 | // fired end event when game is over | event onEndRoundEvent
(
uint256 winnerTID, // winner
bytes32 winnerTName,
uint256 playersCount,
uint256 eth // eth in pot
);
| event onEndRoundEvent
(
uint256 winnerTID, // winner
bytes32 winnerTName,
uint256 playersCount,
uint256 eth // eth in pot
);
| 1,954 |
43 | // Unregister ledger contractparaAddress - parachain address of ledger/ | function deleteSubAccount(address paraAddress) external onlyLido {
require(senderToIndex[paraAddress] > 0, "CONTROLLER: UNREGISTERED_LEDGER");
delete indexToAccount[senderToIndex[paraAddress]];
delete senderToIndex[paraAddress];
}
| function deleteSubAccount(address paraAddress) external onlyLido {
require(senderToIndex[paraAddress] > 0, "CONTROLLER: UNREGISTERED_LEDGER");
delete indexToAccount[senderToIndex[paraAddress]];
delete senderToIndex[paraAddress];
}
| 45,303 |
7 | // emite el evento de q se completo bien la transaccion | emit Transfer(_from, _to, _value);
return true;
| emit Transfer(_from, _to, _value);
return true;
| 10,688 |
7 | // Function to get all doctors | function getAllDoctors() public view returns (Doctor[] memory) {
Doctor[] memory getAll = new Doctor[](doctorCounter - 1);
for (uint256 i = 1; i < doctorCounter; i++) {
getAll[i - 1] = doctors[i];
}
return getAll;
}
| function getAllDoctors() public view returns (Doctor[] memory) {
Doctor[] memory getAll = new Doctor[](doctorCounter - 1);
for (uint256 i = 1; i < doctorCounter; i++) {
getAll[i - 1] = doctors[i];
}
return getAll;
}
| 14,394 |
147 | // Implements Action interface and common helpers for passing inputs | abstract contract ActionBase is AdminAuth {
address public constant REGISTRY_ADDR = 0xD6049E1F5F3EfF1F921f5532aF1A1632bA23929C;
DFSRegistry public constant registry = DFSRegistry(REGISTRY_ADDR);
DefisaverLogger public constant logger = DefisaverLogger(
0x5c55B921f590a89C1Ebe84dF170E655a82b62126
);
string public constant ERR_SUB_INDEX_VALUE = "Wrong sub index value";
string public constant ERR_RETURN_INDEX_VALUE = "Wrong return index value";
/// @dev Subscription params index range [128, 255]
uint8 public constant SUB_MIN_INDEX_VALUE = 128;
uint8 public constant SUB_MAX_INDEX_VALUE = 255;
/// @dev Return params index range [1, 127]
uint8 public constant RETURN_MIN_INDEX_VALUE = 1;
uint8 public constant RETURN_MAX_INDEX_VALUE = 127;
/// @dev If the input value should not be replaced
uint8 public constant NO_PARAM_MAPPING = 0;
/// @dev We need to parse Flash loan actions in a different way
enum ActionType { FL_ACTION, STANDARD_ACTION, CUSTOM_ACTION }
/// @notice Parses inputs and runs the implemented action through a proxy
/// @dev Is called by the TaskExecutor chaining actions together
/// @param _callData Array of input values each value encoded as bytes
/// @param _subData Array of subscribed vales, replaces input values if specified
/// @param _paramMapping Array that specifies how return and subscribed values are mapped in input
/// @param _returnValues Returns values from actions before, which can be injected in inputs
/// @return Returns a bytes32 value through DSProxy, each actions implements what that value is
function executeAction(
bytes[] memory _callData,
bytes[] memory _subData,
uint8[] memory _paramMapping,
bytes32[] memory _returnValues
) public payable virtual returns (bytes32);
/// @notice Parses inputs and runs the single implemented action through a proxy
/// @dev Used to save gas when executing a single action directly
function executeActionDirect(bytes[] memory _callData) public virtual payable;
/// @notice Returns the type of action we are implementing
function actionType() public pure virtual returns (uint8);
//////////////////////////// HELPER METHODS ////////////////////////////
/// @notice Given an uint256 input, injects return/sub values if specified
/// @param _param The original input value
/// @param _mapType Indicated the type of the input in paramMapping
/// @param _subData Array of subscription data we can replace the input value with
/// @param _returnValues Array of subscription data we can replace the input value with
function _parseParamUint(
uint _param,
uint8 _mapType,
bytes[] memory _subData,
bytes32[] memory _returnValues
) internal pure returns (uint) {
if (isReplaceable(_mapType)) {
if (isReturnInjection(_mapType)) {
_param = uint(_returnValues[getReturnIndex(_mapType)]);
} else {
_param = abi.decode(_subData[getSubIndex(_mapType)], (uint));
}
}
return _param;
}
/// @notice Given an addr input, injects return/sub values if specified
/// @param _param The original input value
/// @param _mapType Indicated the type of the input in paramMapping
/// @param _subData Array of subscription data we can replace the input value with
/// @param _returnValues Array of subscription data we can replace the input value with
function _parseParamAddr(
address _param,
uint8 _mapType,
bytes[] memory _subData,
bytes32[] memory _returnValues
) internal pure returns (address) {
if (isReplaceable(_mapType)) {
if (isReturnInjection(_mapType)) {
_param = address(bytes20((_returnValues[getReturnIndex(_mapType)])));
} else {
_param = abi.decode(_subData[getSubIndex(_mapType)], (address));
}
}
return _param;
}
/// @notice Given an bytes32 input, injects return/sub values if specified
/// @param _param The original input value
/// @param _mapType Indicated the type of the input in paramMapping
/// @param _subData Array of subscription data we can replace the input value with
/// @param _returnValues Array of subscription data we can replace the input value with
function _parseParamABytes32(
bytes32 _param,
uint8 _mapType,
bytes[] memory _subData,
bytes32[] memory _returnValues
) internal pure returns (bytes32) {
if (isReplaceable(_mapType)) {
if (isReturnInjection(_mapType)) {
_param = (_returnValues[getReturnIndex(_mapType)]);
} else {
_param = abi.decode(_subData[getSubIndex(_mapType)], (bytes32));
}
}
return _param;
}
/// @notice Checks if the paramMapping value indicated that we need to inject values
/// @param _type Indicated the type of the input
function isReplaceable(uint8 _type) internal pure returns (bool) {
return _type != NO_PARAM_MAPPING;
}
/// @notice Checks if the paramMapping value is in the return value range
/// @param _type Indicated the type of the input
function isReturnInjection(uint8 _type) internal pure returns (bool) {
return (_type >= RETURN_MIN_INDEX_VALUE) && (_type <= RETURN_MAX_INDEX_VALUE);
}
/// @notice Transforms the paramMapping value to the index in return array value
/// @param _type Indicated the type of the input
function getReturnIndex(uint8 _type) internal pure returns (uint8) {
require(isReturnInjection(_type), ERR_SUB_INDEX_VALUE);
return (_type - RETURN_MIN_INDEX_VALUE);
}
/// @notice Transforms the paramMapping value to the index in sub array value
/// @param _type Indicated the type of the input
function getSubIndex(uint8 _type) internal pure returns (uint8) {
require(_type >= SUB_MIN_INDEX_VALUE, ERR_RETURN_INDEX_VALUE);
return (_type - SUB_MIN_INDEX_VALUE);
}
}
| abstract contract ActionBase is AdminAuth {
address public constant REGISTRY_ADDR = 0xD6049E1F5F3EfF1F921f5532aF1A1632bA23929C;
DFSRegistry public constant registry = DFSRegistry(REGISTRY_ADDR);
DefisaverLogger public constant logger = DefisaverLogger(
0x5c55B921f590a89C1Ebe84dF170E655a82b62126
);
string public constant ERR_SUB_INDEX_VALUE = "Wrong sub index value";
string public constant ERR_RETURN_INDEX_VALUE = "Wrong return index value";
/// @dev Subscription params index range [128, 255]
uint8 public constant SUB_MIN_INDEX_VALUE = 128;
uint8 public constant SUB_MAX_INDEX_VALUE = 255;
/// @dev Return params index range [1, 127]
uint8 public constant RETURN_MIN_INDEX_VALUE = 1;
uint8 public constant RETURN_MAX_INDEX_VALUE = 127;
/// @dev If the input value should not be replaced
uint8 public constant NO_PARAM_MAPPING = 0;
/// @dev We need to parse Flash loan actions in a different way
enum ActionType { FL_ACTION, STANDARD_ACTION, CUSTOM_ACTION }
/// @notice Parses inputs and runs the implemented action through a proxy
/// @dev Is called by the TaskExecutor chaining actions together
/// @param _callData Array of input values each value encoded as bytes
/// @param _subData Array of subscribed vales, replaces input values if specified
/// @param _paramMapping Array that specifies how return and subscribed values are mapped in input
/// @param _returnValues Returns values from actions before, which can be injected in inputs
/// @return Returns a bytes32 value through DSProxy, each actions implements what that value is
function executeAction(
bytes[] memory _callData,
bytes[] memory _subData,
uint8[] memory _paramMapping,
bytes32[] memory _returnValues
) public payable virtual returns (bytes32);
/// @notice Parses inputs and runs the single implemented action through a proxy
/// @dev Used to save gas when executing a single action directly
function executeActionDirect(bytes[] memory _callData) public virtual payable;
/// @notice Returns the type of action we are implementing
function actionType() public pure virtual returns (uint8);
//////////////////////////// HELPER METHODS ////////////////////////////
/// @notice Given an uint256 input, injects return/sub values if specified
/// @param _param The original input value
/// @param _mapType Indicated the type of the input in paramMapping
/// @param _subData Array of subscription data we can replace the input value with
/// @param _returnValues Array of subscription data we can replace the input value with
function _parseParamUint(
uint _param,
uint8 _mapType,
bytes[] memory _subData,
bytes32[] memory _returnValues
) internal pure returns (uint) {
if (isReplaceable(_mapType)) {
if (isReturnInjection(_mapType)) {
_param = uint(_returnValues[getReturnIndex(_mapType)]);
} else {
_param = abi.decode(_subData[getSubIndex(_mapType)], (uint));
}
}
return _param;
}
/// @notice Given an addr input, injects return/sub values if specified
/// @param _param The original input value
/// @param _mapType Indicated the type of the input in paramMapping
/// @param _subData Array of subscription data we can replace the input value with
/// @param _returnValues Array of subscription data we can replace the input value with
function _parseParamAddr(
address _param,
uint8 _mapType,
bytes[] memory _subData,
bytes32[] memory _returnValues
) internal pure returns (address) {
if (isReplaceable(_mapType)) {
if (isReturnInjection(_mapType)) {
_param = address(bytes20((_returnValues[getReturnIndex(_mapType)])));
} else {
_param = abi.decode(_subData[getSubIndex(_mapType)], (address));
}
}
return _param;
}
/// @notice Given an bytes32 input, injects return/sub values if specified
/// @param _param The original input value
/// @param _mapType Indicated the type of the input in paramMapping
/// @param _subData Array of subscription data we can replace the input value with
/// @param _returnValues Array of subscription data we can replace the input value with
function _parseParamABytes32(
bytes32 _param,
uint8 _mapType,
bytes[] memory _subData,
bytes32[] memory _returnValues
) internal pure returns (bytes32) {
if (isReplaceable(_mapType)) {
if (isReturnInjection(_mapType)) {
_param = (_returnValues[getReturnIndex(_mapType)]);
} else {
_param = abi.decode(_subData[getSubIndex(_mapType)], (bytes32));
}
}
return _param;
}
/// @notice Checks if the paramMapping value indicated that we need to inject values
/// @param _type Indicated the type of the input
function isReplaceable(uint8 _type) internal pure returns (bool) {
return _type != NO_PARAM_MAPPING;
}
/// @notice Checks if the paramMapping value is in the return value range
/// @param _type Indicated the type of the input
function isReturnInjection(uint8 _type) internal pure returns (bool) {
return (_type >= RETURN_MIN_INDEX_VALUE) && (_type <= RETURN_MAX_INDEX_VALUE);
}
/// @notice Transforms the paramMapping value to the index in return array value
/// @param _type Indicated the type of the input
function getReturnIndex(uint8 _type) internal pure returns (uint8) {
require(isReturnInjection(_type), ERR_SUB_INDEX_VALUE);
return (_type - RETURN_MIN_INDEX_VALUE);
}
/// @notice Transforms the paramMapping value to the index in sub array value
/// @param _type Indicated the type of the input
function getSubIndex(uint8 _type) internal pure returns (uint8) {
require(_type >= SUB_MIN_INDEX_VALUE, ERR_RETURN_INDEX_VALUE);
return (_type - SUB_MIN_INDEX_VALUE);
}
}
| 16,843 |
48 | // Default function called by sending Ether to this address with no arguments. Buy tokens with market order / | function() payable fundingActive
| function() payable fundingActive
| 44,864 |
215 | // returnTrue if there is an active season for farming, or false if there isn't one. / | function isFarmActive() external view returns (bool);
function dmmController() external view returns (address);
| function isFarmActive() external view returns (bool);
function dmmController() external view returns (address);
| 33,644 |
13 | // Used to determine the number of Items being sold by a Seller. This is NOT the quantity being sold for each Item, but the number of different types of Items. It contains the number of Items in the seller's "mapping(string => mapping(bool => string))" double-linked list of the "itemsBeingSoldBySpecificSeller" mapping. Mapping is as follows: 1) Key: Ethereum Address of the Seller. 2) Value: Number of different types of Items being sold that is in the Seller's"mapping(string => mapping(bool => string))" double-linked list of the "itemsBeingSoldBySpecificSeller" mapping. | mapping(address => uint) private numberOfDifferentItemsBeingSoldBySellerMap;
| mapping(address => uint) private numberOfDifferentItemsBeingSoldBySellerMap;
| 46,574 |
3 | // validates the requesting entity is authorized to make changes/ | modifier isValidated() {
require(msg.sender == byteSize, "Unauthorized access");
_;
}
| modifier isValidated() {
require(msg.sender == byteSize, "Unauthorized access");
_;
}
| 51,435 |
249 | // Events for offchain building of blacklist index | event AddToBlacklist(address indexed token);
event RemoveFromBlacklist(address indexed token);
| event AddToBlacklist(address indexed token);
event RemoveFromBlacklist(address indexed token);
| 21,308 |
69 | // Remove liquidity from the pool, weighted differently than thepool's current balances.self Swap struct to read from and write to amounts how much of each token to withdraw maxBurnAmount the max LP token provider is willing to pay toremove liquidity. Useful as a front-running mitigation.return actual amount of LP tokens burned in the withdrawal / | function removeLiquidityImbalance(
Swap storage self,
uint256[] memory amounts,
uint256 maxBurnAmount
| function removeLiquidityImbalance(
Swap storage self,
uint256[] memory amounts,
uint256 maxBurnAmount
| 11,610 |
83 | // NOTE: requires that delegate key which sent the original proposal cancels, msg.sender == proposal.proposer | function cancelProposal(uint256 proposalId) external nonReentrant {
Proposal storage proposal = proposals[proposalId];
require(!proposal.flags[0], "SPONSORED");
require(!proposal.flags[3], "CANCELLED");
require(msg.sender == proposal.proposer, "ONLY_PROPOSER");
proposal.flags[3] = true; // cancelled
unsafeInternalTransfer(ESCROW, proposal.proposer, proposal.tributeToken, proposal.tributeOffered);
emit CancelProposal(proposalId, msg.sender);
}
| function cancelProposal(uint256 proposalId) external nonReentrant {
Proposal storage proposal = proposals[proposalId];
require(!proposal.flags[0], "SPONSORED");
require(!proposal.flags[3], "CANCELLED");
require(msg.sender == proposal.proposer, "ONLY_PROPOSER");
proposal.flags[3] = true; // cancelled
unsafeInternalTransfer(ESCROW, proposal.proposer, proposal.tributeToken, proposal.tributeOffered);
emit CancelProposal(proposalId, msg.sender);
}
| 19,820 |
16 | // Zap ETH in a WETH pool (e.g. WETH/token) _lpToken: LP token address (e.g. DACKIE/ETH) _tokenAmountOutMin: minimum token amount (e.g. DACKIE) to receive in the intermediary swap (e.g. ETH --> DACKIE) / | function zapInETH(
address _lpToken,
uint256 _tokenAmountOutMin
| function zapInETH(
address _lpToken,
uint256 _tokenAmountOutMin
| 18,644 |
35 | // Transfer tokens from one address to another from address The address which you want to send tokens from to address The address which you want to transfer to value uint the amout of tokens to be transfered / | function transferFrom(address from, address to, uint value) public returns (bool success) {
uint allowance = allowed[from][msg.sender];
// Check is not needed because sub(allowance, value) will already throw if this condition is not met
// require(value <= allowance);
// SafeMath uses assert instead of require though, beware when using an analysis tool
balances[from] = balances[from].sub(value);
balances[to] = balances[to].add(value);
allowed[from][msg.sender] = allowance.sub(value);
Transfer(from, to, value);
return true;
}
| function transferFrom(address from, address to, uint value) public returns (bool success) {
uint allowance = allowed[from][msg.sender];
// Check is not needed because sub(allowance, value) will already throw if this condition is not met
// require(value <= allowance);
// SafeMath uses assert instead of require though, beware when using an analysis tool
balances[from] = balances[from].sub(value);
balances[to] = balances[to].add(value);
allowed[from][msg.sender] = allowance.sub(value);
Transfer(from, to, value);
return true;
}
| 6,882 |
11 | // TODO Implement SafeMaths - This is awful | uint donationTotal = _amount;
uint fosterAmount = _amount * (_ratio / 100);
uint fosterOverflow;
if (fosterAmount > kitties[_kittyId].donationCap) {
fosterOverflow = fosterAmount - kitties[_kittyId].donationCap;
fosterAmount = fosterAmount - fosterOverflow;
}
| uint donationTotal = _amount;
uint fosterAmount = _amount * (_ratio / 100);
uint fosterOverflow;
if (fosterAmount > kitties[_kittyId].donationCap) {
fosterOverflow = fosterAmount - kitties[_kittyId].donationCap;
fosterAmount = fosterAmount - fosterOverflow;
}
| 10,829 |
39 | // Splits the slice, setting `self` to everything after the first occurrence of `needle`, and returning everything before it. If `needle` does not occur in `self`, `self` is set to the empty slice, and the entirety of `self` is returned. self The slice to split. needle The text to search for in `self`.return The part of `self` up to the first occurrence of `delim`. / | function split(slice self, slice needle) internal returns (slice token) {
split(self, needle, token);
}
| function split(slice self, slice needle) internal returns (slice token) {
split(self, needle, token);
}
| 6,427 |
29 | // Deposits to mint options in the current epoch for selected strikes strikeIndex Index of strike amount Amout of collateral to deposit user Address of the user to deposit forreturn Whether deposit was successful / | function mintOption(
uint256 strikeIndex,
uint256 amount,
address user
| function mintOption(
uint256 strikeIndex,
uint256 amount,
address user
| 50,529 |
9 | // Completes a cross-chain transaction on the receiving chain using the NXTP protocol. _lifiData data used purely for tracking and analytics assetId token received on the receiving chain receiver address that will receive the tokens amount number of tokens received / | function completeBridgeTokensViaNXTP(
LiFiData memory _lifiData,
address assetId,
address receiver,
uint256 amount
| function completeBridgeTokensViaNXTP(
LiFiData memory _lifiData,
address assetId,
address receiver,
uint256 amount
| 22,016 |
20 | // Withdraw a bid that was overbid. | function withdraw() public returns (bool) {
uint amount = balances[msg.sender]; // 50
if (amount > 0) {
// It is important to set this to zero because the recipient
// can call this function again as part of the receiving call
// before `send` returns.
balances[msg.sender] = 0; // 0
if (!msg.sender.send(amount)) { // -> 50
// No need to call throw here, just reset the amount owing
balances[msg.sender] = amount;
return false;
}
}
return true;
}
| function withdraw() public returns (bool) {
uint amount = balances[msg.sender]; // 50
if (amount > 0) {
// It is important to set this to zero because the recipient
// can call this function again as part of the receiving call
// before `send` returns.
balances[msg.sender] = 0; // 0
if (!msg.sender.send(amount)) { // -> 50
// No need to call throw here, just reset the amount owing
balances[msg.sender] = amount;
return false;
}
}
return true;
}
| 15,781 |
33 | // ITransferRestrictions interface Represents interface for any on-chain SRC20 transfer restrictionimplementation. Transfer Restriction registries are expected to followsame interface, managing multiply transfer restriction implementations. It is intended to implementation of this interface be used for transferToken() / | interface ITransferRestrictions {
function authorize(address from, address to, uint256 value) external returns (bool);
}
| interface ITransferRestrictions {
function authorize(address from, address to, uint256 value) external returns (bool);
}
| 43,169 |
300 | // Used for depositing the funds into the pooland minting the liquidity tranche ERC721 tokenwhich represents the liquidity provider's sharein the pool and her unrealized P&L for this tranche. account The liquidity provider's address amount The size of the liquidity tranche hedged The type of the liquidity tranche minShare The minimum share in the pool for the user / | ) external override nonReentrant returns (uint256 share) {
uint256 totalShare = hedged ? hedgedShare : unhedgedShare;
uint256 balance = hedged ? hedgedBalance : unhedgedBalance;
share = totalShare > 0 && balance > 0
? (amount * totalShare) / balance
: amount * INITIAL_RATE;
uint256 limit =
hedged
? maxHedgedDepositAmount - hedgedBalance
: maxDepositAmount - hedgedBalance - unhedgedBalance;
require(share >= minShare, "Pool Error: The mint limit is too large");
require(share > 0, "Pool Error: The amount is too small");
require(
amount <= limit,
"Pool Error: Depositing into the pool is not available"
);
if (hedged) {
hedgedShare += share;
hedgedBalance += amount;
} else {
unhedgedShare += share;
unhedgedBalance += amount;
}
uint256 trancheID = tranches.length;
tranches.push(
Tranche(TrancheState.Open, share, amount, block.timestamp, hedged)
);
_safeMint(account, trancheID);
token.safeTransferFrom(_msgSender(), address(this), amount);
}
| ) external override nonReentrant returns (uint256 share) {
uint256 totalShare = hedged ? hedgedShare : unhedgedShare;
uint256 balance = hedged ? hedgedBalance : unhedgedBalance;
share = totalShare > 0 && balance > 0
? (amount * totalShare) / balance
: amount * INITIAL_RATE;
uint256 limit =
hedged
? maxHedgedDepositAmount - hedgedBalance
: maxDepositAmount - hedgedBalance - unhedgedBalance;
require(share >= minShare, "Pool Error: The mint limit is too large");
require(share > 0, "Pool Error: The amount is too small");
require(
amount <= limit,
"Pool Error: Depositing into the pool is not available"
);
if (hedged) {
hedgedShare += share;
hedgedBalance += amount;
} else {
unhedgedShare += share;
unhedgedBalance += amount;
}
uint256 trancheID = tranches.length;
tranches.push(
Tranche(TrancheState.Open, share, amount, block.timestamp, hedged)
);
_safeMint(account, trancheID);
token.safeTransferFrom(_msgSender(), address(this), amount);
}
| 60,244 |
40 | // locking is not applicable on marketing & developer account and they will be only eligible to withdraw bonus. Investement using Developement & marketing accounts are restricted via _invest function |
if (_addr != developerAccount && _addr != marketingAccount){
|
if (_addr != developerAccount && _addr != marketingAccount){
| 38,120 |
107 | // Retrieve the size of the code on target address, this needs assembly. | codeLength := extcodesize(_to)
| codeLength := extcodesize(_to)
| 22,932 |
10 | // 0.3 Matic | return 3 * 10 ** 17;
| return 3 * 10 ** 17;
| 20,218 |
59 | // primitives.sha256 txhash (bytes, reserved) | offset = offset.add(LENGTH_SIZE);
offset = offset.add(SHA256_SIZE);
| offset = offset.add(LENGTH_SIZE);
offset = offset.add(SHA256_SIZE);
| 50,918 |
40 | // Token holders / | function addTokenHolder(address investor) private {
if(investor != owner && indexedTokenHolders[0] != investor && tokenHolders[investor] == 0){
tokenHolders[investor] = tokenHoldersCount;
indexedTokenHolders[tokenHoldersCount] = investor;
tokenHoldersCount ++;
}
}
| function addTokenHolder(address investor) private {
if(investor != owner && indexedTokenHolders[0] != investor && tokenHolders[investor] == 0){
tokenHolders[investor] = tokenHoldersCount;
indexedTokenHolders[tokenHoldersCount] = investor;
tokenHoldersCount ++;
}
}
| 47,007 |
64 | // Wrapper nยฐ2 (a little more gas efficient than nยฐ1) built on top of the `_deposit` method to deposit collateral as a SLP in the protocol/ Allows to deposit a collateral within the protocol/user Address where to send the resulting sanTokens, if this address is the router address then it means/ that the intention is to stake the sanTokens obtained in a subsequent `gaugeDeposit` action/amount Amount of collateral to deposit/stableMaster `StableMaster` associated to the sanToken/collateral Token to deposit/poolManager PoolManager associated to the sanToken/sanToken SanToken associated to the `collateral` and `stableMaster`/Contrary to the `mint` action, the `deposit` action can be used in | function deposit(
address user,
uint256 amount,
address stableMaster,
address collateral,
IPoolManager poolManager,
ISanToken sanToken
| function deposit(
address user,
uint256 amount,
address stableMaster,
address collateral,
IPoolManager poolManager,
ISanToken sanToken
| 49,252 |
18 | // Signature will be invalid if it isn't to caller && EIP712: "Addresses are encoded as uint160" | uint160(msg.sender),
| uint160(msg.sender),
| 22,179 |
38 | // Get rewards period / | function getRewardPeriod() external view returns (uint256) {
return _rewardPeriod;
}
| function getRewardPeriod() external view returns (uint256) {
return _rewardPeriod;
}
| 5,281 |
116 | // We return the fees which were removed from storage | return (usedFeeUnderlying, usedFeeBond);
| return (usedFeeUnderlying, usedFeeBond);
| 77,478 |
14 | // Approve transfer on the ERC20 contract | underlying.approve(c_token, amount);
| underlying.approve(c_token, amount);
| 4,671 |
145 | // Interactions During the first deposit, we check that this token is 'real' | if (token_ == USE_ETHEREUM) {
| if (token_ == USE_ETHEREUM) {
| 3,522 |
68 | // participant address => token amount in wei scale | mapping (address => uint) public sentTokens;
| mapping (address => uint) public sentTokens;
| 12,735 |
66 | // returns true if the claim is exposably votable | function isClaimExposablyVotable(uint256 index) external view returns (bool);
| function isClaimExposablyVotable(uint256 index) external view returns (bool);
| 7,443 |
40 | // ========== EVENTS ========== / Track FXS burned | event FRAXBurned(address indexed from, address indexed to, uint256 amount);
| event FRAXBurned(address indexed from, address indexed to, uint256 amount);
| 40,073 |
39 | // Operator filter requires exchanges to enforce creator royalties to not be blacklisted. / | function transferFrom(address from, address to, uint256 tokenId) public override onlyAllowedOperator(from) {
super.transferFrom(from, to, tokenId);
}
| function transferFrom(address from, address to, uint256 tokenId) public override onlyAllowedOperator(from) {
super.transferFrom(from, to, tokenId);
}
| 3,836 |
120 | // return the next worse offer in the sorted listthe worse offer is the higher one if its an ask,and lower one if its a bid offer | function getWorseOffer(uint id) constant returns(uint) {
return _rank[id].prev;
}
| function getWorseOffer(uint id) constant returns(uint) {
return _rank[id].prev;
}
| 16,183 |
80 | // Check if merchant wallet address is not 0x00.. | require(
merchantWalletAddress != address(0),
"Merchat wallet cannot be zero address"
);
| require(
merchantWalletAddress != address(0),
"Merchat wallet cannot be zero address"
);
| 23,118 |
36 | // Function called by the token contract before executing a transfer. payload Payload of the initial transaction. partition Name of the partition (left empty for ERC20 transfer). operator Address which triggered the balance decrease (through transfer or redemption). from Token holder. to Token recipient for a transfer and 0x for a redemption. value Number of tokens the token holder balance is decreased by. data Extra information. operatorData Extra information, attached by the operator (if any).return 'true' if the token transfer can be validated, 'false' if not. / | function tokensToValidate(
bytes calldata payload,
bytes32 partition,
address operator,
address from,
address to,
uint value,
bytes calldata data,
bytes calldata operatorData
) // Comments to avoid compilation warnings for unused variables.
| function tokensToValidate(
bytes calldata payload,
bytes32 partition,
address operator,
address from,
address to,
uint value,
bytes calldata data,
bytes calldata operatorData
) // Comments to avoid compilation warnings for unused variables.
| 47,602 |
240 | // ACCESS LIMITED: For situation where all target units met and remaining WETH, uniformly raise targets by samepercentage in order to allow further trading. Can be called multiple times if necessary, increase should besmall in order to reduce tracking error. / | function raiseAssetTargets() external nonReentrant onlyAllowedTrader(msg.sender) virtual {
require(
_allTargetsMet() && index.getDefaultPositionRealUnit(address(weth)) > 0,
"Targets must be met and ETH remaining in order to raise target"
);
positionMultiplier = positionMultiplier.preciseDiv(TARGET_RAISE_DIVISOR);
}
| function raiseAssetTargets() external nonReentrant onlyAllowedTrader(msg.sender) virtual {
require(
_allTargetsMet() && index.getDefaultPositionRealUnit(address(weth)) > 0,
"Targets must be met and ETH remaining in order to raise target"
);
positionMultiplier = positionMultiplier.preciseDiv(TARGET_RAISE_DIVISOR);
}
| 9,924 |
1 | // Emitted when the configuration of the rewards of an asset is updated. asset The address of the incentivized asset reward The address of the reward token oldEmission The old emissions per second value of the reward distribution newEmission The new emissions per second value of the reward distribution oldDistributionEnd The old end timestamp of the reward distribution newDistributionEnd The new end timestamp of the reward distribution assetIndex The index of the asset distribution / | event AssetConfigUpdated(
address indexed asset,
address indexed reward,
uint256 oldEmission,
uint256 newEmission,
uint256 oldDistributionEnd,
uint256 newDistributionEnd,
uint256 assetIndex
);
| event AssetConfigUpdated(
address indexed asset,
address indexed reward,
uint256 oldEmission,
uint256 newEmission,
uint256 oldDistributionEnd,
uint256 newDistributionEnd,
uint256 assetIndex
);
| 32,765 |
86 | // Stores the resolutions | mapping(uint256 => Resolution) public resolutions;
| mapping(uint256 => Resolution) public resolutions;
| 83,298 |
45 | // Correct tokenID found | if (ownerTokenIds[_collection][address(msg.sender)][j] == _tokenId[i]) {
ownerTokenIds[_collection][address(msg.sender)][j] = ownerTokenIds[_collection][address(msg.sender)][
ownerTokenIds[_collection][address(msg.sender)].length - 1
];
ownerTokenIds[_collection][address(msg.sender)].pop();
}
| if (ownerTokenIds[_collection][address(msg.sender)][j] == _tokenId[i]) {
ownerTokenIds[_collection][address(msg.sender)][j] = ownerTokenIds[_collection][address(msg.sender)][
ownerTokenIds[_collection][address(msg.sender)].length - 1
];
ownerTokenIds[_collection][address(msg.sender)].pop();
}
| 28,874 |
59 | // Calculates exchange amount for DAI to token.amountDAI Amount of DAI, in base units / | function calculateAmountForDAI(uint256 amountDAI) public view returns (uint256) {
return Rationals.rmul(amountDAI, daiRate);
}
| function calculateAmountForDAI(uint256 amountDAI) public view returns (uint256) {
return Rationals.rmul(amountDAI, daiRate);
}
| 19,618 |
18 | // ๆๅ ไปฝ้ข:ๅฝๅMakerๅ
ๅผๅ็ๆๅ ไปฝ้ข = ๅฝๅMakerๅ
ๅธๅผไนๅๆปไปฝ้ข / ไนๅๆปๅธๅผ amount:ๅฝๅMakerๅ
ๅธๅผ lockedamount:ไนๅๆปๅธๅผ totalportion:ไนๅๆปไปฝ้ขreturn ๅฝๅๅฏๆๅธๆฐ้/ | function getDeposit(uint256 amount, uint256 lockedamount, uint256 totalportion) external pure returns (uint256) {
| function getDeposit(uint256 amount, uint256 lockedamount, uint256 totalportion) external pure returns (uint256) {
| 30,197 |
175 | // Remove pending request | _resetUndelegateStakeRequest(delegator);
emit UndelegateStakeRequestCancelled(delegator, unlockFundsSP, unstakeAmount);
| _resetUndelegateStakeRequest(delegator);
emit UndelegateStakeRequestCancelled(delegator, unlockFundsSP, unstakeAmount);
| 55,832 |
69 | // Get the proxy for a given edition's funds handler | function getRoyaltiesReceiver(uint256 _editionId)
external
override
| function getRoyaltiesReceiver(uint256 _editionId)
external
override
| 42,673 |
3 | // An array of structs | Wave[] waves;
| Wave[] waves;
| 23,017 |
6 | // ๆๅฐไธๆณจ้้ข | uint public minAmount;
| uint public minAmount;
| 24,113 |
44 | // Read address from array memory | assembly {
// 1. Add index to address of bytes array
// 2. Load 32-byte word from memory
// 3. Apply 20-byte mask to obtain address
result := and(mload(add(b, index)), 0xffffffffffffffffffffffffffffffffffffffff)
}
| assembly {
// 1. Add index to address of bytes array
// 2. Load 32-byte word from memory
// 3. Apply 20-byte mask to obtain address
result := and(mload(add(b, index)), 0xffffffffffffffffffffffffffffffffffffffff)
}
| 11,983 |
452 | // Reads the uint120 at `cdPtr` in calldata. | function readUint120(
CalldataPointer cdPtr
| function readUint120(
CalldataPointer cdPtr
| 40,281 |
6 | // change the owner of the contract from this contract address to the original one. / | // function transferOwnershipBack() onlyOwner public {
// ownedContract.transferOwnership(origOwner);
// ownedContract = Claimable(address(0));
// origOwner = address(0);
// }
| // function transferOwnershipBack() onlyOwner public {
// ownedContract.transferOwnership(origOwner);
// ownedContract = Claimable(address(0));
// origOwner = address(0);
// }
| 1,524 |
329 | // Allow anyone to mint multiple tokens with the provided IDs if this pass is unrestricted.n token holders can use this function without using the n token holders allowance,this is useful when the allowance is fully utilized. / | function mintTokenId(
address,
uint256[] calldata,
uint256,
bytes calldata
| function mintTokenId(
address,
uint256[] calldata,
uint256,
bytes calldata
| 5,609 |
9 | // ๅๅงๅ๏ผ่จญ็ฝฎๆฟ็ฅจ็ฎฑๅฐๅ | function setVoteProvider(address _provider) public isOwner isBeforeVoting isEnableSetting{
voteProvider = _provider;
}
| function setVoteProvider(address _provider) public isOwner isBeforeVoting isEnableSetting{
voteProvider = _provider;
}
| 31,784 |
29 | // SPDX-License-Identifier: GPL-3.0 |
import './libraries/SafeMath.sol';
contract TacoswapV2ERC20 {
using SafeMathTacoswap for uint;
string public constant name = 'TacoSwap LP Token';
string public constant symbol = 'TLP';
|
import './libraries/SafeMath.sol';
contract TacoswapV2ERC20 {
using SafeMathTacoswap for uint;
string public constant name = 'TacoSwap LP Token';
string public constant symbol = 'TLP';
| 14,158 |
54 | // staking fee percent | uint public stakingFeeRate = 0;
| uint public stakingFeeRate = 0;
| 17,602 |
55 | // Read single signature and recover signer | bytes memory signature;
(signature, rindex) = _signature.readBytes66(rindex);
addr = recoverSigner(_hash, signature);
| bytes memory signature;
(signature, rindex) = _signature.readBytes66(rindex);
addr = recoverSigner(_hash, signature);
| 30,459 |
3 | // For a given curator Ethereum address, return this curator's listed songs | mapping(address => bytes32[]) public curator_address_to_songs;
event ListNewKaraokeVersion(
bytes32 id_karaoke_version,
uint256 created_at,
address curator_address,
string id_original_version,
string uri_metadata,
bool is_indexed
);
| mapping(address => bytes32[]) public curator_address_to_songs;
event ListNewKaraokeVersion(
bytes32 id_karaoke_version,
uint256 created_at,
address curator_address,
string id_original_version,
string uri_metadata,
bool is_indexed
);
| 27,494 |
53 | // Based on: https:github.com/Rari-Capital/solmate/blob/v7/src/utils/MerkleProof.sol Get memory start location of the first element in proof array. | let data := add(proof, OneWord)
| let data := add(proof, OneWord)
| 14,976 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.