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 |
|---|---|---|---|---|
1 | // Mapping owner address to those who are allowed to use the contract | mapping(address => mapping (
address => uint256)) allowed;
| mapping(address => mapping (
address => uint256)) allowed;
| 28,235 |
103 | // Starts a liquidation process for an undercollateralized vault./user Address of the user vault to liquidate. | function liquidate(address user)
public onlyLive
| function liquidate(address user)
public onlyLive
| 54,071 |
4 | // Returns the id of a registered PoolAddressesProvider addressesProvider The address of the PoolAddressesProviderreturn The id of the PoolAddressesProvider or 0 if is not registered / | function getAddressesProviderIdByAddress(address addressesProvider)
external
view
returns (uint256);
| function getAddressesProviderIdByAddress(address addressesProvider)
external
view
returns (uint256);
| 27,507 |
18 | // ChainlinkOracleAdapter Set Protocol Coerces outputs from Chainlink oracles to uint256 and adapts value to 18 decimals. / | contract ChainlinkOracleAdapter {
using SafeMath for uint256;
/* ============ Constants ============ */
uint256 public constant PRICE_MULTIPLIER = 1e10;
/* ============ State Variables ============ */
AggregatorInterface public oracle;
/* ============ Constructor ============ */
/*
* Set address of aggregator being adapted for use
*
* @param _oracle The address of medianizer being adapted from bytes to uint256
*/
constructor(
AggregatorInterface _oracle
)
public
{
oracle = _oracle;
}
/* ============ External ============ */
/*
* Reads value of oracle and coerces return to uint256 then applies price multiplier
*
* @returns Chainlink oracle price in uint256
*/
function read()
external
view
returns (uint256)
{
// Read value of medianizer and coerce to uint256
uint256 oracleOutput = uint256(oracle.latestAnswer());
// Apply multiplier to create 18 decimal price (since Chainlink returns 8 decimals)
return oracleOutput.mul(PRICE_MULTIPLIER);
}
} | contract ChainlinkOracleAdapter {
using SafeMath for uint256;
/* ============ Constants ============ */
uint256 public constant PRICE_MULTIPLIER = 1e10;
/* ============ State Variables ============ */
AggregatorInterface public oracle;
/* ============ Constructor ============ */
/*
* Set address of aggregator being adapted for use
*
* @param _oracle The address of medianizer being adapted from bytes to uint256
*/
constructor(
AggregatorInterface _oracle
)
public
{
oracle = _oracle;
}
/* ============ External ============ */
/*
* Reads value of oracle and coerces return to uint256 then applies price multiplier
*
* @returns Chainlink oracle price in uint256
*/
function read()
external
view
returns (uint256)
{
// Read value of medianizer and coerce to uint256
uint256 oracleOutput = uint256(oracle.latestAnswer());
// Apply multiplier to create 18 decimal price (since Chainlink returns 8 decimals)
return oracleOutput.mul(PRICE_MULTIPLIER);
}
} | 45,644 |
12 | // Send Funds to CrowdFund Rewards Contract | currency.transfer(getSettings().crowdfund_contract, 2000000);
| currency.transfer(getSettings().crowdfund_contract, 2000000);
| 18,293 |
136 | // set excluded wallet limit | function setIsWalletLimitExempt(address holder, bool exempt) external onlyOwner {
isWalletLimitExempt[holder] = exempt;
}
| function setIsWalletLimitExempt(address holder, bool exempt) external onlyOwner {
isWalletLimitExempt[holder] = exempt;
}
| 21,656 |
39 | // Update the guarded status of the pool deposits isGuarded_ boolean value indicating whether the deposits should be guarded / | function setIsGuarded(bool isGuarded_) external onlyOwner {
isGuarded = isGuarded_;
}
| function setIsGuarded(bool isGuarded_) external onlyOwner {
isGuarded = isGuarded_;
}
| 40,781 |
19 | // setWithdrawRequestParams - called by hats governance to set withdraw request params _withdrawRequestPendingPeriod - the time period where the withdraw request is pending. _withdrawRequestEnablePeriod - the time period where the withdraw is enable for a withdraw request./ | function setWithdrawRequestParams(uint256 _withdrawRequestPendingPeriod, uint256 _withdrawRequestEnablePeriod)
external
| function setWithdrawRequestParams(uint256 _withdrawRequestPendingPeriod, uint256 _withdrawRequestEnablePeriod)
external
| 927 |
97 | // _balances[from] -= 1; _balances[to] += 1; | _owners[tokenId] = to;
emit Transfer(from, to, tokenId);
| _owners[tokenId] = to;
emit Transfer(from, to, tokenId);
| 41,147 |
101 | // calc amountOut for token1 (ERC20 token) when send liquidity token to pool for burning | function calcOutToken1ForBurn(uint256 liquidity, OraclePrice memory _op) public view returns (uint256 amountOut, uint256 fee) {
/*
u &= c * (N_{p}^{'} / NAVPS_{BASE}) * P_{s}^{'} * (THETA_{BASE} - \theta)/THETA_{BASE} \\\\
&= c * \frac{N_{p}^{'}}{NAVPS_{BASE}} * \frac{erc20Amount}{ethAmount} * \frac{(k_{BASE} - k)}{(k_{BASE})} * \frac{THETA_{BASE} - \theta}{THETA_{BASE}} \\\\
&= \frac{c * N_{p}^{'} * erc20Amount * (k_{BASE} - k) * (THETA_{BASE} - \theta)}{NAVPS_{BASE}*ethAmount*k_{BASE}*THETA_{BASE}}
// amountOut = liquidity * navps * _op.erc20Amount * (K_BASE - _op.K) * (THETA_BASE - _op.theta) / NAVPS_BASE / _op.ethAmount / K_BASE / THETA_BASE;
*/
uint256 navps = calcNAVPerShareForBurn(reserve0, reserve1, _op);
uint256 liqMulMany = liquidity.mul(navps).mul(_op.erc20Amount).mul(K_BASE.sub(_op.K)).mul(THETA_BASE.sub(_op.theta));
amountOut = liqMulMany.div(NAVPS_BASE).div(_op.ethAmount).div(K_BASE).div(THETA_BASE);
if (_op.theta != 0) {
// fee = liquidity * navps * (_op.theta) / NAVPS_BASE / THETA_BASE;
fee = liquidity.mul(navps).mul(_op.theta).div(NAVPS_BASE).div(THETA_BASE);
}
return (amountOut, fee);
}
| function calcOutToken1ForBurn(uint256 liquidity, OraclePrice memory _op) public view returns (uint256 amountOut, uint256 fee) {
/*
u &= c * (N_{p}^{'} / NAVPS_{BASE}) * P_{s}^{'} * (THETA_{BASE} - \theta)/THETA_{BASE} \\\\
&= c * \frac{N_{p}^{'}}{NAVPS_{BASE}} * \frac{erc20Amount}{ethAmount} * \frac{(k_{BASE} - k)}{(k_{BASE})} * \frac{THETA_{BASE} - \theta}{THETA_{BASE}} \\\\
&= \frac{c * N_{p}^{'} * erc20Amount * (k_{BASE} - k) * (THETA_{BASE} - \theta)}{NAVPS_{BASE}*ethAmount*k_{BASE}*THETA_{BASE}}
// amountOut = liquidity * navps * _op.erc20Amount * (K_BASE - _op.K) * (THETA_BASE - _op.theta) / NAVPS_BASE / _op.ethAmount / K_BASE / THETA_BASE;
*/
uint256 navps = calcNAVPerShareForBurn(reserve0, reserve1, _op);
uint256 liqMulMany = liquidity.mul(navps).mul(_op.erc20Amount).mul(K_BASE.sub(_op.K)).mul(THETA_BASE.sub(_op.theta));
amountOut = liqMulMany.div(NAVPS_BASE).div(_op.ethAmount).div(K_BASE).div(THETA_BASE);
if (_op.theta != 0) {
// fee = liquidity * navps * (_op.theta) / NAVPS_BASE / THETA_BASE;
fee = liquidity.mul(navps).mul(_op.theta).div(NAVPS_BASE).div(THETA_BASE);
}
return (amountOut, fee);
}
| 42,292 |
62 | // lock the balance of a proposal creator until the voting ends; only callable by DAO | function lockCreatorBalance(address user, uint256 timestamp) external;
| function lockCreatorBalance(address user, uint256 timestamp) external;
| 24,652 |
28 | // Date provides date parsing functionality. | contract Date {
bytes32 constant private JANUARY = keccak256("Jan");
bytes32 constant private FEBRUARY = keccak256("Feb");
bytes32 constant private MARCH = keccak256("Mar");
bytes32 constant private APRIL = keccak256("Apr");
bytes32 constant private MAY = keccak256("May");
bytes32 constant private JUNE = keccak256("Jun");
bytes32 constant private JULY = keccak256("Jul");
bytes32 constant private AUGUST = keccak256("Aug");
bytes32 constant private SEPTEMBER = keccak256("Sep");
bytes32 constant private OCTOBER = keccak256("Oct");
bytes32 constant private NOVEMBER = keccak256("Nov");
bytes32 constant private DECEMBER = keccak256("Dec");
/// @return the number of the month based on its name.
/// @param _month the first three letters of a month's name e.g. "Jan".
function _monthToNumber(string _month) internal pure returns (uint8) {
bytes32 month = keccak256(abi.encodePacked(_month));
if (month == JANUARY) {
return 1;
} else if (month == FEBRUARY) {
return 2;
} else if (month == MARCH) {
return 3;
} else if (month == APRIL) {
return 4;
} else if (month == MAY) {
return 5;
} else if (month == JUNE) {
return 6;
} else if (month == JULY) {
return 7;
} else if (month == AUGUST) {
return 8;
} else if (month == SEPTEMBER) {
return 9;
} else if (month == OCTOBER) {
return 10;
} else if (month == NOVEMBER) {
return 11;
} else if (month == DECEMBER) {
return 12;
} else {
revert("not a valid month");
}
}
}
| contract Date {
bytes32 constant private JANUARY = keccak256("Jan");
bytes32 constant private FEBRUARY = keccak256("Feb");
bytes32 constant private MARCH = keccak256("Mar");
bytes32 constant private APRIL = keccak256("Apr");
bytes32 constant private MAY = keccak256("May");
bytes32 constant private JUNE = keccak256("Jun");
bytes32 constant private JULY = keccak256("Jul");
bytes32 constant private AUGUST = keccak256("Aug");
bytes32 constant private SEPTEMBER = keccak256("Sep");
bytes32 constant private OCTOBER = keccak256("Oct");
bytes32 constant private NOVEMBER = keccak256("Nov");
bytes32 constant private DECEMBER = keccak256("Dec");
/// @return the number of the month based on its name.
/// @param _month the first three letters of a month's name e.g. "Jan".
function _monthToNumber(string _month) internal pure returns (uint8) {
bytes32 month = keccak256(abi.encodePacked(_month));
if (month == JANUARY) {
return 1;
} else if (month == FEBRUARY) {
return 2;
} else if (month == MARCH) {
return 3;
} else if (month == APRIL) {
return 4;
} else if (month == MAY) {
return 5;
} else if (month == JUNE) {
return 6;
} else if (month == JULY) {
return 7;
} else if (month == AUGUST) {
return 8;
} else if (month == SEPTEMBER) {
return 9;
} else if (month == OCTOBER) {
return 10;
} else if (month == NOVEMBER) {
return 11;
} else if (month == DECEMBER) {
return 12;
} else {
revert("not a valid month");
}
}
}
| 2,764 |
300 | // Creates a new token for `to` with a `tokenId` and `tokenXEPAURI`. Its token ID will be automatically | * assigned (and available on the emitted {IERC721-Transfer} event), and the token
* URI autogenerated based on the base URI passed at construction.
*
* See {ERC721-_mint}.
*
* Requirements:
*
* - the caller must have the `MINTER_ROLE`.
*/
function xepa_minter(address to, uint256 tokenId, string memory tokenXEPAURI) public virtual {
require(hasRole(MINTER_ROLE, _msgSender()), "Xepa/minter-role-required");
_mint(to, tokenId);
_setTokenURI(tokenId, tokenXEPAURI);
}
| * assigned (and available on the emitted {IERC721-Transfer} event), and the token
* URI autogenerated based on the base URI passed at construction.
*
* See {ERC721-_mint}.
*
* Requirements:
*
* - the caller must have the `MINTER_ROLE`.
*/
function xepa_minter(address to, uint256 tokenId, string memory tokenXEPAURI) public virtual {
require(hasRole(MINTER_ROLE, _msgSender()), "Xepa/minter-role-required");
_mint(to, tokenId);
_setTokenURI(tokenId, tokenXEPAURI);
}
| 73,523 |
19 | // zero all bytes to the right | exp(0x100, sub(32, mlength))
),
| exp(0x100, sub(32, mlength))
),
| 32,075 |
2 | // Return true if the user is allowlisted, false otherwise_user user address _collection NFT contract address which user is attempting to mint _phaseId phase at which user is attempting to mint _signature signature generated by AB Backend and signed by AB Allowlist Signer return _isValid boolean corresponding to the user's allowlist inclusion / | function verifySignature721(address _user, address _collection, uint256 _phaseId, bytes calldata _signature)
external
view
returns (bool _isValid);
| function verifySignature721(address _user, address _collection, uint256 _phaseId, bytes calldata _signature)
external
view
returns (bool _isValid);
| 9,533 |
4 | // ================SUBMIT ============================================== | function canSubmitTask(
address _userProxy,
Provider memory _provider,
Task memory _task,
uint256 _expiryDate
)
external
view
override
returns(string memory)
| function canSubmitTask(
address _userProxy,
Provider memory _provider,
Task memory _task,
uint256 _expiryDate
)
external
view
override
returns(string memory)
| 40,740 |
40 | // Do the transfer | require(transferAny(msg.sender, _to, _tokensToTransfer));
| require(transferAny(msg.sender, _to, _tokensToTransfer));
| 34,152 |
1 | // id ==> resource index | mapping(uint256 => uint256) private index_by_id;
function initialize(
string memory _name,
string memory _symbol,
string memory _baseURI_
)
public
initializer
| mapping(uint256 => uint256) private index_by_id;
function initialize(
string memory _name,
string memory _symbol,
string memory _baseURI_
)
public
initializer
| 77,170 |
47 | // remove the record for this user | delete userInfo[_pid][msg.sender];
stakingToken.safeTransfer(msg.sender, withdrawAmount);
emit Withdraw(msg.sender, _pid, withdrawAmount);
| delete userInfo[_pid][msg.sender];
stakingToken.safeTransfer(msg.sender, withdrawAmount);
emit Withdraw(msg.sender, _pid, withdrawAmount);
| 72,222 |
5 | // Returns bankId, branch, timeSlot if exists for sender. 0, "", "" otherwise. | function checkAppointment() public view returns (uint, string memory, string memory) {
address visitorAddress = msg.sender;
if (appointments[visitorAddress].isBooked) {
return (appointments[visitorAddress].bankId, appointments[visitorAddress].branch, appointments[visitorAddress].timeSlot);
} else {
return (0, "", "");
}
}
| function checkAppointment() public view returns (uint, string memory, string memory) {
address visitorAddress = msg.sender;
if (appointments[visitorAddress].isBooked) {
return (appointments[visitorAddress].bankId, appointments[visitorAddress].branch, appointments[visitorAddress].timeSlot);
} else {
return (0, "", "");
}
}
| 34,410 |
189 | // Will update the base URL of token's URI _newBaseMetadataURI New base URL of token's URI / | function _setBaseMetadataURI(string memory _newBaseMetadataURI) internal {
baseMetadataURI = _newBaseMetadataURI;
}
| function _setBaseMetadataURI(string memory _newBaseMetadataURI) internal {
baseMetadataURI = _newBaseMetadataURI;
}
| 35,652 |
59 | // Sanity check. This could be removed in the future. | assert(tokens[tokenIndex] == _tokenId);
uint256 lastTokenIndex = tokens.length - 1;
uint256 lastToken = tokens[lastTokenIndex];
tokens[tokenIndex] = lastToken;
tokens.length--;
| assert(tokens[tokenIndex] == _tokenId);
uint256 lastTokenIndex = tokens.length - 1;
uint256 lastToken = tokens[lastTokenIndex];
tokens[tokenIndex] = lastToken;
tokens.length--;
| 29,869 |
20 | // Transfer coins from a source address to a destination address (if allowed)src The address from which to transfer coinsdst The address that will receive the coinsamount The amount of coins to transfer/ | function transferFrom(address src, address dst, uint256 amount)
public returns (bool)
| function transferFrom(address src, address dst, uint256 amount)
public returns (bool)
| 56,425 |
64 | // Query if an address is an authorized operator for another addressTells whether an operator is approved by a given owner _owner owner address which you want to query the approval of _operator operator address which you want to query the approval ofreturn bool whether the given operator is approved by the given owner / | function isApprovedForAll(address _owner, address _operator) external view returns (bool) {
return _isApprovedForAll(_owner,_operator);
}
| function isApprovedForAll(address _owner, address _operator) external view returns (bool) {
return _isApprovedForAll(_owner,_operator);
}
| 44,557 |
492 | // buy other token | address pairWithEth = IUniswapV2Factory(_uniV2Factory).getPair(
address(_WETH),
otherToken
);
(uint256 reserveWeth, uint256 reserveOther) = getPairReserves(
pairWithEth
);
outOther = UniswapV2Library.getAmountOut(
buyAmount,
reserveWeth,
| address pairWithEth = IUniswapV2Factory(_uniV2Factory).getPair(
address(_WETH),
otherToken
);
(uint256 reserveWeth, uint256 reserveOther) = getPairReserves(
pairWithEth
);
outOther = UniswapV2Library.getAmountOut(
buyAmount,
reserveWeth,
| 41,814 |
114 | // sells have fees of 12 and 6 (101.2 and 51.2) | uint256 public immutable sellFeeIncreaseFactor = 120;
| uint256 public immutable sellFeeIncreaseFactor = 120;
| 15,513 |
7 | // Reports the Witnet-provided result to a previously posted request./Fails if:/- called from unauthorized address;/- the `_queryId` is not in 'Posted' status./- provided `_drTxHash` is zero;/- length of provided `_result` is zero./_queryId The unique query identifier/_timestamp The timestamp of the solving tally transaction in Witnet./_drTxHash The hash of the solving tally transaction in Witnet./_result The result itself as bytes. | function reportResult(uint256 _queryId, uint256 _timestamp, bytes32 _drTxHash, bytes calldata _result) external;
| function reportResult(uint256 _queryId, uint256 _timestamp, bytes32 _drTxHash, bytes calldata _result) external;
| 18,496 |
35 | // A method to allow a stakeholder to check his rewards._stakeholder The stakeholder to check rewards for./ | function rewardOf(address _stakeholder)
public
view
returns(uint256)
| function rewardOf(address _stakeholder)
public
view
returns(uint256)
| 5,253 |
33 | // Odstejemo uporabnikovo vrednost od vrednosti pogodbe. | contract_eth_value -= balances[msg.sender];
| contract_eth_value -= balances[msg.sender];
| 46,482 |
48 | // Upgrade the backing implementation of the proxy.Only the admin can call this function. newImplementation Address of the new implementation. / | function upgradeTo(address newImplementation) external onlyGovernor {
_upgradeTo(newImplementation);
}
| function upgradeTo(address newImplementation) external onlyGovernor {
_upgradeTo(newImplementation);
}
| 20,906 |
23 | // Indicator that this is a PToken contract (for inspection) / | bool public constant isPToken = true;
| bool public constant isPToken = true;
| 29,855 |
6 | // Change state before transer | payeesRecord[msg.sender] = 0;
| payeesRecord[msg.sender] = 0;
| 13,749 |
58 | // mapping from pool address to the total amount of CRV tokens that the pool has claimed | mapping(address => uint256) internal _poolCRVClaimed;
| mapping(address => uint256) internal _poolCRVClaimed;
| 21,067 |
13 | // Lock mutex before function call | locked = true;
| locked = true;
| 37,809 |
274 | // redirects the interest generated by _from to a target address. when the interest is redirected, the user balance is added to the recepient redirected balance. The caller needs to have allowance on the interest redirection to be able to execute the function._from the address of the user whom interest is being redirected_to the address to which the interest will be redirected/ | function redirectInterestStreamOf(address _from, address _to) external {
require(
msg.sender == interestRedirectionAllowances[_from],
"Caller is not allowed to redirect the interest of the user"
);
redirectInterestStreamInternal(_from,_to);
}
| function redirectInterestStreamOf(address _from, address _to) external {
require(
msg.sender == interestRedirectionAllowances[_from],
"Caller is not allowed to redirect the interest of the user"
);
redirectInterestStreamInternal(_from,_to);
}
| 15,195 |
130 | // Tracks ERC20 tokens added by owner | mapping(address => bool) isErc20TokenWhitelisted;
event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
| mapping(address => bool) isErc20TokenWhitelisted;
event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
| 54,565 |
292 | // Returns the list of reward tokens supported by the strategy.return The list of reward tokens supported by the strategy. / | function rewardTokens() external view override returns (address[] memory) {
return _rewardTokens.toArray();
}
| function rewardTokens() external view override returns (address[] memory) {
return _rewardTokens.toArray();
}
| 31,692 |
91 | // Remember the last 32 bytes of source This needs to be done here and not after the loop because we may have overwritten the last bytes in source already due to overlap. | let last := mload(sEnd)
| let last := mload(sEnd)
| 15,034 |
129 | // Since rMax >= rMx, we can start with a great guess | uint256 rMx = Mx.sqrt(rMax+1);
uint256 rNy = (N*y).sqrt();
uint256 X2 = marketWeightX*marketWeightX;
uint256 XY = marketWeightX*marketWeightY;
uint256 Y2 = marketWeightY*marketWeightY;
| uint256 rMx = Mx.sqrt(rMax+1);
uint256 rNy = (N*y).sqrt();
uint256 X2 = marketWeightX*marketWeightX;
uint256 XY = marketWeightX*marketWeightY;
uint256 Y2 = marketWeightY*marketWeightY;
| 7,889 |
19 | // Returns a human readable name about this oracle./data Usually abi encoded, implementation specific data that contains information and arguments to & about the oracle./ For example:/ (string memory collateralSymbol, string memory assetSymbol, uint256 division) = abi.decode(data, (string, string, uint256));/ return (string) A human readable name about this oracle. | function name(bytes calldata data) external view returns (string memory);
| function name(bytes calldata data) external view returns (string memory);
| 17,099 |
129 | // batchCancelOrders | bytes4 constant public BATCH_CANCEL_ORDERS_SELECTOR = 0x4ac14782;
bytes4 constant public BATCH_CANCEL_ORDERS_SELECTOR_GENERATOR = bytes4(keccak256("batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])"));
| bytes4 constant public BATCH_CANCEL_ORDERS_SELECTOR = 0x4ac14782;
bytes4 constant public BATCH_CANCEL_ORDERS_SELECTOR_GENERATOR = bytes4(keccak256("batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])"));
| 14,136 |
140 | // 获取利率 | uint256 exchangeRate = exchangeRateCurrent();
| uint256 exchangeRate = exchangeRateCurrent();
| 49,834 |
16 | // SMART CONTRACT FUNCTIONS / /Add an airline to the registration queueCan only be called from FlightSuretyApp contract/ | function registerAirline (string _airlineName, address _airlineAddress, address _senderAddress) public
| function registerAirline (string _airlineName, address _airlineAddress, address _senderAddress) public
| 2,862 |
13 | // Wrapper function over proxied_call, with hardcoded function signature | function callSetN(address addr, uint256 _n) public {
// encoded_value = abi.encode(bytes4(keccak256("setN(uint256)")), _n);
proxied_call(addr, "setN(uint256)", _n);
}
| function callSetN(address addr, uint256 _n) public {
// encoded_value = abi.encode(bytes4(keccak256("setN(uint256)")), _n);
proxied_call(addr, "setN(uint256)", _n);
}
| 15,332 |
6 | // OwnableWithoutRenounce Sablier Fork of OpenZeppelin's Ownable contract, which provides basic authorization control, but with the `renounceOwnership` function removed to avoid fat-finger errors. We inherit from `Context` to keep this contract compatible with the Gas Station Network. / | contract OwnableWithoutRenounce is Initializable, Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function initialize(address sender) public initializer {
_owner = sender;
emit OwnershipTransferred(address(0), _owner);
}
/**
* @return the address of the owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner());
_;
}
/**
* @return true if `msg.sender` is the owner of the contract.
*/
function isOwner() public view returns (bool) {
return _msgSender() == _owner;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0));
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
uint256[50] private ______gap;
}
| contract OwnableWithoutRenounce is Initializable, Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function initialize(address sender) public initializer {
_owner = sender;
emit OwnershipTransferred(address(0), _owner);
}
/**
* @return the address of the owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner());
_;
}
/**
* @return true if `msg.sender` is the owner of the contract.
*/
function isOwner() public view returns (bool) {
return _msgSender() == _owner;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0));
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
uint256[50] private ______gap;
}
| 9,164 |
29 | // ADDRESSES | address public constant ownerAddress = 0x20C84e76C691e38E81EaE5BA60F655b8C388718D; // The owners address
| address public constant ownerAddress = 0x20C84e76C691e38E81EaE5BA60F655b8C388718D; // The owners address
| 16,877 |
134 | // ibETH/Alpha Pool (50 SFI) | uint256 ibeSFI = (50 * 1 ether);
SFI(SFI_address).mint_SFI(pools[8], ibeSFI);
ISaffronPool(pools[8]).wind_down_epoch(epoch, ibeSFI);
| uint256 ibeSFI = (50 * 1 ether);
SFI(SFI_address).mint_SFI(pools[8], ibeSFI);
ISaffronPool(pools[8]).wind_down_epoch(epoch, ibeSFI);
| 30,275 |
570 | // See {ERC721-_beforeTokenTransfer}. Requirements: - the contract must not be paused. / | function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual override {
super._beforeTokenTransfer(from, to, tokenId);
require(!paused(), "ERC721Pausable: token transfer while paused");
}
| function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual override {
super._beforeTokenTransfer(from, to, tokenId);
require(!paused(), "ERC721Pausable: token transfer while paused");
}
| 42,866 |
26 | // Applicants apply for a specific job Can flesh out a little bit more, but this is probably ok for now jobID The ID of a specific job / | function applyForJob(uint256 jobID) public inState(State.Open, jobID) {
jobToApplicants[jobID].push(msg.sender);
emit ApplicantApplied(msg.sender, jobID);
}
| function applyForJob(uint256 jobID) public inState(State.Open, jobID) {
jobToApplicants[jobID].push(msg.sender);
emit ApplicantApplied(msg.sender, jobID);
}
| 10,390 |
17 | // Loop is at first iteration | linkedListOfIndices[indexOfSmallest] = i;
| linkedListOfIndices[indexOfSmallest] = i;
| 25,019 |
12 | // Now use Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works in modular arithmetic, doubling the correct bits in each step. | inv *= 2 - denominator * inv; // inverse mod 2**8
inv *= 2 - denominator * inv; // inverse mod 2**16
inv *= 2 - denominator * inv; // inverse mod 2**32
inv *= 2 - denominator * inv; // inverse mod 2**64
inv *= 2 - denominator * inv; // inverse mod 2**128
inv *= 2 - denominator * inv; // inverse mod 2**256
| inv *= 2 - denominator * inv; // inverse mod 2**8
inv *= 2 - denominator * inv; // inverse mod 2**16
inv *= 2 - denominator * inv; // inverse mod 2**32
inv *= 2 - denominator * inv; // inverse mod 2**64
inv *= 2 - denominator * inv; // inverse mod 2**128
inv *= 2 - denominator * inv; // inverse mod 2**256
| 25,745 |
121 | // Registry for financial contracts and approved financial contract creators. Maintains a whitelist of financial contract creators that are allowedto register new financial contracts and stores party members of a financial contract. / | contract Registry is RegistryInterface, MultiRole {
using SafeMath for uint256;
/****************************************
* INTERNAL VARIABLES AND STORAGE *
****************************************/
enum Roles {
Owner, // The owner manages the set of ContractCreators.
ContractCreator // Can register financial contracts.
}
// This enum is required because a `WasValid` state is required
// to ensure that financial contracts cannot be re-registered.
enum Validity { Invalid, Valid }
// Local information about a contract.
struct FinancialContract {
Validity valid;
uint128 index;
}
struct Party {
address[] contracts; // Each financial contract address is stored in this array.
// The address of each financial contract is mapped to its index for constant time look up and deletion.
mapping(address => uint256) contractIndex;
}
// Array of all contracts that are approved to use the UMA Oracle.
address[] public registeredContracts;
// Map of financial contract contracts to the associated FinancialContract struct.
mapping(address => FinancialContract) public contractMap;
// Map each party member to their their associated Party struct.
mapping(address => Party) private partyMap;
/****************************************
* EVENTS *
****************************************/
event NewContractRegistered(address indexed contractAddress, address indexed creator, address[] parties);
event PartyAdded(address indexed contractAddress, address indexed party);
event PartyRemoved(address indexed contractAddress, address indexed party);
/**
* @notice Construct the Registry contract.
*/
constructor() public {
_createExclusiveRole(uint256(Roles.Owner), uint256(Roles.Owner), msg.sender);
// Start with no contract creators registered.
_createSharedRole(uint256(Roles.ContractCreator), uint256(Roles.Owner), new address[](0));
}
/****************************************
* REGISTRATION FUNCTIONS *
****************************************/
/**
* @notice Registers a new financial contract.
* @dev Only authorized contract creators can call this method.
* @param parties array of addresses who become parties in the contract.
* @param contractAddress address of the contract against which the parties are registered.
*/
function registerContract(address[] calldata parties, address contractAddress)
external
override
onlyRoleHolder(uint256(Roles.ContractCreator))
{
FinancialContract storage financialContract = contractMap[contractAddress];
require(contractMap[contractAddress].valid == Validity.Invalid, "Can only register once");
// Store contract address as a registered contract.
registeredContracts.push(contractAddress);
// No length check necessary because we should never hit (2^127 - 1) contracts.
financialContract.index = uint128(registeredContracts.length.sub(1));
// For all parties in the array add them to the contract's parties.
financialContract.valid = Validity.Valid;
for (uint256 i = 0; i < parties.length; i = i.add(1)) {
_addPartyToContract(parties[i], contractAddress);
}
emit NewContractRegistered(contractAddress, msg.sender, parties);
}
/**
* @notice Adds a party member to the calling contract.
* @dev msg.sender will be used to determine the contract that this party is added to.
* @param party new party for the calling contract.
*/
function addPartyToContract(address party) external override {
address contractAddress = msg.sender;
require(contractMap[contractAddress].valid == Validity.Valid, "Can only add to valid contract");
_addPartyToContract(party, contractAddress);
}
/**
* @notice Removes a party member from the calling contract.
* @dev msg.sender will be used to determine the contract that this party is removed from.
* @param partyAddress address to be removed from the calling contract.
*/
function removePartyFromContract(address partyAddress) external override {
address contractAddress = msg.sender;
Party storage party = partyMap[partyAddress];
uint256 numberOfContracts = party.contracts.length;
require(numberOfContracts != 0, "Party has no contracts");
require(contractMap[contractAddress].valid == Validity.Valid, "Remove only from valid contract");
require(isPartyMemberOfContract(partyAddress, contractAddress), "Can only remove existing party");
// Index of the current location of the contract to remove.
uint256 deleteIndex = party.contractIndex[contractAddress];
// Store the last contract's address to update the lookup map.
address lastContractAddress = party.contracts[numberOfContracts - 1];
// Swap the contract to be removed with the last contract.
party.contracts[deleteIndex] = lastContractAddress;
// Update the lookup index with the new location.
party.contractIndex[lastContractAddress] = deleteIndex;
// Pop the last contract from the array and update the lookup map.
party.contracts.pop();
delete party.contractIndex[contractAddress];
emit PartyRemoved(contractAddress, partyAddress);
}
/****************************************
* REGISTRY STATE GETTERS *
****************************************/
/**
* @notice Returns whether the contract has been registered with the registry.
* @dev If it is registered, it is an authorized participant in the UMA system.
* @param contractAddress address of the financial contract.
* @return bool indicates whether the contract is registered.
*/
function isContractRegistered(address contractAddress) external override view returns (bool) {
return contractMap[contractAddress].valid == Validity.Valid;
}
/**
* @notice Returns a list of all contracts that are associated with a particular party.
* @param party address of the party.
* @return an array of the contracts the party is registered to.
*/
function getRegisteredContracts(address party) external override view returns (address[] memory) {
return partyMap[party].contracts;
}
/**
* @notice Returns all registered contracts.
* @return all registered contract addresses within the system.
*/
function getAllRegisteredContracts() external override view returns (address[] memory) {
return registeredContracts;
}
/**
* @notice checks if an address is a party of a contract.
* @param party party to check.
* @param contractAddress address to check against the party.
* @return bool indicating if the address is a party of the contract.
*/
function isPartyMemberOfContract(address party, address contractAddress) public override view returns (bool) {
uint256 index = partyMap[party].contractIndex[contractAddress];
return partyMap[party].contracts.length > index && partyMap[party].contracts[index] == contractAddress;
}
/****************************************
* INTERNAL FUNCTIONS *
****************************************/
function _addPartyToContract(address party, address contractAddress) internal {
require(!isPartyMemberOfContract(party, contractAddress), "Can only register a party once");
uint256 contractIndex = partyMap[party].contracts.length;
partyMap[party].contracts.push(contractAddress);
partyMap[party].contractIndex[contractAddress] = contractIndex;
emit PartyAdded(contractAddress, party);
}
}
| contract Registry is RegistryInterface, MultiRole {
using SafeMath for uint256;
/****************************************
* INTERNAL VARIABLES AND STORAGE *
****************************************/
enum Roles {
Owner, // The owner manages the set of ContractCreators.
ContractCreator // Can register financial contracts.
}
// This enum is required because a `WasValid` state is required
// to ensure that financial contracts cannot be re-registered.
enum Validity { Invalid, Valid }
// Local information about a contract.
struct FinancialContract {
Validity valid;
uint128 index;
}
struct Party {
address[] contracts; // Each financial contract address is stored in this array.
// The address of each financial contract is mapped to its index for constant time look up and deletion.
mapping(address => uint256) contractIndex;
}
// Array of all contracts that are approved to use the UMA Oracle.
address[] public registeredContracts;
// Map of financial contract contracts to the associated FinancialContract struct.
mapping(address => FinancialContract) public contractMap;
// Map each party member to their their associated Party struct.
mapping(address => Party) private partyMap;
/****************************************
* EVENTS *
****************************************/
event NewContractRegistered(address indexed contractAddress, address indexed creator, address[] parties);
event PartyAdded(address indexed contractAddress, address indexed party);
event PartyRemoved(address indexed contractAddress, address indexed party);
/**
* @notice Construct the Registry contract.
*/
constructor() public {
_createExclusiveRole(uint256(Roles.Owner), uint256(Roles.Owner), msg.sender);
// Start with no contract creators registered.
_createSharedRole(uint256(Roles.ContractCreator), uint256(Roles.Owner), new address[](0));
}
/****************************************
* REGISTRATION FUNCTIONS *
****************************************/
/**
* @notice Registers a new financial contract.
* @dev Only authorized contract creators can call this method.
* @param parties array of addresses who become parties in the contract.
* @param contractAddress address of the contract against which the parties are registered.
*/
function registerContract(address[] calldata parties, address contractAddress)
external
override
onlyRoleHolder(uint256(Roles.ContractCreator))
{
FinancialContract storage financialContract = contractMap[contractAddress];
require(contractMap[contractAddress].valid == Validity.Invalid, "Can only register once");
// Store contract address as a registered contract.
registeredContracts.push(contractAddress);
// No length check necessary because we should never hit (2^127 - 1) contracts.
financialContract.index = uint128(registeredContracts.length.sub(1));
// For all parties in the array add them to the contract's parties.
financialContract.valid = Validity.Valid;
for (uint256 i = 0; i < parties.length; i = i.add(1)) {
_addPartyToContract(parties[i], contractAddress);
}
emit NewContractRegistered(contractAddress, msg.sender, parties);
}
/**
* @notice Adds a party member to the calling contract.
* @dev msg.sender will be used to determine the contract that this party is added to.
* @param party new party for the calling contract.
*/
function addPartyToContract(address party) external override {
address contractAddress = msg.sender;
require(contractMap[contractAddress].valid == Validity.Valid, "Can only add to valid contract");
_addPartyToContract(party, contractAddress);
}
/**
* @notice Removes a party member from the calling contract.
* @dev msg.sender will be used to determine the contract that this party is removed from.
* @param partyAddress address to be removed from the calling contract.
*/
function removePartyFromContract(address partyAddress) external override {
address contractAddress = msg.sender;
Party storage party = partyMap[partyAddress];
uint256 numberOfContracts = party.contracts.length;
require(numberOfContracts != 0, "Party has no contracts");
require(contractMap[contractAddress].valid == Validity.Valid, "Remove only from valid contract");
require(isPartyMemberOfContract(partyAddress, contractAddress), "Can only remove existing party");
// Index of the current location of the contract to remove.
uint256 deleteIndex = party.contractIndex[contractAddress];
// Store the last contract's address to update the lookup map.
address lastContractAddress = party.contracts[numberOfContracts - 1];
// Swap the contract to be removed with the last contract.
party.contracts[deleteIndex] = lastContractAddress;
// Update the lookup index with the new location.
party.contractIndex[lastContractAddress] = deleteIndex;
// Pop the last contract from the array and update the lookup map.
party.contracts.pop();
delete party.contractIndex[contractAddress];
emit PartyRemoved(contractAddress, partyAddress);
}
/****************************************
* REGISTRY STATE GETTERS *
****************************************/
/**
* @notice Returns whether the contract has been registered with the registry.
* @dev If it is registered, it is an authorized participant in the UMA system.
* @param contractAddress address of the financial contract.
* @return bool indicates whether the contract is registered.
*/
function isContractRegistered(address contractAddress) external override view returns (bool) {
return contractMap[contractAddress].valid == Validity.Valid;
}
/**
* @notice Returns a list of all contracts that are associated with a particular party.
* @param party address of the party.
* @return an array of the contracts the party is registered to.
*/
function getRegisteredContracts(address party) external override view returns (address[] memory) {
return partyMap[party].contracts;
}
/**
* @notice Returns all registered contracts.
* @return all registered contract addresses within the system.
*/
function getAllRegisteredContracts() external override view returns (address[] memory) {
return registeredContracts;
}
/**
* @notice checks if an address is a party of a contract.
* @param party party to check.
* @param contractAddress address to check against the party.
* @return bool indicating if the address is a party of the contract.
*/
function isPartyMemberOfContract(address party, address contractAddress) public override view returns (bool) {
uint256 index = partyMap[party].contractIndex[contractAddress];
return partyMap[party].contracts.length > index && partyMap[party].contracts[index] == contractAddress;
}
/****************************************
* INTERNAL FUNCTIONS *
****************************************/
function _addPartyToContract(address party, address contractAddress) internal {
require(!isPartyMemberOfContract(party, contractAddress), "Can only register a party once");
uint256 contractIndex = partyMap[party].contracts.length;
partyMap[party].contracts.push(contractAddress);
partyMap[party].contractIndex[contractAddress] = contractIndex;
emit PartyAdded(contractAddress, party);
}
}
| 17,126 |
47 | // Fail if borrow not allowed //Return if borrowAmount is zero.Put behind `borrowAllowed` for accuring potential COMP rewards. / | if (borrowAmount == 0) {
accountBorrows[borrower].interestIndex = borrowIndex;
return uint(Error.NO_ERROR);
}
| if (borrowAmount == 0) {
accountBorrows[borrower].interestIndex = borrowIndex;
return uint(Error.NO_ERROR);
}
| 22,838 |
110 | // the amount of the tokens used for calculation may need to mature over time | Interpolation public tokenVesting;
| Interpolation public tokenVesting;
| 20,917 |
103 | // save in returned value the amount of weth receive to use off-chain | _balances[i] = _res[_res.length - 1];
| _balances[i] = _res[_res.length - 1];
| 71,856 |
4 | // Mapping from token ID to ownership details An empty struct value does not necessarily mean the token is unowned. See ownershipOf implementation for details. | mapping(uint256 => TokenOwnership) private _ownerships;
| mapping(uint256 => TokenOwnership) private _ownerships;
| 9,513 |
37 | // IBEP20 basic token contract being held | IBEP20 immutable public _token;
| IBEP20 immutable public _token;
| 12,190 |
189 | // fee.recipient | mstore(add(mem, 32), and(ADDRESS_MASK, mload(fee)))
| mstore(add(mem, 32), and(ADDRESS_MASK, mload(fee)))
| 62,319 |
136 | // we potentially do any "inline" swapping after the taxes are taken so that we know if there's balance to take. | uint256 contractTokenBalance = balanceOf(address(this));
bool overMinTokenBalance = contractTokenBalance >= _minimumTokensToSwap;
if (!_inSwap && overMinTokenBalance && reflectionsForTreasury != 0) {
_swapTokensForETH(contractTokenBalance);
}
| uint256 contractTokenBalance = balanceOf(address(this));
bool overMinTokenBalance = contractTokenBalance >= _minimumTokensToSwap;
if (!_inSwap && overMinTokenBalance && reflectionsForTreasury != 0) {
_swapTokensForETH(contractTokenBalance);
}
| 10,830 |
47 | // event for wallet update | event WalletSet(address indexed wallet);
| event WalletSet(address indexed wallet);
| 43,076 |
112 | // if reaches 50% more agreement | if ((proposals[hash].votecount * 2) > nodeCount) {
| if ((proposals[hash].votecount * 2) > nodeCount) {
| 1,591 |
80 | // Function that updates community address for portion of fee | function setCommunityFeeAddress(address _communityAddress) external onlyOwner() {
communityFund = _communityAddress;
}
| function setCommunityFeeAddress(address _communityAddress) external onlyOwner() {
communityFund = _communityAddress;
}
| 41,469 |
7 | // internal | function _baseURI() internal view virtual override returns (string memory) {
return baseTokenURI;
}
| function _baseURI() internal view virtual override returns (string memory) {
return baseTokenURI;
}
| 428 |
88 | // factor in passive and active rollover decay | stakeWeight =
| stakeWeight =
| 15,674 |
32 | // We block deposits in negative interest rate regimes The +2 allows for very small rounding errors which occur when depositing into a tranche which is attached to a wp which has accrued interest but the tranche has not yet accrued interest and the first deposit into the tranche is substantially smaller than following ones. | require(_valueSupplied <= holdingsValue + 2, "E:NEG_INT");
uint256 adjustedAmount;
| require(_valueSupplied <= holdingsValue + 2, "E:NEG_INT");
uint256 adjustedAmount;
| 12,904 |
220 | // Refund any excess ETH paid back to the wallet | uint256 _ethPaid = address(this).balance.sub(_initialEth);
uint256 _ethRefund = _ethPaid.sub(_actualCharge);
(bool _success,) = address(_from).call.value(_ethRefund)("");
require(_success);
| uint256 _ethPaid = address(this).balance.sub(_initialEth);
uint256 _ethRefund = _ethPaid.sub(_actualCharge);
(bool _success,) = address(_from).call.value(_ethRefund)("");
require(_success);
| 3,687 |
152 | // put eth in players vault | plyr_[_pID].gen = plyr_[_pID].gen.add(msg.value);
| plyr_[_pID].gen = plyr_[_pID].gen.add(msg.value);
| 7,804 |
198 | // Sets a new comptroller for the marketAdmin function to set a new comptroller return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/ | function _setComptroller(ComptrollerInterface newComptroller) public returns (uint) {
// Check caller is admin
if (msg.sender != admin) {
return fail(Error.UNAUTHORIZED, FailureInfo.SET_COMPTROLLER_OWNER_CHECK);
}
ComptrollerInterface oldComptroller = comptroller;
// Ensure invoke comptroller.isComptroller() returns true
require(newComptroller.isComptroller(), "marker method returned false");
// Set market's comptroller to newComptroller
comptroller = newComptroller;
// Emit NewComptroller(oldComptroller, newComptroller)
emit NewComptroller(oldComptroller, newComptroller);
return uint(Error.NO_ERROR);
}
| function _setComptroller(ComptrollerInterface newComptroller) public returns (uint) {
// Check caller is admin
if (msg.sender != admin) {
return fail(Error.UNAUTHORIZED, FailureInfo.SET_COMPTROLLER_OWNER_CHECK);
}
ComptrollerInterface oldComptroller = comptroller;
// Ensure invoke comptroller.isComptroller() returns true
require(newComptroller.isComptroller(), "marker method returned false");
// Set market's comptroller to newComptroller
comptroller = newComptroller;
// Emit NewComptroller(oldComptroller, newComptroller)
emit NewComptroller(oldComptroller, newComptroller);
return uint(Error.NO_ERROR);
}
| 10,727 |
16 | // SuperToken.upgrade batch operation type Call spec:ISuperToken(target).operationUpgrade(abi.decode(data, (uint256 amount)) / | uint32 constant internal OPERATION_TYPE_SUPERTOKEN_UPGRADE = 1 + 100;
| uint32 constant internal OPERATION_TYPE_SUPERTOKEN_UPGRADE = 1 + 100;
| 33,259 |
47 | // No duplicate owners allowed. | require(owners[owner] == address(0), "GS204");
owners[currentOwner] = owner;
currentOwner = owner;
| require(owners[owner] == address(0), "GS204");
owners[currentOwner] = owner;
currentOwner = owner;
| 51,450 |
161 | // Remove the ask on a piece of media / | function removeAsk(uint256 tokenId) external;
| function removeAsk(uint256 tokenId) external;
| 63,965 |
6 | // MKR contract address | function gem() external view returns (address);
| function gem() external view returns (address);
| 26,331 |
4 | // struct array for storage pollid => pollStruct/ |
mapping (string => Poll) public polls;
|
mapping (string => Poll) public polls;
| 21,259 |
75 | // event for token purchase loggingpurchaser who paid for the tokensbeneficiary who got the tokensvalue weis paid for purchaseamount amount of tokens purchased/ | event SwordTokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);
| event SwordTokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);
| 60,934 |
283 | // get the burn amount of a sell transfer/amount the FEI size of the transfer/ return penalty the FEI size of the burn incentive/ return _initialDeviation the Decimal deviation from peg before a transfer/ return _finalDeviation the Decimal deviation from peg after a transfer/calculated based on a hypothetical sell, applies to any ERC20 FEI transfer to the pool | function getSellPenalty(uint256 amount)
public
view
override
returns (
uint256 penalty,
Decimal.D256 memory _initialDeviation,
Decimal.D256 memory _finalDeviation
)
| function getSellPenalty(uint256 amount)
public
view
override
returns (
uint256 penalty,
Decimal.D256 memory _initialDeviation,
Decimal.D256 memory _finalDeviation
)
| 82,391 |
20 | // Change the state of the DataType_dataType String - Data type./ | function changeState( string _dataType )
onlyOwner
isValidData( _dataType )
public
| function changeState( string _dataType )
onlyOwner
isValidData( _dataType )
public
| 49,305 |
102 | // Mint `_amount` of reputation that are assigned to `_to` ._amount amount of reputation to mint _to beneficiary addressreturn bool which represents a success/ | function mintReputation(uint256 _amount, address _to,address _avatar)
external
returns(bool);
| function mintReputation(uint256 _amount, address _to,address _avatar)
external
returns(bool);
| 8,046 |
30 | // solhint-disable-next-line avoid-low-level-calls, avoid-call-value | (bool success,) = recipient.call{value : amount}("");
| (bool success,) = recipient.call{value : amount}("");
| 25,484 |
137 | // Withdraw the pending Stable amount for which no tokens are bought. Here early exit fees wil be charged before transfering to user | if(_pendingAmount>0){
| if(_pendingAmount>0){
| 46,504 |
10 | // SWAP | function swap(UserSwapRequest calldata _userRequest, bytes memory _sign)
external
payable
ensure(_userRequest.deadline)
nonReentrant
| function swap(UserSwapRequest calldata _userRequest, bytes memory _sign)
external
payable
ensure(_userRequest.deadline)
nonReentrant
| 34,764 |
116 | // get the address of the offer this user is cashing out | IOffer offer = mapOffers[nNextCashoutIndex];
| IOffer offer = mapOffers[nNextCashoutIndex];
| 8,083 |
118 | // START_BIT = PARAM_BITS(PARAM_AMOUNT - 1) | uint256 internal constant START_BIT = 204;
struct Update {
uint256 updatedAt;
bytes32 params;
}
| uint256 internal constant START_BIT = 204;
struct Update {
uint256 updatedAt;
bytes32 params;
}
| 22,848 |
30 | // return The maximal amount a main partner can fund at this moment/_mainPartner The address of the main parner | function fundingMaxAmount(address _mainPartner) constant external returns (uint);
| function fundingMaxAmount(address _mainPartner) constant external returns (uint);
| 12,106 |
8 | // lp | IJoePair pair = IJoePair(lp);
address token0 = pair.token0();
address token1 = pair.token1();
if (token0 == WAVAX || token1 == WAVAX) {
address token = token0 == WAVAX ? token1 : token0;
uint256 swapValue = amount.div(2);
uint256 tokenAmount = _swapAVAXForToken(
token,
swapValue,
address(this)
| IJoePair pair = IJoePair(lp);
address token0 = pair.token0();
address token1 = pair.token1();
if (token0 == WAVAX || token1 == WAVAX) {
address token = token0 == WAVAX ? token1 : token0;
uint256 swapValue = amount.div(2);
uint256 tokenAmount = _swapAVAXForToken(
token,
swapValue,
address(this)
| 43,350 |
62 | // Checks if a player has betting activity on House / | function isPlayer(address playerAddress) public view returns(bool) {
return (totalPlayerBets[playerAddress] > 0);
}
| function isPlayer(address playerAddress) public view returns(bool) {
return (totalPlayerBets[playerAddress] > 0);
}
| 36,149 |
64 | // Validation TODO 1. Check msg.sender is a member in Group(grpPubKey). Clients actually signs (data || addr(selected_submitter)). | bytes memory message = abi.encodePacked(data, msg.sender);
| bytes memory message = abi.encodePacked(data, msg.sender);
| 4,535 |
51 | // Mint the specified amount of token to the specified address and freeze it. _to Address to which token will be frozen. _amount Amount of token to mint and freeze.return A boolean that indicates if the operation was successful. / | function mintAndFreeze(address _to, uint _amount) public onlyOwner canMint returns (bool) {
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
frozenBalance[_to] = frozenBalance[_to].add(_amount);
emit Mint(_to, _amount);
emit TokensFrozen(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
| function mintAndFreeze(address _to, uint _amount) public onlyOwner canMint returns (bool) {
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
frozenBalance[_to] = frozenBalance[_to].add(_amount);
emit Mint(_to, _amount);
emit TokensFrozen(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
| 24,501 |
13 | // require(tokens[symbol_] != address(0)); | require(addrs.length <= maxTransactions, "Too many addresses in transaction");
| require(addrs.length <= maxTransactions, "Too many addresses in transaction");
| 18,729 |
69 | // Change the transfer fee percentage to be paid in Custom tokens._transferFeePercentage The fee percentage to be paid for transfer in range [0, 100]./ | function setTransferFeePercentage(uint256 _transferFeePercentage) public onlyOwner {
require(0 <= _transferFeePercentage && _transferFeePercentage <= 100);
require(_transferFeePercentage != transferFeePercentage);
transferFeePercentage = _transferFeePercentage;
LogTransferFeePercentageChanged(msg.sender, _transferFeePercentage);
}
| function setTransferFeePercentage(uint256 _transferFeePercentage) public onlyOwner {
require(0 <= _transferFeePercentage && _transferFeePercentage <= 100);
require(_transferFeePercentage != transferFeePercentage);
transferFeePercentage = _transferFeePercentage;
LogTransferFeePercentageChanged(msg.sender, _transferFeePercentage);
}
| 41,053 |
8 | // Adds collateral to the CDP/_managerAddr Address of the CDP Manager/_cdpId Id of the CDP/_joinAddr Address of the join contract for the CDP collateral/_amount Amount of collateral to add | function addCollateral(
address _managerAddr,
uint256 _cdpId,
address _joinAddr,
uint256 _amount
| function addCollateral(
address _managerAddr,
uint256 _cdpId,
address _joinAddr,
uint256 _amount
| 27,427 |
14 | // Cannot realistically overflow, since we are using uint256 | unchecked {
for (tokenId; tokenId < qty; tokenId++) {
if (owner == ownerOf(tokenId)) {
if (count == index) return tokenId;
else count++;
}
| unchecked {
for (tokenId; tokenId < qty; tokenId++) {
if (owner == ownerOf(tokenId)) {
if (count == index) return tokenId;
else count++;
}
| 25,853 |
31 | // override function to pause transfers/ | function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
| function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
| 21,449 |
79 | // Emit event in case of a successful trade. | event TradeSuccessful(
address indexed maker,
address indexed taker,
address makerAsset,
address takerAsset,
uint256 makerAmount,
uint256 takerAmount,
bytes32 orderHash
);
| event TradeSuccessful(
address indexed maker,
address indexed taker,
address makerAsset,
address takerAsset,
uint256 makerAmount,
uint256 takerAmount,
bytes32 orderHash
);
| 38,603 |
3 | // Get the root owner of tokenId./_tokenId The token to query for a root owner address/ return rootOwner The root owner at the top of tree of tokens and ERC998 magic value./ swithed from pubic to external | function rootOwnerOf(
uint256 _tokenId
) external view returns (
bytes32 rootOwner
);
| function rootOwnerOf(
uint256 _tokenId
) external view returns (
bytes32 rootOwner
);
| 31,576 |
116 | // If the first transaction is not yet 21 days old then do not aggregate | if (_timedTransactionsMap[sender].txBlockTimes[0] > oldestBlockTime) {
return;
}
| if (_timedTransactionsMap[sender].txBlockTimes[0] > oldestBlockTime) {
return;
}
| 74,792 |
4 | // Integer division of two unsigned integers truncating the quotient, reverts on division by zero. / | function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0);
uint256 c ; //inject UNINIT LOCAL/STATE VAR
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
| function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0);
uint256 c ; //inject UNINIT LOCAL/STATE VAR
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
| 20,379 |
101 | // do withdraw | _withdraw(cut, value, spenders);
| _withdraw(cut, value, spenders);
| 45,832 |
118 | // Mints `tokenId` and transfers it to `to`. | * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
}
| * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
}
| 1,443 |
22 | // find the stake index thenend stake | hexInterface.stakeEnd(getStakeIndexById(address(this), stake.hexStakeId), stake.hexStakeId);
stake.isStaking = false;
stake.stakeEnded = true;
| hexInterface.stakeEnd(getStakeIndexById(address(this), stake.hexStakeId), stake.hexStakeId);
stake.isStaking = false;
stake.stakeEnded = true;
| 32,413 |
13 | // Updates an identity contract corresponding to a user address. Requires that the user address should be the owner of the identity contract. Requires that the user should have an identity contract already deployed that will be replaced. This function can only be called by an address set as agent of the smart contract_userAddress The address of the user_identity The address of the user's new identity contract emits `IdentityModified` event / | function modifyStoredIdentity(address _userAddress, IIdentity _identity) external;
| function modifyStoredIdentity(address _userAddress, IIdentity _identity) external;
| 34,961 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.