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 |
|---|---|---|---|---|
0 | // L1DEX / | contract l1dex is SupervisedERC777Token {
constructor () public SupervisedERC777Token("Decentralised Exchanges", "L1DEX") {}
}
| contract l1dex is SupervisedERC777Token {
constructor () public SupervisedERC777Token("Decentralised Exchanges", "L1DEX") {}
}
| 52,236 |
197 | // Updates taxBurn | * Emits a {TaxBurnUpdate} event.
*
* Requirements:
*
* - auto burn feature must be enabled.
* - total tax rate must be less than 100%.
*/
function setTaxBurn(uint8 taxBurn_, uint8 taxBurnDecimals_) public onlyOwner {
require(_autoBurnEnabled, "Auto burn feature must... | * Emits a {TaxBurnUpdate} event.
*
* Requirements:
*
* - auto burn feature must be enabled.
* - total tax rate must be less than 100%.
*/
function setTaxBurn(uint8 taxBurn_, uint8 taxBurnDecimals_) public onlyOwner {
require(_autoBurnEnabled, "Auto burn feature must... | 25,280 |
55 | // Bird's BDelegation Storage/ | contract BDelegationStorage {
/**
* @notice Implementation address for this contract
*/
address public implementation;
}
| contract BDelegationStorage {
/**
* @notice Implementation address for this contract
*/
address public implementation;
}
| 18,881 |
7 | // Returns bank node staking pool upBeacon contract/ return upBeaconBankNodeStakingPool bank node staking pool upBeacon contract | function upBeaconBankNodeStakingPool() external view returns (UpgradeableBeacon);
| function upBeaconBankNodeStakingPool() external view returns (UpgradeableBeacon);
| 9,237 |
8 | // Add a proposal _content content of proposal / | function addProposal(string memory _content) external {
require(currentStatus == WorkflowStatus.ProposalsRegistrationStarted, "Not ProposalsRegistrationStarted Status");
require(voters[msg.sender].isRegistered, "Voter not registered");
require(voters[msg.sender].isAbleToPropose, "Voter not p... | function addProposal(string memory _content) external {
require(currentStatus == WorkflowStatus.ProposalsRegistrationStarted, "Not ProposalsRegistrationStarted Status");
require(voters[msg.sender].isRegistered, "Voter not registered");
require(voters[msg.sender].isAbleToPropose, "Voter not p... | 43,055 |
13 | // returns earnable ICE for "amount" of ICE vested for "duration" seconds / | function getIceByVestingDuration(uint256 amount, uint256 duration, bool withDiscount) public view returns (uint256) {
uint256 _minRedeemDuration = withDiscount ? minRedeemDurationDiscounted : minRedeemDuration;
uint256 _maxRedeemDuration = withDiscount ? maxRedeemDurationDiscounted : maxRedeemDuration;
i... | function getIceByVestingDuration(uint256 amount, uint256 duration, bool withDiscount) public view returns (uint256) {
uint256 _minRedeemDuration = withDiscount ? minRedeemDurationDiscounted : minRedeemDuration;
uint256 _maxRedeemDuration = withDiscount ? maxRedeemDurationDiscounted : maxRedeemDuration;
i... | 33,556 |
304 | // Award from airdrop _id Airdrop ids _recipients Recepients of award _amount0s The karma amount _amount1s The currency amount _proofs Merkle proofs _proofLengths Merkle proof lengths / | function awardToMany(uint _id, address[] _recipients, uint[] _amount0s, uint[] _amount1s, bytes _proofs, uint[] _proofLengths) public {
uint marker = 32;
for (uint i = 0; i < _recipients.length; i++) {
address recipient = _recipients[i];
if( airdrops[_id].awarded[recipient... | function awardToMany(uint _id, address[] _recipients, uint[] _amount0s, uint[] _amount1s, bytes _proofs, uint[] _proofLengths) public {
uint marker = 32;
for (uint i = 0; i < _recipients.length; i++) {
address recipient = _recipients[i];
if( airdrops[_id].awarded[recipient... | 41,162 |
107 | // uint256 eathValue = msg.value.div(1e18); | uint256 amountToBuy = (msg.value.div(tokenPrice)).mul(1e18);
uint256 vendorBalance = yourToken.balanceOf(address(this));
require(vendorBalance >= amountToBuy, "Vendor contract has not enough tokens in its balance");
(bool sent) = yourToken.transfer(msg.sender, amountToBuy);
require(sent, "Failed to ... | uint256 amountToBuy = (msg.value.div(tokenPrice)).mul(1e18);
uint256 vendorBalance = yourToken.balanceOf(address(this));
require(vendorBalance >= amountToBuy, "Vendor contract has not enough tokens in its balance");
(bool sent) = yourToken.transfer(msg.sender, amountToBuy);
require(sent, "Failed to ... | 16,617 |
81 | // Get the next floor and set it | uint256 nextCollateralFloor = getNextCollateralFloor();
setFloor(nextCollateralFloor);
| uint256 nextCollateralFloor = getNextCollateralFloor();
setFloor(nextCollateralFloor);
| 16,812 |
254 | // ========== yearn V2 ========== / | function yDepositUSDC(uint256 USDC_amount) public onlyByOwnerOrGovernance {
require(allow_yearn, 'yearn strategy is currently off');
collateral_token.approve(address(yUSDC_V2), USDC_amount);
yUSDC_V2.deposit(USDC_amount);
}
| function yDepositUSDC(uint256 USDC_amount) public onlyByOwnerOrGovernance {
require(allow_yearn, 'yearn strategy is currently off');
collateral_token.approve(address(yUSDC_V2), USDC_amount);
yUSDC_V2.deposit(USDC_amount);
}
| 22,185 |
165 | // transfers tokens to contract and calcualtes amount sent with fees tokenAddress address of the token totalDeposited total tokens attempting to be sent tokenFee fee taken for lockingreturn total amount sent / | function _transferAndCalculateWithFee(
address tokenAddress,
uint totalDeposited,
uint tokenFee
| function _transferAndCalculateWithFee(
address tokenAddress,
uint totalDeposited,
uint tokenFee
| 13,518 |
1 | // โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ\/Synapse:Bridge address | ISynapseBridge public immutable synapseBridge;
| ISynapseBridge public immutable synapseBridge;
| 16,521 |
32 | // Transfer the balance from owner&39;s account to advisor&39;s account | function transferToAdvisors(address _to, uint256 _amount) public returns(bool success) {
require( _to != 0x0);
require(balances[msg.sender] >= _amount && _amount >= 0);
// if this is a new advisor
if(!isAdvisor(_to)) {
addAdvisor(_to);
advisorCount++ ;
}
... | function transferToAdvisors(address _to, uint256 _amount) public returns(bool success) {
require( _to != 0x0);
require(balances[msg.sender] >= _amount && _amount >= 0);
// if this is a new advisor
if(!isAdvisor(_to)) {
addAdvisor(_to);
advisorCount++ ;
}
... | 35,039 |
986 | // Calculate repay amount (_amount + (2 wei)) Approve transfer from | uint256 repayAmount = _getRepaymentAmountInternal(_ethAmount);
ERC20(WETH_ADDR).approve(SOLO_MARGIN_ADDRESS, repayAmount);
Actions.ActionArgs[] memory operations = new Actions.ActionArgs[](3);
operations[0] = _getWithdrawAction(marketId, _ethAmount, _receiver);
operations[1] = ... | uint256 repayAmount = _getRepaymentAmountInternal(_ethAmount);
ERC20(WETH_ADDR).approve(SOLO_MARGIN_ADDRESS, repayAmount);
Actions.ActionArgs[] memory operations = new Actions.ActionArgs[](3);
operations[0] = _getWithdrawAction(marketId, _ethAmount, _receiver);
operations[1] = ... | 55,177 |
0 | // protoId is a precursor hash to a cloneId used to identify tokenId/erc20 pairs | mapping(uint256 => uint256) public protoIdToIndexHead;
| mapping(uint256 => uint256) public protoIdToIndexHead;
| 5,779 |
19 | // IArbitrable Arbitrable interface. When developing arbitrable contracts, we need to: -Define the action taken when a ruling is received by the contract. We should do so in executeRuling. -Allow dispute creation. For this a function must: -Call arbitrator.createDispute.value(_fee)(_choices,_extraData); -Create the eve... | interface IArbitrable {
/** @dev To be emmited when meta-evidence is submitted.
* @param _metaEvidenceID Unique identifier of meta-evidence.
* @param _evidence A link to the meta-evidence JSON.
*/
event MetaEvidence(uint indexed _metaEvidenceID, string _evidence);
/** @dev To be emmited wh... | interface IArbitrable {
/** @dev To be emmited when meta-evidence is submitted.
* @param _metaEvidenceID Unique identifier of meta-evidence.
* @param _evidence A link to the meta-evidence JSON.
*/
event MetaEvidence(uint indexed _metaEvidenceID, string _evidence);
/** @dev To be emmited wh... | 10,365 |
236 | // Handle the different scenarios that may arise when trading currencies with or without the PureChainlinkPrice set. outlined here: https:sips.synthetix.io/sips/sip-198/computation-methodology-in-atomic-pricing | if (usePureChainlinkPriceForSource) {
sourceRate = systemSourceRate;
} else {
| if (usePureChainlinkPriceForSource) {
sourceRate = systemSourceRate;
} else {
| 11,870 |
15 | // Convert Tokens to ETH && transfers ETH to recipient. User specifies exact input && minimum output. tokens_sold Amount of Tokens sold. min_eth Minimum ETH purchased. deadline Time after which this transaction can no longer be executed. recipient The address that receives output ETH.returnAmount of ETH bought. / | function tokenToEthTransferInput(uint256 tokens_sold, uint256 min_eth, uint256 deadline, address payable recipient) public returns (uint256) {
require(recipient != address(this) && recipient != address(0));
return tokenToEthInput(tokens_sold, min_eth, deadline, msg.sender, recipient);
}
| function tokenToEthTransferInput(uint256 tokens_sold, uint256 min_eth, uint256 deadline, address payable recipient) public returns (uint256) {
require(recipient != address(this) && recipient != address(0));
return tokenToEthInput(tokens_sold, min_eth, deadline, msg.sender, recipient);
}
| 7,756 |
152 | // Calculate pure call option price and N(d1) by black-scholes formula. spotPrice is a oracle price. strikePrice Strike price of call option volatilityE8 is a oracle volatility. untilMaturity Remaining period of target bond in second / | ) public pure returns (uint256 price, int256 nd1E8) {
require(spotPrice > 0 && spotPrice < 10**13, "oracle price should be between 0 and 10^13");
require(
volatilityE8 > 0 && volatilityE8 < 10 * 10**8,
"oracle volatility should be between 0% and 1000%"
);
requ... | ) public pure returns (uint256 price, int256 nd1E8) {
require(spotPrice > 0 && spotPrice < 10**13, "oracle price should be between 0 and 10^13");
require(
volatilityE8 > 0 && volatilityE8 < 10 * 10**8,
"oracle volatility should be between 0% and 1000%"
);
requ... | 31,402 |
7 | // Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), Reverts when dividing by zero. Counterpart to Solidity's `%` operator. This function uses a `revert` opcode (which leaves remaining gas untouched) while Solidity uses an invalid opcode to revert (consuming all remaining gas). Require... | function mod(uint32 a, uint32 b) internal pure returns (uint32) {
require(b != 0, "SafeMath: modulo by zero");
return a % b;
}
| function mod(uint32 a, uint32 b) internal pure returns (uint32) {
require(b != 0, "SafeMath: modulo by zero");
return a % b;
}
| 5,051 |
259 | // Qbist / | contract Qbist is ERC721, Ownable {
constructor (string memory name, string memory symbol) public ERC721(name, symbol) { }
function exists(uint256 tokenId) public view returns (bool) {
return _exists(tokenId);
}
function setTokenURI(uint256 tokenId, string memory uri) public onlyOwner {
... | contract Qbist is ERC721, Ownable {
constructor (string memory name, string memory symbol) public ERC721(name, symbol) { }
function exists(uint256 tokenId) public view returns (bool) {
return _exists(tokenId);
}
function setTokenURI(uint256 tokenId, string memory uri) public onlyOwner {
... | 21,931 |
19 | // Gets the keeper registry address / | function getKeeperAddress() external view returns (address keeperAddress) {
return KeeperAddress;
}
| function getKeeperAddress() external view returns (address keeperAddress) {
return KeeperAddress;
}
| 26,946 |
8 | // Algebra pool deployer/Is used by AlgebraFactory to deploy pools/Version: Algebra V1.9 | contract AlgebraPoolDeployer is IAlgebraPoolDeployer {
struct Parameters {
address dataStorage;
address factory;
address token0;
address token1;
}
/// @inheritdoc IAlgebraPoolDeployer
Parameters public override parameters;
address private factory;
address private owner;
modifier onlyFac... | contract AlgebraPoolDeployer is IAlgebraPoolDeployer {
struct Parameters {
address dataStorage;
address factory;
address token0;
address token1;
}
/// @inheritdoc IAlgebraPoolDeployer
Parameters public override parameters;
address private factory;
address private owner;
modifier onlyFac... | 14,746 |
22 | // Gets part of delayed rewards that have become available. / | function getClaimableDelayed(address account) external view returns (uint256);
| function getClaimableDelayed(address account) external view returns (uint256);
| 37,336 |
4 | // Balance = pool's balance + pool's token controller contract balance | function balance() public view returns (uint256) {
return
token.balanceOf(address(this)).add(
IController(controller).balanceOf(address(token))
);
}
| function balance() public view returns (uint256) {
return
token.balanceOf(address(this)).add(
IController(controller).balanceOf(address(token))
);
}
| 29,600 |
34 | // za = c/ฮผ(normalizedSharesReservesa) The โpow(x, y, z)โ function not only calculates x^(y/z) but also normalizes the result to fit into 64.64 fixed point number, i.e. it actually calculates: x^(y/z)(2^63)^(1 - y/z) | uint256 za = c.div(mu).mulu(uint128(mu.mulu(sharesReserves)).pow(a, ONE));
require(za <= MAX, "YieldMath: Rate overflow (za)");
| uint256 za = c.div(mu).mulu(uint128(mu.mulu(sharesReserves)).pow(a, ONE));
require(za <= MAX, "YieldMath: Rate overflow (za)");
| 29,279 |
5 | // id object | attributes = string(
abi.encodePacked(
attributes,
'{"trait_type":"id",',
'"value": "',
_stats.id,
'"},'
| attributes = string(
abi.encodePacked(
attributes,
'{"trait_type":"id",',
'"value": "',
_stats.id,
'"},'
| 19,022 |
425 | // Requires that there is a committed draw that has not been rewarded. / | modifier requireCommittedNoReward() {
require(currentCommittedDrawId() > 0, "Pool/committed");
require(!currentCommittedDrawHasBeenRewarded(), "Pool/already");
_;
}
| modifier requireCommittedNoReward() {
require(currentCommittedDrawId() > 0, "Pool/committed");
require(!currentCommittedDrawHasBeenRewarded(), "Pool/already");
_;
}
| 55,326 |
25 | // Allows the sender to claim the tokens he is allowed to withdraw/ | function claimTokens() public {
require(getWithdrawableAmount(msg.sender) != 0);
uint256 amount = getWithdrawableAmount(msg.sender);
withdrawn[msg.sender] = withdrawn[msg.sender].add(amount);
_deliverTokens(msg.sender, amount);
}
| function claimTokens() public {
require(getWithdrawableAmount(msg.sender) != 0);
uint256 amount = getWithdrawableAmount(msg.sender);
withdrawn[msg.sender] = withdrawn[msg.sender].add(amount);
_deliverTokens(msg.sender, amount);
}
| 17,665 |
106 | // unlock k block for Voting Pool | uint256 constant unlockKBlocksV = 1800;
| uint256 constant unlockKBlocksV = 1800;
| 1,627 |
10 | // start the presale (only for MANAGER_ROLE) / | function start() external virtual onlyRole(MANAGER_ROLE) {
require(_presaleStartedAt == 0, "Presale is started");
// solhint-disable-next-line not-rely-on-time
_presaleStartedAt = block.timestamp;
_presaleFinishedAt = 0;
emit PresaleStarted(msg.sender);
}
| function start() external virtual onlyRole(MANAGER_ROLE) {
require(_presaleStartedAt == 0, "Presale is started");
// solhint-disable-next-line not-rely-on-time
_presaleStartedAt = block.timestamp;
_presaleFinishedAt = 0;
emit PresaleStarted(msg.sender);
}
| 5,693 |
110 | // Burns a specific ERC721 token. tokenId uint256 id of the ERC721 token to be burned. / | function burn(uint256 tokenId) public {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721Burnable: caller is not owner nor approved");
_burn(tokenId);
}
| function burn(uint256 tokenId) public {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721Burnable: caller is not owner nor approved");
_burn(tokenId);
}
| 21,406 |
13 | // Function to match the orders in the orderbook / | uint64 maxbid_id=BidOrderBook.getMaximum();
if (maxbid_id==0){
revert();
}
| uint64 maxbid_id=BidOrderBook.getMaximum();
if (maxbid_id==0){
revert();
}
| 15,556 |
2 | // Tiempo que durarรก la votaciรณn. | votingEndDate = now + 15 days;
address[] memory emptyArray;
| votingEndDate = now + 15 days;
address[] memory emptyArray;
| 42,619 |
11 | // Return all addresses where rawPermissionMask bit for permissionId is set to 1./permissionId Id of the permission to check./ return A list of dirty addresses. | function addressesByPermission(uint8 permissionId) external view returns (address[] memory);
| function addressesByPermission(uint8 permissionId) external view returns (address[] memory);
| 17,317 |
1 | // Use forge-std Vm logic | Vm public constant vm = Vm(HEVM_ADDRESS);
| Vm public constant vm = Vm(HEVM_ADDRESS);
| 28,472 |
301 | // We'll need to keep track of left and right siblings. | bytes32 leftSibling;
bytes32 rightSibling;
| bytes32 leftSibling;
bytes32 rightSibling;
| 63,377 |
21 | // Returns symbol of token/ | function symbol() external pure returns(string memory){
return _symbol;
}
| function symbol() external pure returns(string memory){
return _symbol;
}
| 8,685 |
18 | // Validate token is the same | require(
order.token == orders[0].token,
"Order token mismatch"
);
| require(
order.token == orders[0].token,
"Order token mismatch"
);
| 18,806 |
73 | // Return bBadger to Badger Governance to revoke escrow deal | function revoke() external {
require(msg.sender == badgerGovernance, "onlyBadgerGovernance");
uint256 bBadgerBalance = IERC20(bBadger).balanceOf(address(this));
IERC20(bBadger).safeTransfer(badgerGovernance, bBadgerBalance);
}
| function revoke() external {
require(msg.sender == badgerGovernance, "onlyBadgerGovernance");
uint256 bBadgerBalance = IERC20(bBadger).balanceOf(address(this));
IERC20(bBadger).safeTransfer(badgerGovernance, bBadgerBalance);
}
| 9,541 |
23 | // CHECKS // Calculate first order hash. // Check first order validity. // Calculate second order hash. // Check second order validity. // Prevent self-matching (possibly unnecessary, but safer). // Calculate signatures (must be awkwardly decoded here due to stack size constraints). // Check first order authorization. ... | 41,337 | ||
25 | // Token definitionDefine token paramters including ERC20 ones/ | contract ERC20Token is ERC20TokenInterface, admined { //Standard definition of a ERC20Token
using SafeMath for uint256;
uint256 public totalSupply;
mapping (address => uint256) balances; //A mapping of all balances per address
mapping (address => mapping (address => uint256)) allowed; //A mapping of all... | contract ERC20Token is ERC20TokenInterface, admined { //Standard definition of a ERC20Token
using SafeMath for uint256;
uint256 public totalSupply;
mapping (address => uint256) balances; //A mapping of all balances per address
mapping (address => mapping (address => uint256)) allowed; //A mapping of all... | 14,634 |
16 | // Return the cosine of a value, specified in radians scaled by 1e18 This is identical to the sin() method, and just computes the value by delegating to thesin() method using the identity cos(x) = sin(x + pi/2) Overflow when `angle + PI_OVER_TWO > type(uint256).max` is ok, results are still accurate _angle Angle to con... | function cos(uint256 _angle) internal pure returns (int256) {
unchecked {
return sin(_angle + PI_OVER_TWO);
}
}
| function cos(uint256 _angle) internal pure returns (int256) {
unchecked {
return sin(_angle + PI_OVER_TWO);
}
}
| 26,039 |
18 | // Did mSpellStaking receive any token | if (_rewardBalance == lastRewardBalance || _totalSpell == 0) {
return;
}
| if (_rewardBalance == lastRewardBalance || _totalSpell == 0) {
return;
}
| 71,594 |
4 | // change the registry address _regAddressaddress of the registry / | function setRegistryAddress(string memory _regAddress) external onlyAdmin {
registryAddress = _regAddress;
}
| function setRegistryAddress(string memory _regAddress) external onlyAdmin {
registryAddress = _regAddress;
}
| 33,672 |
180 | // Receive Ether | event Received(address from, uint amount);
| event Received(address from, uint amount);
| 10,125 |
83 | // This contract now has the funds requested. Your logic goes here. |
opVars memory vars;
|
opVars memory vars;
| 57,555 |
10 | // withdraw |
uint public balanceReceived;
|
uint public balanceReceived;
| 16,817 |
17 | // The number of halvings since inception | uint256 public halvingCounter;
| uint256 public halvingCounter;
| 17,791 |
18 | // Students can dropout after the course starts but it will get logged and stake will be sent to Peace Antz Council multisig. | function dropOut() external payable onlyRole(STUDENT){
require(courseStatus == true, "Course has not started yet, feel free to simply withdraw :)");
require(courseCompleted[msg.sender] == false, "You have completed the course already!");
(bool success, ) = peaceAntzCouncil.call{value: studen... | function dropOut() external payable onlyRole(STUDENT){
require(courseStatus == true, "Course has not started yet, feel free to simply withdraw :)");
require(courseCompleted[msg.sender] == false, "You have completed the course already!");
(bool success, ) = peaceAntzCouncil.call{value: studen... | 23,474 |
91 | // Sets that the message sent to the AMB bridge has been fixed._messageId of the message sent to the bridge./ | function setMessageFixed(bytes32 _messageId) internal {
boolStorage[keccak256(abi.encodePacked("messageFixed", _messageId))] = true;
}
| function setMessageFixed(bytes32 _messageId) internal {
boolStorage[keccak256(abi.encodePacked("messageFixed", _messageId))] = true;
}
| 2,295 |
430 | // TokenWhitelist stores a list of tokens used by the Consumer Contract Wallet, the Oracle, the TKN Holder and the TKN Licence Contract | contract TokenWhitelist is ENSResolvable, Controllable, Transferrable {
using strings for *;
using SafeMath for uint256;
using BytesUtils for bytes;
event UpdatedTokenRate(address _sender, address _token, uint _rate);
event UpdatedTokenLoadable(address _sender, address _token, bool _loadable);
... | contract TokenWhitelist is ENSResolvable, Controllable, Transferrable {
using strings for *;
using SafeMath for uint256;
using BytesUtils for bytes;
event UpdatedTokenRate(address _sender, address _token, uint _rate);
event UpdatedTokenLoadable(address _sender, address _token, bool _loadable);
... | 43,832 |
10 | // mapping(uint256 => string) public poolNames; | string[] public poolNames;
uint32 public poolCount;
event SetPurpose(address sender, string purpose);
event CreatePool(address sender, string name);
string public purpose = "Yield farmers helping real farmers";
error EmptyPurposeError(uint code, string message);
| string[] public poolNames;
uint32 public poolCount;
event SetPurpose(address sender, string purpose);
event CreatePool(address sender, string name);
string public purpose = "Yield farmers helping real farmers";
error EmptyPurposeError(uint code, string message);
| 29,070 |
138 | // = keccak256("IncreaseAllowanceWithAuthorization(address owner,address spender,uint256 increment,uint256 validAfter,uint256 validBefore,bytes32 nonce)") | bytes32 public constant DECREASE_ALLOWANCE_WITH_AUTHORIZATION_TYPEHASH =
0xb70559e94cbda91958ebec07f9b65b3b490097c8d25c8dacd71105df1015b6d8;
| bytes32 public constant DECREASE_ALLOWANCE_WITH_AUTHORIZATION_TYPEHASH =
0xb70559e94cbda91958ebec07f9b65b3b490097c8d25c8dacd71105df1015b6d8;
| 1,895 |
50 | // Returns all rpc urls and their aliases as structs. | function rpcUrlStructs() external view returns (Rpc[] memory urls);
| function rpcUrlStructs() external view returns (Rpc[] memory urls);
| 47,544 |
15 | // Registration bol | controller.registerBOL(address(bol));
| controller.registerBOL(address(bol));
| 26,136 |
23 | // COMP token address | 0xc00e94Cb662C3520282E6f5717214004A7f26888
);
| 0xc00e94Cb662C3520282E6f5717214004A7f26888
);
| 22,854 |
88 | // Set the pair address.Don't allow changing whilst LP is staked (as this would prevent stakers getting their LP back) / | function setPairAddress(address pair) external owned {
require(_totalLP == 0, "Cannot change pair whilst there is LP staked");
_pair = IERC20(pair);
_pairInitialized = true;
}
| function setPairAddress(address pair) external owned {
require(_totalLP == 0, "Cannot change pair whilst there is LP staked");
_pair = IERC20(pair);
_pairInitialized = true;
}
| 21,190 |
13 | // Rock Paper Scissors Contract Constructor/Constructs the contract and initializes the queue./minBet the minimum bet required when making a move by calling `play`. | constructor(uint minBet) public
| constructor(uint minBet) public
| 43,391 |
34 | // Single liquidation function. Closes the vault if its ICR is lower than the minimum collateral ratio. | function liquidate(address _borrower) external override {
_requireVaultIsActive(_borrower);
address[] memory borrowers = new address[](1);
borrowers[0] = _borrower;
batchLiquidateVaults(borrowers);
}
| function liquidate(address _borrower) external override {
_requireVaultIsActive(_borrower);
address[] memory borrowers = new address[](1);
borrowers[0] = _borrower;
batchLiquidateVaults(borrowers);
}
| 55,867 |
19 | // Basic token Basic version of StandardToken, with no allowances. / | contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
**/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* ... | contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
**/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* ... | 6,729 |
17 | // / | uint256 treasuryShare;
unchecked {
treasuryShare = _amount * 2 / 3;
}
| uint256 treasuryShare;
unchecked {
treasuryShare = _amount * 2 / 3;
}
| 22,303 |
58 | // `allowed` tracks any extra transfer rights as in all ERC20 tokens | mapping(address => mapping(address => uint256)) internal allowed;
| mapping(address => mapping(address => uint256)) internal allowed;
| 64,729 |
95 | // Send ether amount to the fund collection wallet. override to create custom fund forwarding mechanisms | function forwardFunds(uint256 amount) internal;
| function forwardFunds(uint256 amount) internal;
| 25,587 |
2 | // Transfers punk to the smart contract owner / | function transfer(address punkContract, uint256 punkIndex) external returns (bool) {
if (_owner != msg.sender) {
return false;
}
// solhint-disable-next-line avoid-low-level-calls
(bool result, ) = punkContract.call(
abi.encodeWithSignature("transferPunk(addr... | function transfer(address punkContract, uint256 punkIndex) external returns (bool) {
if (_owner != msg.sender) {
return false;
}
// solhint-disable-next-line avoid-low-level-calls
(bool result, ) = punkContract.call(
abi.encodeWithSignature("transferPunk(addr... | 27,024 |
20 | // uint256 amountToken = calculatePoint(_mintAmount); | Auction memory currentAuction = auction;
require(lock,"Wait for public sale");
require(block.timestamp >= currentAuction.firstStat, "Auction not started");
require(pointBalances[msg.sender] >= _mintAmountA + _mintAmountB + _mintAmountC, "Buy call option first");
uint256 amountETH... | Auction memory currentAuction = auction;
require(lock,"Wait for public sale");
require(block.timestamp >= currentAuction.firstStat, "Auction not started");
require(pointBalances[msg.sender] >= _mintAmountA + _mintAmountB + _mintAmountC, "Buy call option first");
uint256 amountETH... | 27,091 |
116 | // returns the referee for a given address, if new, registers referee/referee the address of the referee for msg.sender/ return referee address from referral registry | function _getReferee(address referee) internal returns (address) {
address sender = msg.sender;
if (!referralRegistry.hasUserReferee(sender) && referee != address(0)) {
referralRegistry.createReferralAnchor(sender, referee);
}
return referralRegistry.getUserReferee(sender... | function _getReferee(address referee) internal returns (address) {
address sender = msg.sender;
if (!referralRegistry.hasUserReferee(sender) && referee != address(0)) {
referralRegistry.createReferralAnchor(sender, referee);
}
return referralRegistry.getUserReferee(sender... | 77,731 |
45 | // Transfer total allocated (minus previously claimed tokens) | newAmountClaimed = allocations[_recipient].totalAllocated;
| newAmountClaimed = allocations[_recipient].totalAllocated;
| 54,450 |
123 | // Exclusive upper limit on ECDSA signatures 'S' values. The valid range is given by fig (283) of the yellow paper. | uint256 private constant ECDSA_SIGNATURE_S_LIMIT = ECDSA_SIGNATURE_R_LIMIT / 2 + 1;
| uint256 private constant ECDSA_SIGNATURE_S_LIMIT = ECDSA_SIGNATURE_R_LIMIT / 2 + 1;
| 23,820 |
10 | // stop presale minting | bool public presaleActive = true;
| bool public presaleActive = true;
| 4,931 |
488 | // Terminate employee `_employeeId` on `@formatDate(_endDate)` _employeeId Employee's identifier _endDate Termination timestamp in seconds / | function terminateEmployee(uint256 _employeeId, uint64 _endDate)
external
authP(TERMINATE_EMPLOYEE_ROLE, arr(_employeeId, uint256(_endDate)))
employeeActive(_employeeId)
| function terminateEmployee(uint256 _employeeId, uint64 _endDate)
external
authP(TERMINATE_EMPLOYEE_ROLE, arr(_employeeId, uint256(_endDate)))
employeeActive(_employeeId)
| 5,781 |
71 | // ๆไฝๅญ่ฒจ-้ฒ่ฒจ ๆญคๆนๆณๅท่ก๏ผ - ็ด้ๆฐๅข็็ฝ้๏ผ็ด้่ณ่จ๏ผ - index: ็ฝ้็ทจ่ - unit: ็ฝ้ๅฎไฝ - amount: ๆธ้ - ipfs: ็ฝ้่ญๆURL - ๅขๅ ็ฝ้็ธฝๅบซๅญๆธ้๏ผ้็บamount Requires: - ๅท่ก่
้ ็บowner - ็ฝ้็ทจ่indexไธ่ฝ้่ค - ๅฎไฝ้ ็ญๆผ็ฎๅๅ็ดๆ่จญๅฎ็ๅฎไฝ - ้amount้ๅคงๆผ0 Returns: - bool: ๅท่กๆๅๆ๏ผๅๅณtrue Events: - Stock: ๅท่กๆๅๆ่งธ็ผ / | function stock(string _index, string _unit, uint256 _amount, string _ipfs) onlyOwner returns (bool) {
bytes32 _bindex = ConvertStringByte.stringToBytes32(_index);
require(_amount > 0);
require(_unit.toSlice().equals(unit.toSlice()));
require(!(storehouse[_bindex].amount > 0));
Bullion bullion = ... | function stock(string _index, string _unit, uint256 _amount, string _ipfs) onlyOwner returns (bool) {
bytes32 _bindex = ConvertStringByte.stringToBytes32(_index);
require(_amount > 0);
require(_unit.toSlice().equals(unit.toSlice()));
require(!(storehouse[_bindex].amount > 0));
Bullion bullion = ... | 38,563 |
90 | // Get ICoFiXRouter implementation contract address for CoFiX/ return ICoFiXRouter implementation contract address for CoFiX | function getCoFiXRouterAddress() external view returns (address);
| function getCoFiXRouterAddress() external view returns (address);
| 27,601 |
273 | // get the rate between the reserves upon adding liquidity and now | Fraction memory addSpotRate = Fraction({ n: packedRates.addSpotRateN, d: packedRates.addSpotRateD });
| Fraction memory addSpotRate = Fraction({ n: packedRates.addSpotRateN, d: packedRates.addSpotRateD });
| 2,705 |
206 | // There has to be at least one Safe owner. | require(_threshold >= 1, "GS202");
| require(_threshold >= 1, "GS202");
| 26,734 |
111 | // BLACKHAT PROTECTION | bool public _hasLiqBeenAdded = false;
mapping (address => bool) private _liquidityHolders;
mapping (address => bool) private _isSniper;
uint256 private _liqAddBlock;
uint256 private snipeBlockAmt;
uint256 public snipersCaught;
event SniperCaught(address sniperAddress);
| bool public _hasLiqBeenAdded = false;
mapping (address => bool) private _liquidityHolders;
mapping (address => bool) private _isSniper;
uint256 private _liqAddBlock;
uint256 private snipeBlockAmt;
uint256 public snipersCaught;
event SniperCaught(address sniperAddress);
| 15,998 |
3 | // user functions //Send an ERC20 token/ access control: only owner/ state machine:/ - can be called multiple times/ - only online/ state scope: none/ token transfer: transfer tokens from self to recipient/token address The token to send/to address The recipient to send to/value uint256 Amount of tokens to send | function sendERC20(
address token,
address to,
uint256 value
| function sendERC20(
address token,
address to,
uint256 value
| 10,741 |
183 | // Get tokens to mint 100000x | uint256 tokens100000xPerMinuteRate = eras[eraIndex].tokens100000xPerMinuteRate;
uint256 tokens100000x = minutesSinceLastMint.mul(tokens100000xPerMinuteRate);
| uint256 tokens100000xPerMinuteRate = eras[eraIndex].tokens100000xPerMinuteRate;
uint256 tokens100000x = minutesSinceLastMint.mul(tokens100000xPerMinuteRate);
| 16,597 |
1 | // Number of ExpansionPunks reserved for promotion & giveaways | uint8 public totalReserved = 11;
| uint8 public totalReserved = 11;
| 42,895 |
5 | // every time a trader's position value is checked, the base token list of this trader will be traversed;/thus, this list should be kept as short as possible/trader The address of the trader/baseToken The address of the trader's base token | function registerBaseToken(address trader, address baseToken) external;
| function registerBaseToken(address trader, address baseToken) external;
| 33,480 |
36 | // TO DO ไฝฟ็จไบๆธไพ็ข็DNA, ๆ็ด, ๅ็ฉ็จฎ้ก | dna = random();
uint ram = uint(random()) % 100;
| dna = random();
uint ram = uint(random()) % 100;
| 16,890 |
215 | // start next round | rID_++;
_rID++;
round_[_rID].strt = now;
round_[_rID].end = now.add(rndInit_).add(rndGap_);
round_[_rID].pot = _res;
return(_eventData_);
| rID_++;
_rID++;
round_[_rID].strt = now;
round_[_rID].end = now.add(rndInit_).add(rndGap_);
round_[_rID].pot = _res;
return(_eventData_);
| 3,535 |
3 | // State variable storing the number of times fallback function was called. | uint fallbackCounter = 0;
| uint fallbackCounter = 0;
| 30,362 |
59 | // if (myBet.resolved) {continue;}myBet.resolved = true; | bool result = targets[myBet.target];
uint256 potentialWinningAmount = myBet.potentialWinningAmount;
if (result) {
lockUserBalance_0Hao(
myBet.roomId,
myBet.bettor
);
userBalances[myBet.roomId][
... | bool result = targets[myBet.target];
uint256 potentialWinningAmount = myBet.potentialWinningAmount;
if (result) {
lockUserBalance_0Hao(
myBet.roomId,
myBet.bettor
);
userBalances[myBet.roomId][
... | 2,276 |
60 | // beneficiary of tokens after they are released | address public beneficiary;
| address public beneficiary;
| 8,382 |
29 | // mapping that contains all the farming contract linked to this extension | address internal _farmingContract;
| address internal _farmingContract;
| 30,982 |
54 | // return The total number of fragments. / | function totalSupply() public view returns (uint256) {
return info.totalSupply;
}
| function totalSupply() public view returns (uint256) {
return info.totalSupply;
}
| 10,465 |
29 | // return enabledlockingNFTs state, access: ANY/ if true user can't unlock NFT and vice versa | function enabledlockingNFTs() external view returns (bool);
| function enabledlockingNFTs() external view returns (bool);
| 59,751 |
13 | // Deal action to start a new game with proxy mode, submit by croupier bot.gambler gambler's address.commit generated by keccak of 2 256-bit reveals, used to unique identify a deck. gambler get commit but don't know the deck, dealer can't change the deck because of keccak is one-way irreversible.amount 128-bit number o... | function deal(address gambler, uint256 commit, uint128 amount, uint8 cutCard, uint8 v, bytes32 r, bytes32 s)
public
onlyCroupier
| function deal(address gambler, uint256 commit, uint128 amount, uint8 cutCard, uint8 v, bytes32 r, bytes32 s)
public
onlyCroupier
| 49,383 |
1 | // Returns true if `gauge` was created by this factory. / | function isGaugeFromFactory(address gauge) external view returns (bool);
| function isGaugeFromFactory(address gauge) external view returns (bool);
| 22,811 |
64 | // withdraw NAC and ETH for non top investor execute by investor | function withdrawNonTop(uint _roundIndex)
public
| function withdrawNonTop(uint _roundIndex)
public
| 43,701 |
9 | // Enter markets | address[] memory cTokens = new address[](1);
cTokens[0] = fuse_pools_array[i];
IComptroller(_initial_unitrollers[i]).enterMarkets(cTokens);
| address[] memory cTokens = new address[](1);
cTokens[0] = fuse_pools_array[i];
IComptroller(_initial_unitrollers[i]).enterMarkets(cTokens);
| 56,797 |
4 | // total supply(modified for etherscan display) | function totalSupply() constant returns (uint256) {
return activeSupply();
}
| function totalSupply() constant returns (uint256) {
return activeSupply();
}
| 45,029 |
35 | // get nft details | NftDetails[] memory nftDetails;
(nftDetails) = abi.decode(
data,
(NftDetails[])
);
| NftDetails[] memory nftDetails;
(nftDetails) = abi.decode(
data,
(NftDetails[])
);
| 25,954 |
1 | // Fiat currencies follow https:en.wikipedia.org/wiki/ISO_4217 | address public constant USD = address(840);
address public constant GBP = address(826);
address public constant EUR = address(978);
| address public constant USD = address(840);
address public constant GBP = address(826);
address public constant EUR = address(978);
| 34,204 |
221 | // calculate time based on number of keys bought | uint256 _newTime;
if (_now > round_[_rID].end && round_[_rID].plyr == 0)
_newTime = (((_keys) / (1000000000000000000)).mul(rndInc_)).add(_now);
else
_newTime = (((_keys) / (1000000000000000000)).mul(rndInc_)).add(round_[_rID].end);
| uint256 _newTime;
if (_now > round_[_rID].end && round_[_rID].plyr == 0)
_newTime = (((_keys) / (1000000000000000000)).mul(rndInc_)).add(_now);
else
_newTime = (((_keys) / (1000000000000000000)).mul(rndInc_)).add(round_[_rID].end);
| 3,540 |
5 | // Miningamount Number of handling chargesblockNum Offer block numbertarget Transfer targettoken Token address return Ore yield/ | function mining(uint256 amount, uint256 blockNum, address target, address token) public returns(uint256) {
require(address(msg.sender) == offerFactoryAddress);
uint256 miningAmount = amount.mul(blockMining[blockNum]).div(blockEth[blockNum][token].mul(blockTokenNum[blockNum]));
uint256 realAm... | function mining(uint256 amount, uint256 blockNum, address target, address token) public returns(uint256) {
require(address(msg.sender) == offerFactoryAddress);
uint256 miningAmount = amount.mul(blockMining[blockNum]).div(blockEth[blockNum][token].mul(blockTokenNum[blockNum]));
uint256 realAm... | 4,949 |
118 | // Fund the farm, increase the end block | function fund(uint256 _amount) public {
require(block.number < endBlock, "fund: too late, the farm is closed");
erc20.safeTransferFrom(address(msg.sender), address(this), _amount);
endBlock += _amount.div(rewardPerBlock);
}
| function fund(uint256 _amount) public {
require(block.number < endBlock, "fund: too late, the farm is closed");
erc20.safeTransferFrom(address(msg.sender), address(this), _amount);
endBlock += _amount.div(rewardPerBlock);
}
| 12,164 |
133 | // setRenewable - sets if a product is renewable_productId - the product id_newRenewable - the new renewable setting/ | function setRenewable(uint256 _productId, bool _newRenewable)
external
onlyCLevel
| function setRenewable(uint256 _productId, bool _newRenewable)
external
onlyCLevel
| 42,771 |
285 | // (uint8 TradeActionType, uint8 MarketIndex, uint88 assetCashAmount, uint32 minImpliedRate, uint32 maxImpliedRate, uint88 unused) | AddLiquidity,
| AddLiquidity,
| 5,919 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.