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 |
|---|---|---|---|---|
61 | // Tokens could not be issued. | throw;
| throw;
| 42,409 |
12 | // Base contract of Strategy.This contact defines common properties and functions shared by all strategies.One strategy is bound to one vault and cannot be changed. / | abstract contract StrategyBase is IStrategy {
using SafeERC20Upgradeable for IERC20Upgradeable;
event PerformanceFeeUpdated(uint256 oldPerformanceFee, uint256 newPerformanceFee);
event WithdrawalFeeUpdated(uint256 oldWithdrawFee, uint256 newWithdrawFee);
address public override vault;
uint256 publ... | abstract contract StrategyBase is IStrategy {
using SafeERC20Upgradeable for IERC20Upgradeable;
event PerformanceFeeUpdated(uint256 oldPerformanceFee, uint256 newPerformanceFee);
event WithdrawalFeeUpdated(uint256 oldWithdrawFee, uint256 newWithdrawFee);
address public override vault;
uint256 publ... | 23,141 |
9 | // Set the royalties rate in basis points | function setRoyaltyRate(uint96 _royaltyRate) external onlyOwner {
royaltyRate = _royaltyRate;
}
| function setRoyaltyRate(uint96 _royaltyRate) external onlyOwner {
royaltyRate = _royaltyRate;
}
| 73,155 |
0 | // to store token price | mapping(uint256 => uint256) public tokenPrice;
| mapping(uint256 => uint256) public tokenPrice;
| 45,042 |
17 | // set staking state (in terms of STM)_isStakeAvailable block stake_isUnstakeAvailable block unstake_isClaimAvailable block claim / | function setAvailability(
bool _isStakeAvailable,
bool _isUnstakeAvailable,
bool _isClaimAvailable
| function setAvailability(
bool _isStakeAvailable,
bool _isUnstakeAvailable,
bool _isClaimAvailable
| 2,010 |
0 | // a simple counter | uint256 private tokenId;
constructor(
string memory _name,
string memory _symbol
| uint256 private tokenId;
constructor(
string memory _name,
string memory _symbol
| 22,442 |
51 | // 1. Get how many tokens this contract has with a token instance and check this token balance | uint256 tokenBalance = Token(levAddress).balanceOf(disbursement);
| uint256 tokenBalance = Token(levAddress).balanceOf(disbursement);
| 30,876 |
240 | // In some circumstance, we should not burn OX on transfer, eg: Transfer from owner to distribute bounty, from depositing to swap for liquidity | function addTransferBurnExceptAddress(address _transferBurnExceptAddress) public onlyOwner {
ox.addTransferBurnExceptAddress(_transferBurnExceptAddress);
}
| function addTransferBurnExceptAddress(address _transferBurnExceptAddress) public onlyOwner {
ox.addTransferBurnExceptAddress(_transferBurnExceptAddress);
}
| 12,025 |
96 | // sBTC uses pool2 | estimate = pool2.get_dy_underlying(tokenList[0].curveID, tokenList[i].curveID, renBTCAmount);
| estimate = pool2.get_dy_underlying(tokenList[0].curveID, tokenList[i].curveID, renBTCAmount);
| 3,902 |
128 | // put the input bytes into the result | bytes memory result = abi.encodePacked(input);
| bytes memory result = abi.encodePacked(input);
| 35,304 |
85 | // <CHK> 個人情報登録済みチェック 発行体への移転の場合はチェックを行わない | if (_to != owner) {
require(PersonalInfo(personalInfoAddress).isRegistered(_to, owner) == true);
}
| if (_to != owner) {
require(PersonalInfo(personalInfoAddress).isRegistered(_to, owner) == true);
}
| 48,882 |
1,053 | // Allows the Owner to set a slashing penalty in SKL tokens for agiven offense. / | function setPenalty(string calldata offense, uint penalty) external {
require(hasRole(PENALTY_SETTER_ROLE, msg.sender), "PENALTY_SETTER_ROLE is required");
_penalties[uint(keccak256(abi.encodePacked(offense)))] = penalty;
| function setPenalty(string calldata offense, uint penalty) external {
require(hasRole(PENALTY_SETTER_ROLE, msg.sender), "PENALTY_SETTER_ROLE is required");
_penalties[uint(keccak256(abi.encodePacked(offense)))] = penalty;
| 29,169 |
64 | // Deposit and withdraw | function deposit(uint _amount)
public
| function deposit(uint _amount)
public
| 49,059 |
128 | // Now calculate the amount going to the executor | uint256 gasFee = getFastGasPrice().mul(gasStipend); // This is gas stipend in wei
if(gasFee >= estimate.mul(maxPercentStipend).div(DIVISION_FACTOR)){ // Max percent of total
return estimate.mul(maxPercentStipend).div(DIVISION_FACTOR); // The executor will get max percent of total... | uint256 gasFee = getFastGasPrice().mul(gasStipend); // This is gas stipend in wei
if(gasFee >= estimate.mul(maxPercentStipend).div(DIVISION_FACTOR)){ // Max percent of total
return estimate.mul(maxPercentStipend).div(DIVISION_FACTOR); // The executor will get max percent of total... | 2,573 |
0 | // Implementation: https:etherscan.io/address/0x0000000022d53366457f9d5e68ec105046fc4383readContract | interface ICurveAddressProvider {
function get_registry() external view returns(address);
function get_address(uint256 _id) external view returns(address);
}
| interface ICurveAddressProvider {
function get_registry() external view returns(address);
function get_address(uint256 _id) external view returns(address);
}
| 13,812 |
137 | // CEther / CErc20 =============== | function borrowBalanceCurrent(address account) external returns (uint256) {
address _avatar = registry.getAvatar(account);
return IAvatar(_avatar).borrowBalanceCurrent(cToken);
}
| function borrowBalanceCurrent(address account) external returns (uint256) {
address _avatar = registry.getAvatar(account);
return IAvatar(_avatar).borrowBalanceCurrent(cToken);
}
| 37,340 |
354 | // Returns an array of token IDs owned by `owner`. This function scans the ownership mapping and is O(`totalSupply`) in complexity.It is meant to be called off-chain. | * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into
* multiple smaller scans if the collection is large enough to cause
* an out-of-gas error (10K collections should be fine).
*/
function tokensOfOwner(address owner) external view virtual override returns (uint256[] memory) {
... | * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into
* multiple smaller scans if the collection is large enough to cause
* an out-of-gas error (10K collections should be fine).
*/
function tokensOfOwner(address owner) external view virtual override returns (uint256[] memory) {
... | 9,134 |
189 | // make sure _deposit is more than minDeposit and smaller than unstaked deposit | require(_deposit >= minDeposit && _deposit <= listing.unstakedDeposit);
| require(_deposit >= minDeposit && _deposit <= listing.unstakedDeposit);
| 11,843 |
47 | // Burns a specific amount of tokens._value The amount of token to be burned./ | function burn(
uint256 _value
)
public
whenNotPaused
| function burn(
uint256 _value
)
public
whenNotPaused
| 20,437 |
198 | // WOMANOID ERC-721 Contract DegenDeveloper.eth The contract owner has the following permissions:- Toggle whitelist minting- Toggle public minting- Set the URI for the revealed tokens- Set the merkle root for the whitelist- Withdraw the funds from the contract / | contract Womanoid is ERC721, Ownable, ReentrancyGuard {
/// ============ SETUP ============ ///
using Counters for Counters.Counter;
using Strings for uint256;
Counters.Counter private totalMinted;
string private URI;
bytes32 private merkleRoot;
bool private WHITELIST_SALE_ACTIVE = false;
bool priv... | contract Womanoid is ERC721, Ownable, ReentrancyGuard {
/// ============ SETUP ============ ///
using Counters for Counters.Counter;
using Strings for uint256;
Counters.Counter private totalMinted;
string private URI;
bytes32 private merkleRoot;
bool private WHITELIST_SALE_ACTIVE = false;
bool priv... | 46,780 |
23 | // Called by: Elections contract/ Notifies a guardian certification change | function memberCertificationChange(address addr, bool isCertified) external returns (bool committeeChanged) /* onlyElectionsContract */;
| function memberCertificationChange(address addr, bool isCertified) external returns (bool committeeChanged) /* onlyElectionsContract */;
| 36,638 |
178 | // Reserves contracts are mutable | reservesContracts[0] = reservesContracts_[0]; // Treasury
reservesContracts[1] = reservesContracts_[1]; // Liquidity
reservesContracts[2] = reservesContracts_[2]; // Lending
| reservesContracts[0] = reservesContracts_[0]; // Treasury
reservesContracts[1] = reservesContracts_[1]; // Liquidity
reservesContracts[2] = reservesContracts_[2]; // Lending
| 14,292 |
151 | // Emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin) | emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin);
return uint256(Error.NO_ERROR);
| emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin);
return uint256(Error.NO_ERROR);
| 19,761 |
12 | // Linked List of Users (User Address => Smart Account ID => UserList(Previous and next Account ID)). | mapping(address => mapping(uint64 => UserList)) public userList;
| mapping(address => mapping(uint64 => UserList)) public userList;
| 43,619 |
86 | // Bulk mint tokens (different amounts)beneficiaries array whom to send tokendamounts array how much tokens to send param message reason why we are sending tokens (not stored anythere, only in transaction itself)/ | function bulkTokenSend(address[] beneficiaries, uint256[] amounts, string /*message*/) onlyOwner external{
require(beneficiaries.length == amounts.length);
for(uint32 i=0; i < beneficiaries.length; i++){
mintTokens(beneficiaries[i], amounts[i]);
}
}
| function bulkTokenSend(address[] beneficiaries, uint256[] amounts, string /*message*/) onlyOwner external{
require(beneficiaries.length == amounts.length);
for(uint32 i=0; i < beneficiaries.length; i++){
mintTokens(beneficiaries[i], amounts[i]);
}
}
| 50,140 |
0 | // ERC20 contract interface // With ERC23/ERC223 Extensions // Fully backward compatible with ERC20 / | contract ERC20 {
uint public totalSupply;
// ERC223 and ERC20 functions and events
function balanceOf(address who) public constant returns (uint);
function totalSupply() constant public returns (uint256 _supply);
function transfer(address to, uint value) public returns (bool ok);
function trans... | contract ERC20 {
uint public totalSupply;
// ERC223 and ERC20 functions and events
function balanceOf(address who) public constant returns (uint);
function totalSupply() constant public returns (uint256 _supply);
function transfer(address to, uint value) public returns (bool ok);
function trans... | 25,608 |
255 | // Ensure that all of the asset data is valid. Fee asset data only needs to be valid if the fees are nonzero. | if (!_areOrderAssetDatasValid(order)) {
fillableTakerAssetAmount = 0;
}
| if (!_areOrderAssetDatasValid(order)) {
fillableTakerAssetAmount = 0;
}
| 54,826 |
2 | // Buy tokens/ | function tokens_buy() payable returns (bool) {
require(active > 0);
require(msg.value >= token_price);
uint tokens_buy = msg.value*10**18/token_price;
require(tokens_buy > 0);
if(!c.call(bytes4(sha3("transferFrom(address,address,uint256)")),owner,... | function tokens_buy() payable returns (bool) {
require(active > 0);
require(msg.value >= token_price);
uint tokens_buy = msg.value*10**18/token_price;
require(tokens_buy > 0);
if(!c.call(bytes4(sha3("transferFrom(address,address,uint256)")),owner,... | 49,464 |
55 | // Payments Event Emitter | contract PaymentModelEventEmitter {
event LogPaymentSent(address from, address to, uint amount);
event LogPaymentRecv(address from, address to, uint amount);
}
| contract PaymentModelEventEmitter {
event LogPaymentSent(address from, address to, uint amount);
event LogPaymentRecv(address from, address to, uint amount);
}
| 27,402 |
4 | // Constructor _guardian The guardian address / | constructor(address _guardian) {
require(
_guardian != address(0),
| constructor(address _guardian) {
require(
_guardian != address(0),
| 45,526 |
38 | // decrease receiverAmount based on receiverBasisPoints | uint256 receiverAmount = _amount;
uint256 receiverBasisPoints = receiverBurn.add(receiverFund);
if (receiverBasisPoints > 0) {
uint256 receiverTax = _amount.mul(receiverBasisPoints).div(BASIS_POINTS_DIVISOR);
receiverAmount = receiverAmount.sub(receiverTax);
}
| uint256 receiverAmount = _amount;
uint256 receiverBasisPoints = receiverBurn.add(receiverFund);
if (receiverBasisPoints > 0) {
uint256 receiverTax = _amount.mul(receiverBasisPoints).div(BASIS_POINTS_DIVISOR);
receiverAmount = receiverAmount.sub(receiverTax);
}
| 43,138 |
1 | // Amount the contract borrowed | uint256 public minted_sum_historical = 0;
uint256 public burned_sum_historical = 0;
| uint256 public minted_sum_historical = 0;
uint256 public burned_sum_historical = 0;
| 38,352 |
63 | // then, add them to the new choice | uint balance = governance.balances(msg.sender);
require(balance > 0, "no balance");
votesByValue[value] += balance;
votesByValueAddress[value][msg.sender] = balance;
choices[msg.sender] = value;
hasVote[msg.sender] = true;
| uint balance = governance.balances(msg.sender);
require(balance > 0, "no balance");
votesByValue[value] += balance;
votesByValueAddress[value][msg.sender] = balance;
choices[msg.sender] = value;
hasVote[msg.sender] = true;
| 51,369 |
22 | // console.log("prices",amount, info.eth_price, number_of_items); console.log("mint ",number_of_items); console.log("max_purchase",info.max_mint); | _mintCards(number_of_items, from);
| _mintCards(number_of_items, from);
| 28,106 |
88 | // Functions//This function stakes the five initial miners, sets the supply and all the constant variables. This function is called by the constructor function on TellorMaster.sol/ | function init(TellorStorage.TellorStorageStruct storage self) public {
require(self.uintVars[keccak256("decimals")] == 0, "Too many decimals");
//Give this contract 6000 Tellor Tributes so that it can stake the initial 6 miners
TellorTransfer.updateBalanceAtNow(self.balances[address(this)], ... | function init(TellorStorage.TellorStorageStruct storage self) public {
require(self.uintVars[keccak256("decimals")] == 0, "Too many decimals");
//Give this contract 6000 Tellor Tributes so that it can stake the initial 6 miners
TellorTransfer.updateBalanceAtNow(self.balances[address(this)], ... | 7,599 |
10 | // emit CredentialOrgEvent(_schoolAddress, "createCredentialOrg (PRE)"); | require(bytes(_shortName).length > 0 && bytes(_shortName).length < 31, "createCredentialOrg shortName problem");
require(bytes(_officialSchoolName).length > 0 && bytes(_officialSchoolName).length < 70, "createCredentialOrg officalSchoolName problem");
require(_schoolAddress != 0, "createCredenti... | require(bytes(_shortName).length > 0 && bytes(_shortName).length < 31, "createCredentialOrg shortName problem");
require(bytes(_officialSchoolName).length > 0 && bytes(_officialSchoolName).length < 70, "createCredentialOrg officalSchoolName problem");
require(_schoolAddress != 0, "createCredenti... | 18,764 |
3 | // Throws if called by any account other than the owner. / | modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
| modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
| 453 |
12 | // Returns the number of NFTs in `owner`'s account. / | function balanceOf(address owner) public view returns (uint256 balance);
| function balanceOf(address owner) public view returns (uint256 balance);
| 73,789 |
5 | // Lock the Sushi in the contract | sushi.transferFrom(msg.sender, address(this), _amount);
| sushi.transferFrom(msg.sender, address(this), _amount);
| 11,737 |
3 | // Standard Token Smart Contract that implements ERC-20 token with specialunlimited supply "Central Bank" account. / | contract StandardToken is AbstractToken {
uint256 constant private MAX_UINT256 =
0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
/**
* Create new Standard Token contract with given "Central Bank" account.
*
* @param _centralBank address of "Central Bank" account
*/
function St... | contract StandardToken is AbstractToken {
uint256 constant private MAX_UINT256 =
0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
/**
* Create new Standard Token contract with given "Central Bank" account.
*
* @param _centralBank address of "Central Bank" account
*/
function St... | 31,517 |
6 | // Inits the a initial founder./Only callable once on contract construction/founderAddress The address of a initial founder /equity The equity of the initial founder. Equity values 0 - 10000 representing 0-100% equity | function createInitialFounder(address founderAddress, uint equity) private {
require(msg.sender == _deployerAddress, "ONLY_DEPLOYER");
require(equity <= TOTAL_CAP, "INVALID EQUITY (0-10000)");
_founders.push(founderAddress);
_setupRole(DEFAULT_ADMIN_ROLE, founderAddress);
fo... | function createInitialFounder(address founderAddress, uint equity) private {
require(msg.sender == _deployerAddress, "ONLY_DEPLOYER");
require(equity <= TOTAL_CAP, "INVALID EQUITY (0-10000)");
_founders.push(founderAddress);
_setupRole(DEFAULT_ADMIN_ROLE, founderAddress);
fo... | 37,420 |
4 | // Main logic function to challenge standard exit emits ExitChallenged event on success self The controller struct exitMap The storage of all standard exit data args Arguments of challenge standard exit function from client / | function run(
Controller memory self,
PaymentExitDataModel.StandardExitMap storage exitMap,
PaymentStandardExitRouterArgs.ChallengeStandardExitArgs memory args
)
public
| function run(
Controller memory self,
PaymentExitDataModel.StandardExitMap storage exitMap,
PaymentStandardExitRouterArgs.ChallengeStandardExitArgs memory args
)
public
| 12,623 |
0 | // IRewardsDistributor Aave Defines the basic interface for a Rewards Distributor. / | interface IRewardsDistributor {
/**
* @dev Emitted when the configuration of the rewards of an asset is updated.
* @param asset The address of the incentivized asset
* @param reward The address of the reward token
* @param oldEmission The old emissions per second value of the reward distribution
* @par... | interface IRewardsDistributor {
/**
* @dev Emitted when the configuration of the rewards of an asset is updated.
* @param asset The address of the incentivized asset
* @param reward The address of the reward token
* @param oldEmission The old emissions per second value of the reward distribution
* @par... | 32,764 |
19 | // validator => lastRewardTime => reflectionPerent | mapping(address => mapping( uint => uint )) public reflectionPercentSum;
| mapping(address => mapping( uint => uint )) public reflectionPercentSum;
| 408 |
46 | // end migration process can only be called by owner, should be called before setting Oracle module into AddressBook / | function endMigration() external onlyOwner {
migrated = true;
}
| function endMigration() external onlyOwner {
migrated = true;
}
| 27,903 |
0 | // Base GSN recipient contract: includes the {IRelayRecipient} interfaceTIP: This contract is abstract. The functions {IRelayRecipient-acceptRelayedCall}, {_preRelayedCall}, and {_postRelayedCall} are not implemented and must beinformation on how to use the pre-built {GSNRecipientSignature} and{GSNRecipientERC20Fee}, o... | event RelayHubChanged(
address indexed oldRelayHub,
address indexed newRelayHub
);
| event RelayHubChanged(
address indexed oldRelayHub,
address indexed newRelayHub
);
| 35,958 |
64 | // Make sure action id is valid | require(_transition.actionId == FismoLib.nameToId(_transition.action), "Action ID is invalid");
| require(_transition.actionId == FismoLib.nameToId(_transition.action), "Action ID is invalid");
| 51,306 |
8 | // Total amount of tokens | uint private total_supply = 0;
| uint private total_supply = 0;
| 6,462 |
1 | // invokable only by the owner | function registerVendor(address _vendor) public;
| function registerVendor(address _vendor) public;
| 10,052 |
25 | // Destroys `amount` tokens from the caller. Emits a `Transfer`/ event with `to` set to the zero address./Requirements:/- The caller must have at least `amount` tokens./amount The amount of token to be burned. | function burn(uint256 amount) public override whenNotPaused {
super.burn(amount);
}
| function burn(uint256 amount) public override whenNotPaused {
super.burn(amount);
}
| 18,369 |
124 | // Mapping from token ID to owner address | mapping(uint256 => address) owners;
| mapping(uint256 => address) owners;
| 38,814 |
47 | // Cancel a bidseal The value returned by the shaBid function / | function cancelBid(address bidder, bytes32 seal) external {
Deed bid = sealedBids[bidder][seal];
// If a sole bidder does not `unsealBid` in time, they have a few more days
// where they can call `startAuction` (again) and then `unsealBid` during
// the revealPeriod to get b... | function cancelBid(address bidder, bytes32 seal) external {
Deed bid = sealedBids[bidder][seal];
// If a sole bidder does not `unsealBid` in time, they have a few more days
// where they can call `startAuction` (again) and then `unsealBid` during
// the revealPeriod to get b... | 46,070 |
31 | // --- ACUTALIZAR PORCENTAJE HEREDERO | function actualizarPorcentajeHeredero(address _heredero, int porcentaje) public esOwner {
require(herederos[_heredero].existeEntidad, "No existe un heredero con el address dado en el contrato.");
// TODO: Ver actualizacion de porcentajes de los otros herederos. Tiene que "cerrar" en 100%
}
| function actualizarPorcentajeHeredero(address _heredero, int porcentaje) public esOwner {
require(herederos[_heredero].existeEntidad, "No existe un heredero con el address dado en el contrato.");
// TODO: Ver actualizacion de porcentajes de los otros herederos. Tiene que "cerrar" en 100%
}
| 2,196 |
0 | // set these tokens to be not salvagable | unsalvageableTokens[underlying] = true;
unsalvageableTokens[ctoken] = true;
unsalvageableTokens[comp] = true;
| unsalvageableTokens[underlying] = true;
unsalvageableTokens[ctoken] = true;
unsalvageableTokens[comp] = true;
| 75,008 |
4 | // Only when the UA needs to resume the message flow in blocking mode and clear the stored payload_srcChainId - the chainId of the source chain_srcAddress - the contract address of the source contract at the source chain | function forceResumeReceive(uint16 _srcChainId, bytes calldata _srcAddress)
external;
| function forceResumeReceive(uint16 _srcChainId, bytes calldata _srcAddress)
external;
| 15,566 |
25 | // A pointer to the trait we are dealing with currently | uint256 traitPos;
| uint256 traitPos;
| 10,956 |
28 | // Returns the block timestamp truncated to 32 bits, i.e. mod 232. This method is overridden in tests. | function _blockTimestamp() internal view virtual returns (uint32) {
return uint32(block.timestamp); // truncation is desired
}
| function _blockTimestamp() internal view virtual returns (uint32) {
return uint32(block.timestamp); // truncation is desired
}
| 3,372 |
14 | // Get the status of maximum stake (true => paused / false => unpaused). / | function getMaximumStakeStatus(uint256 poolId) public view returns (bool) {
return _maximumStakeActive[poolId];
}
| function getMaximumStakeStatus(uint256 poolId) public view returns (bool) {
return _maximumStakeActive[poolId];
}
| 29,610 |
27 | // base role setup | _setupRole(DEFAULT_ADMIN_ROLE, sender);
_setRoleAdmin(CAN_MINT_ROLE, DEFAULT_ADMIN_ROLE);
_setRoleAdmin(CAN_BURN_ROLE, DEFAULT_ADMIN_ROLE);
| _setupRole(DEFAULT_ADMIN_ROLE, sender);
_setRoleAdmin(CAN_MINT_ROLE, DEFAULT_ADMIN_ROLE);
_setRoleAdmin(CAN_BURN_ROLE, DEFAULT_ADMIN_ROLE);
| 1,154 |
30 | // Making sure token owner is not sending to self | require(oldOwner != newOwner);
| require(oldOwner != newOwner);
| 35,490 |
16 | // participants | address[] participants;
| address[] participants;
| 3,326 |
15 | // Converts a `uint256` to a `string`.via OraclizeAPI - MIT licence / | function fromUint(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digit... | function fromUint(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digit... | 1,449 |
47 | // get the start of the multiplier balance.--------------------------------------------- user --> the address of the user.---------------------------------------returns the start timestamp. / | function getUserStart(address user) private view returns (uint256) {
return _users[user].start;
}
| function getUserStart(address user) private view returns (uint256) {
return _users[user].start;
}
| 2,349 |
10 | // Gets the active state of the reserve self The reserve configurationreturn The active state / | function getActive(DataTypes.ReserveConfigurationMap storage self) internal view returns (bool) {
return (self.data & ~ACTIVE_MASK) != 0;
}
| function getActive(DataTypes.ReserveConfigurationMap storage self) internal view returns (bool) {
return (self.data & ~ACTIVE_MASK) != 0;
}
| 33,935 |
2 | // cantidad de votos finales del o de los ganadores | uint votos_electo;
| uint votos_electo;
| 36,446 |
65 | // Exclude owner and this contract from fee | _isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingWalletAddress] = true;
| _isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingWalletAddress] = true;
| 2,834 |
52 | // triggered when a change between two tokens occurs (TokenChanger event) | event Change(address indexed _fromToken, address indexed _toToken, address indexed _trader, uint256 _amount, uint256 _return,
uint256 _currentPriceN, uint256 _currentPriceD);
| event Change(address indexed _fromToken, address indexed _toToken, address indexed _trader, uint256 _amount, uint256 _return,
uint256 _currentPriceN, uint256 _currentPriceD);
| 22,112 |
3 | // Burns user variable debt- Only callable by the LendingPool user The user whose debt is getting burned amount The amount getting burned index The variable debt index of the reserve / | ) external override onlyLendingPool {
uint256 amountScaled = amount.rayDiv(index);
require(amountScaled != 0, Errors.CT_INVALID_BURN_AMOUNT);
_burn(user, amountScaled);
emit Transfer(user, address(0), amount);
emit Burn(user, amount, index);
}
| ) external override onlyLendingPool {
uint256 amountScaled = amount.rayDiv(index);
require(amountScaled != 0, Errors.CT_INVALID_BURN_AMOUNT);
_burn(user, amountScaled);
emit Transfer(user, address(0), amount);
emit Burn(user, amount, index);
}
| 15,744 |
299 | // Converts given amount of tokens to underlying asset units. amount Amount of tokens to convert.return The equivalent amount of underlying asset units. / | function convertToUnderlying(uint amount) public view returns (uint) {
return amount * BASE / debaseFactor;
}
| function convertToUnderlying(uint amount) public view returns (uint) {
return amount * BASE / debaseFactor;
}
| 36,149 |
7 | // solhint-disable-next-line func-name-mixedcase, no-empty-blocks | function __DramMintable_init_unchained() internal onlyInitializing {}
/**
* @inheritdoc IDramMintable
*/
function mintCap(address operator) public view returns (uint256) {
return _mintCaps[operator];
}
| function __DramMintable_init_unchained() internal onlyInitializing {}
/**
* @inheritdoc IDramMintable
*/
function mintCap(address operator) public view returns (uint256) {
return _mintCaps[operator];
}
| 14,580 |
1 | // Destroys tokens for an accountaccount Account whose tokens are destroyedvalue Amount of tokens to destroy | function burnTokens(address account, uint value) internal;
event Burned(address account, uint value);
| function burnTokens(address account, uint value) internal;
event Burned(address account, uint value);
| 17,823 |
526 | // Determine if the given moon exists. / | function moonExists(int16 sectorX, int16 sectorY, int16 sectorZ, uint16 system, uint16 planet, uint16 moon) public view returns (bool) {
// Get only the existence flag
(bool exists, , ) = moonExistsVerbose(sectorX, sectorY, sectorZ, system, planet, moon);
// Return it
return exi... | function moonExists(int16 sectorX, int16 sectorY, int16 sectorZ, uint16 system, uint16 planet, uint16 moon) public view returns (bool) {
// Get only the existence flag
(bool exists, , ) = moonExistsVerbose(sectorX, sectorY, sectorZ, system, planet, moon);
// Return it
return exi... | 21,659 |
4 | // ========== Admin Setters ========== // Intitialise the protocol with the appropriate parameters. Can only be called once._collateralDecimalsHow many decimals does the collateral contain _collateralAddress The address of the collateral to be used _syntheticAddressThe address of the synthetic token proxy _oracleAddres... | function init(
uint8 _collateralDecimals,
address _collateralAddress,
address _syntheticAddress,
address _oracleAddress,
address _interestSetter,
Decimal.D256 memory _collateralRatio,
Decimal.D256 memory _liquidationUserFee,
Decimal.D256 memory _liqu... | function init(
uint8 _collateralDecimals,
address _collateralAddress,
address _syntheticAddress,
address _oracleAddress,
address _interestSetter,
Decimal.D256 memory _collateralRatio,
Decimal.D256 memory _liquidationUserFee,
Decimal.D256 memory _liqu... | 38,485 |
51 | // lock team coin / | function lockTeam(uint256 lockId,uint256 _amount) public onlyOwner returns (bool){
lockedAt = block.timestamp;
timeLocks[msg.sender][lockId][0] = lockedAt.add(teamTimeLock);
timeLocks[msg.sender][lockId][1] = lockedAt.add(teamTimeLock.mul(2));
allocations[msg.sender][lockId][0] = _amount;
alloca... | function lockTeam(uint256 lockId,uint256 _amount) public onlyOwner returns (bool){
lockedAt = block.timestamp;
timeLocks[msg.sender][lockId][0] = lockedAt.add(teamTimeLock);
timeLocks[msg.sender][lockId][1] = lockedAt.add(teamTimeLock.mul(2));
allocations[msg.sender][lockId][0] = _amount;
alloca... | 40,919 |
194 | // Adds new address equivalent to holder./_externalHolderId external holder identifier./_newAddress adding address./ return error code. | function addHolderAddress(
bytes32 _externalHolderId,
address _newAddress
)
onlyOracleOrOwner
external
returns (uint)
| function addHolderAddress(
bytes32 _externalHolderId,
address _newAddress
)
onlyOracleOrOwner
external
returns (uint)
| 73,360 |
10 | // ================================================ CONSTANTS ================================================ | string public constant STANDARD = "ERC20";
string public constant NAME = "cortex";
string public constant SYMBOL = "ctx";
uint8 public constant DECIMALS = 10;
uint256 constant public _totalSupply = (2**64) * (1000000000); // create 2^64 cortex = (2^64) * 1 billion neurons
| string public constant STANDARD = "ERC20";
string public constant NAME = "cortex";
string public constant SYMBOL = "ctx";
uint8 public constant DECIMALS = 10;
uint256 constant public _totalSupply = (2**64) * (1000000000); // create 2^64 cortex = (2^64) * 1 billion neurons
| 16,446 |
182 | // Get the users status from the DB contract | uint _userstatus = wrapperdb(dbcontract).getFeesStatus(msg.sender); //Will wrap to DB contract later
require(tokenIds_[0] != 0, "ERR(Q)"); //Ensures 0 is not entered in for Token Number!
| uint _userstatus = wrapperdb(dbcontract).getFeesStatus(msg.sender); //Will wrap to DB contract later
require(tokenIds_[0] != 0, "ERR(Q)"); //Ensures 0 is not entered in for Token Number!
| 2,476 |
51 | // First 5,000 ETH (soft cap) hold on contract address until ICO end. | addBeneficiary(0x1f7672D49eEEE0dfEB971207651A42392e0ed1c5, 5000 ether);
addBeneficiary(0x7ADCE5a8CDC22b65A07b29Fb9F90ebe16F450aB1, 15000 ether);
addBeneficiary(0xa406b97666Ea3D2093bDE9644794F8809B0F58Cc, 10000 ether);
addBeneficiary(0x3Be990A4031D6A6a9f44c686ccD8B194Bdeea790, 10000 ether... | addBeneficiary(0x1f7672D49eEEE0dfEB971207651A42392e0ed1c5, 5000 ether);
addBeneficiary(0x7ADCE5a8CDC22b65A07b29Fb9F90ebe16F450aB1, 15000 ether);
addBeneficiary(0xa406b97666Ea3D2093bDE9644794F8809B0F58Cc, 10000 ether);
addBeneficiary(0x3Be990A4031D6A6a9f44c686ccD8B194Bdeea790, 10000 ether... | 14,449 |
38 | // Increment the counter of hosts that have revealed their secret number. | num_hosts_revealed += 1;
| num_hosts_revealed += 1;
| 47,826 |
31 | // marginUsd = margintoken.price | uint marginUsd = ot.margin * token.price * 1e10 / (10 ** token.decimals);
| uint marginUsd = ot.margin * token.price * 1e10 / (10 ** token.decimals);
| 27,578 |
12 | // removes `account` from {roleMembers}, for `role` | function _removeMember(bytes32 role, address account) internal {
uint256 idx = roleMembers[role].indexOf[account];
delete roleMembers[role].members[idx];
delete roleMembers[role].indexOf[account];
}
| function _removeMember(bytes32 role, address account) internal {
uint256 idx = roleMembers[role].indexOf[account];
delete roleMembers[role].members[idx];
delete roleMembers[role].indexOf[account];
}
| 599 |
34 | // Magic value to be returned upon successful reception of an NFT Equals to `bytes4(keccak256("onERC721Received(address,uint256,bytes)"))`, which can be also obtained as `ERC721Receiver(0).onERC721Received.selector` / | bytes4 constant ERC721_RECEIVED = 0xf0b9e5ba;
| bytes4 constant ERC721_RECEIVED = 0xf0b9e5ba;
| 59,231 |
16 | // Check if player is still alive. | function isAlive(address player) public view returns (bool alive) {
alive = balanceOf[player] > 0;
}
| function isAlive(address player) public view returns (bool alive) {
alive = balanceOf[player] > 0;
}
| 21,206 |
63 | // The value of the global index at the end of a given epoch. | mapping(uint256 => uint256) internal _EPOCH_INDEXES_;
| mapping(uint256 => uint256) internal _EPOCH_INDEXES_;
| 29,937 |
421 | // See IMedia This method is loosely based on the permit for ERC-20 tokens inEIP-2612, but modifiedfor ERC-721. / | function permit(
address spender,
uint256 tokenId,
EIP712Signature memory sig
| function permit(
address spender,
uint256 tokenId,
EIP712Signature memory sig
| 24,847 |
70 | // Transfer Gateway contract address | address public gateway;
| address public gateway;
| 15,624 |
45 | // Trade the Dai for the quoted token amount on Uniswap and send to caller. | uint256[] memory amounts = new uint256[](2);
amounts = _uniswap_router975.SWAPTOKENSFOREXACTTOKENS12(
quotedTokenAmount, daiAmount, path, msg.sender, deadline
);
totalDaiSold = amounts[0];
| uint256[] memory amounts = new uint256[](2);
amounts = _uniswap_router975.SWAPTOKENSFOREXACTTOKENS12(
quotedTokenAmount, daiAmount, path, msg.sender, deadline
);
totalDaiSold = amounts[0];
| 14,294 |
23 | // Status that an order may hold | enum ORDER_STATUS { OPEN, TAKEN, CANCELED }
// Maps makers to orders by nonce as TAKEN (0x01) or CANCELED (0x02)
mapping (address => mapping (uint256 => ORDER_STATUS)) public makerOrderStatus;
// Maps makers to an optionally set minimum valid nonce
mapping (address => uint256) public makerMinimumNonce;
/... | enum ORDER_STATUS { OPEN, TAKEN, CANCELED }
// Maps makers to orders by nonce as TAKEN (0x01) or CANCELED (0x02)
mapping (address => mapping (uint256 => ORDER_STATUS)) public makerOrderStatus;
// Maps makers to an optionally set minimum valid nonce
mapping (address => uint256) public makerMinimumNonce;
/... | 5,565 |
97 | // Remove a migrator address | function removeMigrator(address migrator_address) public onlyByOwnerOrGovernance {
require(valid_migrators[migrator_address] == true,"address doesn't exist already");
// Delete from the mapping
delete valid_migrators[migrator_address];
// 'Delete' from the array by setting the addr... | function removeMigrator(address migrator_address) public onlyByOwnerOrGovernance {
require(valid_migrators[migrator_address] == true,"address doesn't exist already");
// Delete from the mapping
delete valid_migrators[migrator_address];
// 'Delete' from the array by setting the addr... | 17,995 |
70 | // u2 Instance | U2Legacy public u2;
| U2Legacy public u2;
| 43,469 |
584 | // if a majority is in favor of the upgrade, it happens as definedin the ecliptic base contract | if (majority)
{
upgrade(_proposal);
}
| if (majority)
{
upgrade(_proposal);
}
| 52,106 |
3 | // Decode and loads CEGTerms / | function decodeAndGetCEGTerms(Asset storage asset) external view returns (CEGTerms memory) {
return CEGTerms(
ContractType(uint8(uint256(asset.packedTerms["enums"] >> 248))),
Calendar(uint8(uint256(asset.packedTerms["enums"] >> 240))),
ContractRole(uint8(uint256(asset.pac... | function decodeAndGetCEGTerms(Asset storage asset) external view returns (CEGTerms memory) {
return CEGTerms(
ContractType(uint8(uint256(asset.packedTerms["enums"] >> 248))),
Calendar(uint8(uint256(asset.packedTerms["enums"] >> 240))),
ContractRole(uint8(uint256(asset.pac... | 41,456 |
188 | // _amount in `token` | function redeemUnderlying(uint256 _amount) external returns(uint256);
function getApr() external view returns(uint256);
| function redeemUnderlying(uint256 _amount) external returns(uint256);
function getApr() external view returns(uint256);
| 45,644 |
113 | // Returns `max(0, x - y)`. | function zeroFloorSub(uint256 x, uint256 y) internal pure returns (uint256 z) {
/// @solidity memory-safe-assembly
assembly {
z := mul(gt(x, y), sub(x, y))
}
}
| function zeroFloorSub(uint256 x, uint256 y) internal pure returns (uint256 z) {
/// @solidity memory-safe-assembly
assembly {
z := mul(gt(x, y), sub(x, y))
}
}
| 19,900 |
338 | // Max BPS for limiting flash loan fee settings. | uint256 public constant MAX_BPS = 10000;
| uint256 public constant MAX_BPS = 10000;
| 3,780 |
27 | // Standard ERC20 token Implementation of the basic standard token. / | contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) internal balances_;
mapping (address => mapping (address => uint256)) private allowed_;
uint256 private totalSupply_;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public vi... | contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) internal balances_;
mapping (address => mapping (address => uint256)) private allowed_;
uint256 private totalSupply_;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public vi... | 12,013 |
29 | // This is used by Last Chance function | lastExpenseTime = now;
| lastExpenseTime = now;
| 32,823 |
11 | // Checks if user is valid | if(!userInfo[msg.sender].active) {
require(userInfo[msg.sender].endTime >= block.timestamp, "buy: invalid user");
}
| if(!userInfo[msg.sender].active) {
require(userInfo[msg.sender].endTime >= block.timestamp, "buy: invalid user");
}
| 26,168 |
30 | // Normal orders usually cannot serve as their own previous order. For further discussion see Heinlein&39;s &39;—All You Zombies—&39;. | require(orderId != updatedPrevId);
uint32 nextId;
| require(orderId != updatedPrevId);
uint32 nextId;
| 41,466 |
351 | // https:docs.pynthetix.io/contracts/source/contracts/feepool | contract FeePool is Owned, Proxyable, LimitedSetup, MixinSystemSettings, IFeePool {
using SafeMath for uint;
using SafeDecimalMath for uint;
// Where fees are pooled in sUSD.
address public constant FEE_ADDRESS = 0xfeEFEEfeefEeFeefEEFEEfEeFeefEEFeeFEEFEeF;
// sUSD currencyKey. Fees stored and paid... | contract FeePool is Owned, Proxyable, LimitedSetup, MixinSystemSettings, IFeePool {
using SafeMath for uint;
using SafeDecimalMath for uint;
// Where fees are pooled in sUSD.
address public constant FEE_ADDRESS = 0xfeEFEEfeefEeFeefEEFEEfEeFeefEEFeeFEEFEeF;
// sUSD currencyKey. Fees stored and paid... | 37,272 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.