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 |
|---|---|---|---|---|
14 | // Error for unsupported function (returned when calling empty renounceOwnership()) | error UnsupportedFunction();
| error UnsupportedFunction();
| 34,982 |
23 | // return the symbol of the token./ | function symbol() external view override returns(string memory){
return _symbol;
}
| function symbol() external view override returns(string memory){
return _symbol;
}
| 17,785 |
14 | // ------------------------------------------------------------------------ Lets a user list a software module for sale in this registry ------------------------------------------------------------------------ | function listModule(uint price, bytes32 sellerUsername, bytes32 moduleName, string usernameAndProjectName, bytes4 licenseId) public {
// make sure input params are valid
require(price != 0 && sellerUsername != "" && moduleName != "" && bytes(usernameAndProjectName).length != 0 && licenseId != 0);
... | function listModule(uint price, bytes32 sellerUsername, bytes32 moduleName, string usernameAndProjectName, bytes4 licenseId) public {
// make sure input params are valid
require(price != 0 && sellerUsername != "" && moduleName != "" && bytes(usernameAndProjectName).length != 0 && licenseId != 0);
... | 47,219 |
5 | // mapping asset historic | mapping(uint256 => History[]) private _history;
| mapping(uint256 => History[]) private _history;
| 6,253 |
10 | // `msg.sender` approves `_addr` to spend `_value` tokens /_spender The address of the account able to transfer the tokens /_value The amount of wei to be approved for transfer / return Whether the approval was successful or not | function approve(address _spender, uint256 _value) returns (bool success);
| function approve(address _spender, uint256 _value) returns (bool success);
| 43,108 |
43 | // to check the user etherbalance | function etherbalance(address _account)public view returns (uint) {
return _account.balance;
}
| function etherbalance(address _account)public view returns (uint) {
return _account.balance;
}
| 42,400 |
770 | // Price calculation when price is decreased linearly in proportion to time: tau: The number of seconds after the start of the auction where the price will hit 0 top: Initial price dur: current seconds since the start of the auction Returns y = top((tau - dur) / tau) Note the internal call to mul multiples by RAY, ther... | function price(uint256 top, uint256 dur) override external view returns (uint256) {
if (dur >= tau) return 0;
return rmul(top, mul(tau - dur, RAY) / tau);
}
| function price(uint256 top, uint256 dur) override external view returns (uint256) {
if (dur >= tau) return 0;
return rmul(top, mul(tau - dur, RAY) / tau);
}
| 12,107 |
6 | // Check the deposit parameters | require(amount > 0, "Amount must be greater than 0.");
require(
unlockTimestamp > block.timestamp,
"Unlock timestamp must be in the future."
);
| require(amount > 0, "Amount must be greater than 0.");
require(
unlockTimestamp > block.timestamp,
"Unlock timestamp must be in the future."
);
| 16,044 |
214 | // leaving _flAmount to be the same as the older version | function repay(address _market, ExchangeData memory _data, uint _rateMode, uint256 _gasCost, uint _flAmount) public payable burnGas(10) {
address lendingPool = ILendingPoolAddressesProviderV2(_market).getLendingPool();
// send msg.value for exchange to the receiver
AAVE_RECEIVER.transfer(ms... | function repay(address _market, ExchangeData memory _data, uint _rateMode, uint256 _gasCost, uint _flAmount) public payable burnGas(10) {
address lendingPool = ILendingPoolAddressesProviderV2(_market).getLendingPool();
// send msg.value for exchange to the receiver
AAVE_RECEIVER.transfer(ms... | 83,238 |
93 | // Lets a SLP enter the protocol by sending collateral to the system in exchange of sanTokens/user Address of the SLP to send sanTokens to/amount Amount of collateral sent/poolManager Address of the `PoolManager` of the required collateral | function deposit(
uint256 amount,
address user,
address poolManager
) external;
| function deposit(
uint256 amount,
address user,
address poolManager
) external;
| 31,553 |
110 | // calculateFeeUses basis points to calculate fee / | function calculateFee(uint amount) internal returns (uint) {
require((amount / 1000) * 1000 == amount, 'amount is too small');
return amount * feeRate / 10000;
}
| function calculateFee(uint amount) internal returns (uint) {
require((amount / 1000) * 1000 == amount, 'amount is too small');
return amount * feeRate / 10000;
}
| 49,019 |
651 | // Address of the token held in the position as collateral | address public HELD_TOKEN;
| address public HELD_TOKEN;
| 72,446 |
60 | // "commit" for bet settlement can only be obtained by hashing a "reveal". | uint commit = uint(keccak256(abi.encodePacked(combinationParameter[uint8(SettleParam.Reveal)])));
| uint commit = uint(keccak256(abi.encodePacked(combinationParameter[uint8(SettleParam.Reveal)])));
| 16,209 |
5 | // Emitted on borrow() and flashLoan() when debt needs to be opened reserve The address of the underlying asset being borrowed user The address of the user initiating the borrow(), receiving the funds on borrow() or justinitiator of the transaction on flashLoan() onBehalfOf The address that will be getting the debt amo... | event Borrow(
| event Borrow(
| 21,833 |
51 | // jhhong/계정(approver)이 계정(spender)에게 위임한 통화량을 반환한다./approver 위임할 계정/spender 위임받을 계정/ return 계정(approver)이 계정(spender)에게 위임한 통화량 | function allowance(address approver, address spender) public view returns (uint256) {
return _allowances[approver][spender];
}
| function allowance(address approver, address spender) public view returns (uint256) {
return _allowances[approver][spender];
}
| 46,247 |
84 | // Adjust reward accordingly | reward = adjustedReward;
| reward = adjustedReward;
| 61,433 |
176 | // require(msg.value >= FEE, "Value below price"); |
_safeMint(_to, tokenid);
|
_safeMint(_to, tokenid);
| 42,130 |
20 | // When does the period end? | uint public endBlock;
| uint public endBlock;
| 25,694 |
13 | // since we have to be able to return -1 (if the char isn't found or input error),this function must return an "int" type with a max length of (2^128 - 1) | return -1;
| return -1;
| 2,335 |
115 | // transferring WETH with unwrap flag | _withdrawWeth(_receiver, _amount);
| _withdrawWeth(_receiver, _amount);
| 19,325 |
23 | // Only manager is able to call this function Sets the devaluation period of collateral after liquidation asset The address of the main collateral token newValue The devaluation period in blocks / | function setDevaluationPeriod(address asset, uint newValue) public onlyManager {
require(newValue != 0, "Unit Protocol: INCORRECT_DEVALUATION_VALUE");
devaluationPeriod[asset] = newValue;
}
| function setDevaluationPeriod(address asset, uint newValue) public onlyManager {
require(newValue != 0, "Unit Protocol: INCORRECT_DEVALUATION_VALUE");
devaluationPeriod[asset] = newValue;
}
| 84,055 |
2 | // dUtlityBenchmark contract. Inherits from dUtility. Used for benchmarks. / | contract dUtilityBenchmark is dUtility {
/**
* @dev Sets up contract for conducting benchmarks.
* @param _verifier Address of verifier contract.
* @param _households List of household addresses to add for the benchmark.
* @param _energyDeltaHashes List of energy delta hashes corresponding to household add... | contract dUtilityBenchmark is dUtility {
/**
* @dev Sets up contract for conducting benchmarks.
* @param _verifier Address of verifier contract.
* @param _households List of household addresses to add for the benchmark.
* @param _energyDeltaHashes List of energy delta hashes corresponding to household add... | 30,851 |
15 | // We use a single lock for the whole contract. / | bool private reentrancyLock = false;
| bool private reentrancyLock = false;
| 9,037 |
50 | // функция, которая позволяет посмотреть список участников в хронологическом порядке, которые имеют депозит больше 0.05 eth | function getInvestors() public view returns(address payable [] memory) {
return investors;
}
| function getInvestors() public view returns(address payable [] memory) {
return investors;
}
| 16,364 |
187 | // CONFIGURATION //Attempts to tunnel a route over the main token and save it./This route is of the form [from, 0, main, 0, to] | function generateAutomaticRoute(IERC20 from, IERC20 to) private {
IERC20 main = mainToken;
require(from != main && to != main, "!no route found");
address[] memory route = new address[](5);
route[0] = address(from);
route[1] = address(0);
route[2] = address(main);
... | function generateAutomaticRoute(IERC20 from, IERC20 to) private {
IERC20 main = mainToken;
require(from != main && to != main, "!no route found");
address[] memory route = new address[](5);
route[0] = address(from);
route[1] = address(0);
route[2] = address(main);
... | 48,742 |
1 | // WETH to token price | mapping (address => FixedPoint.uq112x112) internal W2TPrice;
mapping (address => uint256) internal price0CumulativeLastUpdate;
mapping (address => uint256) internal price1CumulativeLastUpdate;
mapping (address => uint32) public blockTimestampLastUpdate;
mapping (address => IUniswapV2Pair) public uniswapPairs... | mapping (address => FixedPoint.uq112x112) internal W2TPrice;
mapping (address => uint256) internal price0CumulativeLastUpdate;
mapping (address => uint256) internal price1CumulativeLastUpdate;
mapping (address => uint32) public blockTimestampLastUpdate;
mapping (address => IUniswapV2Pair) public uniswapPairs... | 25,364 |
9 | // (bool success, ) = address(lock).call( abi.encodeWithSignature( "purchase(uint256[],address[],address[],address[],bytes[])", val, recipient, referrer, keyManager, data ) ); require(success, "calldata failed");require(totalSupply() + 1 <= maxSupply, "Max Supply reached"); | _safeMint(msg.sender, 1);
| _safeMint(msg.sender, 1);
| 16,253 |
71 | // ============ R = 1 cases ============ |
function _ROneSellBaseToken(PMMState memory state, uint256 payBaseAmount)
internal
pure
returns (
uint256 // receiveQuoteToken
)
|
function _ROneSellBaseToken(PMMState memory state, uint256 payBaseAmount)
internal
pure
returns (
uint256 // receiveQuoteToken
)
| 36,521 |
94 | // name of token | ERC721("Lucky Eggs", "LUCK") {
owner = msg.sender;
}
| ERC721("Lucky Eggs", "LUCK") {
owner = msg.sender;
}
| 30,742 |
16 | // "toETHaddr" is the address to which the ETH contributions are forwarded to, aka FWDaddrETH "addrESSgenesis" is the address of the Essentia ERC20 token contract, aka ESSgenesis NOTE: this contract will sell only its token balance on the ERC20 specified in addrESSgenesis the maxCap in ETH and the tokenPrice will indir... |
constructor
(
address toETHaddr,
address addrESSgenesis
|
constructor
(
address toETHaddr,
address addrESSgenesis
| 19,027 |
36 | // Implementation of the `IERC734` "KeyHolder" interface. / | contract ERC734 is IERC734 {
uint256 public constant MANAGEMENT_KEY = 1;
uint256 public constant ACTION_KEY = 2;
uint256 public constant CLAIM_SIGNER_KEY = 3;
uint256 public constant ENCRYPTION_KEY = 4;
bool private identitySettled = false;
uint256 private executionNonce;
struct Execution ... | contract ERC734 is IERC734 {
uint256 public constant MANAGEMENT_KEY = 1;
uint256 public constant ACTION_KEY = 2;
uint256 public constant CLAIM_SIGNER_KEY = 3;
uint256 public constant ENCRYPTION_KEY = 4;
bool private identitySettled = false;
uint256 private executionNonce;
struct Execution ... | 45,335 |
11 | // Require the following conditions: - oracle is active- oracle type is assigned- oracle type is active / | function requireOracleActiveWithAssignedActiveOracleType(address _oracle, bytes32 _oracleType) external view {
Oracle storage o = oracleDetails[_oracle];
require(o.active == true, "Oracle is not active");
require(o.assignedOracleTypes.has(_oracleType), "Oracle type not assigned");
require(
pggC... | function requireOracleActiveWithAssignedActiveOracleType(address _oracle, bytes32 _oracleType) external view {
Oracle storage o = oracleDetails[_oracle];
require(o.active == true, "Oracle is not active");
require(o.assignedOracleTypes.has(_oracleType), "Oracle type not assigned");
require(
pggC... | 31,931 |
278 | // - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. Emits a {Transfer} event./ | function safeTransferFrom(address from, address to, uint256 tokenId) external;
| function safeTransferFrom(address from, address to, uint256 tokenId) external;
| 39,624 |
20 | // Emitted when a Pool is registered by calling `registerPool`. / | event PoolRegistered(bytes32 indexed poolId, address indexed poolAddress, PoolSpecialization specialization);
| event PoolRegistered(bytes32 indexed poolId, address indexed poolAddress, PoolSpecialization specialization);
| 22,853 |
0 | // Neobank Interface Utilities for Neobank / | interface INeobank {
//@dev functions from Neobank that are going to be used
function depositIntoAccount(
address _owner,
uint256 _accountNumber,
uint256 _amount
) external payable;
function depositERC20IntoAccount(
address _owner,
uint256 _accountNumber,
... | interface INeobank {
//@dev functions from Neobank that are going to be used
function depositIntoAccount(
address _owner,
uint256 _accountNumber,
uint256 _amount
) external payable;
function depositERC20IntoAccount(
address _owner,
uint256 _accountNumber,
... | 6,056 |
28 | // Append only list of requested forced action hashes. | bytes32[] actionHashList;
| bytes32[] actionHashList;
| 39,792 |
272 | // column16_row0/ mload(0x31a0), pedersen/hash3/ec_subset_sum/bit_neg_0 = 1 - pedersen__hash3__ec_subset_sum__bit_0. |
let val := addmod(
1,
sub(PRIME, /*intermediate_value/pedersen/hash3/ec_subset_sum/bit_0*/ mload(0x4240)),
PRIME)
mstore(0x4260, val)
|
let val := addmod(
1,
sub(PRIME, /*intermediate_value/pedersen/hash3/ec_subset_sum/bit_0*/ mload(0x4240)),
PRIME)
mstore(0x4260, val)
| 4,360 |
52 | // Only allows to withdraw non-core strategy tokens ~ this is over and above normal yield | function yearn(address _strategy, address _token, uint parts) public {
require(msg.sender == strategist || msg.sender == governance, "!governance");
// This contract should never have value in it, but just incase since this is a public call
uint _before = IERC20(_token).balanceOf(address(thi... | function yearn(address _strategy, address _token, uint parts) public {
require(msg.sender == strategist || msg.sender == governance, "!governance");
// This contract should never have value in it, but just incase since this is a public call
uint _before = IERC20(_token).balanceOf(address(thi... | 11,244 |
2 | // updates the rage trade pool settings/poolId rage trade pool id/newSettings updated rage trade pool settings | function updatePoolSettings(uint32 poolId, PoolSettings calldata newSettings) external;
| function updatePoolSettings(uint32 poolId, PoolSettings calldata newSettings) external;
| 26,854 |
231 | // --------------------------------------------/Breed crabs for a fee /--------------------------------------------/ | function breed(uint256 oneCrab, uint256 anotherCrab) external payable {
// Checks for payment.
require(msg.value >= _price);
// Caller must own the Crabies.
require(_owns(msg.sender, oneCrab));
require(_owns(msg.sender, anotherCrab));
// Get the DNA of the two Crab... | function breed(uint256 oneCrab, uint256 anotherCrab) external payable {
// Checks for payment.
require(msg.value >= _price);
// Caller must own the Crabies.
require(_owns(msg.sender, oneCrab));
require(_owns(msg.sender, anotherCrab));
// Get the DNA of the two Crab... | 3,207 |
15 | // ERC721 with permit/Nonfungible tokens that support an approve via signature, i.e. permit | abstract contract ERC721Permit is DeadlineValidation, ERC721Enumerable, IERC721Permit {
/// @dev Value is equal to keccak256("Permit(address spender,uint256 tokenId,uint256 nonce,uint256 deadline)");
bytes32 public constant override PERMIT_TYPEHASH =
0x49ecf333e5b8c95c40fdafc95c1ad136e8914a8fb55e9dc8bb01eaa83a2... | abstract contract ERC721Permit is DeadlineValidation, ERC721Enumerable, IERC721Permit {
/// @dev Value is equal to keccak256("Permit(address spender,uint256 tokenId,uint256 nonce,uint256 deadline)");
bytes32 public constant override PERMIT_TYPEHASH =
0x49ecf333e5b8c95c40fdafc95c1ad136e8914a8fb55e9dc8bb01eaa83a2... | 14,324 |
1 | // The reference value to check against | mapping(address => uint256) public referenceValues;
| mapping(address => uint256) public referenceValues;
| 27,358 |
4 | // calculate staking rewards | uint256 stakingRewards = amount / 10;
| uint256 stakingRewards = amount / 10;
| 11,337 |
6 | // remove stable yield distributor- Caller is only EmissionManager who manage yield distribution _reserve The address of the internal asset _index The index of stable yield distributors array / | ) external payable onlyEmissionManager {
require(_reserve != address(0), Errors.YD_INVALID_CONFIGURATION);
uint256 length = _reserveToSDistributorCount[_reserve];
require(_index < length, Errors.YD_INVALID_CONFIGURATION);
length = length - 1;
address removing = _reserveToSDistributors[_reserve][... | ) external payable onlyEmissionManager {
require(_reserve != address(0), Errors.YD_INVALID_CONFIGURATION);
uint256 length = _reserveToSDistributorCount[_reserve];
require(_index < length, Errors.YD_INVALID_CONFIGURATION);
length = length - 1;
address removing = _reserveToSDistributors[_reserve][... | 23,213 |
59 | // spawningFor: per address, the points they can spawn with | mapping(address => uint32[]) public spawningFor;
| mapping(address => uint32[]) public spawningFor;
| 57,600 |
191 | // initialize the summonDelay if it's 0 | if (summonDelay[msg.sender] == 0) {
summonDelay[msg.sender] = startDelay;
}
| if (summonDelay[msg.sender] == 0) {
summonDelay[msg.sender] = startDelay;
}
| 15,139 |
30 | // log ether drop event / | emit NewDropOut(_queue[_winpos], _round - 1, _winpos + 1, _reward);
| emit NewDropOut(_queue[_winpos], _round - 1, _winpos + 1, _reward);
| 48,740 |
32 | // it should also be the same agreement class proxy address | return idx != 0 && _agreementClasses[idx - 1] == agreementClass;
| return idx != 0 && _agreementClasses[idx - 1] == agreementClass;
| 7,361 |
19 | // ============ Modifiers ============ //Throws if the sender is not the SetToken manager contract owner / | modifier onlyOwner(ISetToken _setToken) {
require(msg.sender == _manager(_setToken).owner(), "Must be owner");
_;
}
| modifier onlyOwner(ISetToken _setToken) {
require(msg.sender == _manager(_setToken).owner(), "Must be owner");
_;
}
| 66,694 |
7 | // Transfers the provided reward amount into RewardsPool and/ creates a new, one-week reward interval starting from now./ Reward tokens from the previous reward interval that unlocked/ over the time will be available for withdrawal immediately./ Reward tokens from the previous interval that has not been yet/ unlocked, ... | function topUpReward(uint256 reward) external onlyOwner {
rewardAccumulated = earned();
/* solhint-disable not-rely-on-time */
if (block.timestamp >= intervalFinish) {
// see https://github.com/crytic/slither/issues/844
// slither-disable-next-line divide-before-mult... | function topUpReward(uint256 reward) external onlyOwner {
rewardAccumulated = earned();
/* solhint-disable not-rely-on-time */
if (block.timestamp >= intervalFinish) {
// see https://github.com/crytic/slither/issues/844
// slither-disable-next-line divide-before-mult... | 48,905 |
126 | // break if the offer started after the payment date | if (nOfferDate > _nPaymentDate) {
break;
}
| if (nOfferDate > _nPaymentDate) {
break;
}
| 8,091 |
122 | // check that new times array is in order | if (i.add(1) < _timesToExpiry.length) {
require(_timesToExpiry[i] < _timesToExpiry[i.add(1)], "MarginCalculator: time should be in order");
}
| if (i.add(1) < _timesToExpiry.length) {
require(_timesToExpiry[i] < _timesToExpiry[i.add(1)], "MarginCalculator: time should be in order");
}
| 67,488 |
272 | // aggregated deposit | uint256 deposit0PricedInToken1 = deposit0.mul((price < twap) ? price : twap).div(PRECISION);
if (deposit0 > 0) {
IERC20(token0).safeTransferFrom(
msg.sender,
address(this),
deposit0
);
}
| uint256 deposit0PricedInToken1 = deposit0.mul((price < twap) ? price : twap).div(PRECISION);
if (deposit0 > 0) {
IERC20(token0).safeTransferFrom(
msg.sender,
address(this),
deposit0
);
}
| 38,322 |
210 | // See {ERC721-_approve}. / | function _approve(address to, uint16 tokenId) internal virtual override {
_tokenApprovals[getInternalMapping(tokenId)] = to;
emit Approval(ownerOf(tokenId), to, tokenId);
}
| function _approve(address to, uint16 tokenId) internal virtual override {
_tokenApprovals[getInternalMapping(tokenId)] = to;
emit Approval(ownerOf(tokenId), to, tokenId);
}
| 10,724 |
309 | // propose to remove a scheme for a controller_avatar the address of the controller from which we want to remove a scheme_scheme the address of the scheme we want to remove_descriptionHash proposal description hash NB: not only registers the proposal, but also votes for it/ | function proposeToRemoveScheme(Avatar _avatar, address _scheme, string memory _descriptionHash)
public
returns(bytes32)
| function proposeToRemoveScheme(Avatar _avatar, address _scheme, string memory _descriptionHash)
public
returns(bytes32)
| 11,195 |
279 | // this import function should be called if accounts that don't have debt this is safe only if the owner of the compound account is an EOA | function importCollateral(address[] calldata cTokenCollateral) external {
address account = tx.origin;
address avatar = registry.getAvatar(account);
// redeem all non ETH collateral from Compound and deposit it in B
_transferCollateral(
cTokenCollateral,
acco... | function importCollateral(address[] calldata cTokenCollateral) external {
address account = tx.origin;
address avatar = registry.getAvatar(account);
// redeem all non ETH collateral from Compound and deposit it in B
_transferCollateral(
cTokenCollateral,
acco... | 18,779 |
164 | // Transfer Bond Amount back to Block Producer | transfer(BOND_SIZE, EtherToken, EtherToken, blockProducer)
| transfer(BOND_SIZE, EtherToken, EtherToken, blockProducer)
| 21,499 |
156 | // Gets the segment corresponding to the last pool in the path/path The bytes encoded swap path/ return The segment containing all data necessary to target the last pool in the path | function getLastPool(bytes memory path) internal pure returns (bytes memory) {
if(path.length==POP_OFFSET){
return path;
}else{
return path.slice(path.length-POP_OFFSET, path.length);
}
}
| function getLastPool(bytes memory path) internal pure returns (bytes memory) {
if(path.length==POP_OFFSET){
return path;
}else{
return path.slice(path.length-POP_OFFSET, path.length);
}
}
| 81,260 |
108 | // Iterate over each owner and token ID | for (uint256 i = 0; i < _owners.length; i++) {
batchBalances[i] = _isOwner(_owners[i], _ids[i]) ? 1 : 0;
}
| for (uint256 i = 0; i < _owners.length; i++) {
batchBalances[i] = _isOwner(_owners[i], _ids[i]) ? 1 : 0;
}
| 20,446 |
73 | // Total allocation points. Must be the sum of all allocation points in all pools. | uint256 public totalAllocPoint;
uint256 public suwpPerSecond;
uint256 private constant ACC_SUWP_PRECISION = 1e12;
event Deposit(address indexed user, uint256 indexed pid, uint256 amount, address indexed to);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount, address indexed ... | uint256 public totalAllocPoint;
uint256 public suwpPerSecond;
uint256 private constant ACC_SUWP_PRECISION = 1e12;
event Deposit(address indexed user, uint256 indexed pid, uint256 amount, address indexed to);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount, address indexed ... | 5,801 |
28 | // withdraw foreign tokens / | function withdrawForeignTokens(address _tokenContract) onlyOwner public returns (bool) {
ERC20Basic token = ERC20Basic(_tokenContract);
uint256 amount = token.balanceOf(address(this));
return token.transfer(owner, amount);
}
| function withdrawForeignTokens(address _tokenContract) onlyOwner public returns (bool) {
ERC20Basic token = ERC20Basic(_tokenContract);
uint256 amount = token.balanceOf(address(this));
return token.transfer(owner, amount);
}
| 34,119 |
7 | // Performs a delegetecall on a targetContract in the context of self.Internally reverts execution to avoid side effects (making it static). Catches revert and returns encoded result as bytes. targetContract Address of the contract containing the code to execute. calldataPayload Calldata that should be sent to the targ... | function simulateDelegatecall(
address targetContract,
bytes memory calldataPayload
| function simulateDelegatecall(
address targetContract,
bytes memory calldataPayload
| 16,985 |
11 | // This contract is for creating proxy to access ERC721Rarible token. The beacon should be initialized before call ERC721RaribleFactoryC2 constructor./ | contract ERC721RaribleFactoryC2 is Ownable {
address public beacon;
address transferProxy;
address lazyTransferProxy;
event Create721RaribleProxy(address proxy);
event Create721RaribleUserProxy(address proxy);
constructor(address _beacon, address _transferProxy, address _lazyTransferProxy) {
... | contract ERC721RaribleFactoryC2 is Ownable {
address public beacon;
address transferProxy;
address lazyTransferProxy;
event Create721RaribleProxy(address proxy);
event Create721RaribleUserProxy(address proxy);
constructor(address _beacon, address _transferProxy, address _lazyTransferProxy) {
... | 38,033 |
108 | // Return the amount of ETH to be drawn from a trove's collateral and sent as gas compensation. | function _getCollGasCompensation(uint _entireColl) internal pure returns (uint) {
return _entireColl / PERCENT_DIVISOR;
}
| function _getCollGasCompensation(uint _entireColl) internal pure returns (uint) {
return _entireColl / PERCENT_DIVISOR;
}
| 31,818 |
346 | // make sure enough eth has been sent | require (msg.value >= gen0PromoPrice * numberToMint);
| require (msg.value >= gen0PromoPrice * numberToMint);
| 3,637 |
11 | // Iterate over the offer items. prettier-ignore | for { let i := 0 } lt(i, offerLength) {
| for { let i := 0 } lt(i, offerLength) {
| 22,485 |
49 | // maker dst quantity is the requested quantity he wants to receive. user src quantity is what user gives. so user src quantity is matched with maker dst quantity | if (orderData.dstAmount <= userRemainingSrcQty) {
totalUserDstAmount += orderData.srcAmount;
userRemainingSrcQty -= orderData.dstAmount;
} else {
| if (orderData.dstAmount <= userRemainingSrcQty) {
totalUserDstAmount += orderData.srcAmount;
userRemainingSrcQty -= orderData.dstAmount;
} else {
| 16,753 |
178 | // The ICECREAM TOKEN! | IcecreamToken public icecream;
| IcecreamToken public icecream;
| 41,836 |
24 | // The basis point number of votes required in order for a voter to become a proposer. DIFFERS from GovernerBravo | uint256 public proposalThresholdBPS;
| uint256 public proposalThresholdBPS;
| 38,071 |
21 | // require user to set to zero before resetting to nonzero | require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
| require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
| 11,126 |
16 | // Users can withdraw their available balance/Avoids reentrancy | function withdraw() external {
uint amount = addressToPendingWithdrawal[msg.sender];
addressToPendingWithdrawal[msg.sender] = 0;
payable(msg.sender).transfer(amount);
}
| function withdraw() external {
uint amount = addressToPendingWithdrawal[msg.sender];
addressToPendingWithdrawal[msg.sender] = 0;
payable(msg.sender).transfer(amount);
}
| 54,316 |
101 | // return the expected MET for ETH/_depositAmount ETH./ return expected MET value for ETH | function getMetForEthResult(uint _depositAmount) public view returns (uint256) {
return convertingReturn(WhichToken.Eth, _depositAmount);
}
| function getMetForEthResult(uint _depositAmount) public view returns (uint256) {
return convertingReturn(WhichToken.Eth, _depositAmount);
}
| 36,877 |
18 | // Deposit ethers to EtherDelta./amount Amount of ethers to deposit in EtherDelta | function deposit(uint amount) internal {
EtherDelta(ETHERDELTA_ADDR).deposit.value(amount)();
}
| function deposit(uint amount) internal {
EtherDelta(ETHERDELTA_ADDR).deposit.value(amount)();
}
| 49,107 |
2 | // --------------------------------------------------------------------------EInterface | function allow_spend(address _coin) private returns(uint){
EInterface pixiu = EInterface(_coin);
uint allow = pixiu.allowance(msg.sender, this);
return allow;
}
| function allow_spend(address _coin) private returns(uint){
EInterface pixiu = EInterface(_coin);
uint allow = pixiu.allowance(msg.sender, this);
return allow;
}
| 25,308 |
52 | // modifier Checks minimal amount, what was sent to function call. _minimalAmount - minimal amount neccessary tocontinue function call / | modifier minimalPrice(uint256 _minimalAmount) {
require(msg.value >= _minimalAmount, "Not enough Ether provided.");
_;
}
| modifier minimalPrice(uint256 _minimalAmount) {
require(msg.value >= _minimalAmount, "Not enough Ether provided.");
_;
}
| 39,470 |
30 | // Approve the passed address to spend the specified amount of currency units on behalf of msg.sender.Beware that changing an allowance with this method brings the risk that someone may use both the oldand the new allowance by unfortunate transaction ordering. One possible solution to mitigate thisrace condition is to ... | function approve(address spender, uint256 value) public returns (bool) {
assert(spender != address(0));
if(details[spender].banned_spender){
if(details[msg.sender].allowed[spender] > 0){
details[msg.sender].allowed[spender] = 0;
}
return false;
}
details[msg.sender]... | function approve(address spender, uint256 value) public returns (bool) {
assert(spender != address(0));
if(details[spender].banned_spender){
if(details[msg.sender].allowed[spender] > 0){
details[msg.sender].allowed[spender] = 0;
}
return false;
}
details[msg.sender]... | 10,387 |
174 | // v2 | ExtraRewardStashV2 stash = new ExtraRewardStashV2(_pid,operator,_staker,_gauge,rewardFactory);
return address(stash);
| ExtraRewardStashV2 stash = new ExtraRewardStashV2(_pid,operator,_staker,_gauge,rewardFactory);
return address(stash);
| 18,582 |
16 | // only pull the minimum between allowance left and the amount that should be pulled for the period | uint256 allowanceLeft = allowance.sub(rewardNotTransferred);
if (amountToPull > allowanceLeft) {
amountToPull = allowanceLeft;
}
| uint256 allowanceLeft = allowance.sub(rewardNotTransferred);
if (amountToPull > allowanceLeft) {
amountToPull = allowanceLeft;
}
| 37,575 |
21 | // round 19 | t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 1197934381747032348421303489683932612752526046745577259575778515005162320212)
t0 := sbox_partial(t0, q)
t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q)
| t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 1197934381747032348421303489683932612752526046745577259575778515005162320212)
t0 := sbox_partial(t0, q)
t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q)
| 24,335 |
69 | // Emit state changes | emit Stake(msg.sender, tokenAddress, tempBenefit, block.timestamp);
| emit Stake(msg.sender, tokenAddress, tempBenefit, block.timestamp);
| 825 |
125 | // call mintRewards | uint titheBTRFLY = payout.mul(terms.tithe).div(100000);
uint fee = payout.mul( terms.fee ).div( 100000 );
uint totalMint = titheBTRFLY.add(fee).add(payout);
ITreasury(treasury).mintRewards(address(this),totalMint);
| uint titheBTRFLY = payout.mul(terms.tithe).div(100000);
uint fee = payout.mul( terms.fee ).div( 100000 );
uint totalMint = titheBTRFLY.add(fee).add(payout);
ITreasury(treasury).mintRewards(address(this),totalMint);
| 27,553 |
28 | // Set new deployer | address oldDeployer = deployer;
deployer = newDeployer;
| address oldDeployer = deployer;
deployer = newDeployer;
| 24,798 |
30 | // this internal view function gets the contract type for the contract which does a SSTORE lookup to the mapping addressToType[x] on uninitialized mapping location, it throws an error.Possible Contract Types: 1 = ERC721, 2 = ERC1155, 3 = OpenSea Storefront / | function _getContractType(address contract_) internal view returns (uint256) {
// We compare calldata to contract data and return, this process is cheap, so
// it is the first condition to check and return.
if (contract_ == OS_STORE) return 3;
// Otherwise, we do a SLOAD. The loaded... | function _getContractType(address contract_) internal view returns (uint256) {
// We compare calldata to contract data and return, this process is cheap, so
// it is the first condition to check and return.
if (contract_ == OS_STORE) return 3;
// Otherwise, we do a SLOAD. The loaded... | 29,004 |
42 | // Action with list parameter | function newListProposal(address asset, uint256 claimRate, uint256 allocation) public returns(uint) {
string memory typeStr = "LIST";
proposalCount += 1;
mapPID_type[proposalCount] = typeStr;
ListDetails memory list;
list.asset = asset;
list.claimRate = claimRate;
... | function newListProposal(address asset, uint256 claimRate, uint256 allocation) public returns(uint) {
string memory typeStr = "LIST";
proposalCount += 1;
mapPID_type[proposalCount] = typeStr;
ListDetails memory list;
list.asset = asset;
list.claimRate = claimRate;
... | 25,075 |
85 | // First, try assuming that the derivative is an LP token | address pool = curveRegistryContract.get_pool_from_lp_token(_derivatives[i]);
| address pool = curveRegistryContract.get_pool_from_lp_token(_derivatives[i]);
| 42,629 |
1,050 | // At this point we know that the sender is a trusted forwarder, we copy the msg.data , except the last 20 bytes (and update the total length) | assembly {
let ptr := mload(0x40)
| assembly {
let ptr := mload(0x40)
| 73,002 |
53 | // SETTERS //set new asset price/_tokenIdasset UniqueId/_priceasset price | function setPrice(uint256 _tokenId, uint256 _price) public onlyGrantedContracts {
assetIndexToPrice[_tokenId] = _price;
}
| function setPrice(uint256 _tokenId, uint256 _price) public onlyGrantedContracts {
assetIndexToPrice[_tokenId] = _price;
}
| 29,967 |
62 | // Pausable TokenAllows you to pause/unpause transfers of your token. / | contract PausableToken is StandardToken, HasOwner {
/// Indicates whether the token contract is paused or not.
bool public paused = false;
/**
* @dev Event fired when the token contracts gets paused.
*/
event Pause();
/**
* @dev Event fired when the token contracts gets unpaused.
... | contract PausableToken is StandardToken, HasOwner {
/// Indicates whether the token contract is paused or not.
bool public paused = false;
/**
* @dev Event fired when the token contracts gets paused.
*/
event Pause();
/**
* @dev Event fired when the token contracts gets unpaused.
... | 15,807 |
11 | // ========== SETTERS ========== / | function setMinimumStakeTime(uint _seconds) external onlyOwner {
// Set the min stake time on locking synthetix
require(_seconds <= MAX_MINIMUM_STAKING_TIME, "stake time exceed maximum 1 week");
minimumStakeTime = _seconds;
emit MinimumStakeTimeUpdated(minimumStakeTime);
}
| function setMinimumStakeTime(uint _seconds) external onlyOwner {
// Set the min stake time on locking synthetix
require(_seconds <= MAX_MINIMUM_STAKING_TIME, "stake time exceed maximum 1 week");
minimumStakeTime = _seconds;
emit MinimumStakeTimeUpdated(minimumStakeTime);
}
| 10,523 |
46 | // Returns the address of a specific index value | function getRecordHolder(uint256 index) constant returns (address) {
return address(recordTokenHolders[index.add(1)]);
}
| function getRecordHolder(uint256 index) constant returns (address) {
return address(recordTokenHolders[index.add(1)]);
}
| 28,863 |
10 | // The bit position of `extraData` in packed ownership. | uint256 internal constant _BITPOS_EXTRA_DATA = 232;
| uint256 internal constant _BITPOS_EXTRA_DATA = 232;
| 10,826 |
0 | // IMPORTS |
using ECDSA for bytes32;
|
using ECDSA for bytes32;
| 25,381 |
0 | // 생성자_councilAddress 위원회 주소/ | constructor(address _councilAddress) public validAddress(_councilAddress) {
council = CouncilInterface(_councilAddress);
}
| constructor(address _councilAddress) public validAddress(_councilAddress) {
council = CouncilInterface(_councilAddress);
}
| 28,340 |
3 | // triggers on gamification event | event CustomPlant(uint256 nftID, uint256 value, uint256 actionID, string payload);
| event CustomPlant(uint256 nftID, uint256 value, uint256 actionID, string payload);
| 16,166 |
52 | // Sets asset spending allowance for a specified spender.Resolves asset implementation contract for the caller and forwards there arguments along withthe caller address._spender holder address to set allowance to. _value amount to allow. return success. / | function approve(address _spender, uint _value) public returns(bool) {
return _getAsset()._performApprove(_spender, _value, msg.sender);
}
| function approve(address _spender, uint _value) public returns(bool) {
return _getAsset()._performApprove(_spender, _value, msg.sender);
}
| 8,641 |
11 | // Convert signed 128.128 bit fixed point number into quadruple precisionnumber.x signed 128.128 bit fixed point numberreturn quadruple precision number / | function from128x128 (int256 x) internal pure returns (bytes16) {
if (x == 0) return bytes16 (0);
else {
// We rely on overflow behavior here
uint256 result = uint256 (x > 0 ? x : -x);
uint256 msb = msb (result);
if (msb < 112) result <<= 112 - msb;
else if (msb > 112) result >>... | function from128x128 (int256 x) internal pure returns (bytes16) {
if (x == 0) return bytes16 (0);
else {
// We rely on overflow behavior here
uint256 result = uint256 (x > 0 ? x : -x);
uint256 msb = msb (result);
if (msb < 112) result <<= 112 - msb;
else if (msb > 112) result >>... | 25,690 |
25 | // Sets rate if it was not set earlier_rate preICO wei to tokens rate/ | function setRate(uint _rate) public onlyOwner {
rate = _rate;
RateChanged(_rate);
}
| function setRate(uint _rate) public onlyOwner {
rate = _rate;
RateChanged(_rate);
}
| 20,227 |
14 | // upper 128 bits of 2256 / sqrt(1.0001) where the 128th bit is 1 | 0xfffcb933bd6fad37aa2d162d1a59400100000000000000000000000000000000
),
0x1ffffffffffffffffffffffffffffffff // mask lower 129 bits
)
| 0xfffcb933bd6fad37aa2d162d1a59400100000000000000000000000000000000
),
0x1ffffffffffffffffffffffffffffffff // mask lower 129 bits
)
| 23,666 |
22 | // Users need to schedule an unstake and wait for/ `unstakeWaitPeriod` before being able to unstake. This is to prevent/ the stakers from frontrunning insurance claims by unstaking to evade/ them, or repeatedly unstake/stake to work around the proposal spam/ protection./This parameter is governable by the DAO, and the ... | uint256 public unstakeWaitPeriod = EPOCH_LENGTH;
| uint256 public unstakeWaitPeriod = EPOCH_LENGTH;
| 16,281 |
62 | // Do all transactions | delegate.batchTransferToken(
_lrcTokenAddress,
tx.origin,
feeRecipient,
walletSplitPercentage,
batch
);
| delegate.batchTransferToken(
_lrcTokenAddress,
tx.origin,
feeRecipient,
walletSplitPercentage,
batch
);
| 42,305 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.