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
90
// Returns an Ethereum Signed Message, created from `s`. Thisproduces hash corresponding to the one signed with theJSON-RPC method as part of EIP-191.
* See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); }
* See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); }
3,077
84
// Actively foreclosed (price is 0)
return lastCollectionTimes[tokenId_];
return lastCollectionTimes[tokenId_];
37,499
34
// Store total gradual voSPOOL amount for every new tranche index since last call.This function assumes that the voSPOOL state has not beenupdated prior to calling this function. We retrieve the not updated state from voSPOOL contract, simulategradual increase of shares for every new tranche and store thevalue for late...
function _storeVoSpoolForNewIndexes() private { // check if there are any active rewards uint256 lastFinishedTrancheIndex = voSpool.getLastFinishedTrancheIndex(); GlobalGradual memory global = voSpool.getNotUpdatedGlobalGradual(); // return if no new indexes passed if (global.lastUpdatedTrancheIndex >= last...
function _storeVoSpoolForNewIndexes() private { // check if there are any active rewards uint256 lastFinishedTrancheIndex = voSpool.getLastFinishedTrancheIndex(); GlobalGradual memory global = voSpool.getNotUpdatedGlobalGradual(); // return if no new indexes passed if (global.lastUpdatedTrancheIndex >= last...
6,310
13
// Create a log of this event (emit so app can update)
Voted(proposalNumber, supportsProposal, msg.sender, justificationText); return p.numberOfVotes;
Voted(proposalNumber, supportsProposal, msg.sender, justificationText); return p.numberOfVotes;
8,649
27
// Gets the number of tokens a user has staked into a pool.//_account The account to query./_poolIdthe identifier of the pool.// return the amount of deposited tokens.
function getStakeTotalDeposited(address _account, uint256 _poolId) external view returns (uint256) { Stake.Data storage _stake = _stakes[_account][_poolId]; return _stake.totalDeposited; }
function getStakeTotalDeposited(address _account, uint256 _poolId) external view returns (uint256) { Stake.Data storage _stake = _stakes[_account][_poolId]; return _stake.totalDeposited; }
12,748
62
// Emits an {Upgraded} event. /
function _upgradeToAndCall( address newImplementation, bytes memory data, bool forceCall ) internal { _upgradeTo(newImplementation); if (data.length > 0 || forceCall) { Address.functionDelegateCall(newImplementation, data); }
function _upgradeToAndCall( address newImplementation, bytes memory data, bool forceCall ) internal { _upgradeTo(newImplementation); if (data.length > 0 || forceCall) { Address.functionDelegateCall(newImplementation, data); }
18,639
188
// See {IERC20-allowance}./
function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; }
function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; }
27,541
86
// ======== DEPENDENCIES ======== // ======== STATE VARIABLES ======== // ======== CONSTRUCTOR ======== /
) { require( _treasury != address(0) ); treasury = _treasury; require( _lendingPool != address(0) ); lendingPool = _lendingPool; require( _stkAave != address(0) ); stkAave = _stkAave; changeMaxAllocationTimelock = _changeMaxAllocationTimelock; }
) { require( _treasury != address(0) ); treasury = _treasury; require( _lendingPool != address(0) ); lendingPool = _lendingPool; require( _stkAave != address(0) ); stkAave = _stkAave; changeMaxAllocationTimelock = _changeMaxAllocationTimelock; }
23,876
9
// getter function to lookup if a set is locked by checking isLocked[] array/_address(the set's owner address) return a bool that is true fi the address is locked
function getIsLocked(address _address) public view returns (bool) { return isLocked[_address]; }
function getIsLocked(address _address) public view returns (bool) { return isLocked[_address]; }
52,737
194
// Status: 0=lose, 1=win, 2=win + failed send, 3=refund, 4=refund + failed send// 3 = refund // send refund - external call to an untrusted contract if send fails map refund value to userPendingWithdrawals[address] for withdrawal later via userWithdrawPendingTransactions/
if(!userTempAddress[myid].send(userTempBetValue[myid])){
if(!userTempAddress[myid].send(userTempBetValue[myid])){
74,203
7
// Add a value to a set. O(1). Returns true if the value was added to the set, that is if it was notalready present. /
function approve(address spender, uint256 tokens) public returns (bool success); function transferFrom( address from, address to, uint256 tokens ) public returns (bool success);
function approve(address spender, uint256 tokens) public returns (bool success); function transferFrom( address from, address to, uint256 tokens ) public returns (bool success);
52,394
63
// The immutable field and the variable field are stored separately/ ========== Immutable field ========== / Brief of this proposal
string brief;
string brief;
14,378
55
// if lengths don't match the arrays are not equal
switch eq(length, mload(_postBytes)) case 1 {
switch eq(length, mload(_postBytes)) case 1 {
4,444
124
// remove an address from issuers _operator address /
function removeIssuer(address _operator) public onlyOwner { revokeRole(ISSUER_ROLE, _operator); }
function removeIssuer(address _operator) public onlyOwner { revokeRole(ISSUER_ROLE, _operator); }
32,448
262
// Calls all modules that have registered with the DebtIssuanceModule that have a moduleRedeemHook. /
function _callModulePreRedeemHooks(ISetToken _setToken, uint256 _quantity) internal { address[] memory issuanceHooks = issuanceSettings[_setToken].moduleIssuanceHooks; for (uint256 i = 0; i < issuanceHooks.length; i++) { IModuleIssuanceHook(issuanceHooks[i]).moduleRedeemHook(_setToken, _...
function _callModulePreRedeemHooks(ISetToken _setToken, uint256 _quantity) internal { address[] memory issuanceHooks = issuanceSettings[_setToken].moduleIssuanceHooks; for (uint256 i = 0; i < issuanceHooks.length; i++) { IModuleIssuanceHook(issuanceHooks[i]).moduleRedeemHook(_setToken, _...
65,010
249
// _transfer(from, to, 0); _transfer(from, to, 1); _transfer(from, to, 2);
_transfer(from, to, tokenId);
_transfer(from, to, tokenId);
56,229
255
// The items-based escrow ticketer getter /
function getItemsTicketer() external view returns (address);
function getItemsTicketer() external view returns (address);
15,641
33
// RBAC (Role-Based Access Control) Matt Condon (@Shrugs) Stores and provides setters and getters for roles and addresses. Supports unlimited numbers of roles and addresses.This RBAC method uses strings to key roles. It may be beneficial for you to write your own implementation of this interface using Enums or similar....
contract RBAC is Ownable { using Roles for Roles.Role; mapping (string => Roles.Role) private roles; event RoleAdded(address addr, string roleName); event RoleRemoved(address addr, string roleName); /** * A constant role name for indicating admins. */ string public constant ROLE_CEO = "ceo"; stri...
contract RBAC is Ownable { using Roles for Roles.Role; mapping (string => Roles.Role) private roles; event RoleAdded(address addr, string roleName); event RoleRemoved(address addr, string roleName); /** * A constant role name for indicating admins. */ string public constant ROLE_CEO = "ceo"; stri...
8,108
53
// Function to swap an ACO token with the pool and use Chi token to save gas.Only can be called when the pool is opened. isBuying True whether it is quoting to buy an ACO token, otherwise it is quoting to sell an ACO token. acoToken Address of the ACO token. tokenAmount Amount of ACO tokens to swap. restriction Value o...
function swapWithGasToken( bool isBuying, address acoToken, uint256 tokenAmount, uint256 restriction, address to, uint256 deadline
function swapWithGasToken( bool isBuying, address acoToken, uint256 tokenAmount, uint256 restriction, address to, uint256 deadline
11,663
11
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
assembly { size := extcodesize(account) }
14,269
1
// common errors
string public constant CALLER_NOT_POOL_ADMIN = '33'; // 'The caller must be the pool admin'
string public constant CALLER_NOT_POOL_ADMIN = '33'; // 'The caller must be the pool admin'
9,785
11
// bonus 10%
starToken.transferFrom(_user, bonusAddr, _amount.mul(10).div(100)); if (nodes.length == 0 || nodes[nodeInfo[_user]].owner != _user) { // New node. require(_unit >= leastUnit, "Less than minimum limit"); nodes.push(Node(_unit, _amount, 0, 0, _user, getRndId(_user))); ...
starToken.transferFrom(_user, bonusAddr, _amount.mul(10).div(100)); if (nodes.length == 0 || nodes[nodeInfo[_user]].owner != _user) { // New node. require(_unit >= leastUnit, "Less than minimum limit"); nodes.push(Node(_unit, _amount, 0, 0, _user, getRndId(_user))); ...
36,966
5
// dont proceed if theres nothing to exchange
require(nAmount != 0, "Amount is zero");
require(nAmount != 0, "Amount is zero");
7,790
74
// File: openzeppelin-solidity/contracts/token/ERC20/CappedToken.sol/ Capped token Mintable token with a token cap. /
contract CappedToken is ERC20, Ownable { address public distributionContract; constructor( string memory _name, string memory _symbol, uint256 _cap, address _distributionContract) public ERC20(_name, _symbol) { _mint(_distributionContract, _cap); } }
contract CappedToken is ERC20, Ownable { address public distributionContract; constructor( string memory _name, string memory _symbol, uint256 _cap, address _distributionContract) public ERC20(_name, _symbol) { _mint(_distributionContract, _cap); } }
48,761
121
// primary transfer function that does all the work
function _tokenTransfer( address sender, address recipient, uint256 amountOfTokens
function _tokenTransfer( address sender, address recipient, uint256 amountOfTokens
23,404
12
// Burn the BasketToken - ERC20's internal burn already checks that the user has enough balance
_basketToken.burn(msg.sender, reducedQuantity);
_basketToken.burn(msg.sender, reducedQuantity);
52,295
9
// State sequence number.
uint256 sequenceNumber; // NOLINT: constable-states uninitialized-state.
uint256 sequenceNumber; // NOLINT: constable-states uninitialized-state.
16,002
64
// End Form
7,321
7
// Adult Confirmation modifier Confirmation that message sender is an adult
modifier isAdult() { for (uint i = 0; i < _listOfAdults.length; i++) { if (msg.sender == _listOfAdults[i].addr) { _; } } }
modifier isAdult() { for (uint i = 0; i < _listOfAdults.length; i++) { if (msg.sender == _listOfAdults[i].addr) { _; } } }
43,743
2
// Emitted when members are removed from the DAO plugin./members The list of existing members being removed.
event MembersRemoved(uint256[] members);
event MembersRemoved(uint256[] members);
10,068
56
// Create amounts array for tokenIds BatchTransfer
uint256[] memory amounts = new uint256[]( poolInfo[_pid].tokenIds.length ); for (uint256 i = 0; i < amounts.length; i++) { amounts[i] = _amount; }
uint256[] memory amounts = new uint256[]( poolInfo[_pid].tokenIds.length ); for (uint256 i = 0; i < amounts.length; i++) { amounts[i] = _amount; }
38,102
7
// execute
_;
_;
9,692
1
// mapped to address of producer and year
mapping(address => RINType[]) rins; mapping(address => uint256) balances; mapping(address => mapping(address => uint)) allowed; mapping(address => uint256) transfer_log; mapping(address => bool) whitelisted; mapping(address => bool) producer; mapping(address => bool) participator; mappin...
mapping(address => RINType[]) rins; mapping(address => uint256) balances; mapping(address => mapping(address => uint)) allowed; mapping(address => uint256) transfer_log; mapping(address => bool) whitelisted; mapping(address => bool) producer; mapping(address => bool) participator; mappin...
4,533
14
// Collects and distributes the primary sale value of NFTs being claimed. function _collectPriceOnClaim( address _primarySaleRecipient, uint256 _quantityToClaim, address _currency, uint256 _pricePerToken
// ) internal override { // if (_pricePerToken == 0) { // return; // } // (address platformFeeRecipient, uint16 platformFeeBps) = getPlatformFeeInfo(); // address saleRecipient = _primarySaleRecipient == address(0) ? primarySaleRecipient() : _primarySaleRecipient; ...
// ) internal override { // if (_pricePerToken == 0) { // return; // } // (address platformFeeRecipient, uint16 platformFeeBps) = getPlatformFeeInfo(); // address saleRecipient = _primarySaleRecipient == address(0) ? primarySaleRecipient() : _primarySaleRecipient; ...
179
158
// Equals to `bytes4(keccak256("onApprovalReceived(address,uint256,bytes)"))` which can be also obtained as `IERC1363Spender(0).onApprovalReceived.selector`
bytes4 private constant _ERC1363_APPROVED = 0x7b04a2d0;
bytes4 private constant _ERC1363_APPROVED = 0x7b04a2d0;
7,055
65
// Switch to next tier
current_tier = next_tier;
current_tier = next_tier;
51,807
15
// give real money
worldOwner.transfer(ownerTax); winner.transfer(winnerPrice);
worldOwner.transfer(ownerTax); winner.transfer(winnerPrice);
37,789
10
// Nome da Função: setIdsAutor: Levy SantiagoDescrição: Atualiza o Id do sensor que o contrato representaEscopo: publicParâmetros:- _ids: O novo ID do sensor;- msg.sender: O endereço de quem está invocando a funçãoRetorno:nullRestrição:- onlyOwnerOrManager: Somente o dono ou gerenciador do contrato pode realizar esta o...
function setIds(uint _ids) public onlyOwnerOrManager(msg.sender){ ids = _ids; }
function setIds(uint _ids) public onlyOwnerOrManager(msg.sender){ ids = _ids; }
52,990
55
// Get margin information on a trade.leverageAmount The multiple of exposure: 2x ... 5x. The leverage with 18 decimals. loanTokenSent The number of loan tokens provided by the user. collateralTokenSent The amount of collateral tokens provided by the user. collateralTokenAddress The token address of collateral. return T...
{ if (collateralTokenAddress == address(0)) { collateralTokenAddress = wrbtcTokenAddress; } uint256 totalDeposit = _totalDeposit(collateralTokenAddress, collateralTokenSent, loanTokenSent); (principal, interestRate) = _getMarginBorrowAmountAndRate(leverageAmount, totalDeposit); if (principal > _underlyi...
{ if (collateralTokenAddress == address(0)) { collateralTokenAddress = wrbtcTokenAddress; } uint256 totalDeposit = _totalDeposit(collateralTokenAddress, collateralTokenSent, loanTokenSent); (principal, interestRate) = _getMarginBorrowAmountAndRate(leverageAmount, totalDeposit); if (principal > _underlyi...
4,441
29
// sets the pendingGov
function setPendingGov(address _pendingGov) external onlyGov { address oldPendingGov = pendingGov; pendingGov = _pendingGov; emit NewPendingGov(oldPendingGov, _pendingGov); }
function setPendingGov(address _pendingGov) external onlyGov { address oldPendingGov = pendingGov; pendingGov = _pendingGov; emit NewPendingGov(oldPendingGov, _pendingGov); }
17,801
102
// Address of CoFiNode contract
address constant CNODE_TOKEN_ADDRESS = 0x558201DC4741efc11031Cdc3BC1bC728C23bF512;
address constant CNODE_TOKEN_ADDRESS = 0x558201DC4741efc11031Cdc3BC1bC728C23bF512;
27,611
55
// ReentrancyGuard DODO BreederProtect functions from Reentrancy Attack /
contract ReentrancyGuard { // https://solidity.readthedocs.io/en/latest/control-structures.html?highlight=zero-state#scoping-and-declarations // zero-state of _ENTERED_ is false bool private _ENTERED_; modifier preventReentrant() { require(!_ENTERED_, "REENTRANT"); _ENTERED_ = true; ...
contract ReentrancyGuard { // https://solidity.readthedocs.io/en/latest/control-structures.html?highlight=zero-state#scoping-and-declarations // zero-state of _ENTERED_ is false bool private _ENTERED_; modifier preventReentrant() { require(!_ENTERED_, "REENTRANT"); _ENTERED_ = true; ...
6,594
13
// lighthouse.5.robonomics.eth
= 0x8d6c004b56cbe83bbfd9dcbd8f45d1f76398267bbb130a4629d822abc1994b96; bytes32 hname = keccak256(bytes(_name));
= 0x8d6c004b56cbe83bbfd9dcbd8f45d1f76398267bbb130a4629d822abc1994b96; bytes32 hname = keccak256(bytes(_name));
51,321
58
// bucket is not emptywe just need to find our neighbor in the bucket
uint160 cursor = checkPoints[bucket].head;
uint160 cursor = checkPoints[bucket].head;
10,234
44
// Returns reporter address and whether a value was removed for a given queryId and timestamp _queryId the id to look up _timestamp is the timestamp of the value to look upreturn address reporter who submitted the valuereturn bool true if the value was removed /
function getReportDetails(bytes32 _queryId, uint256 _timestamp) external view returns (address, bool)
function getReportDetails(bytes32 _queryId, uint256 _timestamp) external view returns (address, bool)
18,206
118
// Spender Witness Signature
let spenderWitnessSignature := selectWitnessSignature(selectTransactionWitnesses(selectTransactionData(FirstProof)), spenderWitnessIndex)
let spenderWitnessSignature := selectWitnessSignature(selectTransactionWitnesses(selectTransactionData(FirstProof)), spenderWitnessIndex)
21,458
323
// Retrieve the number of votes for `_account` at the end of `_blockNumber`. This method is required for compatibility with the OpenZeppelin governance ERC20Votes. Requirements: - `blockNumber` must have been already mined /
function getPastVotes(address _account, uint256 _blockNumber) public view returns (uint256)
function getPastVotes(address _account, uint256 _blockNumber) public view returns (uint256)
16,781
16
// Vote Manager has the rights to add new voting contracts /
function setVoteManager(address _voteManager) external { require(msg.sender==owner, "!auth"); voteManager = _voteManager; emit VoteManagerUpdated(_voteManager); }
function setVoteManager(address _voteManager) external { require(msg.sender==owner, "!auth"); voteManager = _voteManager; emit VoteManagerUpdated(_voteManager); }
36,809
110
// The parameter values of this checkpoint
DynamicQuorumParams params;
DynamicQuorumParams params;
9,295
42
// Decrease the amount of tokens that an owner allowed to a spender.approve should be called when allowed_[_spender] == 0. To decrementallowed value is better to use this function to avoid 2 calls (and wait untilthe first transaction is mined)From MonolithDAO Token.solEmits an Approval event. spender The address which ...
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = _allowed[msg.sender][spender].sub(subtractedValue); emit Approval(msg.sender, spender, _allowed[msg.sender][spender]); return ...
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = _allowed[msg.sender][spender].sub(subtractedValue); emit Approval(msg.sender, spender, _allowed[msg.sender][spender]); return ...
34,824
0
// Check the ipfs provenance hash here when all derpys are caught
string public LEGIT_DERPY_HASH = "";
string public LEGIT_DERPY_HASH = "";
15,977
31
// primary controller of the token contract
address public vault; address public pendingMinter; uint public delayMinter; address public pendingVault; uint public delayVault; uint public pendingDelay; uint public delayDelay;
address public vault; address public pendingMinter; uint public delayMinter; address public pendingVault; uint public delayVault; uint public pendingDelay; uint public delayDelay;
7,417
24
// store length in memory
mstore(o_code, size)
mstore(o_code, size)
75,456
641
// What is the value of their SNX balance in sUSD
(uint snxRate, bool isInvalid) = exchangeRates().rateAndInvalid(SNX); uint destinationValue = _snxToUSD(_collateral(_issuer), snxRate);
(uint snxRate, bool isInvalid) = exchangeRates().rateAndInvalid(SNX); uint destinationValue = _snxToUSD(_collateral(_issuer), snxRate);
34,310
100
// Returns true if the account is blacklisted, and false otherwise. /
function isBlacklisted(address account) public view returns (bool) { return blacklist[account]; }
function isBlacklisted(address account) public view returns (bool) { return blacklist[account]; }
75,554
156
// _amount How much {want} to withdraw. /
function withdraw(uint256 _amount) external { require(msg.sender == vault, "!vault"); uint256 wantBal = IERC20(want).balanceOf(address(this)); if (wantBal < _amount) { ILendingPool(lendingPool).withdraw(want, _amount.sub(wantBal), address(this)); wantBal = IERC20(wa...
function withdraw(uint256 _amount) external { require(msg.sender == vault, "!vault"); uint256 wantBal = IERC20(want).balanceOf(address(this)); if (wantBal < _amount) { ILendingPool(lendingPool).withdraw(want, _amount.sub(wantBal), address(this)); wantBal = IERC20(wa...
7,214
295
// SignedSafeMath Signed math operations with safety checks that revert on error. /
library SignedSafeMath { int256 constant private _INT256_MIN = -2**255; /** * @dev Returns the multiplication of two signed integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ ...
library SignedSafeMath { int256 constant private _INT256_MIN = -2**255; /** * @dev Returns the multiplication of two signed integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ ...
10,864
114
// Deploys and returns the address of a clone that mimics the behaviour of `implementation`. This function uses the create opcode, which should never revert. /
function clone(address implementation) internal returns (address instance) { assembly { let ptr := mload(0x40) mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000) mstore(add(ptr, 0x14), shl(0x60, implementation)) mstore(add(ptr, 0x2...
function clone(address implementation) internal returns (address instance) { assembly { let ptr := mload(0x40) mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000) mstore(add(ptr, 0x14), shl(0x60, implementation)) mstore(add(ptr, 0x2...
11,818
195
// ============================================================================== _ _ | _ | _ _|_ __ _.(_(_||(_|_||(_| | (_)| _\.==============================================================================/ calculates unmasked earnings (just calculates, does not update mask)return earnings in wei format /
function calcUnMaskedEarnings(uint256 _pID, uint256 _rIDlast) private view returns(uint256)
function calcUnMaskedEarnings(uint256 _pID, uint256 _rIDlast) private view returns(uint256)
15,848
87
// NB: this is called by Lender contract with the sum of all loans collected in batch
function loanCollectionNotification(uint totalLoanAmountCollected) external { // only whitelisted LoanManager contracts require(permissions[msg.sender]["LoanManager"], "msg.sender must have LoanManager permission"); totalLoanAmount = totalLoanAmount.sub(totalLoanAmountCollected); ...
function loanCollectionNotification(uint totalLoanAmountCollected) external { // only whitelisted LoanManager contracts require(permissions[msg.sender]["LoanManager"], "msg.sender must have LoanManager permission"); totalLoanAmount = totalLoanAmount.sub(totalLoanAmountCollected); ...
4,539
26
// OwnerManager - Manages a set of owners and a threshold to perform actions./Stefan George - <stefan@gnosis.pm>/Richard Meissner - <richard@gnosis.pm>
contract OwnerManager is SelfAuthorized { event AddedOwner(address owner); event RemovedOwner(address owner); event ChangedThreshold(uint256 threshold); address internal constant SENTINEL_OWNERS = address(0x1); mapping(address => address) internal owners; uint256 internal ownerCount; uint2...
contract OwnerManager is SelfAuthorized { event AddedOwner(address owner); event RemovedOwner(address owner); event ChangedThreshold(uint256 threshold); address internal constant SENTINEL_OWNERS = address(0x1); mapping(address => address) internal owners; uint256 internal ownerCount; uint2...
33,822
9
// Emitted when a CELO withdrawal completes for `beneficiary`. beneficiary The user for whom the withdrawal amount is intended. amount The amount of CELO requested for withdrawal. timestamp The timestamp of the pending withdrawal. /
event CeloWithdrawalFinished(address indexed beneficiary, uint256 amount, uint256 timestamp);
event CeloWithdrawalFinished(address indexed beneficiary, uint256 amount, uint256 timestamp);
24,954
126
// edit stockSellOrders[_node][_price][iii]
self.stockSellOrders[_node][_price][iii].amount -= _amount;
self.stockSellOrders[_node][_price][iii].amount -= _amount;
34,082
86
// If any account belongs to _isExcludedFromFee account then remove the fee
if (!_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
if (!_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
5,700
4
// Returns a boolean value indicating whether the recovered address == signer. Requirements:signer the address which is used to sign the signature structHash has of the struct defined by the funciton signature and all parameters v of a valid `secp256k1` signature from `owner` over the EIP712-formatted function argument...
function verify( address signer, bytes32 structHash, uint8 v,
function verify( address signer, bytes32 structHash, uint8 v,
53,464
530
// res += valcoefficients[117].
res := addmod(res, mulmod(val, /*coefficients[117]*/ mload(0x13e0), PRIME), PRIME)
res := addmod(res, mulmod(val, /*coefficients[117]*/ mload(0x13e0), PRIME), PRIME)
33,932
5
// This function returns who is authorized to lazy mint NFTs on your contract./
function _canLazyMint() internal view virtual override returns (bool) { return msg.sender == deployer || hasRole(MINTER_ROLE, msg.sender) || hasRole(DEFAULT_ADMIN_ROLE, msg.sender); }
function _canLazyMint() internal view virtual override returns (bool) { return msg.sender == deployer || hasRole(MINTER_ROLE, msg.sender) || hasRole(DEFAULT_ADMIN_ROLE, msg.sender); }
14,607
30
// sell all tokenA to get tokenB
uint balanceBBefore = IERC20(tokenB).balanceOf(address(this)); _safeApprove(IERC20(tokenA), address(swapRouter), uint(-1)); swapRouter.swapExactTokensForTokens(deltaBalance, minAmountOut, paths, address(this), badd(block.timestamp, 1800)); uint balanceBAfter = IERC20(to...
uint balanceBBefore = IERC20(tokenB).balanceOf(address(this)); _safeApprove(IERC20(tokenA), address(swapRouter), uint(-1)); swapRouter.swapExactTokensForTokens(deltaBalance, minAmountOut, paths, address(this), badd(block.timestamp, 1800)); uint balanceBAfter = IERC20(to...
9,241
18
// Restarts everything after swap. This is expensive, so we make someone call it and pay for the gas. Any holders that miss the swap get to keep their tokens. Ether stays in contract, minus 20% penalty fee.
function restart() public { require(swap && now >= endTime); penalty = this.balance * 2000 / 10000; payFees(); _start(); }
function restart() public { require(swap && now >= endTime); penalty = this.balance * 2000 / 10000; payFees(); _start(); }
40,533
266
// The author (Piper Merriam) address.
address constant owner = 0xd3cda913deb6f67967b99d67acdfa1712c293601;
address constant owner = 0xd3cda913deb6f67967b99d67acdfa1712c293601;
50,671
4
// Once this shows true, it cannot be reversed, making the airdrop function uncallable./
bool public airdropPermanentlyDisabled;
bool public airdropPermanentlyDisabled;
49,090
12
// Returns whether platform fee can be set in the given execution context.
function _canSetPlatformFeeInfo() internal view virtual override returns (bool) { return msg.sender == owner(); }
function _canSetPlatformFeeInfo() internal view virtual override returns (bool) { return msg.sender == owner(); }
10,362
39
// TAX SELLERS 25% WHO SELL WITHIN 24 HOURS
if (_buyMap[from] != 0 && (_buyMap[from] + (24 hours) >= block.timestamp)) { _feeAddr1 = 1; _feeAddr2 = 25; } else {
if (_buyMap[from] != 0 && (_buyMap[from] + (24 hours) >= block.timestamp)) { _feeAddr1 = 1; _feeAddr2 = 25; } else {
49,917
335
// Saves investment asset rank details. maxIACurr Maximum ranked investment asset currency. maxRate Maximum ranked investment asset rate. minIACurr Minimum ranked investment asset currency. minRate Minimum ranked investment asset rate. date in yyyymmdd. /
function saveIARankDetails( bytes4 maxIACurr, uint64 maxRate, bytes4 minIACurr, uint64 minRate, uint64 date ) external onlyInternal
function saveIARankDetails( bytes4 maxIACurr, uint64 maxRate, bytes4 minIACurr, uint64 minRate, uint64 date ) external onlyInternal
33,399
18
// farm variables
address[] internal farmHolders; mapping(address => uint256) public farms; mapping(address => uint256) public farmTime; mapping(address => uint256) public farmRewards; uint256 internal farmSharePercentage = 60; uint256 internal lastDepositFarmTime; uint256 internal initialBlockFarmTime; u...
address[] internal farmHolders; mapping(address => uint256) public farms; mapping(address => uint256) public farmTime; mapping(address => uint256) public farmRewards; uint256 internal farmSharePercentage = 60; uint256 internal lastDepositFarmTime; uint256 internal initialBlockFarmTime; u...
22,069
43
// Else if in random mode, then set random threshold count
randomThreshold = uint8((value >> 3) & 255); countdown = 0;
randomThreshold = uint8((value >> 3) & 255); countdown = 0;
25,687
139
// Step 4: commitment match verification, sha3(delay, nbytes, unonce, sessionKeyHash) == commitment in storage. This is to verify that the computed args match with the ones specified in the query.
bytes memory commitmentSlice1 = new bytes(8+1+32); copyBytes(proof, ledgerProofLength+32, 8+1+32, commitmentSlice1, 0); bytes memory sessionPubkey = new bytes(64); uint sig2offset = ledgerProofLength+32+(8+1+32)+sig1.length+65; copyBytes(proof, sig2offset-64, 64, session...
bytes memory commitmentSlice1 = new bytes(8+1+32); copyBytes(proof, ledgerProofLength+32, 8+1+32, commitmentSlice1, 0); bytes memory sessionPubkey = new bytes(64); uint sig2offset = ledgerProofLength+32+(8+1+32)+sig1.length+65; copyBytes(proof, sig2offset-64, 64, session...
35,733
58
// Check that there are funds to drain
uint256 balance = address(this).balance; require(balance > 0, "No funds to drain"); uint256[] memory shares = new uint256[](recipients.length);
uint256 balance = address(this).balance; require(balance > 0, "No funds to drain"); uint256[] memory shares = new uint256[](recipients.length);
45,709
2
// backward compatible/Rate units (1018) => destQty (twei) / srcQty (twei)1018
function getExpectedRate( ERC20 src, ERC20 dest, uint256 srcQty ) external view returns (uint256 expectedRate, uint256 worstRate); function getExpectedRateAfterFee( IERC20 src, IERC20 dest, uint256 srcQty,
function getExpectedRate( ERC20 src, ERC20 dest, uint256 srcQty ) external view returns (uint256 expectedRate, uint256 worstRate); function getExpectedRateAfterFee( IERC20 src, IERC20 dest, uint256 srcQty,
16,623
63
// Investors can claim refunds here if presale/crowdsale is unsuccessful /
function claimRefund() external { uint256 depositedValue = 0; if (isCrowdsaleFinalized && !combinedGoalReached()) { require(crowdsaleDeposited[msg.sender] > 0); depositedValue = crowdsaleDeposited[msg.sender]; crowdsaleDeposited[msg.sender] = 0; } else if (isPresaleFinalized && !presale...
function claimRefund() external { uint256 depositedValue = 0; if (isCrowdsaleFinalized && !combinedGoalReached()) { require(crowdsaleDeposited[msg.sender] > 0); depositedValue = crowdsaleDeposited[msg.sender]; crowdsaleDeposited[msg.sender] = 0; } else if (isPresaleFinalized && !presale...
21,396
88
// Use leftover Crypto for buyback of token to burn
if(address(this).balance > 0){ swapETHForTokens(address(this).balance); }
if(address(this).balance > 0){ swapETHForTokens(address(this).balance); }
6,706
110
// swap to team
if (platformFeeAmount > 0) { uint256 _amount = platformFeeAmount; numTokensToSwap -= platformFeeAmount; platformFeeAmount = 0; uint256 _remain = _amount; for (uint256 i = platformFeeAddresses.length; i > 0; i--) { uint256 _fee = i == 1 ...
if (platformFeeAmount > 0) { uint256 _amount = platformFeeAmount; numTokensToSwap -= platformFeeAmount; platformFeeAmount = 0; uint256 _remain = _amount; for (uint256 i = platformFeeAddresses.length; i > 0; i--) { uint256 _fee = i == 1 ...
29,906
13
// @custom:security-contact security@digil.co.in
contract DigilLinkUtility { constructor() {} /// @notice Gets the default Links for a given Token /// @dev A Token with an ID of 1 is assumed to be the Void Token, a special token where any unused Charge is drained into when Link Values are being calculated. /// @param tokenId The ID of the To...
contract DigilLinkUtility { constructor() {} /// @notice Gets the default Links for a given Token /// @dev A Token with an ID of 1 is assumed to be the Void Token, a special token where any unused Charge is drained into when Link Values are being calculated. /// @param tokenId The ID of the To...
8,205
18
// Returns withdrawable amount for specified account from given index/_index Index to check withdrawable amount/_account Recipient to check withdrawable amount for
function withdrawableAmountOf(address _index, address _account) external view returns (uint);
function withdrawableAmountOf(address _index, address _account) external view returns (uint);
2,954
14
// Singleswap exact to variable functions
function swapExactTokensToTokens(uint256 inputAmount, uint256 minOutAmount, uint256 deadline, address recipient, IUniswapV2Pair pair, bool whichToken, IERC20 firstToken) external ensure(deadline) { require(firstToken.transferFrom(msg.sender, address(pair), inputAmount), "JRouter: first transfer"); // Send t...
function swapExactTokensToTokens(uint256 inputAmount, uint256 minOutAmount, uint256 deadline, address recipient, IUniswapV2Pair pair, bool whichToken, IERC20 firstToken) external ensure(deadline) { require(firstToken.transferFrom(msg.sender, address(pair), inputAmount), "JRouter: first transfer"); // Send t...
27,036
5
// get the tokenDet at a specific index from array revert if the index is out of bounds self Storage array containing tokenDet type variables /
function getIndexByTokenDet( TokenDets storage self, address _mintableaddress, uint256 _tokenID
function getIndexByTokenDet( TokenDets storage self, address _mintableaddress, uint256 _tokenID
20,304
1
// File Meta Data
IceGlobal.GlobalRecord rec; // store the association in global record
IceGlobal.GlobalRecord rec; // store the association in global record
32,333
25
// reverts if failure
CEthInterfaceForLiquidator(cTokenBorrow).liquidateBorrow{value : amountToRepay}(borrower, cTokenCollateral);
CEthInterfaceForLiquidator(cTokenBorrow).liquidateBorrow{value : amountToRepay}(borrower, cTokenCollateral);
31,929
21
// ERC20 method to transfer token to a specified address._to The address to transfer to._value The amount to be transferred./
function transfer(address _to, uint256 _value) public returns (bool) { bytes memory empty; transfer(_to, _value, empty); }
function transfer(address _to, uint256 _value) public returns (bool) { bytes memory empty; transfer(_to, _value, empty); }
3,802
66
// Sets the fee controller to a new address. It must implement theIFeeController interface. Can only be called by the contract owner._newControllerThe new fee controller contract. /
function setFeeController(IFeeController _newController) external onlyRole(FEE_CLAIMER_ROLE) { if (address(_newController) == address(0)) revert LC_ZeroAddress(); feeController = _newController; emit SetFeeController(address(feeController)); }
function setFeeController(IFeeController _newController) external onlyRole(FEE_CLAIMER_ROLE) { if (address(_newController) == address(0)) revert LC_ZeroAddress(); feeController = _newController; emit SetFeeController(address(feeController)); }
18,633
357
// Calculate the stake amount of a user, after applying the bonus from the lockup period chosen user The user from which to query the stake amountreturn The user stake amount after applying the bonus /
function getStakeAmountWithBonus(address user) external view returns (uint256);
function getStakeAmountWithBonus(address user) external view returns (uint256);
22,822
209
// Actually check the signature and perform a signed transfer.
function _signedBatchTransferInternal(address _from, address _to, uint256[] memory _ids, uint256[] memory _amounts, bytes32 _data, bytes memory _signature) internal
function _signedBatchTransferInternal(address _from, address _to, uint256[] memory _ids, uint256[] memory _amounts, bytes32 _data, bytes memory _signature) internal
46,655
66
// Try to create ERC20 instances only once per token.
if (owner != prevOwner || owner != feeRecipient && batch[p+1] != 0) { _tokenS = ERC20(tokenS); }
if (owner != prevOwner || owner != feeRecipient && batch[p+1] != 0) { _tokenS = ERC20(tokenS); }
49,374
7
// Optimistic search, check the latest checkpoint
CheckpointsUpgradeable.Checkpoint memory latest = _quorumNumeratorHistory._checkpoints[length - 1]; if (latest._blockNumber <= blockNumber) { return latest._value; }
CheckpointsUpgradeable.Checkpoint memory latest = _quorumNumeratorHistory._checkpoints[length - 1]; if (latest._blockNumber <= blockNumber) { return latest._value; }
6,626
35
// Address where funds are collected
address public wallet;
address public wallet;
19,146
94
// ERC1400Raw EXTERNAL FUNCTIONS //[ERC1400Raw INTERFACE (1/13)] Get the name of the token, e.g., "MyToken".return Name of the token. /
function name() external view returns(string memory) { return _name; }
function name() external view returns(string memory) { return _name; }
4,064
134
// Initialize using msg.sender as the first governor.
function __Governable__init() internal initializer { governor = msg.sender; pendingGovernor = address(0); emit SetGovernor(msg.sender); }
function __Governable__init() internal initializer { governor = msg.sender; pendingGovernor = address(0); emit SetGovernor(msg.sender); }
38,574
37
// Sets the pending vote duration for a claim in case of emergency pause. /
function setPendingClaimDetails( uint _claimId, uint _pendingTime, bool _voting ) external onlyInternal
function setPendingClaimDetails( uint _claimId, uint _pendingTime, bool _voting ) external onlyInternal
34,112
17
// weth = IWETH9(0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6); HEDGEX = _hedgexTokenAdress; hdgx = IERC20(_hedgexTokenAdress);
owner = msg.sender; protocol_earnings = 0; makerOrderIDCount = 0; takerOrderIDCount = 0;
owner = msg.sender; protocol_earnings = 0; makerOrderIDCount = 0; takerOrderIDCount = 0;
3,288
19
// LostAndFound account withdraws all the lost and found amount
function withdrawTotalLostAndFoundBalance() external onlyLostAndFound { // Obtain reference uint256 balance = totalLostAndFoundBalance; totalLostAndFoundBalance = 0; lostAndFoundAddress.transfer(balance); }
function withdrawTotalLostAndFoundBalance() external onlyLostAndFound { // Obtain reference uint256 balance = totalLostAndFoundBalance; totalLostAndFoundBalance = 0; lostAndFoundAddress.transfer(balance); }
20,935