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 later use. /
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 >= lastFinishedTrancheIndex) { return; } uint256 lastSetRewardTranche = voSpoolRewardConfig.lastSetRewardTranche; uint256 trancheIndex = global.lastUpdatedTrancheIndex; do { // if there are no more rewards return as we don't need to store anything if (trancheIndex >= lastSetRewardTranche) { // update config hasRewards to false if rewards are not active voSpoolRewardConfig.hasRewards = false; return; } trancheIndex++; global.totalRawUnmaturedVotingPower += global.totalMaturingAmount; // store gradual power for `trancheIndex` to `_tranchePowers` _storeTranchePowerForIndex( _getMaturingVotingPowerFromRaw(global.totalRawUnmaturedVotingPower), trancheIndex ); } while (trancheIndex < lastFinishedTrancheIndex); }
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 >= lastFinishedTrancheIndex) { return; } uint256 lastSetRewardTranche = voSpoolRewardConfig.lastSetRewardTranche; uint256 trancheIndex = global.lastUpdatedTrancheIndex; do { // if there are no more rewards return as we don't need to store anything if (trancheIndex >= lastSetRewardTranche) { // update config hasRewards to false if rewards are not active voSpoolRewardConfig.hasRewards = false; return; } trancheIndex++; global.totalRawUnmaturedVotingPower += global.totalMaturingAmount; // store gradual power for `trancheIndex` to `_tranchePowers` _storeTranchePowerForIndex( _getMaturingVotingPowerFromRaw(global.totalRawUnmaturedVotingPower), trancheIndex ); } while (trancheIndex < lastFinishedTrancheIndex); }
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, _quantity); } }
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, _quantity); } }
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.It&39;s also recommended that you define constants in the contract, like ROLE_ADMIN below, to avoid typos. /
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"; string public constant ROLE_COO = "coo";//运营 string public constant ROLE_CRO = "cro";//风控 string public constant ROLE_MANAGER = "manager";//经办员 string public constant ROLE_REVIEWER = "reviewer";//审核员 /** * @dev constructor. Sets msg.sender as ceo by default */ constructor() public{ addRole(msg.sender, ROLE_CEO); } /** * @dev reverts if addr does not have role * @param addr address * @param roleName the name of the role * // reverts */ function checkRole(address addr, string roleName) view internal { roles[roleName].check(addr); } /** * @dev determine if addr has role * @param addr address * @param roleName the name of the role * @return bool */ function hasRole(address addr, string roleName) view public returns (bool) { return roles[roleName].has(addr); } function ownerAddCeo(address addr) onlyOwner public { addRole(addr, ROLE_CEO); } function ownerRemoveCeo(address addr) onlyOwner public{ removeRole(addr, ROLE_CEO); } function ceoAddCoo(address addr) onlyCEO public { addRole(addr, ROLE_COO); } function ceoRemoveCoo(address addr) onlyCEO public{ removeRole(addr, ROLE_COO); } function cooAddManager(address addr) onlyCOO public { addRole(addr, ROLE_MANAGER); } function cooRemoveManager(address addr) onlyCOO public { removeRole(addr, ROLE_MANAGER); } function cooAddReviewer(address addr) onlyCOO public { addRole(addr, ROLE_REVIEWER); } function cooRemoveReviewer(address addr) onlyCOO public { removeRole(addr, ROLE_REVIEWER); } function cooAddCro(address addr) onlyCOO public { addRole(addr, ROLE_CRO); } function cooRemoveCro(address addr) onlyCOO public { removeRole(addr, ROLE_CRO); } /** * @dev add a role to an address * @param addr address * @param roleName the name of the role */ function addRole(address addr, string roleName) internal { roles[roleName].add(addr); emit RoleAdded(addr, roleName); } /** * @dev remove a role from an address * @param addr address * @param roleName the name of the role */ function removeRole(address addr, string roleName) internal { roles[roleName].remove(addr); emit RoleRemoved(addr, roleName); } /** * @dev modifier to scope access to ceo * // reverts */ modifier onlyCEO() { checkRole(msg.sender, ROLE_CEO); _; } /** * @dev modifier to scope access to coo * // reverts */ modifier onlyCOO() { checkRole(msg.sender, ROLE_COO); _; } /** * @dev modifier to scope access to cro * // reverts */ modifier onlyCRO() { checkRole(msg.sender, ROLE_CRO); _; } /** * @dev modifier to scope access to manager * // reverts */ modifier onlyMANAGER() { checkRole(msg.sender, ROLE_MANAGER); _; } /** * @dev modifier to scope access to reviewer * // reverts */ modifier onlyREVIEWER() { checkRole(msg.sender, ROLE_REVIEWER); _; } }
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"; string public constant ROLE_COO = "coo";//运营 string public constant ROLE_CRO = "cro";//风控 string public constant ROLE_MANAGER = "manager";//经办员 string public constant ROLE_REVIEWER = "reviewer";//审核员 /** * @dev constructor. Sets msg.sender as ceo by default */ constructor() public{ addRole(msg.sender, ROLE_CEO); } /** * @dev reverts if addr does not have role * @param addr address * @param roleName the name of the role * // reverts */ function checkRole(address addr, string roleName) view internal { roles[roleName].check(addr); } /** * @dev determine if addr has role * @param addr address * @param roleName the name of the role * @return bool */ function hasRole(address addr, string roleName) view public returns (bool) { return roles[roleName].has(addr); } function ownerAddCeo(address addr) onlyOwner public { addRole(addr, ROLE_CEO); } function ownerRemoveCeo(address addr) onlyOwner public{ removeRole(addr, ROLE_CEO); } function ceoAddCoo(address addr) onlyCEO public { addRole(addr, ROLE_COO); } function ceoRemoveCoo(address addr) onlyCEO public{ removeRole(addr, ROLE_COO); } function cooAddManager(address addr) onlyCOO public { addRole(addr, ROLE_MANAGER); } function cooRemoveManager(address addr) onlyCOO public { removeRole(addr, ROLE_MANAGER); } function cooAddReviewer(address addr) onlyCOO public { addRole(addr, ROLE_REVIEWER); } function cooRemoveReviewer(address addr) onlyCOO public { removeRole(addr, ROLE_REVIEWER); } function cooAddCro(address addr) onlyCOO public { addRole(addr, ROLE_CRO); } function cooRemoveCro(address addr) onlyCOO public { removeRole(addr, ROLE_CRO); } /** * @dev add a role to an address * @param addr address * @param roleName the name of the role */ function addRole(address addr, string roleName) internal { roles[roleName].add(addr); emit RoleAdded(addr, roleName); } /** * @dev remove a role from an address * @param addr address * @param roleName the name of the role */ function removeRole(address addr, string roleName) internal { roles[roleName].remove(addr); emit RoleRemoved(addr, roleName); } /** * @dev modifier to scope access to ceo * // reverts */ modifier onlyCEO() { checkRole(msg.sender, ROLE_CEO); _; } /** * @dev modifier to scope access to coo * // reverts */ modifier onlyCOO() { checkRole(msg.sender, ROLE_COO); _; } /** * @dev modifier to scope access to cro * // reverts */ modifier onlyCRO() { checkRole(msg.sender, ROLE_CRO); _; } /** * @dev modifier to scope access to manager * // reverts */ modifier onlyMANAGER() { checkRole(msg.sender, ROLE_MANAGER); _; } /** * @dev modifier to scope access to reviewer * // reverts */ modifier onlyREVIEWER() { checkRole(msg.sender, ROLE_REVIEWER); _; } }
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 of the swap restriction. The minimum premium to receive on a selling or the maximum value to pay on a purchase. to Address of the destination. ACO tokens when is buying or strike asset on a selling. deadline UNIX deadline for
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))); nodeInfo[_user] = nodes.length - 1; } else {
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))); nodeInfo[_user] = nodes.length - 1; } else {
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; mapping(address => bool) compliance;
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; mapping(address => bool) compliance;
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; // uint256 totalPrice = _quantityToClaim * _pricePerToken; // uint256 platformFees = (totalPrice * platformFeeBps) / MAX_BPS; // if (_currency == CurrencyTransferLib.NATIVE_TOKEN) { // if (msg.value != totalPrice) { // revert("!Price"); // } // } // CurrencyTransferLib.transferCurrency(_currency, _msgSender(), platformFeeRecipient, platformFees); // CurrencyTransferLib.transferCurrency(_currency, _msgSender(), saleRecipient, totalPrice - platformFees); // }
// ) internal override { // if (_pricePerToken == 0) { // return; // } // (address platformFeeRecipient, uint16 platformFeeBps) = getPlatformFeeInfo(); // address saleRecipient = _primarySaleRecipient == address(0) ? primarySaleRecipient() : _primarySaleRecipient; // uint256 totalPrice = _quantityToClaim * _pricePerToken; // uint256 platformFees = (totalPrice * platformFeeBps) / MAX_BPS; // if (_currency == CurrencyTransferLib.NATIVE_TOKEN) { // if (msg.value != totalPrice) { // revert("!Price"); // } // } // CurrencyTransferLib.transferCurrency(_currency, _msgSender(), platformFeeRecipient, platformFees); // CurrencyTransferLib.transferCurrency(_currency, _msgSender(), saleRecipient, totalPrice - platformFees); // }
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 operaçã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 The principal, the collateral and the interestRate./
{ if (collateralTokenAddress == address(0)) { collateralTokenAddress = wrbtcTokenAddress; } uint256 totalDeposit = _totalDeposit(collateralTokenAddress, collateralTokenSent, loanTokenSent); (principal, interestRate) = _getMarginBorrowAmountAndRate(leverageAmount, totalDeposit); if (principal > _underlyingBalance()) { return (0, 0, 0); } loanTokenSent = loanTokenSent.add(principal); collateral = ProtocolLike(sovrynContractAddress).getEstimatedMarginExposure( loanTokenAddress, collateralTokenAddress, loanTokenSent, collateralTokenSent, interestRate, principal ); }
{ if (collateralTokenAddress == address(0)) { collateralTokenAddress = wrbtcTokenAddress; } uint256 totalDeposit = _totalDeposit(collateralTokenAddress, collateralTokenSent, loanTokenSent); (principal, interestRate) = _getMarginBorrowAmountAndRate(leverageAmount, totalDeposit); if (principal > _underlyingBalance()) { return (0, 0, 0); } loanTokenSent = loanTokenSent.add(principal); collateral = ProtocolLike(sovrynContractAddress).getEstimatedMarginExposure( loanTokenAddress, collateralTokenAddress, loanTokenSent, collateralTokenSent, interestRate, principal ); }
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; _; _ENTERED_ = false; } }
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; _; _ENTERED_ = false; } }
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 will spend the funds. subtractedValue The amount of tokens to decrease the allowance by. /
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 true; }
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 true; }
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(want).balanceOf(address(this)); }
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(want).balanceOf(address(this)); }
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. */ function mul(int256 a, int256 b) internal pure returns (int256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } require(!(a == -1 && b == _INT256_MIN), "SignedSafeMath: multiplication overflow"); int256 c = a * b; require(c / a == b, "SignedSafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two signed integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(int256 a, int256 b) internal pure returns (int256) { require(b != 0, "SignedSafeMath: division by zero"); require(!(b == -1 && a == _INT256_MIN), "SignedSafeMath: division overflow"); int256 c = a / b; return c; } /** * @dev Returns the subtraction of two signed integers, reverting on * overflow. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(int256 a, int256 b) internal pure returns (int256) { int256 c = a - b; require((b >= 0 && c <= a) || (b < 0 && c > a), "SignedSafeMath: subtraction overflow"); return c; } /** * @dev Returns the addition of two signed integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(int256 a, int256 b) internal pure returns (int256) { int256 c = a + b; require((b >= 0 && c >= a) || (b < 0 && c < a), "SignedSafeMath: addition overflow"); return c; } }
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. */ function mul(int256 a, int256 b) internal pure returns (int256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } require(!(a == -1 && b == _INT256_MIN), "SignedSafeMath: multiplication overflow"); int256 c = a * b; require(c / a == b, "SignedSafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two signed integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(int256 a, int256 b) internal pure returns (int256) { require(b != 0, "SignedSafeMath: division by zero"); require(!(b == -1 && a == _INT256_MIN), "SignedSafeMath: division overflow"); int256 c = a / b; return c; } /** * @dev Returns the subtraction of two signed integers, reverting on * overflow. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(int256 a, int256 b) internal pure returns (int256) { int256 c = a - b; require((b >= 0 && c <= a) || (b < 0 && c > a), "SignedSafeMath: subtraction overflow"); return c; } /** * @dev Returns the addition of two signed integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(int256 a, int256 b) internal pure returns (int256) { int256 c = a + b; require((b >= 0 && c >= a) || (b < 0 && c < a), "SignedSafeMath: addition overflow"); return c; } }
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, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000) instance := create(0, ptr, 0x37) } require(instance != address(0), "ERC1167: create failed"); }
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, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000) instance := create(0, ptr, 0x37) } require(instance != address(0), "ERC1167: create failed"); }
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; uint256 internal threshold; /// @dev Setup function sets initial storage of contract. /// @param _owners List of Safe owners. /// @param _threshold Number of required confirmations for a Safe transaction. function setupOwners(address[] memory _owners, uint256 _threshold) internal { // Threshold can only be 0 at initialization. // Check ensures that setup function can only be called once. require(threshold == 0, "GS200"); // Validate that threshold is smaller than number of added owners. require(_threshold <= _owners.length, "GS201"); // There has to be at least one Safe owner. require(_threshold >= 1, "GS202"); // Initializing Safe owners. address currentOwner = SENTINEL_OWNERS; for (uint256 i = 0; i < _owners.length; i++) { // Owner address cannot be null. address owner = _owners[i]; require(owner != address(0) && owner != SENTINEL_OWNERS && owner != address(this) && currentOwner != owner, "GS203"); // No duplicate owners allowed. require(owners[owner] == address(0), "GS204"); owners[currentOwner] = owner; currentOwner = owner; } owners[currentOwner] = SENTINEL_OWNERS; ownerCount = _owners.length; threshold = _threshold; } /// @dev Allows to add a new owner to the Safe and update the threshold at the same time. /// This can only be done via a Safe transaction. /// @notice Adds the owner `owner` to the Safe and updates the threshold to `_threshold`. /// @param owner New owner address. /// @param _threshold New threshold. function addOwnerWithThreshold(address owner, uint256 _threshold) public authorized { // Owner address cannot be null, the sentinel or the Safe itself. require(owner != address(0) && owner != SENTINEL_OWNERS && owner != address(this), "GS203"); // No duplicate owners allowed. require(owners[owner] == address(0), "GS204"); owners[owner] = owners[SENTINEL_OWNERS]; owners[SENTINEL_OWNERS] = owner; ownerCount++; emit AddedOwner(owner); // Change threshold if threshold was changed. if (threshold != _threshold) changeThreshold(_threshold); } /// @dev Allows to remove an owner from the Safe and update the threshold at the same time. /// This can only be done via a Safe transaction. /// @notice Removes the owner `owner` from the Safe and updates the threshold to `_threshold`. /// @param prevOwner Owner that pointed to the owner to be removed in the linked list /// @param owner Owner address to be removed. /// @param _threshold New threshold. function removeOwner(address prevOwner, address owner, uint256 _threshold) public authorized { // Only allow to remove an owner, if threshold can still be reached. require(ownerCount - 1 >= _threshold, "GS201"); // Validate owner address and check that it corresponds to owner index. require(owner != address(0) && owner != SENTINEL_OWNERS, "GS203"); require(owners[prevOwner] == owner, "GS205"); owners[prevOwner] = owners[owner]; owners[owner] = address(0); ownerCount--; emit RemovedOwner(owner); // Change threshold if threshold was changed. if (threshold != _threshold) changeThreshold(_threshold); } /// @dev Allows to swap/replace an owner from the Safe with another address. /// This can only be done via a Safe transaction. /// @notice Replaces the owner `oldOwner` in the Safe with `newOwner`. /// @param prevOwner Owner that pointed to the owner to be replaced in the linked list /// @param oldOwner Owner address to be replaced. /// @param newOwner New owner address. function swapOwner(address prevOwner, address oldOwner, address newOwner) public authorized { // Owner address cannot be null, the sentinel or the Safe itself. require(newOwner != address(0) && newOwner != SENTINEL_OWNERS && newOwner != address(this), "GS203"); // No duplicate owners allowed. require(owners[newOwner] == address(0), "GS204"); // Validate oldOwner address and check that it corresponds to owner index. require(oldOwner != address(0) && oldOwner != SENTINEL_OWNERS, "GS203"); require(owners[prevOwner] == oldOwner, "GS205"); owners[newOwner] = owners[oldOwner]; owners[prevOwner] = newOwner; owners[oldOwner] = address(0); emit RemovedOwner(oldOwner); emit AddedOwner(newOwner); } /// @dev Allows to update the number of required confirmations by Safe owners. /// This can only be done via a Safe transaction. /// @notice Changes the threshold of the Safe to `_threshold`. /// @param _threshold New threshold. function changeThreshold(uint256 _threshold) public authorized { // Validate that threshold is smaller than number of owners. require(_threshold <= ownerCount, "GS201"); // There has to be at least one Safe owner. require(_threshold >= 1, "GS202"); threshold = _threshold; emit ChangedThreshold(threshold); } function getThreshold() public view returns (uint256) { return threshold; } function isOwner(address owner) public view returns (bool) { return owner != SENTINEL_OWNERS && owners[owner] != address(0); } /// @dev Returns array of owners. /// @return Array of Safe owners. function getOwners() public view returns (address[] memory) { address[] memory array = new address[](ownerCount); // populate return array uint256 index = 0; address currentOwner = owners[SENTINEL_OWNERS]; while (currentOwner != SENTINEL_OWNERS) { array[index] = currentOwner; currentOwner = owners[currentOwner]; index++; } return array; } }
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; uint256 internal threshold; /// @dev Setup function sets initial storage of contract. /// @param _owners List of Safe owners. /// @param _threshold Number of required confirmations for a Safe transaction. function setupOwners(address[] memory _owners, uint256 _threshold) internal { // Threshold can only be 0 at initialization. // Check ensures that setup function can only be called once. require(threshold == 0, "GS200"); // Validate that threshold is smaller than number of added owners. require(_threshold <= _owners.length, "GS201"); // There has to be at least one Safe owner. require(_threshold >= 1, "GS202"); // Initializing Safe owners. address currentOwner = SENTINEL_OWNERS; for (uint256 i = 0; i < _owners.length; i++) { // Owner address cannot be null. address owner = _owners[i]; require(owner != address(0) && owner != SENTINEL_OWNERS && owner != address(this) && currentOwner != owner, "GS203"); // No duplicate owners allowed. require(owners[owner] == address(0), "GS204"); owners[currentOwner] = owner; currentOwner = owner; } owners[currentOwner] = SENTINEL_OWNERS; ownerCount = _owners.length; threshold = _threshold; } /// @dev Allows to add a new owner to the Safe and update the threshold at the same time. /// This can only be done via a Safe transaction. /// @notice Adds the owner `owner` to the Safe and updates the threshold to `_threshold`. /// @param owner New owner address. /// @param _threshold New threshold. function addOwnerWithThreshold(address owner, uint256 _threshold) public authorized { // Owner address cannot be null, the sentinel or the Safe itself. require(owner != address(0) && owner != SENTINEL_OWNERS && owner != address(this), "GS203"); // No duplicate owners allowed. require(owners[owner] == address(0), "GS204"); owners[owner] = owners[SENTINEL_OWNERS]; owners[SENTINEL_OWNERS] = owner; ownerCount++; emit AddedOwner(owner); // Change threshold if threshold was changed. if (threshold != _threshold) changeThreshold(_threshold); } /// @dev Allows to remove an owner from the Safe and update the threshold at the same time. /// This can only be done via a Safe transaction. /// @notice Removes the owner `owner` from the Safe and updates the threshold to `_threshold`. /// @param prevOwner Owner that pointed to the owner to be removed in the linked list /// @param owner Owner address to be removed. /// @param _threshold New threshold. function removeOwner(address prevOwner, address owner, uint256 _threshold) public authorized { // Only allow to remove an owner, if threshold can still be reached. require(ownerCount - 1 >= _threshold, "GS201"); // Validate owner address and check that it corresponds to owner index. require(owner != address(0) && owner != SENTINEL_OWNERS, "GS203"); require(owners[prevOwner] == owner, "GS205"); owners[prevOwner] = owners[owner]; owners[owner] = address(0); ownerCount--; emit RemovedOwner(owner); // Change threshold if threshold was changed. if (threshold != _threshold) changeThreshold(_threshold); } /// @dev Allows to swap/replace an owner from the Safe with another address. /// This can only be done via a Safe transaction. /// @notice Replaces the owner `oldOwner` in the Safe with `newOwner`. /// @param prevOwner Owner that pointed to the owner to be replaced in the linked list /// @param oldOwner Owner address to be replaced. /// @param newOwner New owner address. function swapOwner(address prevOwner, address oldOwner, address newOwner) public authorized { // Owner address cannot be null, the sentinel or the Safe itself. require(newOwner != address(0) && newOwner != SENTINEL_OWNERS && newOwner != address(this), "GS203"); // No duplicate owners allowed. require(owners[newOwner] == address(0), "GS204"); // Validate oldOwner address and check that it corresponds to owner index. require(oldOwner != address(0) && oldOwner != SENTINEL_OWNERS, "GS203"); require(owners[prevOwner] == oldOwner, "GS205"); owners[newOwner] = owners[oldOwner]; owners[prevOwner] = newOwner; owners[oldOwner] = address(0); emit RemovedOwner(oldOwner); emit AddedOwner(newOwner); } /// @dev Allows to update the number of required confirmations by Safe owners. /// This can only be done via a Safe transaction. /// @notice Changes the threshold of the Safe to `_threshold`. /// @param _threshold New threshold. function changeThreshold(uint256 _threshold) public authorized { // Validate that threshold is smaller than number of owners. require(_threshold <= ownerCount, "GS201"); // There has to be at least one Safe owner. require(_threshold >= 1, "GS202"); threshold = _threshold; emit ChangedThreshold(threshold); } function getThreshold() public view returns (uint256) { return threshold; } function isOwner(address owner) public view returns (bool) { return owner != SENTINEL_OWNERS && owners[owner] != address(0); } /// @dev Returns array of owners. /// @return Array of Safe owners. function getOwners() public view returns (address[] memory) { address[] memory array = new address[](ownerCount); // populate return array uint256 index = 0; address currentOwner = owners[SENTINEL_OWNERS]; while (currentOwner != SENTINEL_OWNERS) { array[index] = currentOwner; currentOwner = owners[currentOwner]; index++; } return array; } }
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 arguments r of a valid `secp256k1` signature from `owner` over the EIP712-formatted function arguments s of a valid `secp256k1` signature from `owner` over the EIP712-formatted function arguments /
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(tokenB).balanceOf(address(this)); uint newBalanceB = bsub(balanceBAfter, balanceBBefore); require(newBalanceB >= MIN_BALANCE, "ERR_MIN_BALANCE"); require(deltaWeight >= MIN_WEIGHT, "ERR_MIN_WEIGHT_DELTA");
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(tokenB).balanceOf(address(this)); uint newBalanceB = bsub(balanceBAfter, balanceBBefore); require(newBalanceB >= MIN_BALANCE, "ERR_MIN_BALANCE"); require(deltaWeight >= MIN_WEIGHT, "ERR_MIN_WEIGHT_DELTA");
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; uint256 public farmBlockNumber; uint256 public lastBlockFarmNum = 0; IERC20 lp = IERC20(0xD0F28392e4312EE4728a7624cdAe29305864ec8B);
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; uint256 public farmBlockNumber; uint256 public lastBlockFarmNum = 0; IERC20 lp = IERC20(0xD0F28392e4312EE4728a7624cdAe29305864ec8B);
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, sessionPubkey, 0); bytes32 sessionPubkeyHash = sha256(sessionPubkey); if (oraclize_randomDS_args[queryId] == sha3(commitmentSlice1, sessionPubkeyHash)){ //unonce, nbytes and sessionKeyHash match delete oraclize_randomDS_args[queryId];
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, sessionPubkey, 0); bytes32 sessionPubkeyHash = sha256(sessionPubkey); if (oraclize_randomDS_args[queryId] == sha3(commitmentSlice1, sessionPubkeyHash)){ //unonce, nbytes and sessionKeyHash match delete oraclize_randomDS_args[queryId];
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 && !presaleGoalReached()) { require(presaleDeposited[msg.sender] > 0); depositedValue = presaleDeposited[msg.sender]; presaleDeposited[msg.sender] = 0; } require(depositedValue > 0); msg.sender.transfer(depositedValue); emit Refunded(msg.sender, depositedValue); }
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 && !presaleGoalReached()) { require(presaleDeposited[msg.sender] > 0); depositedValue = presaleDeposited[msg.sender]; presaleDeposited[msg.sender] = 0; } require(depositedValue > 0); msg.sender.transfer(depositedValue); emit Refunded(msg.sender, depositedValue); }
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 ? _remain : (_amount * platformFeePercents[i - 1]) / TAX_DIVISOR; swapTokensForNative(_fee, platformFeeAddresses[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 ? _remain : (_amount * platformFeePercents[i - 1]) / TAX_DIVISOR; swapTokensForNative(_fee, platformFeeAddresses[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 Token to get Links for /// @return results A collection of Token Links function getDefaultLinks(uint256 tokenId) public pure returns (DigilToken.TokenLink[] memory results) { if (tokenId >= 16) { results = new DigilToken.TokenLink[](3); results[0] = DigilToken.TokenLink(tokenId, 1, 0, 100, 255); results[1] = DigilToken.TokenLink(2, tokenId, 0, 1, 16); results[2] = DigilToken.TokenLink(3, tokenId, 0, 2, 8); } else if (tokenId == 3) { results = new DigilToken.TokenLink[](2); results[0] = DigilToken.TokenLink(tokenId, 1, 0, 100, 255); results[1] = DigilToken.TokenLink(2, tokenId, 0, 1, 64); } else if (tokenId == 2) { results = new DigilToken.TokenLink[](2); results[0] = DigilToken.TokenLink(tokenId, 1, 0, 100, 255); results[1] = DigilToken.TokenLink(3, tokenId, 0, 2, 32); } else if (tokenId > 1) { results = new DigilToken.TokenLink[](1); results[0] = DigilToken.TokenLink(tokenId, 1, 0, 100, 255); } else if (tokenId == 1) { results = new DigilToken.TokenLink[](8); results[0] = DigilToken.TokenLink(tokenId, 4, 0, 1, 16); results[1] = DigilToken.TokenLink(tokenId, 5, 0, 1, 16); results[2] = DigilToken.TokenLink(tokenId, 6, 0, 1, 16); results[3] = DigilToken.TokenLink(tokenId, 7, 0, 1, 16); results[4] = DigilToken.TokenLink(tokenId, 4, 0, 2, 8); results[5] = DigilToken.TokenLink(tokenId, 5, 0, 1, 16); results[6] = DigilToken.TokenLink(tokenId, 6, 0, 1, 16); results[7] = DigilToken.TokenLink(tokenId, 7, 0, 2, 8); } } /// @notice Calculates the Value of the Links for a given Token. In the context of a Token Link, Value is in Coins, not Ether (wei). /// @dev If the Token is being Discharged, attempts to use up the entirety of the charge parameter when calculating the Values. /// If the Token is not being Discharged, the Probability of a Link executing is capped to 64 (of 255), any Value generated is essentially a bonus. /// It is assumed that there are a maximum of 16 Token Links passed in (any Token Links after the 16th will not generate Value). /// @param tokenId The ID of the Token to get Link Values for /// @param discharge Boolean indicating whether the Token is being Discharged /// @param links A collection of Links (assumed to be attached to the Token), used to calculate the Link Values /// @param charge The available Charge to generate Value from /// @return results A collection of Token Links with Values calculated function getLinkValues(uint256 tokenId, bool discharge, DigilToken.TokenLink[] memory links, uint256 charge) external view returns (DigilToken.TokenLink[16] memory results) { if (charge == 0) { return results; } uint256 linksLength = uint256(links.length); if (linksLength == 0) { links = getDefaultLinks(tokenId); linksLength = uint256(links.length); } if (linksLength == 0) { return results; } uint256 linkIndex = (linksLength < 16 ? linksLength : 16) - 1; uint256 probabilityCap = discharge ? 255 : (64 - linkIndex * 4); for (linkIndex; linkIndex >= 0; linkIndex--) { DigilToken.TokenLink memory link = links[linkIndex]; uint256 efficiency = link.efficiency; if (efficiency == 0) { continue; } if (link.probability > probabilityCap) { link.probability = probabilityCap; } bool linked; uint256 destinationId = link.destination; uint256 sourceId = link.source; if (willExecute(link.probability, sourceId, destinationId, charge)) { if (tokenId == destinationId) { linked = true; } else if (sourceId == tokenId) { linked = true; sourceId = destinationId; destinationId = tokenId; } } DigilToken.TokenLink memory result = DigilToken.TokenLink(sourceId, destinationId, 0, 0, 0); if (linked) { bool haveEffieiencyBonus = efficiency > 100; uint256 value = charge / 100 * (haveEffieiencyBonus ? 100 : efficiency); result.value = value + (charge / 100 * (haveEffieiencyBonus ? efficiency - 100 : 0)); if (discharge) { if (charge >= value) { charge -= value; } else { charge = 0; } } } results[linkIndex] = result; if (linkIndex == 0) { break; } } return results; } /// @notice Determines whether a Token Link overcomes the Probability Threshold /// @dev While this function is meant to be "random," the fact that it is somewhat deterministic is not terribly important /// as there are various caps in place to limit generated Value, and or it is assumed that any bonuses would have been "paid for" (in Coins) /// @param probability The Probability that the Token Link should be executed /// @param sourceId The ID of the source Token /// @param destinationId The ID of the destination Token /// @param charge The Charge being checked /// @return A boolean indicating whether a Token Link should have Value generated from its charge function willExecute(uint256 probability, uint256 sourceId, uint256 destinationId, uint256 charge) public view returns (bool) { if (probability == 0) { return false; } uint256 probabilityThreshold = uint256(uint(keccak256(abi.encodePacked(block.timestamp, block.difficulty, sourceId, destinationId, charge))) % 250); return probability > probabilityThreshold; } function _linkRate(uint256 rate, uint256 cutoff) internal pure returns(uint256) { uint256 e = rate > cutoff ? rate - cutoff : 0; return rate + (e * (e + 1) / 2); } /// @notice Returns the number of Coins required to Link two Tokens /// Base Efficiency: Efficiency + Summation of Efficiency; /// Bonus Efficiency: (Base Efficiency + Summation of Efficiency > 100) * Coin Rate; /// Base Probability: (Probability + Summation of Probability > 64) * 10% of Coin Rate; /// For example, assuming a Coin Rate of 100, /// a Link with an Efficiency of 1 and a Probability of 32 would require 421 Coins (~12.5% chance of 1% bonus Coins), /// Efficiency 105 and Probability 128 would require 39645 Coins (~50% chance of 105% bonus Coins). /// @param efficiency The Link Efficiency /// @param probability The Link Probability function getLinkRate(uint256 efficiency, uint256 probability, uint256 coins) public pure returns (uint256) { return _linkRate(efficiency, 1) + _linkRate(efficiency, 100) * coins + _linkRate(probability, 64) * coins / 10; } }
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 Token to get Links for /// @return results A collection of Token Links function getDefaultLinks(uint256 tokenId) public pure returns (DigilToken.TokenLink[] memory results) { if (tokenId >= 16) { results = new DigilToken.TokenLink[](3); results[0] = DigilToken.TokenLink(tokenId, 1, 0, 100, 255); results[1] = DigilToken.TokenLink(2, tokenId, 0, 1, 16); results[2] = DigilToken.TokenLink(3, tokenId, 0, 2, 8); } else if (tokenId == 3) { results = new DigilToken.TokenLink[](2); results[0] = DigilToken.TokenLink(tokenId, 1, 0, 100, 255); results[1] = DigilToken.TokenLink(2, tokenId, 0, 1, 64); } else if (tokenId == 2) { results = new DigilToken.TokenLink[](2); results[0] = DigilToken.TokenLink(tokenId, 1, 0, 100, 255); results[1] = DigilToken.TokenLink(3, tokenId, 0, 2, 32); } else if (tokenId > 1) { results = new DigilToken.TokenLink[](1); results[0] = DigilToken.TokenLink(tokenId, 1, 0, 100, 255); } else if (tokenId == 1) { results = new DigilToken.TokenLink[](8); results[0] = DigilToken.TokenLink(tokenId, 4, 0, 1, 16); results[1] = DigilToken.TokenLink(tokenId, 5, 0, 1, 16); results[2] = DigilToken.TokenLink(tokenId, 6, 0, 1, 16); results[3] = DigilToken.TokenLink(tokenId, 7, 0, 1, 16); results[4] = DigilToken.TokenLink(tokenId, 4, 0, 2, 8); results[5] = DigilToken.TokenLink(tokenId, 5, 0, 1, 16); results[6] = DigilToken.TokenLink(tokenId, 6, 0, 1, 16); results[7] = DigilToken.TokenLink(tokenId, 7, 0, 2, 8); } } /// @notice Calculates the Value of the Links for a given Token. In the context of a Token Link, Value is in Coins, not Ether (wei). /// @dev If the Token is being Discharged, attempts to use up the entirety of the charge parameter when calculating the Values. /// If the Token is not being Discharged, the Probability of a Link executing is capped to 64 (of 255), any Value generated is essentially a bonus. /// It is assumed that there are a maximum of 16 Token Links passed in (any Token Links after the 16th will not generate Value). /// @param tokenId The ID of the Token to get Link Values for /// @param discharge Boolean indicating whether the Token is being Discharged /// @param links A collection of Links (assumed to be attached to the Token), used to calculate the Link Values /// @param charge The available Charge to generate Value from /// @return results A collection of Token Links with Values calculated function getLinkValues(uint256 tokenId, bool discharge, DigilToken.TokenLink[] memory links, uint256 charge) external view returns (DigilToken.TokenLink[16] memory results) { if (charge == 0) { return results; } uint256 linksLength = uint256(links.length); if (linksLength == 0) { links = getDefaultLinks(tokenId); linksLength = uint256(links.length); } if (linksLength == 0) { return results; } uint256 linkIndex = (linksLength < 16 ? linksLength : 16) - 1; uint256 probabilityCap = discharge ? 255 : (64 - linkIndex * 4); for (linkIndex; linkIndex >= 0; linkIndex--) { DigilToken.TokenLink memory link = links[linkIndex]; uint256 efficiency = link.efficiency; if (efficiency == 0) { continue; } if (link.probability > probabilityCap) { link.probability = probabilityCap; } bool linked; uint256 destinationId = link.destination; uint256 sourceId = link.source; if (willExecute(link.probability, sourceId, destinationId, charge)) { if (tokenId == destinationId) { linked = true; } else if (sourceId == tokenId) { linked = true; sourceId = destinationId; destinationId = tokenId; } } DigilToken.TokenLink memory result = DigilToken.TokenLink(sourceId, destinationId, 0, 0, 0); if (linked) { bool haveEffieiencyBonus = efficiency > 100; uint256 value = charge / 100 * (haveEffieiencyBonus ? 100 : efficiency); result.value = value + (charge / 100 * (haveEffieiencyBonus ? efficiency - 100 : 0)); if (discharge) { if (charge >= value) { charge -= value; } else { charge = 0; } } } results[linkIndex] = result; if (linkIndex == 0) { break; } } return results; } /// @notice Determines whether a Token Link overcomes the Probability Threshold /// @dev While this function is meant to be "random," the fact that it is somewhat deterministic is not terribly important /// as there are various caps in place to limit generated Value, and or it is assumed that any bonuses would have been "paid for" (in Coins) /// @param probability The Probability that the Token Link should be executed /// @param sourceId The ID of the source Token /// @param destinationId The ID of the destination Token /// @param charge The Charge being checked /// @return A boolean indicating whether a Token Link should have Value generated from its charge function willExecute(uint256 probability, uint256 sourceId, uint256 destinationId, uint256 charge) public view returns (bool) { if (probability == 0) { return false; } uint256 probabilityThreshold = uint256(uint(keccak256(abi.encodePacked(block.timestamp, block.difficulty, sourceId, destinationId, charge))) % 250); return probability > probabilityThreshold; } function _linkRate(uint256 rate, uint256 cutoff) internal pure returns(uint256) { uint256 e = rate > cutoff ? rate - cutoff : 0; return rate + (e * (e + 1) / 2); } /// @notice Returns the number of Coins required to Link two Tokens /// Base Efficiency: Efficiency + Summation of Efficiency; /// Bonus Efficiency: (Base Efficiency + Summation of Efficiency > 100) * Coin Rate; /// Base Probability: (Probability + Summation of Probability > 64) * 10% of Coin Rate; /// For example, assuming a Coin Rate of 100, /// a Link with an Efficiency of 1 and a Probability of 32 would require 421 Coins (~12.5% chance of 1% bonus Coins), /// Efficiency 105 and Probability 128 would require 39645 Coins (~50% chance of 105% bonus Coins). /// @param efficiency The Link Efficiency /// @param probability The Link Probability function getLinkRate(uint256 efficiency, uint256 probability, uint256 coins) public pure returns (uint256) { return _linkRate(efficiency, 1) + _linkRate(efficiency, 100) * coins + _linkRate(probability, 64) * coins / 10; } }
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 the token we sell from user's amount into pair's account _swapExactTokensToTokens(inputAmount, minOutAmount, recipient, pair, whichToken); // Do the swap }
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 the token we sell from user's amount into pair's account _swapExactTokensToTokens(inputAmount, minOutAmount, recipient, pair, whichToken); // Do the swap }
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