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 |
|---|---|---|---|---|
16 | // uint256[] memory _chestIds; | _chestIds = new uint256[](1);
_chestIds[0] = _chestId;
| _chestIds = new uint256[](1);
_chestIds[0] = _chestId;
| 23,085 |
47 | // Official record of token balances for each account | mapping(address => uint) internal balances;
mapping(address => LockedBalance) public locked;
DexAggregatorInterface public dexAgg;
IERC20 public oleToken;
| mapping(address => uint) internal balances;
mapping(address => LockedBalance) public locked;
DexAggregatorInterface public dexAgg;
IERC20 public oleToken;
| 31,558 |
68 | // Collected ETH is transferred to multisigs. Unsold tokens transferred to GoldmintUnsold contract. | ICOFinished,
| ICOFinished,
| 39,812 |
8 | // 참여자 금액 되돌려주기/ | function withdraw() external {
require(state == AuctionState.COMPLETED);
require(stakeAmounts[msg.sender] > 0);
uint amount = stakeAmounts[msg.sender];
stakeAmounts[msg.sender] = 0;
msg.sender.transfer(amount);
}
| function withdraw() external {
require(state == AuctionState.COMPLETED);
require(stakeAmounts[msg.sender] > 0);
uint amount = stakeAmounts[msg.sender];
stakeAmounts[msg.sender] = 0;
msg.sender.transfer(amount);
}
| 42,592 |
25 | // get all depositers and their claimed amount | function getDepositors()
public
view
returns (address[] memory, uint256[] memory)
| function getDepositors()
public
view
returns (address[] memory, uint256[] memory)
| 36,774 |
23 | // Запрос на выплату от пользователя, используется в случае, если клиент делает withdraw / | function _withdraw(address toAddress, uint weiAmount) private {
// Делаем перевод получателю
toAddress.transfer(weiAmount);
Withdraw(toAddress, weiAmount);
}
| function _withdraw(address toAddress, uint weiAmount) private {
// Делаем перевод получателю
toAddress.transfer(weiAmount);
Withdraw(toAddress, weiAmount);
}
| 21,873 |
16 | // Buys a position in a reality market./For a given starting token index n, n = Invalid, n+1 = No, n+2 = Yes./index Market index to buy the position in./outcome Token index of the outcome to buy into./amount Amount of Vision to stake on the outcome./Invariant - User may not purchase positions once the market has been f... | function buyPosition(uint index, uint outcome, uint amount) public nonReentrant isInitialized {
require(!realityMarketRegistry[index].finalized, "Market already finalized.");
require(amount > 0, "Amount to mint should be greater than 0.");
uint invalid = realityMarketRegistry[index].tokenInd... | function buyPosition(uint index, uint outcome, uint amount) public nonReentrant isInitialized {
require(!realityMarketRegistry[index].finalized, "Market already finalized.");
require(amount > 0, "Amount to mint should be greater than 0.");
uint invalid = realityMarketRegistry[index].tokenInd... | 40,241 |
12 | // tokens should be held until vote is not one of the states below. | IAaveGovernanceV2.ProposalState state = aaveGovernanceV2
.getProposalState(runningProposals[i]);
if (
state == IAaveGovernanceV2.ProposalState.Pending ||
state == IAaveGovernanceV2.ProposalState.Active ||
state == IAaveGovernanceV2.... | IAaveGovernanceV2.ProposalState state = aaveGovernanceV2
.getProposalState(runningProposals[i]);
if (
state == IAaveGovernanceV2.ProposalState.Pending ||
state == IAaveGovernanceV2.ProposalState.Active ||
state == IAaveGovernanceV2.... | 6,719 |
7 | // The payment terms. paymentCycleAmount The amount to be paid every cycle. monthlyCycleInterest The interest to be paid every cycle. paymentCycle The duration of a payment cycle. APR The interest rate involved in bps. installments The total installments for the loan repayment. installmentsPaid The installments paid. / | struct Terms {
uint256 paymentCycleAmount;
uint256 monthlyCycleInterest;
uint32 paymentCycle;
uint16 APR;
uint32 installments;
uint32 installmentsPaid;
}
| struct Terms {
uint256 paymentCycleAmount;
uint256 monthlyCycleInterest;
uint32 paymentCycle;
uint16 APR;
uint32 installments;
uint32 installmentsPaid;
}
| 11,295 |
37 | // A generic interface for a contract which properly accepts ERC721 tokens./Solmate (https:github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC721.sol) | interface ERC721TokenReceiver {
function onERC721Received(
address operator,
address from,
uint256 id,
bytes calldata data
) external returns (bytes4);
}
| interface ERC721TokenReceiver {
function onERC721Received(
address operator,
address from,
uint256 id,
bytes calldata data
) external returns (bytes4);
}
| 23,394 |
359 | // start block of release to VAI Vault | uint256 public releaseStartBlock;
| uint256 public releaseStartBlock;
| 14,678 |
9 | // Set each state variable manually | function setTokenAddress(address _newToken) external onlyOwner{
REMI_INTERFACE = IERC20(_newToken);
}
| function setTokenAddress(address _newToken) external onlyOwner{
REMI_INTERFACE = IERC20(_newToken);
}
| 24,551 |
88 | // Hook that is called before a set of serially-ordered token ids are about to be transferred. This includes minting.And also called before burning one token. startTokenId - the first token id to be transferredquantity - the amount to be transferred Calling conditions: - When `from` and `to` are both non-zero, `from`'s... | function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
| function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
| 11,231 |
209 | // ========== SETTERS ========== / | ) public view returns (uint amountAfterSettlement) {
amountAfterSettlement = amount;
// balance of a pynth will show an amount after settlement
uint balanceOfSourceAfterSettlement = IERC20(address(issuer().pynths(currencyKey))).balanceOf(from);
// when there isn't enough supply (ei... | ) public view returns (uint amountAfterSettlement) {
amountAfterSettlement = amount;
// balance of a pynth will show an amount after settlement
uint balanceOfSourceAfterSettlement = IERC20(address(issuer().pynths(currencyKey))).balanceOf(from);
// when there isn't enough supply (ei... | 57,514 |
30 | // Add the application | applications[jobId][msg.sender] = Application(
msg.sender,
jobs[jobId].employerAddress,
jobId,
false,
false
);
| applications[jobId][msg.sender] = Application(
msg.sender,
jobs[jobId].employerAddress,
jobId,
false,
false
);
| 2,240 |
249 | // Constructor _securityToken Address of the security token / | constructor (address _securityToken, address _polyAddress) public
ModuleStorage(_securityToken, _polyAddress)
| constructor (address _securityToken, address _polyAddress) public
ModuleStorage(_securityToken, _polyAddress)
| 33,371 |
132 | // 크라우드 세일이 진행 중인지 여부를 반환한다.return isOpened true: 진행 중 false : 진행 중이 아님(참여 불가) / | function isOpened() public view returns (bool isOpend) {
if(now < startTime) return false;
if(now >= endTime) return false;
if(closed == true) return false;
return true;
}
| function isOpened() public view returns (bool isOpend) {
if(now < startTime) return false;
if(now >= endTime) return false;
if(closed == true) return false;
return true;
}
| 49,901 |
204 | // Toggles minting state. / | function toggleMintEnabled() public onlyOwner {
mintEnabled = !mintEnabled;
}
| function toggleMintEnabled() public onlyOwner {
mintEnabled = !mintEnabled;
}
| 38,491 |
64 | // Tax and MarketingPool fees will start at 0 so we don't have a big impact when deploying to Uniswap MarketingPool wallet address is null but the method to set the address is exposed | uint256 private _taxFee = 8;
uint256 private _MarketingPoolFee = 8;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousMarketingPoolFee = _MarketingPoolFee;
address payable public _MarketingPoolWalletAddress;
IUniswapV2Router02 public immutable... | uint256 private _taxFee = 8;
uint256 private _MarketingPoolFee = 8;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousMarketingPoolFee = _MarketingPoolFee;
address payable public _MarketingPoolWalletAddress;
IUniswapV2Router02 public immutable... | 24,428 |
29 | // A fulfillment is applied to a group of orders. It decrements a series of offer and consideration items, then generates a single execution element. A given fulfillment can be applied to as many offer and consideration items as desired, but must contain at least one offer and at least one consideration that match. The... | struct Fulfillment {
FulfillmentComponent[] offerComponents;
FulfillmentComponent[] considerationComponents;
}
| struct Fulfillment {
FulfillmentComponent[] offerComponents;
FulfillmentComponent[] considerationComponents;
}
| 32,753 |
25 | // If the observation fails validation, do not update anything | if (!validateObservation(data, price)) return false;
ObservationLibrary.PriceObservation storage observation = observations[token];
AccumulationLibrary.PriceAccumulator storage accumulation = accumulations[token];
if (observation.timestamp == 0) {
| if (!validateObservation(data, price)) return false;
ObservationLibrary.PriceObservation storage observation = observations[token];
AccumulationLibrary.PriceAccumulator storage accumulation = accumulations[token];
if (observation.timestamp == 0) {
| 23,872 |
1 | // cliff period in seconds | uint256 cliff;
| uint256 cliff;
| 6,598 |
132 | // send some amount of arbitrary ERC20 Tokens_externalToken the address of the Token Contract_to address of the beneficiary_value the amount of ether (in Wei) to send_avatar address return bool which represents a success/ | function externalTokenTransfer(IERC20 _externalToken, address _to, uint256 _value, Avatar _avatar)
| function externalTokenTransfer(IERC20 _externalToken, address _to, uint256 _value, Avatar _avatar)
| 21,558 |
11 | // step => address => 可提取token | mapping(uint256 => mapping(address => uint256)) private tokenBalance;
mapping(uint256 => mapping(address => uint256)) FissionBalance;
mapping(uint256 => mapping(address => uint256)) FOMOBalance;
mapping(uint256 => mapping(address => uint256)) LuckyBalance;
| mapping(uint256 => mapping(address => uint256)) private tokenBalance;
mapping(uint256 => mapping(address => uint256)) FissionBalance;
mapping(uint256 => mapping(address => uint256)) FOMOBalance;
mapping(uint256 => mapping(address => uint256)) LuckyBalance;
| 11,084 |
37 | // A special address that is authorized to call `emergencyRecovery()`. That function/resets ALL authorization for this wallet, and must therefore be treated with utmost security./Reasonable choices for recoveryAddress include:/ - the address of a private key in cold storage/ - a physically secured hardware wallet/ - a ... | address public recoveryAddress;
| address public recoveryAddress;
| 7,278 |
212 | // Set the lastRewardBlock as the startBlock | lastRewardBlock = _startBlock;
| lastRewardBlock = _startBlock;
| 52,855 |
34 | // Pausable Base contract which allows children to implement an emergency stop mechanism. / | contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only wh... | contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only wh... | 2,595 |
132 | // Query if a contract implements an interfaceInterface identification is specified in ERC-165. This function uses less than 30,000 gas.interfaceID The interface identifier, as specified in ERC-165return `true` if the contract implements `interfaceID` and `interfaceID` is not 0xffffffff, `false` otherwise / | function supportsInterface(bytes4 interfaceID) external view returns (bool);
| function supportsInterface(bytes4 interfaceID) external view returns (bool);
| 6,035 |
126 | // Returns the underlying token address of the given cToken | function getUnderlyingAddr(address _cTokenAddr) internal returns (address tokenAddr) {
// cEth has no .underlying() method
if (_cTokenAddr == C_ETH_ADDR) return TokenUtils.WETH_ADDR;
tokenAddr = ICToken(_cTokenAddr).underlying();
}
| function getUnderlyingAddr(address _cTokenAddr) internal returns (address tokenAddr) {
// cEth has no .underlying() method
if (_cTokenAddr == C_ETH_ADDR) return TokenUtils.WETH_ADDR;
tokenAddr = ICToken(_cTokenAddr).underlying();
}
| 25,227 |
91 | // The oracle will have given you an ID for the VRF keypair they have committed to (let's call it keyHash), and have told you the minimum LINK price for VRF service. Make sure your contract has sufficient LINK, and call requestRandomness(keyHash, fee, seed), where seed is the input you want to generate randomness from.... | abstract contract VRFConsumerBase is VRFRequestIDBase {
using SafeMath for uint256;
/**
* @notice fulfillRandomness handles the VRF response. Your contract must
* @notice implement it.
*
* @dev The VRFCoordinator expects a calling contract to have a method with
* @dev this signature, and will trigg... | abstract contract VRFConsumerBase is VRFRequestIDBase {
using SafeMath for uint256;
/**
* @notice fulfillRandomness handles the VRF response. Your contract must
* @notice implement it.
*
* @dev The VRFCoordinator expects a calling contract to have a method with
* @dev this signature, and will trigg... | 30,685 |
128 | // prepended message with the length of the signed hash in hexadecimal | bytes constant private PREPEND_HEX = "\x19Ethereum Signed Message:\n\x20";
| bytes constant private PREPEND_HEX = "\x19Ethereum Signed Message:\n\x20";
| 10,386 |
9 | // Settlement of unsettled trades of maker orders./account Account placing the related maker orders/epoch Epoch of the settled trades/amountM Amount of Token M added to the account's available balance/amountA Amount of Token A added to the account's available balance/amountB Amount of Token B added to the account's ava... | event MakerSettled(
address indexed account,
uint256 epoch,
uint256 amountM,
uint256 amountA,
uint256 amountB,
uint256 quoteAmount
);
| event MakerSettled(
address indexed account,
uint256 epoch,
uint256 amountM,
uint256 amountA,
uint256 amountB,
uint256 quoteAmount
);
| 14,726 |
7 | // @custom:legacy/Initiates a withdrawal from L2 to L1 to a target account on L1./ Note that if ETH is sent to a contract on L1 and the call fails, then that ETH will/ be locked in the L1StandardBridge. ETH may be recoverable if the call can be/ successfully replayed by increasing the amount of gas supplied to the call... | function withdrawTo(
address _l2Token,
address _to,
uint256 _amount,
uint32 _minGasLimit,
bytes calldata _extraData
| function withdrawTo(
address _l2Token,
address _to,
uint256 _amount,
uint32 _minGasLimit,
bytes calldata _extraData
| 12,256 |
6 | // BuilderCrowdfunding contract / | contract BuilderCrowdfunding is Builder {
/**
* @dev Run script creation contract
* @return address new contract
*/
function create(
address _fund,
address _bounty,
string _reference,
uint256 _startBlock,
uint256 _stopBlock,
uint256 _minValue,
... | contract BuilderCrowdfunding is Builder {
/**
* @dev Run script creation contract
* @return address new contract
*/
function create(
address _fund,
address _bounty,
string _reference,
uint256 _startBlock,
uint256 _stopBlock,
uint256 _minValue,
... | 46,519 |
257 | // Convert ETH to WETH if needed |
if (gemJoin == wethJoin) {
invokeWallet(_wallet, address(wethToken), _collateralAmount, abi.encodeWithSignature("deposit()"));
}
|
if (gemJoin == wethJoin) {
invokeWallet(_wallet, address(wethToken), _collateralAmount, abi.encodeWithSignature("deposit()"));
}
| 2,452 |
7 | // Only deploy if a smart wallet doesn't already exist at expected address. | uint256 size;
| uint256 size;
| 6,670 |
135 | // event emitted when a token template is added | event TokenTemplateAdded(address newToken, uint256 templateId);
| event TokenTemplateAdded(address newToken, uint256 templateId);
| 22,579 |
0 | // forward registrar | mapping(address=>bytes32) registrar;
| mapping(address=>bytes32) registrar;
| 32,315 |
115 | // delegates one specific power to a delegatee delegatee the user which delegated power has changed delegationType the type of delegation (VOTING_POWER, PROPOSITION_POWER) / | function delegateByType(address delegatee, DelegationType delegationType) external override {
_delegateByType(msg.sender, delegatee, delegationType);
}
| function delegateByType(address delegatee, DelegationType delegationType) external override {
_delegateByType(msg.sender, delegatee, delegationType);
}
| 12,316 |
24 | // Events contract for logging trade activity on Rubicon Market/Provides the key event logs that are used in all core functionality of exchanging on the Rubicon Market | contract EventfulMarket {
event LogItemUpdate(uint256 id);
event LogTrade(
uint256 pay_amt,
address indexed pay_gem,
uint256 buy_amt,
address indexed buy_gem
);
event LogMake(
bytes32 indexed id,
bytes32 indexed pair,
address indexed maker,
... | contract EventfulMarket {
event LogItemUpdate(uint256 id);
event LogTrade(
uint256 pay_amt,
address indexed pay_gem,
uint256 buy_amt,
address indexed buy_gem
);
event LogMake(
bytes32 indexed id,
bytes32 indexed pair,
address indexed maker,
... | 14,238 |
62 | // Allows the governance to set the locker/Can be called only by the governance/_locker locker address | function setLocker(address _locker) external {
require(msg.sender == governance, "!gov");
require(_locker != address(0), "can't be zero address");
emit LockerSet(locker, _locker);
locker = _locker;
}
| function setLocker(address _locker) external {
require(msg.sender == governance, "!gov");
require(_locker != address(0), "can't be zero address");
emit LockerSet(locker, _locker);
locker = _locker;
}
| 70,729 |
115 | // Handle the approval of ERC1363 tokens Any ERC1363 smart contract calls this function on the recipientafter an `approve`. This function MAY throw to revert and reject theapproval. Return of other than the magic value MUST result in thetransaction being reverted.Note: the token contract address is always the message s... | function onApprovalReceived(address sender, uint256 amount, bytes calldata data) external returns (bytes4);
| function onApprovalReceived(address sender, uint256 amount, bytes calldata data) external returns (bytes4);
| 18,289 |
7 | // Provides tracking nonces for addresses. Nonces will only increment. / | abstract contract Nonces {
/**
* @dev The nonce used for an `account` is not the expected current nonce.
*/
error InvalidAccountNonce(address account, uint256 currentNonce);
mapping(address account => uint256) private _nonces;
/**
* @dev Returns the next unused nonce for an address.
... | abstract contract Nonces {
/**
* @dev The nonce used for an `account` is not the expected current nonce.
*/
error InvalidAccountNonce(address account, uint256 currentNonce);
mapping(address account => uint256) private _nonces;
/**
* @dev Returns the next unused nonce for an address.
... | 9,919 |
184 | // The Tangshuk TOKEN! | TangshukBar public tangshuk;
| TangshukBar public tangshuk;
| 8,291 |
19 | // Lifecycle | bool public suspended;
| bool public suspended;
| 43,639 |
235 | // Update the given pool's PEARL allocation point. Can only be called by the owner. | function set(uint256 _pid, uint256 _allocPoint, bool _withUpdate) public onlyOwner {
if (_withUpdate) {
massUpdatePools();
}
totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(_allocPoint);
uint256 prevAllocPoint = poolInfo[_pid].allocPoint;
pool... | function set(uint256 _pid, uint256 _allocPoint, bool _withUpdate) public onlyOwner {
if (_withUpdate) {
massUpdatePools();
}
totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(_allocPoint);
uint256 prevAllocPoint = poolInfo[_pid].allocPoint;
pool... | 37,100 |
98 | // string read methods | function getStringValue() public view returns (string memory) {
return stringValue;
}
| function getStringValue() public view returns (string memory) {
return stringValue;
}
| 20,124 |
50 | // Setting the initial fees | uint256 private _TotalFee = 15;
uint256 public _buyFee = 15;
uint256 public _sellFee = 15;
| uint256 private _TotalFee = 15;
uint256 public _buyFee = 15;
uint256 public _sellFee = 15;
| 18,761 |
333 | // returns the converter type the factory is associated with return converter type / | function converterType() external pure override returns (uint16) {
return 3;
}
| function converterType() external pure override returns (uint16) {
return 3;
}
| 87,127 |
501 | // Returns the current RNG Request ID/ return The current Request ID | function getLastRngRequestId() external view returns (uint32) {
return rngRequest.id;
}
| function getLastRngRequestId() external view returns (uint32) {
return rngRequest.id;
}
| 27,509 |
324 | // Queue of pending/unresolved bets | address[] pendingBetsQueue;
uint queueHead = 0;
uint queueTail = 0;
| address[] pendingBetsQueue;
uint queueHead = 0;
uint queueTail = 0;
| 28,036 |
14 | // Set the proposal dispute window -- i.e. how long people have to challenge and answer to the query. | _oracle.setCustomLiveness(queryIdentifier, requestTimestamp, bytes(query), proposalDisputeWindow);
| _oracle.setCustomLiveness(queryIdentifier, requestTimestamp, bytes(query), proposalDisputeWindow);
| 10,811 |
3 | // Manual external price setter. | function setPrice(uint256 price) external returns (bool) {
_price = price;
return true;
}
| function setPrice(uint256 price) external returns (bool) {
_price = price;
return true;
}
| 39,380 |
88 | // Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef). | function mint(address _to, uint256 _amount) public onlyOwner {
_mint(_to, _amount);
_moveDelegates(address(0), _delegates[_to], _amount);
}
| function mint(address _to, uint256 _amount) public onlyOwner {
_mint(_to, _amount);
_moveDelegates(address(0), _delegates[_to], _amount);
}
| 6,172 |
57 | // returns the base token staking limits of a given pool / | function _baseTokenAvailableSpace(IConverterAnchor poolAnchor) internal view returns (uint256) {
// get the pool converter
ILiquidityPoolConverter converter = ILiquidityPoolConverter(payable(_ownedBy(poolAnchor)));
// get the base token
IReserveToken networkToken = IReserveToken(add... | function _baseTokenAvailableSpace(IConverterAnchor poolAnchor) internal view returns (uint256) {
// get the pool converter
ILiquidityPoolConverter converter = ILiquidityPoolConverter(payable(_ownedBy(poolAnchor)));
// get the base token
IReserveToken networkToken = IReserveToken(add... | 29,513 |
102 | // Guarrentees that msg.sender is wetrust owned manager address / | modifier onlyByWeTrustManager() {
require(msg.sender == wetrustManager, "sender must be from WeTrust Manager Address");
_;
}
| modifier onlyByWeTrustManager() {
require(msg.sender == wetrustManager, "sender must be from WeTrust Manager Address");
_;
}
| 45,290 |
70 | // Sets the reference to the market oracle. marketOracle_ The address of the market oracle contract. / | function setMarketOracle(IOracle marketOracle_)
external
onlyOwner
| function setMarketOracle(IOracle marketOracle_)
external
onlyOwner
| 14,216 |
13 | // Set number of extra blocks after a challenge newExtraTimeBlocks new number of blocks / | function setExtraChallengeTimeBlocks(uint256 newExtraTimeBlocks) external;
| function setExtraChallengeTimeBlocks(uint256 newExtraTimeBlocks) external;
| 20,885 |
2 | // EnsResolverExtract of the interface for ENS Resolver/ | contract EnsResolver {
function setAddr(bytes32 node, address addr) public;
}
| contract EnsResolver {
function setAddr(bytes32 node, address addr) public;
}
| 39,704 |
5 | // Change URI base. _uriBase New uriBase. / | function setUriBase(
string calldata _uriBase
)
| function setUriBase(
string calldata _uriBase
)
| 5,090 |
16 | // Checks whether the state has a given known empty account. _address Address of the account to check.return Whether or not the state has the empty account. / | function hasEmptyAccount(
address _address
)
override
public
view
returns (
bool
)
| function hasEmptyAccount(
address _address
)
override
public
view
returns (
bool
)
| 56,444 |
47 | // Approve an address to match orders on behalf of msg.sender / | function approveDelegate(address delegate) external {
relayerDelegates[msg.sender][delegate] = true;
emit RelayerApproveDelegate(msg.sender, delegate);
}
| function approveDelegate(address delegate) external {
relayerDelegates[msg.sender][delegate] = true;
emit RelayerApproveDelegate(msg.sender, delegate);
}
| 4,669 |
9 | // Returns an Ethereum Signed Message, created from a `hash`. Thisreplicates the behavior of theJSON-RPC method. | * See {recover}.
*/
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
// 32 is the length in bytes of hash,
// enforced by the type signature above
return keccak256(abi.encodePacked('\x19Ethereum Signed Message:\n32', hash));
}
| * See {recover}.
*/
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
// 32 is the length in bytes of hash,
// enforced by the type signature above
return keccak256(abi.encodePacked('\x19Ethereum Signed Message:\n32', hash));
}
| 9,910 |
108 | // sell out ETH, amountIn is ETH, amountOutExact is token convert to amountOutExact in ETH | uint256 vol = uint256(amountOutExact).mul(ethAmount).div(erc20Amount);
return impactCostForSellOutETH(vol);
| uint256 vol = uint256(amountOutExact).mul(ethAmount).div(erc20Amount);
return impactCostForSellOutETH(vol);
| 1,376 |
271 | // Sets `_tokenURI` as the tokenURI of `tokenId`. Requirements: - `tokenId` must exist. / | function _setTokenURI(uint256 tokenId, string memory _tokenURI)
internal
virtual
| function _setTokenURI(uint256 tokenId, string memory _tokenURI)
internal
virtual
| 47,824 |
99 | // Emitted when a market for a future yield token and an ERC20 token is created. marketFactoryId Forge identifier. xyt The address of the tokenized future yield token as the base asset. token The address of an ERC20 token as the quote asset. market The address of the newly created market. // Emitted when a swap happens... | event Join(
address indexed sender,
uint256 token0Amount,
uint256 token1Amount,
address market,
uint256 exactOutLp
);
| event Join(
address indexed sender,
uint256 token0Amount,
uint256 token1Amount,
address market,
uint256 exactOutLp
);
| 9,862 |
47 | // send remaining funds to the seller in escrow | _asyncTransfer(
auction.payee,
auction.currentBid.amount.sub(creatorRoyaltyFee).sub(commissionFee)
);
| _asyncTransfer(
auction.payee,
auction.currentBid.amount.sub(creatorRoyaltyFee).sub(commissionFee)
);
| 4,692 |
24 | // This function creates new record, this function is to be called only from within contract/name This is the name of the record/image This is the image/logo of the record/recordCategory This is the category to which record belongs/seedId This is the seed contribution id | function _createNewRecord(
string memory name,
string memory image,
string memory recordCategory,
uint256 seedId,
address owner
| function _createNewRecord(
string memory name,
string memory image,
string memory recordCategory,
uint256 seedId,
address owner
| 23,232 |
139 | // If we don't have enough funds in the strategy We'll deposit funds from the jar to the strategy Note: This assumes that no single person is responsible for 100% of the liquidity. If this a single person is 100% responsible for the liquidity we can simply set min = max in pickle-jars | if (IStrategy(_fromStrategy).balanceOf() < _fromTokenAmount) {
IJar(_fromJar).earn();
}
| if (IStrategy(_fromStrategy).balanceOf() < _fromTokenAmount) {
IJar(_fromJar).earn();
}
| 57,939 |
109 | // internal helper function to penalize arbiters for missing a vote -functionhash- unknown yet voteId The id of the vote that didn't get completed by the end time / | function penalizeArbiter(uint256 voteId)
internal
returns (uint256)
| function penalizeArbiter(uint256 voteId)
internal
returns (uint256)
| 48,234 |
68 | // update to new endpoint | serviceEndpoint.endpoint = _newEndpoint;
serviceProviderInfo[_serviceType][spId] = serviceEndpoint;
serviceProviderEndpointToId[keccak256(bytes(_newEndpoint))] = spId;
emit EndpointUpdated(_serviceType, msg.sender, _oldEndpoint, _newEndpoint, spId);
return spId;
| serviceEndpoint.endpoint = _newEndpoint;
serviceProviderInfo[_serviceType][spId] = serviceEndpoint;
serviceProviderEndpointToId[keccak256(bytes(_newEndpoint))] = spId;
emit EndpointUpdated(_serviceType, msg.sender, _oldEndpoint, _newEndpoint, spId);
return spId;
| 9,791 |
21 | // == Note related operations == | modifier validNote(string memory note) {
bytes memory b = bytes(note);
require(b.length <= noteSizeLimit, "Note should be shorter than noteSizeLimit");
// Reference https://utf8-chartable.de/unicode-utf8-table.pl
// Ignore C0 and C1 control code https://en.wikipedia.org/wiki/C0_and_... | modifier validNote(string memory note) {
bytes memory b = bytes(note);
require(b.length <= noteSizeLimit, "Note should be shorter than noteSizeLimit");
// Reference https://utf8-chartable.de/unicode-utf8-table.pl
// Ignore C0 and C1 control code https://en.wikipedia.org/wiki/C0_and_... | 18,935 |
30 | // Removes liquidity from the bridge pool. Burns lpTokenAmount LP tokens from the caller's wallet. The calleris sent back a commensurate number of l1Tokens at the prevailing exchange rate. The caller does not need to approve the spending of LP tokens as this method directly uses the burn logic. Reentrancy guard not add... | function removeLiquidity(uint256 lpTokenAmount, bool sendEth) public nonReentrant() {
// Can only send eth on withdrawing liquidity iff this is the WETH pool.
require(!sendEth || isWethPool, "Cant send eth");
uint256 l1TokensToReturn = (lpTokenAmount * _exchangeRateCurrent()) / 1e18;
... | function removeLiquidity(uint256 lpTokenAmount, bool sendEth) public nonReentrant() {
// Can only send eth on withdrawing liquidity iff this is the WETH pool.
require(!sendEth || isWethPool, "Cant send eth");
uint256 l1TokensToReturn = (lpTokenAmount * _exchangeRateCurrent()) / 1e18;
... | 7,973 |
128 | // otoken burn | otokenMintBurn().burn(account, amount);
emit BurnOToken(
account,
amount,
assetAddress
);
| otokenMintBurn().burn(account, amount);
emit BurnOToken(
account,
amount,
assetAddress
);
| 67,241 |
30 | // Add fee to developers balance | balances[withdrawWallet] += fee;
| balances[withdrawWallet] += fee;
| 46,711 |
247 | // Mints tokens to a given address (only for ownerMinter)./The minter might be different than the receiver./to Token receiver | function ownerMint(address to, uint16 num) external {
if (msg.sender != ownerMinter) revert OnlyOwnerMinter();
if (num > remainingSales) revert InsufficientTokensRemanining();
remainingSales -= num;
_processMint(to, num);
}
| function ownerMint(address to, uint16 num) external {
if (msg.sender != ownerMinter) revert OnlyOwnerMinter();
if (num > remainingSales) revert InsufficientTokensRemanining();
remainingSales -= num;
_processMint(to, num);
}
| 57,059 |
54 | // takes raw amount of cUsdc, returns numeraire amount | function viewRawAmount (int128 _amount) public view returns (uint256 amount_) {
uint256 _rate = cusdc.exchangeRateStored();
uint256 _supplyRate = cusdc.supplyRatePerBlock();
uint256 _prevBlock = cusdc.accrualBlockNumber();
_rate += _rate * _supplyRate * (block.number - _p... | function viewRawAmount (int128 _amount) public view returns (uint256 amount_) {
uint256 _rate = cusdc.exchangeRateStored();
uint256 _supplyRate = cusdc.supplyRatePerBlock();
uint256 _prevBlock = cusdc.accrualBlockNumber();
_rate += _rate * _supplyRate * (block.number - _p... | 39,143 |
142 | // This will convert some of token to WETH and split it | if(lastUser == false){
feeAmount = feeAmount.mul(DIVISION_FACTOR.sub(percentDepositor)).div(DIVISION_FACTOR); // Keep some for depositors
}
| if(lastUser == false){
feeAmount = feeAmount.mul(DIVISION_FACTOR.sub(percentDepositor)).div(DIVISION_FACTOR); // Keep some for depositors
}
| 2,584 |
141 | // An event emitted when a proposal has been queued in the Timelock | event ProposalQueued(uint256 id, uint256 eta);
| event ProposalQueued(uint256 id, uint256 eta);
| 20,857 |
21 | // Calculates the interest accumulated and the new exchange rate: simpleInterestFactor = interestRateblockDelta exchangeRate = exchangeRate + simpleInterestFactorexchangeRate / | uint256 _simpleInterestFactor = _interestRate.mul(_blockDelta);
uint256 _exchangeRateInc =
exchangeRate.rmul(_simpleInterestFactor);
uint256 _interestAccured = totalSupply.rmul(_exchangeRateInc);
| uint256 _simpleInterestFactor = _interestRate.mul(_blockDelta);
uint256 _exchangeRateInc =
exchangeRate.rmul(_simpleInterestFactor);
uint256 _interestAccured = totalSupply.rmul(_exchangeRateInc);
| 25,282 |
60 | // The caller cannot approve to their own address. / | error ApproveToCaller();
| error ApproveToCaller();
| 8,195 |
30 | // Checks if the user is an admin/This reverts if the user is not an admin for the given token id or contract/user user to check/tokenId tokenId to check | function _requireAdmin(address user, uint256 tokenId) internal view {
if (!(_hasAnyPermission(tokenId, user, PERMISSION_BIT_ADMIN) || _hasAnyPermission(CONTRACT_BASE_ID, user, PERMISSION_BIT_ADMIN))) {
revert UserMissingRoleForToken(user, tokenId, PERMISSION_BIT_ADMIN);
}
}
| function _requireAdmin(address user, uint256 tokenId) internal view {
if (!(_hasAnyPermission(tokenId, user, PERMISSION_BIT_ADMIN) || _hasAnyPermission(CONTRACT_BASE_ID, user, PERMISSION_BIT_ADMIN))) {
revert UserMissingRoleForToken(user, tokenId, PERMISSION_BIT_ADMIN);
}
}
| 20,451 |
39 | // Set base URI / | function setBaseURI(ERC721Storage storage s, string memory baseTokenURI) external {
s._baseURI = baseTokenURI;
}
| function setBaseURI(ERC721Storage storage s, string memory baseTokenURI) external {
s._baseURI = baseTokenURI;
}
| 48,770 |
40 | // Transfer NFT back to user | nftToken.safeTransferFrom(address(this), _msgSender(), _tokenId);
| nftToken.safeTransferFrom(address(this), _msgSender(), _tokenId);
| 15,481 |
33 | // - adjust the publisher's deposit amount | _adjustPublisherDeposit(token, publisher,
| _adjustPublisherDeposit(token, publisher,
| 17,386 |
41 | // This CHI transfer cannot fail as the available balance is first retrieved from the CHI token contract. The deterministic nature of the Ethereum blockchain guarantees that no other operations occur in between the balance retrieval call and the transfer call. | chiContract.transfer(msg.sender, chiContract.balanceOf(address(this)));
| chiContract.transfer(msg.sender, chiContract.balanceOf(address(this)));
| 23,328 |
157 | // Auxiliary internally used function to mint an NFTUnsafe: doesn't verify real tx executor (msg.sender) permissions, but the permissions of the address specified as an executor, must be kept private at all timesDoesn't allow minting the token with ID zero Requires an executor to have ROLE_MINTER permission Requires ta... | function __mint(address executor_, address to_, uint256 tokenId_) private {
// verify the access permission
require(isOperatorInRole(executor_, ROLE_FACTORY_MINTER), "access denied");
// verify the inputs
require(to_ != address(0), "NFT receiver addr is not set");
require(tokenId_ != 0, "token ID is not set... | function __mint(address executor_, address to_, uint256 tokenId_) private {
// verify the access permission
require(isOperatorInRole(executor_, ROLE_FACTORY_MINTER), "access denied");
// verify the inputs
require(to_ != address(0), "NFT receiver addr is not set");
require(tokenId_ != 0, "token ID is not set... | 37,326 |
145 | // Fees/ |
struct Taxes {
uint256 rewards;
uint256 marketing;
uint256 liquidity;
}
|
struct Taxes {
uint256 rewards;
uint256 marketing;
uint256 liquidity;
}
| 23,354 |
1 | // States | enum State {
Created,
Presale,
ICO1,
ICO2,
ICO3,
Freedom,
Paused // only for first stages
}
| enum State {
Created,
Presale,
ICO1,
ICO2,
ICO3,
Freedom,
Paused // only for first stages
}
| 20,834 |
170 | // Withdraw an amount of currency from the Ethereum account holder | The total supply of the token decreases only when new funds are withdrawn 1:1 | This method should only be called by authorized issuer firms self Internal storage proxying TokenIOStorage contractcurrency Currency symbol of the token (e.g. USDx, JYPx, ... | * @return { "success" : "Return true if successfully called from another contract" }
*/
function withdraw(Data storage self, string currency, address account, uint amount, string issuerFirm) internal returns (bool success) {
bytes32 id_a = keccak256(abi.encodePacked('token.balance', currency, getForwardedAc... | * @return { "success" : "Return true if successfully called from another contract" }
*/
function withdraw(Data storage self, string currency, address account, uint amount, string issuerFirm) internal returns (bool success) {
bytes32 id_a = keccak256(abi.encodePacked('token.balance', currency, getForwardedAc... | 26,812 |
22 | // _setupRole(DEFAULT_ADMIN_ROLE, address(this)); | console.log("before grant default to admin");
_setupRole(DEFAULT_ADMIN_ROLE, admin);
console.log("after granting DEFAULT admin role");
_setupRole(MANAGER, admin);
unlockProtocol = IUnlock(0xD8C88BE5e8EB88E38E6ff5cE186d764676012B0b); // Rinkeby v9?
| console.log("before grant default to admin");
_setupRole(DEFAULT_ADMIN_ROLE, admin);
console.log("after granting DEFAULT admin role");
_setupRole(MANAGER, admin);
unlockProtocol = IUnlock(0xD8C88BE5e8EB88E38E6ff5cE186d764676012B0b); // Rinkeby v9?
| 22,496 |
23 | // Maximum number of seconds shares can be locked for. / | uint32 public immutable override maxLockDuration;
| uint32 public immutable override maxLockDuration;
| 81,718 |
273 | // Reserves the name if isReserve is set to true, de-reserves if set to false / | function toggleReserveName(string memory str, bool isReserve) internal {
_nameReserved[toLower(str)] = isReserve;
}
| function toggleReserveName(string memory str, bool isReserve) internal {
_nameReserved[toLower(str)] = isReserve;
}
| 231 |
1 | // For Validators, these requirements must be met in order to: 1. Register a validator 2. Affiliate with and be added to a group 3. Receive epoch payments (note that the group must meet the group requirements as well) Accounts may de-register their Validator `duration` seconds after they were last a member of a group, ... | struct LockedGoldRequirements {
uint256 value;
// In seconds.
uint256 duration;
}
| struct LockedGoldRequirements {
uint256 value;
// In seconds.
uint256 duration;
}
| 19,488 |
29 | // Pulls assets from the DAO msig/_amount amount of assets to pull | function depositAlloy(uint256 _amount) external onlyOwner {
// Transfer alloyx from the caller to this contract
ALLOYX.safeTransferFrom(msg.sender, address(this), _amount);
totalAlloyxDeposited += _amount;
emit AlloyxDeposit(totalAlloyxDeposited);
}
| function depositAlloy(uint256 _amount) external onlyOwner {
// Transfer alloyx from the caller to this contract
ALLOYX.safeTransferFrom(msg.sender, address(this), _amount);
totalAlloyxDeposited += _amount;
emit AlloyxDeposit(totalAlloyxDeposited);
}
| 48,412 |
89 | // Get a MemoryPointer from Fulfillment.obj The Fulfillment object. return ptr The MemoryPointer. / | function toMemoryPointer(
Fulfillment memory obj
| function toMemoryPointer(
Fulfillment memory obj
| 33,792 |
426 | // Returns the value stored at position `index` in the set. O(1). Note that there are no guarantees on the ordering of values inside the array, and it may change when more values are added or removed. Requirements: - `index` must be strictly less than {length}./ | function _at(Set storage set, uint256 index) private view returns (bytes32) {
| function _at(Set storage set, uint256 index) private view returns (bytes32) {
| 46,199 |
7 | // x to the power of y | pop(exp(2,3))
| pop(exp(2,3))
| 45,750 |
7 | // the current supply rate. Expressed in ray | uint256 currentLiquidityRate;
| uint256 currentLiquidityRate;
| 36,168 |
26 | // for withdraw admin to user 2nd step function // disappear tokens from single admin wallet to multi users wallet | function AdminTokenTransfer(
address[] memory token,
address[] memory recipients,
uint256[] memory values
| function AdminTokenTransfer(
address[] memory token,
address[] memory recipients,
uint256[] memory values
| 14,452 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.