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 |
|---|---|---|---|---|
2 | // This creates an array with all balances | mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
| mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
| 12,422 |
65 | // sin compras desde referidos se agrega bono de referencia nuevamente al reparto global de dividendos. | _dividends = SafeMath.add(_dividends, _referralBonus);
_fee = _dividends * magnitude;
| _dividends = SafeMath.add(_dividends, _referralBonus);
_fee = _dividends * magnitude;
| 9,733 |
318 | // Initializes a new Comptroller V2/_asset The asset to disburse to users/_measure The token to use to measure a users portion/_dripRatePerSecond The amount of the asset to drip each second | function initialize (
IERC20Upgradeable _asset,
IERC20Upgradeable _measure,
uint256 _dripRatePerSecond
| function initialize (
IERC20Upgradeable _asset,
IERC20Upgradeable _measure,
uint256 _dripRatePerSecond
| 36,055 |
85 | // Encodes message for transferring ERC20 with token info. Returns encoded message. / | function encodeTransferErc20AndTokenInfoMessage(
address token,
address receiver,
uint256 amount,
uint256 totalSupply,
Erc20TokenInfo memory tokenInfo
| function encodeTransferErc20AndTokenInfoMessage(
address token,
address receiver,
uint256 amount,
uint256 totalSupply,
Erc20TokenInfo memory tokenInfo
| 13,754 |
72 | // Delegates the current call to the address returned by `_implementation()`.This function does not return to its internall call site, it will return directly to the external caller. / | function _fallback() internal {
_beforeFallback();
_delegate(_implementation());
}
| function _fallback() internal {
_beforeFallback();
_delegate(_implementation());
}
| 4,683 |
58 | // Return the current price for tiles | function tilePrice() view public returns(uint256) {
return (BYZANTINE_TILE_STARTING_PRICE + byzantineTileSalesCount.add(1).mul(INCREASE_RATE));
}
| function tilePrice() view public returns(uint256) {
return (BYZANTINE_TILE_STARTING_PRICE + byzantineTileSalesCount.add(1).mul(INCREASE_RATE));
}
| 17,608 |
131 | // ... //Get the adjusted liquidation spread for some market pair. This is equal to the globalliquidation spread multiplied by (1 + spreadPremium) for each of the two markets. heldMarketIdThe market for which the account has collateralowedMarketIdThe market for which the account has borrowed tokensreturn The adjusted l... | function getLiquidationSpreadForPair(
| function getLiquidationSpreadForPair(
| 59,128 |
54 | // Creator can extend the lock time of the secret,as long as the previous lock time is in the future data the system's data struct instance identifier the identifier of the secret lockTime new lock time for the relockedsecret handlingFee new handling fee for the relocked secret reward new reward for the relocked secret... | function relockSecret(
Datas.Data storage data,
bytes32 identifier,
uint256 lockTime,
uint256 handlingFee,
uint256 reward,
IERC20 lifeToken
| function relockSecret(
Datas.Data storage data,
bytes32 identifier,
uint256 lockTime,
uint256 handlingFee,
uint256 reward,
IERC20 lifeToken
| 18,873 |
60 | // Safety measure - this should never trigger | require(
totalDrawn[_beneficiary] <= vestedAmount[_beneficiary],
"VestingContract::_drawDown: Safety Mechanism - Drawn exceeded Amount Vested"
);
| require(
totalDrawn[_beneficiary] <= vestedAmount[_beneficiary],
"VestingContract::_drawDown: Safety Mechanism - Drawn exceeded Amount Vested"
);
| 67,534 |
59 | // {IERC165} interfaces can also be queried via the registry./ Sets `newManager` as the manager for `account`. A manager of anaccount is able to set interface implementers for it. By default, each account is its own manager. Passing a value of `0x0` in`newManager` will reset the manager to this initial state. Emits a {... | function setManager(address account, address newManager) external;
| function setManager(address account, address newManager) external;
| 13,216 |
308 | // get chope value | (,uint chop,) = manager.end().cat().ilks(collateralType);
uint biteIlk = mul(chop, daiDebt) / currentPriceFeedValue;
| (,uint chop,) = manager.end().cat().ilks(collateralType);
uint biteIlk = mul(chop, daiDebt) / currentPriceFeedValue;
| 81,416 |
58 | // Calculate liquidity and equivalent token amounts of limit order. / | function getLimitPosition()
public
view
returns (
uint128 liquidity,
uint256 amount0,
uint256 amount1
)
| function getLimitPosition()
public
view
returns (
uint128 liquidity,
uint256 amount0,
uint256 amount1
)
| 45,027 |
69 | // Since _startingMultiplier and _endingMultiplier are in 6 decimalsNeed to divide multiplier by _MULTIPLIER_DIVISOR / | return multiplier.div(_MULTIPLIER_DIVISOR);
| return multiplier.div(_MULTIPLIER_DIVISOR);
| 16,485 |
27 | // Creates {amount} tokens and assigns them to {account}, increasing the total supply. | function _minted(address account, uint256 amount) internal virtual returns (bool)
{
if ((account == address(0)) || (amount == uint256(0)))
return false;
mTotalSupply += amount;
mDataBalance[account] += amount;
emit Minted(account, amount);
re... | function _minted(address account, uint256 amount) internal virtual returns (bool)
{
if ((account == address(0)) || (amount == uint256(0)))
return false;
mTotalSupply += amount;
mDataBalance[account] += amount;
emit Minted(account, amount);
re... | 17,081 |
13 | // The DMEX Fee Contract | contract DMEX_Fee_Contract {
address DMEX_CONTRACT = address(0x2101e480e22C953b37b9D0FE6551C1354Fe705E6);
address DMEX_TOKEN = address(0x6263e260fF6597180c9538c69aF8284EDeaCEC80);
address TOKEN_ETH = address(0x0000000000000000000000000000000000000000);
address TOKEN_DAI = address(0x6B175474E89094C... | contract DMEX_Fee_Contract {
address DMEX_CONTRACT = address(0x2101e480e22C953b37b9D0FE6551C1354Fe705E6);
address DMEX_TOKEN = address(0x6263e260fF6597180c9538c69aF8284EDeaCEC80);
address TOKEN_ETH = address(0x0000000000000000000000000000000000000000);
address TOKEN_DAI = address(0x6B175474E89094C... | 77,587 |
13 | // Allows to get the address for a new proxy contact created via `createProxyWithNonce`/This method is only meant for address calculation purpose when you use an initializer that would revert,/therefore the response is returned with a revert. When calling this method set `from` to the address of the proxy factory./_sin... | function calculateCreateProxyWithNonceAddress(
address _singleton,
bytes calldata initializer,
uint256 saltNonce
| function calculateCreateProxyWithNonceAddress(
address _singleton,
bytes calldata initializer,
uint256 saltNonce
| 7,721 |
3,150 | // 1577 | entry "extorsively" : ENG_ADVERB
| entry "extorsively" : ENG_ADVERB
| 22,413 |
5 | // Mainnet address of the KyberNetworkProxy contract. | IKyberNetworkProxy private immutable KYBER_NETWORK_PROXY;
constructor(AdapterAddresses memory addresses)
public
| IKyberNetworkProxy private immutable KYBER_NETWORK_PROXY;
constructor(AdapterAddresses memory addresses)
public
| 36,958 |
55 | // This contract now has the funds requested. | uint256 amountFL = amounts[0];
uint256 amountFLWithFees = amounts[0] + premiums[0];
address tokenFL = assets[0];
if (operation == 0) {
longOperation(amountFL, amountFLWithFees, params);
} else if (operation == 1) {
| uint256 amountFL = amounts[0];
uint256 amountFLWithFees = amounts[0] + premiums[0];
address tokenFL = assets[0];
if (operation == 0) {
longOperation(amountFL, amountFLWithFees, params);
} else if (operation == 1) {
| 8,830 |
81 | // WETH must be converted to Eth for Uniswap trade (Uniswap allows ERC20:ERC20 but most liquidity is on ETH:ERC20 markets) | _withdrawEther(amount);
require(address(this).balance >= amount, "buying from uniswap takes real Ether");
| _withdrawEther(amount);
require(address(this).balance >= amount, "buying from uniswap takes real Ether");
| 1,986 |
106 | // Claim Crowns for all tokens owned by the sender/This function will run out of gas if you have too much Based Stats! If/ this is a concern, you should use claimRangeForOwner and claim Crowns in batches. | function claimAllForOwner() external {
uint256 tokenBalanceOwner = basedContract.balanceOf(_msgSender());
// Checks
require(tokenBalanceOwner > 0, "NO_TOKENS_OWNED");
// i < tokenBalanceOwner because tokenBalanceOwner is 1-indexed
for (uint256 i = 0; i < tokenBalanceOwner; ... | function claimAllForOwner() external {
uint256 tokenBalanceOwner = basedContract.balanceOf(_msgSender());
// Checks
require(tokenBalanceOwner > 0, "NO_TOKENS_OWNED");
// i < tokenBalanceOwner because tokenBalanceOwner is 1-indexed
for (uint256 i = 0; i < tokenBalanceOwner; ... | 32,001 |
0 | // Mapping from token ID to seal status (0 ~ 1) | mapping(uint256 => bool) public isTokenUnsealed;
| mapping(uint256 => bool) public isTokenUnsealed;
| 19,788 |
25 | // An event indicating that a proposal has been accepted for votingcontractAddress The address of the PolicyVotes contract instance. / | event VoteStart(PolicyVotes indexed contractAddress);
| event VoteStart(PolicyVotes indexed contractAddress);
| 9,964 |
45 | // toEthSignedMessageHash prefix a bytes32 value with "\x19Ethereum Signed Message:"and hash the result / | function toEthSignedMessageHash(bytes32 hash)
internal
pure
returns (bytes32)
| function toEthSignedMessageHash(bytes32 hash)
internal
pure
returns (bytes32)
| 41,252 |
38 | // Standard ERC20 tokenImplementation of the basic standard token. This implementation emits additional Approval events, allowing applications to reconstruct the allowance status forall accounts just by listening to said events. Note that this isn't required by the specification, and othercompliant implementations may ... | contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowed;
uint256 private _totalSupply;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public vie... | contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowed;
uint256 private _totalSupply;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public vie... | 8,174 |
1 | // State Variables // Constructor / | {}
}
| {}
}
| 13,911 |
48 | // Event for token purchase loggingpurchaser who paid for the tokensbeneficiary who got the tokensvalue weis paid for purchaseamount amount of tokens purchased/ | event TokenPurchase(
address indexed purchaser,
address indexed beneficiary,
uint256 value,
uint256 amount,
uint256 burned
);
| event TokenPurchase(
address indexed purchaser,
address indexed beneficiary,
uint256 value,
uint256 amount,
uint256 burned
);
| 40,860 |
12 | // Allow player to attack boss. | if (bigBoss.hp < player.attackDamage) {
bigBoss.hp = 0;
} else {
| if (bigBoss.hp < player.attackDamage) {
bigBoss.hp = 0;
} else {
| 18,213 |
11 | // Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first... | function approve(address spender, uint256 value) public returns (bool) {
_allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
| function approve(address spender, uint256 value) public returns (bool) {
_allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
| 27,047 |
26 | // Returns product associated with given productId | function getProductType(string memory productId)
public
view
returns (Product memory)
| function getProductType(string memory productId)
public
view
returns (Product memory)
| 36,027 |
30 | // deduct hub/user wei/tokens from total channel balances | channel.weiBalances[2] = channel.weiBalances[2].sub(channel.weiBalances[0]).sub(channel.weiBalances[1]);
channel.tokenBalances[2] = channel.tokenBalances[2].sub(channel.tokenBalances[0]).sub(channel.tokenBalances[1]);
| channel.weiBalances[2] = channel.weiBalances[2].sub(channel.weiBalances[0]).sub(channel.weiBalances[1]);
channel.tokenBalances[2] = channel.tokenBalances[2].sub(channel.tokenBalances[0]).sub(channel.tokenBalances[1]);
| 1,904 |
5 | // Grab tokens and send to caller If the _amount[i] is 0, then transfer all the tokens _tokens List of tokens _amounts Amount of each token to send / | function _rescueTokens(address[] calldata _tokens, uint256[] memory _amounts)
internal
virtual
| function _rescueTokens(address[] calldata _tokens, uint256[] memory _amounts)
internal
virtual
| 23,281 |
152 | // update balance of verifier | totalDepositedToSCAmount[token] = totalDepositedToSCAmount[token].safeSub(amount);
withdrawRequests[verifier][token] = withdrawRequests[verifier][token].safeSub(amount);
| totalDepositedToSCAmount[token] = totalDepositedToSCAmount[token].safeSub(amount);
withdrawRequests[verifier][token] = withdrawRequests[verifier][token].safeSub(amount);
| 34,682 |
50 | // Sweep the old balance, if any | address[] memory users = new address[](1);
users[0] = user;
_sweepTimelockBalances(users);
timelockTotalSupply = timelockTotalSupply.add(amount);
_timelockBalances[user] = _timelockBalances[user].add(amount);
_unlockTimestamps[user] = timestamp;
| address[] memory users = new address[](1);
users[0] = user;
_sweepTimelockBalances(users);
timelockTotalSupply = timelockTotalSupply.add(amount);
_timelockBalances[user] = _timelockBalances[user].add(amount);
_unlockTimestamps[user] = timestamp;
| 14,357 |
146 | // This stops an attack vector where a user stakes a lot of money then drops the debt requirement by staking less before the deadline to reduce the amount of debt they need to lock in |
require(
debtRequirement >= staker.debtSnapshot,
"Your new debt requiremen cannot be lower than last time"
);
staker.positionId = positionId;
staker.debtSnapshot = debtRequirement;
staker.balance = staker.balance.add(amount);
|
require(
debtRequirement >= staker.debtSnapshot,
"Your new debt requiremen cannot be lower than last time"
);
staker.positionId = positionId;
staker.debtSnapshot = debtRequirement;
staker.balance = staker.balance.add(amount);
| 46,699 |
16 | // get the erc-20 balance of this owner | uint256 balance = token.balanceOf(owner);
| uint256 balance = token.balanceOf(owner);
| 25,217 |
242 | // Resolve governance address from Vault contract, used to make assertionson protected functions in the Strategy. / | function governance() internal view returns (address) {
return IVault(vault).governance();
}
| function governance() internal view returns (address) {
return IVault(vault).governance();
}
| 70,547 |
33 | // Assigns a new address to act as the Banker. | function setBanker(address _newBK) external onlyManager {
require(_newBK != address(0));
bankManager = _newBK;
}
| function setBanker(address _newBK) external onlyManager {
require(_newBK != address(0));
bankManager = _newBK;
}
| 26,327 |
132 | // transfer token | pool.safeTransferFrom(provider, address(this), amount);
| pool.safeTransferFrom(provider, address(this), amount);
| 46,683 |
262 | // calculate spread fee by input quoteAssetAmount _quoteAssetAmount quoteAssetAmountreturn total tx fee / | function calcFee(Decimal.decimal calldata _quoteAssetAmount)
external
view
override
returns (Decimal.decimal memory)
| function calcFee(Decimal.decimal calldata _quoteAssetAmount)
external
view
override
returns (Decimal.decimal memory)
| 2,520 |
2 | // store candidatesFetch candidate | mapping(uint=>Condidate)public candidates;
uint256 public candidatesCount;
address owner;
| mapping(uint=>Condidate)public candidates;
uint256 public candidatesCount;
address owner;
| 10,789 |
277 | // set after end time has been changed once, prevents further changes to end timestamp | bool public genesisEndTimestampLocked;
| bool public genesisEndTimestampLocked;
| 10,682 |
10 | // The `ph` variable represents an instance of the IPriceHandler interface.This contract is used to handle the pricing logic of the tokens. / | IPriceHandler private ph;
| IPriceHandler private ph;
| 358 |
1 | // this function call should be free; check gas | return 'hello there amigo';
| return 'hello there amigo';
| 25,450 |
10 | // SENDS PERMISSION TO ALLOW OR NOT TO DISALLOW | function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external override {
require(deadline >= block.timestamp, 'UniswapV2: EXPIRED');
bytes32 digest = keccak256(
abi.encodePacked(
'\x19\x01',
DOMAIN_SEPAR... | function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external override {
require(deadline >= block.timestamp, 'UniswapV2: EXPIRED');
bytes32 digest = keccak256(
abi.encodePacked(
'\x19\x01',
DOMAIN_SEPAR... | 36,409 |
0 | // uint256 private price = 10000000000000000;0.01 Ether | uint256 private price = 90000000000000000; // 0.09 ETHER
| uint256 private price = 90000000000000000; // 0.09 ETHER
| 77,161 |
78 | // Allows the current owner to set the pendingOwner address./newOwner The address to transfer ownership to. | function transferOwnership(
address newOwner
)
public
override
onlyOwner
| function transferOwnership(
address newOwner
)
public
override
onlyOwner
| 15,997 |
94 | // Token Info | string private constant _name = 'MetaVault';
string private constant _symbol = '$MVT';
uint8 private constant _decimals = 9;
uint256 public constant InitialSupply= 1000000000000 * 10**_decimals;//equals 1 000 000 000 000 tokens
| string private constant _name = 'MetaVault';
string private constant _symbol = '$MVT';
uint8 private constant _decimals = 9;
uint256 public constant InitialSupply= 1000000000000 * 10**_decimals;//equals 1 000 000 000 000 tokens
| 16,483 |
11 | // Overriding the _transfer function to implement tax logic | function _transfer(address sender, address recipient, uint256 amount) internal virtual override {
require(amount > 0, "Amount must be greater than 0");
uint256 taxAmount = 0;
if (recipient == address(this)) {
// The transfer is a buy transaction (transfer to the contract addres... | function _transfer(address sender, address recipient, uint256 amount) internal virtual override {
require(amount > 0, "Amount must be greater than 0");
uint256 taxAmount = 0;
if (recipient == address(this)) {
// The transfer is a buy transaction (transfer to the contract addres... | 7,313 |
441 | // Is the registered ENS node identifying the licence contract. | bytes32 private _licenceNode;
| bytes32 private _licenceNode;
| 42,790 |
15 | // increment license count | NFTCount++;
emit ContractCreated(newNFT);
| NFTCount++;
emit ContractCreated(newNFT);
| 30,188 |
204 | // MasterChef is the master of Fruit. He can make Fruit and he is a fair guy. Note that it's ownable and the owner wields tremendous power. The ownership will be transferred to a governance smart contract once FRUIT is sufficiently distributed and the community can show to govern itself. Have fun reading it. Hopefully ... | contract MasterChef is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// Info of each user.
struct UserInfo {
uint256 amount; // How many LP tokens the user has provided.
uint256 rewardDebt; // Reward debt. See explanation below.
//
// We do some f... | contract MasterChef is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// Info of each user.
struct UserInfo {
uint256 amount; // How many LP tokens the user has provided.
uint256 rewardDebt; // Reward debt. See explanation below.
//
// We do some f... | 52,320 |
193 | // Base URI for token URIs // OpenSea user account proxy // Minter addressess // mapping of each token id to poster type // mapping of each token id to rarity. 0 = common, 1 = rare, 2 = legendary / | constructor(string memory name_, string memory symbol_, string memory _initialBaseURI, address _openSeaProxyRegistryAddress, address[] memory _minters) ERC721Opt(name_, symbol_) {
baseURI = _initialBaseURI;
openSeaProxyRegistryAddress = _openSeaProxyRegistryAddress;
for (uint256 i; ... | constructor(string memory name_, string memory symbol_, string memory _initialBaseURI, address _openSeaProxyRegistryAddress, address[] memory _minters) ERC721Opt(name_, symbol_) {
baseURI = _initialBaseURI;
openSeaProxyRegistryAddress = _openSeaProxyRegistryAddress;
for (uint256 i; ... | 36,614 |
83 | // TODO: Instead of a single array of addresses, this should be a mapping or an array | // of objects of type { address: ...new_regulator, type: whitelisted_or_cusd }
address[] public regulators;
// Events
event CreatedRegulatorProxy(address newRegulator, uint256 index);
/**
*
* @dev generate a new proxyaddress that users can cast to a Regulator or RegulatorProxy. The
* p... | // of objects of type { address: ...new_regulator, type: whitelisted_or_cusd }
address[] public regulators;
// Events
event CreatedRegulatorProxy(address newRegulator, uint256 index);
/**
*
* @dev generate a new proxyaddress that users can cast to a Regulator or RegulatorProxy. The
* p... | 31,744 |
60 | // Send tokens from contract._address the address destination. _amount the specified amount for send. / | function sendFromContract(address _address, uint256 _amount) internal {
balances[this] = balances[this].sub(_amount);
balances[_address] = balances[_address].add(_amount);
Transfer(this, _address, _amount);
}
| function sendFromContract(address _address, uint256 _amount) internal {
balances[this] = balances[this].sub(_amount);
balances[_address] = balances[_address].add(_amount);
Transfer(this, _address, _amount);
}
| 19,180 |
318 | // save current index for this gov token | usersGovTokensIndexes[govToken][_to] = govTokensIndexes[govToken];
| usersGovTokensIndexes[govToken][_to] = govTokensIndexes[govToken];
| 61,606 |
105 | // Delete _price from sellOrderPrices[] if it&39;s the last order | if (self.sellOrders[_price].length == 0) {
uint fromArg = 99999;
for (ii = 0; ii < self.sellOrderPrices.length - 1; ii++) {
if (self.sellOrderPrices[ii] == _price) {
fromArg = ii;
}
| if (self.sellOrders[_price].length == 0) {
uint fromArg = 99999;
for (ii = 0; ii < self.sellOrderPrices.length - 1; ii++) {
if (self.sellOrderPrices[ii] == _price) {
fromArg = ii;
}
| 47,016 |
91 | // Determine what the account liquidity would be if the given amounts were redeemed/borrowed rTokenModify The market to hypothetically redeem/borrow in account The account to determine liquidity for redeemTokens The number of tokens to hypothetically redeem borrowAmount The amount of underlying to hypothetically borrow... | function getHypotheticalAccountLiquidityInternal(
address account,
RToken rTokenModify,
uint redeemTokens,
| function getHypotheticalAccountLiquidityInternal(
address account,
RToken rTokenModify,
uint redeemTokens,
| 27,936 |
0 | // DATA TYPES / Represents an market on an digitalAsset Object | struct Market {
string name;
uint256 marketType;
address holder;
string mediaId;
bool isValid;
}
| struct Market {
string name;
uint256 marketType;
address holder;
string mediaId;
bool isValid;
}
| 18,173 |
52 | // check balance | require( m_User_Map[msg.sender].Stacking_Amounts[period_id]>=stacking_amount);
Update_Global_Data();
Update_User(msg.sender);
uint256 old_stacking_amount=m_User_Map[msg.sender].Stacking_Amount;
bool res=false;
res=ERC20Interface(m_Stac... | require( m_User_Map[msg.sender].Stacking_Amounts[period_id]>=stacking_amount);
Update_Global_Data();
Update_User(msg.sender);
uint256 old_stacking_amount=m_User_Map[msg.sender].Stacking_Amount;
bool res=false;
res=ERC20Interface(m_Stac... | 26,755 |
3 | // Initialization function will initialize the initial values | constructor(address metadataAddress, address paymentAddress) ERC721("Astra Chipmunks Army", "ACA") {
PaymentAddress = paymentAddress;
MetadataAddress = metadataAddress;
// Generate first tokens for Alvxns & teams
saveMetadata(1, 0x00000a000e001c001b00110017000000000000000000... | constructor(address metadataAddress, address paymentAddress) ERC721("Astra Chipmunks Army", "ACA") {
PaymentAddress = paymentAddress;
MetadataAddress = metadataAddress;
// Generate first tokens for Alvxns & teams
saveMetadata(1, 0x00000a000e001c001b00110017000000000000000000... | 67,257 |
38 | // mapping to associate roll number with a roll object | mapping(uint256 => Roll) public rolls;
| mapping(uint256 => Roll) public rolls;
| 19,015 |
18 | // EVENTS // INTER-DOMAIN LINKS FUNCTIONS / add a new set of interd-domain links | function addIDLContext(string memory _e2etop) public returns (bool){
//string memory _log = "Inter-Domain Links distributed and E2E Topology updated";
string memory _status = "NEW_IDL";
e2e_topology = _e2etop;
// generates and event for all the peers except the owner to update the... | function addIDLContext(string memory _e2etop) public returns (bool){
//string memory _log = "Inter-Domain Links distributed and E2E Topology updated";
string memory _status = "NEW_IDL";
e2e_topology = _e2etop;
// generates and event for all the peers except the owner to update the... | 4,982 |
2 | // Constructor //_chainIdOrigin The id of the tracked Ethereum chain. / | constructor (uint256 _chainIdOrigin) public {
chainIdOrigin = _chainIdOrigin;
}
| constructor (uint256 _chainIdOrigin) public {
chainIdOrigin = _chainIdOrigin;
}
| 11,036 |
13 | // ProductProduct - a contract for my non-fungible product. / | abstract contract AccessControl is IAccessControl {
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
mapping(bytes32 => RoleData) private _roles;
struct RoleData {
mapping(address => bool) members;
bytes32 adminRole;
}
modifier onlyRole(bytes32 role) {
_checkRole(role);
... | abstract contract AccessControl is IAccessControl {
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
mapping(bytes32 => RoleData) private _roles;
struct RoleData {
mapping(address => bool) members;
bytes32 adminRole;
}
modifier onlyRole(bytes32 role) {
_checkRole(role);
... | 36,537 |
9 | // Destroy the contract and remove it from the blockchain. Only contract owner can destroy contract. Contract owner willreceive all of the funds that the contract currently holds./ | function suspendWithdrawals(uint time)
public
isOwner()
| function suspendWithdrawals(uint time)
public
isOwner()
| 22,027 |
36 | // Accessor functions per game | function getBid(uint gameId) constant public returns(uint) {
return games[gameId].bid;
}
| function getBid(uint gameId) constant public returns(uint) {
return games[gameId].bid;
}
| 50,963 |
25 | // 3. Convert the position's LP tokens to the underlying assets. | uint256 userBaseToken = lpBalance.mul(totalBaseToken).div(lpSupply);
uint256 userQuoteToken = lpBalance.mul(totalQuoteToken).div(lpSupply);
| uint256 userBaseToken = lpBalance.mul(totalBaseToken).div(lpSupply);
uint256 userQuoteToken = lpBalance.mul(totalQuoteToken).div(lpSupply);
| 29,081 |
170 | // get | function get_price() public view returns (uint256) {
return _price;
}
| function get_price() public view returns (uint256) {
return _price;
}
| 74,538 |
54 | // takes [t1,...,tM], [a1,...,aN] | {
uint[] memory balances = new uint[](tokens.length * accounts.length);
for (uint i = 0; i < tokens.length; i++) {
for (uint j = 0; j < accounts.length; j++) {
uint bal = ERC20BalanceOf(tokens[i]).balanceOf(accounts[j]);
balances[i * accounts.length + j] = bal;
//console.log(toke... | {
uint[] memory balances = new uint[](tokens.length * accounts.length);
for (uint i = 0; i < tokens.length; i++) {
for (uint j = 0; j < accounts.length; j++) {
uint bal = ERC20BalanceOf(tokens[i]).balanceOf(accounts[j]);
balances[i * accounts.length + j] = bal;
//console.log(toke... | 27,142 |
267 | // the sum of decimalsOfBond and decimalsOfOraclePrice of the bondMaker.This value is constant by the restriction of `_assertBondMakerDecimals`. / | uint8 internal constant DECIMALS_OF_BOND_VALUE = DECIMALS_OF_BOND +
DECIMALS_OF_ORACLE_PRICE;
| uint8 internal constant DECIMALS_OF_BOND_VALUE = DECIMALS_OF_BOND +
DECIMALS_OF_ORACLE_PRICE;
| 37,383 |
4 | // The header is an rlp-encoded list. The head item of that list is the 32-byte blockhash of the parent block. Based on how rlp works, we know that blockheaders always have the following form: 0xf9____a0PARENTHASH... ^ ^ ^ | | | | | +--- PARENTHASH is 32 bytes. rlpenc(PARENTHASH) is 0xa || PARENTHASH. | | | +--- 2 byte... |
bytes32 parentHash;
assembly {
parentHash := mload(add(header, 36)) // 36 = 32 byte offset for length prefix of ABI-encoded array
|
bytes32 parentHash;
assembly {
parentHash := mload(add(header, 36)) // 36 = 32 byte offset for length prefix of ABI-encoded array
| 8,555 |
11 | // Contract that will work with ERC223 tokens./ | contract ERC223Receiver {
/**
* @dev Standard ERC223 function that will handle incoming token transfers.
*
* @param _from Token sender address.
* @param _value Amount of tokens.
* @param _data Transaction metadata.
*/
function tokenFallback(address _from, uint _value, bytes _data) public;
}
| contract ERC223Receiver {
/**
* @dev Standard ERC223 function that will handle incoming token transfers.
*
* @param _from Token sender address.
* @param _value Amount of tokens.
* @param _data Transaction metadata.
*/
function tokenFallback(address _from, uint _value, bytes _data) public;
}
| 32,987 |
0 | // Nexus dependencies | _pooledStaking = IPooledStaking(INXMaster(_nxMaster).getLatestAddress("PS"));
_nxmToken = INXMToken(INXMaster(_nxMaster).tokenAddress());
_wNXMToken = IWNXMToken(_wNXMTokenAddress);
_nxmToken.approve(
INXMaster(_nxMaster).getLatestAddress("TC"),
PreciseUnitMath.M... | _pooledStaking = IPooledStaking(INXMaster(_nxMaster).getLatestAddress("PS"));
_nxmToken = INXMToken(INXMaster(_nxMaster).tokenAddress());
_wNXMToken = IWNXMToken(_wNXMTokenAddress);
_nxmToken.approve(
INXMaster(_nxMaster).getLatestAddress("TC"),
PreciseUnitMath.M... | 19,005 |
1 | // Initializer for upgradeable contract. Grant admin and pauser role to the sender. Grant minter role to portfolio and set precompile address _portfolioAddress of the portfolioSub _nativeMinterAddress of the NativeMinter precompile / | function initialize(address _portfolio, address _nativeMinter) public initializer {
require(_portfolio != address(0), "PM-ZADD-01");
__Pausable_init();
__AccessControl_init();
__ReentrancyGuard_init();
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
_grantRole(PAUSER_ROL... | function initialize(address _portfolio, address _nativeMinter) public initializer {
require(_portfolio != address(0), "PM-ZADD-01");
__Pausable_init();
__AccessControl_init();
__ReentrancyGuard_init();
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
_grantRole(PAUSER_ROL... | 34,746 |
122 | // Mint the recipient BPT comensurate with the value of their join in Underlying | _mintPoolTokens(recipient, bptToMint);
_require(bptToMint >= minBptOut, Errors.BPT_OUT_MIN_AMOUNT);
| _mintPoolTokens(recipient, bptToMint);
_require(bptToMint >= minBptOut, Errors.BPT_OUT_MIN_AMOUNT);
| 4,785 |
1,161 | // Activates a volume drip for the given (measure,dripToken) pair./self The VolumeDripManager state/measure The measure token/dripToken The drip token/periodSeconds The period of the volume drip in seconds/dripAmount The amount of tokens to drip each period/endTime The end time to set for the current period. | function activate(
State storage self,
address measure,
address dripToken,
uint32 periodSeconds,
uint112 dripAmount,
uint32 endTime
)
internal
returns (uint32)
| function activate(
State storage self,
address measure,
address dripToken,
uint32 periodSeconds,
uint112 dripAmount,
uint32 endTime
)
internal
returns (uint32)
| 16,645 |
185 | // 报价通道 | PriceChannel[] _channels;
| PriceChannel[] _channels;
| 30,484 |
1 | // pool deposit fee | uint256 public depositFee = 0;
address _lp = 0xC61ff48f94D801c1ceFaCE0289085197B5ec44F0;
address public rewards = 0x65207da01293C692a37f59D1D9b1624F0f21177c;
| uint256 public depositFee = 0;
address _lp = 0xC61ff48f94D801c1ceFaCE0289085197B5ec44F0;
address public rewards = 0x65207da01293C692a37f59D1D9b1624F0f21177c;
| 24,655 |
6 | // (fomo3d long only) fired whenever a player tries a reload after round timer hit zero, and causes end round to be ran. | event onReLoadAndDistribute
(
address playerAddress,
bytes32 playerName,
uint256 compressedData,
uint256 compressedIDs,
address winnerAddr,
bytes32 winnerName,
uint256 amountWon,
uint256 newPot,
| event onReLoadAndDistribute
(
address playerAddress,
bytes32 playerName,
uint256 compressedData,
uint256 compressedIDs,
address winnerAddr,
bytes32 winnerName,
uint256 amountWon,
uint256 newPot,
| 38,117 |
36 | // detect risk if reversePath provided | if (reversePath.length > 0) {
try ISwapTest(address(this))._testSellV3(routerAddress, reversePath, amountIn) {} catch Error(string memory reason) {
require(_stringCompare(reason, "T"), reason);
}
| if (reversePath.length > 0) {
try ISwapTest(address(this))._testSellV3(routerAddress, reversePath, amountIn) {} catch Error(string memory reason) {
require(_stringCompare(reason, "T"), reason);
}
| 15,077 |
578 | // DEFIBaseToken Monetary Supply Policy This is an implementation of the DEFIBaseToken Index Fund protocol. DEFIBaseToken operates symmetrically on expansion and contraction. It will both split and combine coins to maintain a stable unit price.This component regulates the token supply of the DEFIBaseToken ERC20 token i... | contract DEFIBaseTokenMonetaryPolicy is OwnableUpgradeSafe {
using SafeMath for uint256;
using SafeMathInt for int256;
using UInt256Lib for uint256;
event LogRebase(
uint256 indexed epoch,
uint256 exchangeRate,
uint256 mcap,
int256 requestedSupplyAdjustment,
uint... | contract DEFIBaseTokenMonetaryPolicy is OwnableUpgradeSafe {
using SafeMath for uint256;
using SafeMathInt for int256;
using UInt256Lib for uint256;
event LogRebase(
uint256 indexed epoch,
uint256 exchangeRate,
uint256 mcap,
int256 requestedSupplyAdjustment,
uint... | 42,943 |
163 | // BCDC with Governance. | contract BCDC is ERC20("BCDC", "BCDC"), Ownable {
/// @notice Creates `_amount` token to `_to`. Must only be called by the owner (GoldenTouch).
function mint(address _to, uint256 _amount) public onlyOwner {
_mint(_to, _amount);
_moveDelegates(address(0), _delegates[_to], _amount);
}
///... | contract BCDC is ERC20("BCDC", "BCDC"), Ownable {
/// @notice Creates `_amount` token to `_to`. Must only be called by the owner (GoldenTouch).
function mint(address _to, uint256 _amount) public onlyOwner {
_mint(_to, _amount);
_moveDelegates(address(0), _delegates[_to], _amount);
}
///... | 23,871 |
196 | // Enums ----------------------------------------------------------------------------------------------------------------- | enum OperationalMode {Normal, Exit}
//
// Variables
// -----------------------------------------------------------------------------------------------------------------
OperationalMode public operationalMode = OperationalMode.Normal;
BlockNumbUintsLib.BlockNumbUints private updateDelayBlocksBy... | enum OperationalMode {Normal, Exit}
//
// Variables
// -----------------------------------------------------------------------------------------------------------------
OperationalMode public operationalMode = OperationalMode.Normal;
BlockNumbUintsLib.BlockNumbUints private updateDelayBlocksBy... | 24,831 |
2 | // It allows users to harvest from pool _pid: poolId / | function harvestPool(uint8 _pid) external;
| function harvestPool(uint8 _pid) external;
| 37,477 |
656 | // Set ETH amount | amountETH = amountETHRequired;
| amountETH = amountETHRequired;
| 45,060 |
18 | // contracts/interfaces/IFundingLockerFactory.sol/ pragma solidity 0.6.11; / | interface IFundingLockerFactory {
function owner(address) external view returns (address);
function isLocker(address) external view returns (bool);
function factoryType() external view returns (uint8);
function newLocker(address) external returns (address);
}
| interface IFundingLockerFactory {
function owner(address) external view returns (address);
function isLocker(address) external view returns (bool);
function factoryType() external view returns (uint8);
function newLocker(address) external returns (address);
}
| 1,533 |
107 | // Return the sell price of 1 individual token. / | function buyPrice()
public
view
returns(uint256)
| function buyPrice()
public
view
returns(uint256)
| 26,534 |
2 | // The project to which the redeemed tokens are associated. | uint256 projectId;
| uint256 projectId;
| 9,541 |
65 | // check if the milestone requires user to be whitelisted | if (whitelistedMilestones[milestoneIndex]) {
require(whitelist[_msgSender()], "The address must be whitelisted!");
}
| if (whitelistedMilestones[milestoneIndex]) {
require(whitelist[_msgSender()], "The address must be whitelisted!");
}
| 14,735 |
122 | // StakeStake asset-backed tokens / | function stake(uint256 value, address assetAdd)
public
whenNotPaused
returns(bool)
| function stake(uint256 value, address assetAdd)
public
whenNotPaused
returns(bool)
| 7,322 |
164 | // this will mean a service provider could start the program again with stakeServiceProviderBond() | isServiceProviderFullySetup = false;
| isServiceProviderFullySetup = false;
| 26,597 |
98 | // NOTE: Don't take performance fee in this scenario | } else {
| } else {
| 2,957 |
24 | // Update devAddr newValue address / | function updateDevAddr(address newValue) public onlyDev {
emit UpdateDevAddr(devAddr, newValue);
devAddr = newValue;
}
| function updateDevAddr(address newValue) public onlyDev {
emit UpdateDevAddr(devAddr, newValue);
devAddr = newValue;
}
| 2,401 |
79 | // CrowdSale reward | uint256 public constant CROWDSALE_TOKENS_NUMS = 67500000*TOKEN_UNIT;
| uint256 public constant CROWDSALE_TOKENS_NUMS = 67500000*TOKEN_UNIT;
| 75,964 |
14 | // loan period is in days so we convert to seconds, (606024 = 600) | uint256 loanPeriodSeconds = loanPeriod * 86400;
require(block.timestamp > (loanTime + loanPeriodSeconds), "Must have loaned banker for full loan time period");
uint256 rewardTime;
if (loanTime > 0) {
rewardTime = (loanTime - bankerIdToTimeStamp[bankerId... | uint256 loanPeriodSeconds = loanPeriod * 86400;
require(block.timestamp > (loanTime + loanPeriodSeconds), "Must have loaned banker for full loan time period");
uint256 rewardTime;
if (loanTime > 0) {
rewardTime = (loanTime - bankerIdToTimeStamp[bankerId... | 79,590 |
341 | // Selector of `log(bool,bool,address,uint256)`. | mstore(0x00, 0x4c123d57)
mstore(0x20, p0)
mstore(0x40, p1)
mstore(0x60, p2)
mstore(0x80, p3)
| mstore(0x00, 0x4c123d57)
mstore(0x20, p0)
mstore(0x40, p1)
mstore(0x60, p2)
mstore(0x80, p3)
| 30,603 |
188 | // Expiration time of the transaction | uint256 expiration;
| uint256 expiration;
| 2,005 |
38 | // staking not started | if (block.number < poolInfo.tokenAllocationStartBlock) {
return;
}
| if (block.number < poolInfo.tokenAllocationStartBlock) {
return;
}
| 72,216 |
276 | // fetches all the pools data/ return uint256 VUreinsurnacePool/ return uint256 LUreinsurnacePool/ return uint256 LUleveragePool/ return uint256 user leverage pool address | function getPoolsData()
external
view
returns (
uint256,
uint256,
uint256,
address
);
| function getPoolsData()
external
view
returns (
uint256,
uint256,
uint256,
address
);
| 50,650 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.