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
|
---|---|---|---|---|
20 | // OwnedUpgradeabilityStorage This is the storage necessary to perform upgradeable contracts.This means, required state variables for upgradeability purpose and eternal storage per se. / | contract OwnedUpgradeabilityStorage is UpgradeabilityOwnerStorage, UpgradeabilityStorage, EternalStorage {}
// File: contracts/SafeMath.sol
// Roman Storm Multi Sender
// To Use this Dapp: https://rstormsf.github.io/multisender
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
| contract OwnedUpgradeabilityStorage is UpgradeabilityOwnerStorage, UpgradeabilityStorage, EternalStorage {}
// File: contracts/SafeMath.sol
// Roman Storm Multi Sender
// To Use this Dapp: https://rstormsf.github.io/multisender
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
| 18,231 |
38 | // File: openzeppelin-solidity/contracts/token/ERC20/StandardToken.sol/ Standard ERC20 tokenImplementation of the basic standard token. / | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev 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 reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint _addedValue
)
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint _subtractedValue
)
public
returns (bool)
{
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
| contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev 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 reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint _addedValue
)
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint _subtractedValue
)
public
returns (bool)
{
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
| 78,075 |
165 | // Triggered whenever someone stakes tokens | event Staked(
address indexed user,
uint256 amount
);
| event Staked(
address indexed user,
uint256 amount
);
| 24,361 |
21 | // PUBLIC METHODS / | function feePercentageInfo() public override view returns (uint256, address) {
return (_feePercentage, IMVDProxy(IDoubleProxy(_doubleProxy).proxy()).getMVDWalletAddress());
}
| function feePercentageInfo() public override view returns (uint256, address) {
return (_feePercentage, IMVDProxy(IDoubleProxy(_doubleProxy).proxy()).getMVDWalletAddress());
}
| 36,636 |
76 | // Emitted when a round ends. / | event RoundEnded(
uint indexed maxExpiryTimestamp,
uint pricePerToken,
uint totalQuoteAmountReserved,
uint tokensBurnableForRound
);
| event RoundEnded(
uint indexed maxExpiryTimestamp,
uint pricePerToken,
uint totalQuoteAmountReserved,
uint tokensBurnableForRound
);
| 42,330 |
12 | // Overrides the supportsInterface function in three base contracts./ Explicitly points to ERC165Storage to reference _supportsInterfaces mapping./ interfaceId The interfaceId to check support for. | function supportsInterface(bytes4 interfaceId)
public
view
override(ERC165Storage, ERC2981, ERC721Enumerable)
returns (bool)
| function supportsInterface(bytes4 interfaceId)
public
view
override(ERC165Storage, ERC2981, ERC721Enumerable)
returns (bool)
| 29,275 |
11 | // Transferable Mapping from TokenId => bool | mapping(uint256 => bool) private isTransferableMapping;
mapping(uint256 => bool) private isAllowListRequiredMapping;
/*///////////////////////////////////////////////////////////////
Events
| mapping(uint256 => bool) private isTransferableMapping;
mapping(uint256 => bool) private isAllowListRequiredMapping;
/*///////////////////////////////////////////////////////////////
Events
| 22,254 |
23 | // BasicCoin, ECR20 tokens that all belong to the owner for sending around | contract BasicCoin is Owned, Token {
// this is as basic as can be, only the associated balance & allowances
struct Account {
uint balance;
mapping (address => uint) allowanceOf;
}
// the balance should be available
modifier when_owns(address _owner, uint _amount) {
if (accounts[_owner].balance < _amount) throw;
_;
}
// an allowance should be available
modifier when_has_allowance(address _owner, address _spender, uint _amount) {
if (accounts[_owner].allowanceOf[_spender] < _amount) throw;
_;
}
// no ETH should be sent with the transaction
modifier when_no_eth {
if (msg.value > 0) throw;
_;
}
// a value should be > 0
modifier when_non_zero(uint _value) {
if (_value == 0) throw;
_;
}
// the base, tokens denoted in micros
uint constant public base = 1000000;
// available token supply
uint public totalSupply;
// storage and mapping of all balances & allowances
mapping (address => Account) accounts;
// constructor sets the parameters of execution, _totalSupply is all units
function BasicCoin(uint _totalSupply, address _owner) when_no_eth when_non_zero(_totalSupply) {
totalSupply = _totalSupply;
owner = _owner;
accounts[_owner].balance = totalSupply;
}
// balance of a specific address
function balanceOf(address _who) constant returns (uint256) {
return accounts[_who].balance;
}
// transfer
function transfer(address _to, uint256 _value) when_no_eth when_owns(msg.sender, _value) returns (bool) {
Transfer(msg.sender, _to, _value);
accounts[msg.sender].balance -= _value;
accounts[_to].balance += _value;
return true;
}
// transfer via allowance
function transferFrom(address _from, address _to, uint256 _value) when_no_eth when_owns(_from, _value) when_has_allowance(_from, msg.sender, _value) returns (bool) {
Transfer(_from, _to, _value);
accounts[_from].allowanceOf[msg.sender] -= _value;
accounts[_from].balance -= _value;
accounts[_to].balance += _value;
return true;
}
// approve allowances
function approve(address _spender, uint256 _value) when_no_eth returns (bool) {
Approval(msg.sender, _spender, _value);
accounts[msg.sender].allowanceOf[_spender] += _value;
return true;
}
// available allowance
function allowance(address _owner, address _spender) constant returns (uint256) {
return accounts[_owner].allowanceOf[_spender];
}
// no default function, simple contract only, entry-level users
function() {
throw;
}
}
| contract BasicCoin is Owned, Token {
// this is as basic as can be, only the associated balance & allowances
struct Account {
uint balance;
mapping (address => uint) allowanceOf;
}
// the balance should be available
modifier when_owns(address _owner, uint _amount) {
if (accounts[_owner].balance < _amount) throw;
_;
}
// an allowance should be available
modifier when_has_allowance(address _owner, address _spender, uint _amount) {
if (accounts[_owner].allowanceOf[_spender] < _amount) throw;
_;
}
// no ETH should be sent with the transaction
modifier when_no_eth {
if (msg.value > 0) throw;
_;
}
// a value should be > 0
modifier when_non_zero(uint _value) {
if (_value == 0) throw;
_;
}
// the base, tokens denoted in micros
uint constant public base = 1000000;
// available token supply
uint public totalSupply;
// storage and mapping of all balances & allowances
mapping (address => Account) accounts;
// constructor sets the parameters of execution, _totalSupply is all units
function BasicCoin(uint _totalSupply, address _owner) when_no_eth when_non_zero(_totalSupply) {
totalSupply = _totalSupply;
owner = _owner;
accounts[_owner].balance = totalSupply;
}
// balance of a specific address
function balanceOf(address _who) constant returns (uint256) {
return accounts[_who].balance;
}
// transfer
function transfer(address _to, uint256 _value) when_no_eth when_owns(msg.sender, _value) returns (bool) {
Transfer(msg.sender, _to, _value);
accounts[msg.sender].balance -= _value;
accounts[_to].balance += _value;
return true;
}
// transfer via allowance
function transferFrom(address _from, address _to, uint256 _value) when_no_eth when_owns(_from, _value) when_has_allowance(_from, msg.sender, _value) returns (bool) {
Transfer(_from, _to, _value);
accounts[_from].allowanceOf[msg.sender] -= _value;
accounts[_from].balance -= _value;
accounts[_to].balance += _value;
return true;
}
// approve allowances
function approve(address _spender, uint256 _value) when_no_eth returns (bool) {
Approval(msg.sender, _spender, _value);
accounts[msg.sender].allowanceOf[_spender] += _value;
return true;
}
// available allowance
function allowance(address _owner, address _spender) constant returns (uint256) {
return accounts[_owner].allowanceOf[_spender];
}
// no default function, simple contract only, entry-level users
function() {
throw;
}
}
| 4,036 |
108 | // Update token balance in storage | balances[_j] = y;
balances[_i] = _balances[_i];
uint256 fee = swapFee;
if (fee > 0) {
dy = dy.sub(dy.mul(fee).div(feeDenominator));
}
| balances[_j] = y;
balances[_i] = _balances[_i];
uint256 fee = swapFee;
if (fee > 0) {
dy = dy.sub(dy.mul(fee).div(feeDenominator));
}
| 65,525 |
6 | // This payable function is used to receive amount which will be given to the token holders as dividend This function can be run by anyone transferring the native currency into the contract. This private function is used to distribute PLS dividend among the token holders / | receive() external payable {
// this function can only be run after mint process is complete
// and ownership has been revoked
if (owner() != address(0)) {
revert HasAdmin(owner());
}
uint256 amount = msg.value;
uint256 supply = totalSupply();
if (supply == 0) {
revert SupplyMissing();
}
magnifiedDividendPerShare += ((amount * magnitude) / supply);
emit DistributeDividend(_msgSender(), amount);
}
| receive() external payable {
// this function can only be run after mint process is complete
// and ownership has been revoked
if (owner() != address(0)) {
revert HasAdmin(owner());
}
uint256 amount = msg.value;
uint256 supply = totalSupply();
if (supply == 0) {
revert SupplyMissing();
}
magnifiedDividendPerShare += ((amount * magnitude) / supply);
emit DistributeDividend(_msgSender(), amount);
}
| 10,639 |
60 | // this tracks the match outcome, and is assigned to reduce gas costs | uint8 winningTeam = winner[i];
require(winningTeam < 3);
| uint8 winningTeam = winner[i];
require(winningTeam < 3);
| 11,001 |
56 | // users could create staking-reward model with this contract at single mode / | contract SimpleStaking is Ownable {
using SafeMath for uint;
uint constant doubleScale = 10 ** 36;
// stake token
IERC20 public stakeToken;
// reward token
IERC20 public rewardToken;
// the number of reward token distribution for each block
uint public rewardSpeed;
// user deposit
mapping(address => uint) public userCollateral;
uint public totalCollateral;
// use index to distribute reward token
// index is compound exponential
mapping(address => uint) public userIndex;
uint public index;
mapping(address => uint) public userAccrued;
// record latest block height of reward token distributed
uint public lastDistributedBlock;
/* event */
event Deposit(address user, uint amount);
event Withdraw(address user, uint amount);
event RewardSpeedUpdated(uint oldSpeed, uint newSpeed);
event RewardDistributed(address indexed user, uint delta, uint index);
constructor(IERC20 _stakeToken, IERC20 _rewardToken) Ownable(){
stakeToken = _stakeToken;
rewardToken = _rewardToken;
index = doubleScale;
}
function deposit(uint amount) public {
updateIndex();
distributeReward(msg.sender);
require(stakeToken.transferFrom(msg.sender, address(this), amount), "transferFrom failed");
userCollateral[msg.sender] = userCollateral[msg.sender].add(amount);
totalCollateral = totalCollateral.add(amount);
emit Deposit(msg.sender, amount);
}
function withdraw(uint amount) public {
updateIndex();
distributeReward(msg.sender);
require(stakeToken.transfer(msg.sender, amount), "transfer failed");
userCollateral[msg.sender] = userCollateral[msg.sender].sub(amount);
totalCollateral = totalCollateral.sub(amount);
emit Withdraw(msg.sender, amount);
}
function setRewardSpeed(uint speed) public onlyOwner {
updateIndex();
uint oldSpeed = rewardSpeed;
rewardSpeed = speed;
emit RewardSpeedUpdated(oldSpeed, speed);
}
function updateIndex() private {
uint blockDelta = block.number.sub(lastDistributedBlock);
if (blockDelta == 0) {
return;
}
uint rewardAccrued = blockDelta.mul(rewardSpeed);
if (totalCollateral > 0) {
uint indexDelta = rewardAccrued.mul(doubleScale).div(totalCollateral);
index = index.add(indexDelta);
}
lastDistributedBlock = block.number;
}
function distributeReward(address user) private {
if (userIndex[user] == 0 && index > 0) {
userIndex[user] = doubleScale;
}
uint indexDelta = index - userIndex[user];
userIndex[user] = index;
uint rewardDelta = indexDelta.mul(userCollateral[user]).div(doubleScale);
userAccrued[user] = userAccrued[user].add(rewardDelta);
if (rewardToken.balanceOf(address(this)) >= userAccrued[user] && userAccrued[user] > 0) {
if (rewardToken.transfer(user, userAccrued[user])) {
userAccrued[user] = 0;
}
}
emit RewardDistributed(user, rewardDelta, index);
}
function claimReward(address[] memory user) public {
updateIndex();
for (uint i = 0; i < user.length; i++) {
distributeReward(user[i]);
}
}
function withdrawRemainReward() public onlyOwner {
uint balance = rewardToken.balanceOf(address(this));
rewardToken.transfer(owner(), balance);
}
function pendingReward(address user) public view returns (uint){
uint blockDelta = block.number.sub(lastDistributedBlock);
uint rewardAccrued = blockDelta.mul(rewardSpeed);
if (totalCollateral == 0) {
return userAccrued[user];
}
uint ratio = rewardAccrued.mul(doubleScale).div(totalCollateral);
uint currentIndex = index.add(ratio);
uint uIndex = userIndex[user] == 0 && index > 0 ? doubleScale : userIndex[user];
uint indexDelta = currentIndex - uIndex;
uint rewardDelta = indexDelta.mul(userCollateral[user]).div(doubleScale);
return rewardDelta + userAccrued[user];
}
} | contract SimpleStaking is Ownable {
using SafeMath for uint;
uint constant doubleScale = 10 ** 36;
// stake token
IERC20 public stakeToken;
// reward token
IERC20 public rewardToken;
// the number of reward token distribution for each block
uint public rewardSpeed;
// user deposit
mapping(address => uint) public userCollateral;
uint public totalCollateral;
// use index to distribute reward token
// index is compound exponential
mapping(address => uint) public userIndex;
uint public index;
mapping(address => uint) public userAccrued;
// record latest block height of reward token distributed
uint public lastDistributedBlock;
/* event */
event Deposit(address user, uint amount);
event Withdraw(address user, uint amount);
event RewardSpeedUpdated(uint oldSpeed, uint newSpeed);
event RewardDistributed(address indexed user, uint delta, uint index);
constructor(IERC20 _stakeToken, IERC20 _rewardToken) Ownable(){
stakeToken = _stakeToken;
rewardToken = _rewardToken;
index = doubleScale;
}
function deposit(uint amount) public {
updateIndex();
distributeReward(msg.sender);
require(stakeToken.transferFrom(msg.sender, address(this), amount), "transferFrom failed");
userCollateral[msg.sender] = userCollateral[msg.sender].add(amount);
totalCollateral = totalCollateral.add(amount);
emit Deposit(msg.sender, amount);
}
function withdraw(uint amount) public {
updateIndex();
distributeReward(msg.sender);
require(stakeToken.transfer(msg.sender, amount), "transfer failed");
userCollateral[msg.sender] = userCollateral[msg.sender].sub(amount);
totalCollateral = totalCollateral.sub(amount);
emit Withdraw(msg.sender, amount);
}
function setRewardSpeed(uint speed) public onlyOwner {
updateIndex();
uint oldSpeed = rewardSpeed;
rewardSpeed = speed;
emit RewardSpeedUpdated(oldSpeed, speed);
}
function updateIndex() private {
uint blockDelta = block.number.sub(lastDistributedBlock);
if (blockDelta == 0) {
return;
}
uint rewardAccrued = blockDelta.mul(rewardSpeed);
if (totalCollateral > 0) {
uint indexDelta = rewardAccrued.mul(doubleScale).div(totalCollateral);
index = index.add(indexDelta);
}
lastDistributedBlock = block.number;
}
function distributeReward(address user) private {
if (userIndex[user] == 0 && index > 0) {
userIndex[user] = doubleScale;
}
uint indexDelta = index - userIndex[user];
userIndex[user] = index;
uint rewardDelta = indexDelta.mul(userCollateral[user]).div(doubleScale);
userAccrued[user] = userAccrued[user].add(rewardDelta);
if (rewardToken.balanceOf(address(this)) >= userAccrued[user] && userAccrued[user] > 0) {
if (rewardToken.transfer(user, userAccrued[user])) {
userAccrued[user] = 0;
}
}
emit RewardDistributed(user, rewardDelta, index);
}
function claimReward(address[] memory user) public {
updateIndex();
for (uint i = 0; i < user.length; i++) {
distributeReward(user[i]);
}
}
function withdrawRemainReward() public onlyOwner {
uint balance = rewardToken.balanceOf(address(this));
rewardToken.transfer(owner(), balance);
}
function pendingReward(address user) public view returns (uint){
uint blockDelta = block.number.sub(lastDistributedBlock);
uint rewardAccrued = blockDelta.mul(rewardSpeed);
if (totalCollateral == 0) {
return userAccrued[user];
}
uint ratio = rewardAccrued.mul(doubleScale).div(totalCollateral);
uint currentIndex = index.add(ratio);
uint uIndex = userIndex[user] == 0 && index > 0 ? doubleScale : userIndex[user];
uint indexDelta = currentIndex - uIndex;
uint rewardDelta = indexDelta.mul(userCollateral[user]).div(doubleScale);
return rewardDelta + userAccrued[user];
}
} | 28,697 |
217 | // take liquidity fee, keep a half token halfLiquidityToken = totalAmount(liquidityFee/2totalFee) | uint256 tokensToAddLiquidityWith = contractTokenBalance.div(totalFees.mul(2)).mul(liquidityFee);
| uint256 tokensToAddLiquidityWith = contractTokenBalance.div(totalFees.mul(2)).mul(liquidityFee);
| 19,312 |
20 | // replace the players character by the last one | if (nchars > i + 1) {
playerBalance += characters[ids[i]].value;
removed[count] = ids[i];
count++;
nchars--;
replaceCharacter(i, nchars);
}
| if (nchars > i + 1) {
playerBalance += characters[ids[i]].value;
removed[count] = ids[i];
count++;
nchars--;
replaceCharacter(i, nchars);
}
| 49,275 |
61 | // Pauses or unpauses execution of ERC-20 transactions. paused Pauses ERC-20 transactions if this is true. / | function setTokenPaused(bool paused) external onlyOwner {
tokenPaused = paused;
emit LogTokenPaused(paused);
}
| function setTokenPaused(bool paused) external onlyOwner {
tokenPaused = paused;
emit LogTokenPaused(paused);
}
| 11,120 |
48 | // Freeze token transfers.May only be called by smart contract owner. / | function freezeTransfers () public {
require (msg.sender == owner);
if (!frozen) {
frozen = true;
Freeze ();
}
}
| function freezeTransfers () public {
require (msg.sender == owner);
if (!frozen) {
frozen = true;
Freeze ();
}
}
| 73,743 |
671 | // computes the nearest integer to a given quotient without overflowing or underflowing. / | function roundDiv(uint256 _n, uint256 _d) internal pure returns (uint256) {
return _n / _d + (_n % _d) / (_d - _d / 2);
}
| function roundDiv(uint256 _n, uint256 _d) internal pure returns (uint256) {
return _n / _d + (_n % _d) / (_d - _d / 2);
}
| 51,649 |
30 | // MSJ: Function to verify address is registered | function isAirlineRegistered(address airline) external view returns(bool)
| function isAirlineRegistered(address airline) external view returns(bool)
| 21,256 |
35 | // trading token0 for token1 | require(balance0 > _reserve0, 'TP08');
uint256 amount0In = balance0 - _reserve0;
emit Swap(msg.sender, amount0In, 0, 0, amount1Out, to);
uint256 fee0 = amount0In.mul(swapFee).div(PRECISION);
uint256 balance0After = balance0.sub(fee0);
uint256 balance1After = ITwapOracle(oracle).tradeX(balance0After, _reserve0, _reserve1, data);
require(balance1 >= balance1After, 'TP2E');
uint256 fee1 = balance1.sub(balance1After);
| require(balance0 > _reserve0, 'TP08');
uint256 amount0In = balance0 - _reserve0;
emit Swap(msg.sender, amount0In, 0, 0, amount1Out, to);
uint256 fee0 = amount0In.mul(swapFee).div(PRECISION);
uint256 balance0After = balance0.sub(fee0);
uint256 balance1After = ITwapOracle(oracle).tradeX(balance0After, _reserve0, _reserve1, data);
require(balance1 >= balance1After, 'TP2E');
uint256 fee1 = balance1.sub(balance1After);
| 57,668 |
37 | // ERC20 // Issues tokens to allowlisted investors to Investor address to issue tokens to amount Amount of tokens to issue | * @dev - Emits {Transfer} event
*
* Can only be called:
* - by transfer agents
* - AFTER token has launched
* - when token is active and cap table is unlocked (via `_beforeTokenTransfer` hook)
*/
function mint(address to, uint256 amount)
public
onlyAfterLaunch
onlyTransferAgent
isAllowlistedInvestor(to)
returns (bool)
{
super._mint(to, amount);
return true;
}
| * @dev - Emits {Transfer} event
*
* Can only be called:
* - by transfer agents
* - AFTER token has launched
* - when token is active and cap table is unlocked (via `_beforeTokenTransfer` hook)
*/
function mint(address to, uint256 amount)
public
onlyAfterLaunch
onlyTransferAgent
isAllowlistedInvestor(to)
returns (bool)
{
super._mint(to, amount);
return true;
}
| 14,471 |
78 | // Solidity already throws when dividing by 0. | return a / b;
| return a / b;
| 816 |
17 | // report stakes the same amount so inital stake amount should be 2x now | tracker.internalContribute (_reporter, this, initialStakeAmount);
totalStakeAmount+=initialStakeAmount; //double take amount
emit Success(3, arbitrateAddr);
return true;
| tracker.internalContribute (_reporter, this, initialStakeAmount);
totalStakeAmount+=initialStakeAmount; //double take amount
emit Success(3, arbitrateAddr);
return true;
| 32,200 |
165 | // Update the swap router.Can only be called by the current operator. / | function updateuniSwapRouter(address _router) public onlyOperator {
uniSwapRouter = IUniswapV2Router02(_router);
uniSwapPair = IUniswapV2Factory(uniSwapRouter.factory()).getPair(address(this), uniSwapRouter.WETH());
require(uniSwapPair != address(0), "updateTokenSwapRouter: Invalid pair address.");
emit uniSwapRouterUpdated(msg.sender, address(uniSwapRouter), uniSwapPair);
}
| function updateuniSwapRouter(address _router) public onlyOperator {
uniSwapRouter = IUniswapV2Router02(_router);
uniSwapPair = IUniswapV2Factory(uniSwapRouter.factory()).getPair(address(this), uniSwapRouter.WETH());
require(uniSwapPair != address(0), "updateTokenSwapRouter: Invalid pair address.");
emit uniSwapRouterUpdated(msg.sender, address(uniSwapRouter), uniSwapPair);
}
| 23,988 |
3 | // Reverts if `n` does not fit in a `uint96`. | function toUint96(uint256 n) internal pure returns (uint96) {
if (n > type(uint96).max) revert UnsafeCast(n);
return uint96(n);
}
| function toUint96(uint256 n) internal pure returns (uint96) {
if (n > type(uint96).max) revert UnsafeCast(n);
return uint96(n);
}
| 33,935 |
140 | // Match complementary orders that have a profitable spread./Each order is filled at their respective price point, and/the matcher receives a profit denominated in the left maker asset./leftOrders Set of orders with the same maker / taker asset./rightOrders Set of orders to match against `leftOrders`/leftSignatures Proof that left orders were created by the left makers./rightSignatures Proof that right orders were created by the right makers./ return batchMatchedFillResults Amounts filled and profit generated. | function batchMatchOrders(
LibOrder.Order[] memory leftOrders,
LibOrder.Order[] memory rightOrders,
bytes[] memory leftSignatures,
bytes[] memory rightSignatures
)
public
payable
returns (LibFillResults.BatchMatchedFillResults memory batchMatchedFillResults);
| function batchMatchOrders(
LibOrder.Order[] memory leftOrders,
LibOrder.Order[] memory rightOrders,
bytes[] memory leftSignatures,
bytes[] memory rightSignatures
)
public
payable
returns (LibFillResults.BatchMatchedFillResults memory batchMatchedFillResults);
| 44,355 |
78 | // Decrease the total amount that's been paid out to maintain invariance. | totalPayouts -= payoutDiff;
| totalPayouts -= payoutDiff;
| 60,010 |
28 | // push a request to the land owner | // function requstToLandOwner(uint id) public {
// require(_LandRegistry[_msgSender()].land[id].isAvailable);
// _LandRegistry[_msgSender()].land[id].requester=msg.sender;
// _LandRegistry[_msgSender()].land[id].isAvailable=false;
// _LandRegistry[_msgSender()].land[id].requestStatus = reqStatus.pending; //changes the status to pending.
// }
| // function requstToLandOwner(uint id) public {
// require(_LandRegistry[_msgSender()].land[id].isAvailable);
// _LandRegistry[_msgSender()].land[id].requester=msg.sender;
// _LandRegistry[_msgSender()].land[id].isAvailable=false;
// _LandRegistry[_msgSender()].land[id].requestStatus = reqStatus.pending; //changes the status to pending.
// }
| 47,519 |
108 | // 減資数量が対象アドレスのロック数量を上回っている場合はエラー | if (lockedOf(_locked_address, _target_address) < _amount) revert();
| if (lockedOf(_locked_address, _target_address) < _amount) revert();
| 45,193 |
13 | // Give buyer | token = ERC20(idToOffer[_id].offeredContract);
token.transfer(msg.sender, idToOffer[_id].offeredAmount);
idToOffer[_id].buyer = msg.sender;
idToOffer[_id].status = 1;
| token = ERC20(idToOffer[_id].offeredContract);
token.transfer(msg.sender, idToOffer[_id].offeredAmount);
idToOffer[_id].buyer = msg.sender;
idToOffer[_id].status = 1;
| 16,599 |
69 | // Function to be called by top level contract to prevent being initialized.Useful for freezing base contracts when they're used behind proxies./ | function petrify() internal onlyInit {
initializedAt(PETRIFIED_BLOCK);
}
| function petrify() internal onlyInit {
initializedAt(PETRIFIED_BLOCK);
}
| 9,780 |
255 | // enforce that maxValue is greater than or equal to minValue | require(leverMaxValues[k] >= leverMinValues[k], "Max val must >= min");
| require(leverMaxValues[k] >= leverMinValues[k], "Max val must >= min");
| 28,439 |
469 | // collateral_equivalent_d18 = collateral_equivalent_d18.sub((collateral_equivalent_d18.mul(params.buyback_fee)).div(1e6)); |
return (
collateral_equivalent_d18
);
|
return (
collateral_equivalent_d18
);
| 31,211 |
3 | // Human 0.1 standard. Just an arbitrary versioning scheme. | string public constant version = 'H0.1';
uint constant public TOKEN_COST_PER_SWEEPSTAKES = 1;
function PryzeToken(
uint256 _initialAmount
| string public constant version = 'H0.1';
uint constant public TOKEN_COST_PER_SWEEPSTAKES = 1;
function PryzeToken(
uint256 _initialAmount
| 121 |
107 | // Reorg all tokens array | uint256 tokenIndex = allTokensIndex[_tokenId];
uint256 lastTokenIndex = allTokens.length.sub(1);
uint256 lastToken = allTokens[lastTokenIndex];
allTokens[tokenIndex] = lastToken;
allTokens[lastTokenIndex] = 0;
allTokens.length--;
allTokensIndex[_tokenId] = 0;
allTokensIndex[lastToken] = tokenIndex;
| uint256 tokenIndex = allTokensIndex[_tokenId];
uint256 lastTokenIndex = allTokens.length.sub(1);
uint256 lastToken = allTokens[lastTokenIndex];
allTokens[tokenIndex] = lastToken;
allTokens[lastTokenIndex] = 0;
allTokens.length--;
allTokensIndex[_tokenId] = 0;
allTokensIndex[lastToken] = tokenIndex;
| 39,980 |
69 | // Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call:- if using `revokeRole`, it is the admin role bearer- if using `renounceRole`, it is the role bearer (i.e. `account`) / | event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
| event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
| 2,068 |
12 | // If already abandoned throw an error // Work out a refund per share per share // Enum all accounts and send them refund // Calculate how much goes to this shareholder // Allocate appropriate amount of fund to them // Audit the abandonment / There should be no money left, but withdraw just incase for manual resolution | uint256 remainder = this.balance.sub(totalAbandoned);
if (remainder > 0)
if (!msg.sender.send(remainder))
| uint256 remainder = this.balance.sub(totalAbandoned);
if (remainder > 0)
if (!msg.sender.send(remainder))
| 31,983 |
4 | // beneficiary Receives all the money (when finalizing Round1 & Round2) | 0x9a1Fc7173086412A10dE27A9d1d543af3AB68262,
| 0x9a1Fc7173086412A10dE27A9d1d543af3AB68262,
| 27,727 |
0 | // Store internals // Store Events / | struct Customer {
address adr;
bytes32 name;
uint256 balance;
Cart cart;
}
| struct Customer {
address adr;
bytes32 name;
uint256 balance;
Cart cart;
}
| 6,440 |
2 | // Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend). | function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SUB_ERROR");
uint256 c = a - b;
return c;
}
| function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SUB_ERROR");
uint256 c = a - b;
return c;
}
| 48,545 |
4 | // Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by theimplementation. It is used to validate that the this implementation remains valid after an upgrade. IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risksbricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that thisfunction revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier. / | function proxiableUUID() external view virtual override notDelegated returns (bytes32) {
return _IMPLEMENTATION_SECONDARY_SLOT;
}
| function proxiableUUID() external view virtual override notDelegated returns (bytes32) {
return _IMPLEMENTATION_SECONDARY_SLOT;
}
| 33,963 |
118 | // If 1inch return 0, check from Bancor network for ensure this is not a Bancor pool | uint256 oneInchResult = getValueViaOneInch(_from, _to, _amount);
if(oneInchResult > 0)
return oneInchResult;
| uint256 oneInchResult = getValueViaOneInch(_from, _to, _amount);
if(oneInchResult > 0)
return oneInchResult;
| 15,021 |
87 | // Returns true if the caller is the current registryAdmin. / | function isRegistryAdmin() public view returns (bool) {
return _msgSender() == _registryAdmin;
}
| function isRegistryAdmin() public view returns (bool) {
return _msgSender() == _registryAdmin;
}
| 32,607 |
5 | // Sets the address of the ERC20 precompiled contract for GLMR Sets the address of the ERC20 precompiled contract for GLMR _glmr The new GLMR contract address / | function setGLMR(IERC20 _glmr) external onlyOwner {
glmr = _glmr;
}
| function setGLMR(IERC20 _glmr) external onlyOwner {
glmr = _glmr;
}
| 23,195 |
19 | // revert if too late | require(
lockTime + lockWindow >= block.timestamp,
"the lock window has expired"
);
| require(
lockTime + lockWindow >= block.timestamp,
"the lock window has expired"
);
| 18,946 |
130 | // actually retrieve the code, this needs assembly | extcodecopy(_addr, add(outCode, 0x20), 0, size)
| extcodecopy(_addr, add(outCode, 0x20), 0, size)
| 26,160 |
27 | // OrderedSet of active token contracts | RankedAddressSet.Set private _rankedContracts;
| RankedAddressSet.Set private _rankedContracts;
| 8,198 |
4 | // StorageV2 | struct Market {
/// @notice Whether or not this market is listed
bool isListed;
/**
* @notice Multiplier representing the most one can borrow against their collateral in this market.
* For instance, 0.9 to allow borrowing 90% of collateral value.
* Must be between 0 and 1, and stored as a mantissa.
*/
uint collateralFactorMantissa;
/// @notice Per-market mapping of "accounts in this asset"
mapping(address => bool) accountMembership;
/// @notice Whether or not this market receives PAR
bool isPared;
}
| struct Market {
/// @notice Whether or not this market is listed
bool isListed;
/**
* @notice Multiplier representing the most one can borrow against their collateral in this market.
* For instance, 0.9 to allow borrowing 90% of collateral value.
* Must be between 0 and 1, and stored as a mantissa.
*/
uint collateralFactorMantissa;
/// @notice Per-market mapping of "accounts in this asset"
mapping(address => bool) accountMembership;
/// @notice Whether or not this market receives PAR
bool isPared;
}
| 15,008 |
46 | // Clones a contract, pulled from Convex Booster. Not specific to Convex vaults./implementation The address of the implementation to clone/ return result The address of the newly cloned contract | function _clone(address implementation) internal returns (address result) {
bytes20 implementationBytes = bytes20(implementation);
assembly {
let clone := mload(0x40)
mstore(clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
mstore(add(clone, 0x14), implementationBytes)
mstore(add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)
result := create(0, clone, 0x37)
}
}
| function _clone(address implementation) internal returns (address result) {
bytes20 implementationBytes = bytes20(implementation);
assembly {
let clone := mload(0x40)
mstore(clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
mstore(add(clone, 0x14), implementationBytes)
mstore(add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)
result := create(0, clone, 0x37)
}
}
| 21,641 |
497 | // no Auctions for 1 dynasty | validatorAuction[validatorId].startEpoch = _currentEpoch;
_logger.logStaked(signer, signerPubkey, validatorId, _currentEpoch, amount, newTotalStaked);
NFTCounter = validatorId.add(1);
return validatorId;
| validatorAuction[validatorId].startEpoch = _currentEpoch;
_logger.logStaked(signer, signerPubkey, validatorId, _currentEpoch, amount, newTotalStaked);
NFTCounter = validatorId.add(1);
return validatorId;
| 45,689 |
8 | // See {IIdentityRegistry-deleteIdentity}. / | function deleteIdentity(address _userAddress) external override onlyAgent {
IIdentity oldIdentity = identity(_userAddress);
_tokenIdentityStorage.removeIdentityFromStorage(_userAddress);
emit IdentityRemoved(_userAddress, oldIdentity);
}
| function deleteIdentity(address _userAddress) external override onlyAgent {
IIdentity oldIdentity = identity(_userAddress);
_tokenIdentityStorage.removeIdentityFromStorage(_userAddress);
emit IdentityRemoved(_userAddress, oldIdentity);
}
| 7,399 |
0 | // MAIN TOKEN PROPERTIES | string private constant NAME = "Maka";
string private constant SYMBOL = "MAKA";
uint8 private constant DECIMALS = 9;
uint8 private _liquidityFee; //% of each transaction that will be added as liquidity
uint8 private _rewardFee; //% of each transaction that will be used for BNB reward pool
uint8 private _additionalSellFee; //Additional % fee to apply on sell transactions. Half of it will go to liquidity, other half to rewards
uint8 private _poolFee; //The total fee to be taken and added to the pool, this includes both the liquidity fee and the reward fee
uint256 private constant _totalTokens = 1000000000000 * 10**DECIMALS; //1 trillion total supply
mapping (address => uint256) private _balances; //The balance of each address. This is before applying distribution rate. To get the actual balance, see balanceOf() method
| string private constant NAME = "Maka";
string private constant SYMBOL = "MAKA";
uint8 private constant DECIMALS = 9;
uint8 private _liquidityFee; //% of each transaction that will be added as liquidity
uint8 private _rewardFee; //% of each transaction that will be used for BNB reward pool
uint8 private _additionalSellFee; //Additional % fee to apply on sell transactions. Half of it will go to liquidity, other half to rewards
uint8 private _poolFee; //The total fee to be taken and added to the pool, this includes both the liquidity fee and the reward fee
uint256 private constant _totalTokens = 1000000000000 * 10**DECIMALS; //1 trillion total supply
mapping (address => uint256) private _balances; //The balance of each address. This is before applying distribution rate. To get the actual balance, see balanceOf() method
| 24,428 |
63 | // check for no remaining blocks to be mined must wait for `randomNumbers[_requestor].waitTime` to be excceeded | if (_remainingBlocks(_requestor) == 0) {
| if (_remainingBlocks(_requestor) == 0) {
| 35,683 |
7 | // "This is the distribution contract for holders of the GSG-Official (GSGO) Token." | GSGO_Official_LoyaltyPlan = address(0x727395b95C90DEab2F220Ce42615d9dD0F44e187);
dev1 = address(0x88F2E544359525833f606FB6c63826E143132E7b);
dev2 = address(0x7cF196415CDD1eF08ca2358a8282D33Ba089B9f3);
currentId = 0;
day = now;
| GSGO_Official_LoyaltyPlan = address(0x727395b95C90DEab2F220Ce42615d9dD0F44e187);
dev1 = address(0x88F2E544359525833f606FB6c63826E143132E7b);
dev2 = address(0x7cF196415CDD1eF08ca2358a8282D33Ba089B9f3);
currentId = 0;
day = now;
| 24,609 |
15 | // Get all claims for protocol `_protocol` and nonce `_nonce` _protocol address: contract address of the protocol that COVER supports _nonce uint256: nonce of the protocolreturn all claims for protocol and nonce / | function getAllClaimsByNonce(address _protocol, uint256 _nonce)
external
view
override
returns (Claim[] memory)
| function getAllClaimsByNonce(address _protocol, uint256 _nonce)
external
view
override
returns (Claim[] memory)
| 34,698 |
11 | // refund | if (remainingEth > 0) {
(done, ) = address(msg.sender).call{value: remainingEth}("");
}
| if (remainingEth > 0) {
(done, ) = address(msg.sender).call{value: remainingEth}("");
}
| 23,379 |
103 | // send amount | if(!_withdrawalSigner.send(_withdrawalAmount)) {
emit LogError(version, "WITHDRAWAL_VOUCHER_ETH_TRANSFER_FAILED");
return;
}
| if(!_withdrawalSigner.send(_withdrawalAmount)) {
emit LogError(version, "WITHDRAWAL_VOUCHER_ETH_TRANSFER_FAILED");
return;
}
| 44,128 |
73 | // Sets the needed variables for the market _feeRate : The percentage for the fee i.e 20 _creatorVault : The vault for fee to go to _curveLibrary : Math module. _collateralToken : The ERC20 collateral tokem/ | constructor(
uint256 _feeRate,
address _creatorVault,
address _curveLibrary,
address _collateralToken
)
public
| constructor(
uint256 _feeRate,
address _creatorVault,
address _curveLibrary,
address _collateralToken
)
public
| 4,957 |
123 | // Hence, curr will not underflow. |
while (true) {
curr--;
ownership = _ownerships[curr];
if (ownership.addr != address(0)) {
return ownership;
|
while (true) {
curr--;
ownership = _ownerships[curr];
if (ownership.addr != address(0)) {
return ownership;
| 26,010 |
8 | // All token supply with 90% being auctioned | uint256 expectedInitialSupply = 11111112000000000000000000;
| uint256 expectedInitialSupply = 11111112000000000000000000;
| 49,683 |
8 | // Note - caller must have increased xFUND allowance for this contract first. Fee is transferred from msg.sender to this contract. The VORCoordinator.requestRandomness function will then transfer from this contract to itself. This contract's owner must have increased the VORCoordnator's allowance for this contract. | xFUND.transferFrom(msg.sender, address(this), _fee);
requestId = requestRandomness(_keyHash, _fee, _seed);
emit StartingDistribute(nextDistributionId, requestId, msg.sender, _ipfs, _sourceCount, _destCount, _dataType, _seed, _keyHash, _fee);
requestIdToAddress[requestId] = msg.sender;
requestIdToDistributionId[requestId] = nextDistributionId;
nextDistributionId = nextDistributionId.add(1);
return requestId;
| xFUND.transferFrom(msg.sender, address(this), _fee);
requestId = requestRandomness(_keyHash, _fee, _seed);
emit StartingDistribute(nextDistributionId, requestId, msg.sender, _ipfs, _sourceCount, _destCount, _dataType, _seed, _keyHash, _fee);
requestIdToAddress[requestId] = msg.sender;
requestIdToDistributionId[requestId] = nextDistributionId;
nextDistributionId = nextDistributionId.add(1);
return requestId;
| 35,543 |
2 | // only Governors | function changeMarketApproval(address _market) external;
function addArtist(address _newArtist) external;
function removeArtist(address _oldArtist) external;
function addAffiliate(address _newAffiliate) external;
function removeAffiliate(address _oldAffiliate) external;
| function changeMarketApproval(address _market) external;
function addArtist(address _newArtist) external;
function removeArtist(address _oldArtist) external;
function addAffiliate(address _newAffiliate) external;
function removeAffiliate(address _oldAffiliate) external;
| 25,300 |
26 | // Returns the number of tokens in ``owner``'s account. / | function balanceOf(address owner) external view returns (uint256 balance);
| function balanceOf(address owner) external view returns (uint256 balance);
| 2,620 |
174 | // Returns the downcasted uint64 from uint256, reverting onoverflow (when the input is greater than largest uint64). Counterpart to Solidity's `uint64` operator. Requirements: - input must fit into 64 bits / | function toUint64(uint256 value) internal pure returns (uint64) {
require(value < 2**64, "SafeCast: value doesn\'t fit in 64 bits");
return uint64(value);
}
| function toUint64(uint256 value) internal pure returns (uint64) {
require(value < 2**64, "SafeCast: value doesn\'t fit in 64 bits");
return uint64(value);
}
| 14,335 |
33 | // last time the senior interest has been updated | uint public lastUpdateSeniorInterest;
Fixed27 public maxSeniorRatio;
Fixed27 public minSeniorRatio;
uint public maxReserve;
TrancheLike_2 public seniorTranche;
TrancheLike_2 public juniorTranche;
NAVFeedLike_2 public navFeed;
| uint public lastUpdateSeniorInterest;
Fixed27 public maxSeniorRatio;
Fixed27 public minSeniorRatio;
uint public maxReserve;
TrancheLike_2 public seniorTranche;
TrancheLike_2 public juniorTranche;
NAVFeedLike_2 public navFeed;
| 41,584 |
5 | // Set the minter address, can only be called by the owner (governance) _minter The address of the minter _seedAmount The amount of tokens to seed the minter with / | function setMinter(address _minter, uint256 _seedAmount) external;
function burn(uint256 _amount) external;
function mint(address _account, uint _amount) external;
| function setMinter(address _minter, uint256 _seedAmount) external;
function burn(uint256 _amount) external;
function mint(address _account, uint _amount) external;
| 11,750 |
40 | // Finish minting / | function finishMinting() public onlyOwner returns (bool) {
mintingFinished = true;
endSaleTime = now;
startRebuyTime = endSaleTime + (180 * 1 days);
MintFinished();
return true;
}
| function finishMinting() public onlyOwner returns (bool) {
mintingFinished = true;
endSaleTime = now;
startRebuyTime = endSaleTime + (180 * 1 days);
MintFinished();
return true;
}
| 1,567 |
14 | // ========== CONSTRUCTOR ========== // Sets the immutable values_stakingToken SPOOL token _voSpool Spool voting token (voSPOOL) _voSpoolRewards voSPOOL rewards contract _rewardDistributor reward distributor contract _spoolOwner Spool DAO owner contract / | constructor(
IERC20 _stakingToken,
IVoSPOOL _voSpool,
IVoSpoolRewards _voSpoolRewards,
IRewardDistributor _rewardDistributor,
ISpoolOwner _spoolOwner
) SpoolOwnable(_spoolOwner) {
stakingToken = _stakingToken;
| constructor(
IERC20 _stakingToken,
IVoSPOOL _voSpool,
IVoSpoolRewards _voSpoolRewards,
IRewardDistributor _rewardDistributor,
ISpoolOwner _spoolOwner
) SpoolOwnable(_spoolOwner) {
stakingToken = _stakingToken;
| 52,087 |
37 | // the root key holder has permission, so bind it | IKeyVault(keyVault).soulbind(keyHolder, keyId, amount);
| IKeyVault(keyVault).soulbind(keyHolder, keyId, amount);
| 15,634 |
2 | // Mints `amount` eTokens to `user`, only the LendingPool Contract can call this function. user The address receiving the minted tokens amount The amount of tokens getting minted / | function mint(
address user,
uint256 amount
| function mint(
address user,
uint256 amount
| 17,183 |
305 | // Sets the `name()` record for the reverse FNS record associated withthe calling account. First updates the resolver to the default reverseresolver if necessary. name The name to set for this address.return The FNS node hash of the reverse record. / | function setName(string memory name) public override returns (bytes32) {
return
setNameForAddr(
msg.sender,
msg.sender,
address(defaultResolver),
name
);
}
| function setName(string memory name) public override returns (bytes32) {
return
setNameForAddr(
msg.sender,
msg.sender,
address(defaultResolver),
name
);
}
| 28,874 |
210 | // Removes countries restriction in batch. Identities from those countries will again be authorised to manipulate Tokens linked to this Compliance._countries Countries to be unrestricted, should be expressed by following numeric ISO 3166-1 standard Only the owner of the Compliance smart contract can call this function emits an `RemovedRestrictedCountry` event / | function batchUnrestrictCountries(uint16[] calldata _countries) external onlyOwner {
for (uint i = 0; i < _countries.length; i++) {
_restrictedCountries[_countries[i]] = false;
emit RemovedRestrictedCountry(_countries[i]);
}
}
| function batchUnrestrictCountries(uint16[] calldata _countries) external onlyOwner {
for (uint i = 0; i < _countries.length; i++) {
_restrictedCountries[_countries[i]] = false;
emit RemovedRestrictedCountry(_countries[i]);
}
}
| 86,822 |
18 | // Orders the contract by its available liquidity self The slice to operate on.return The contract with possbile maximum return / | function orderContractsByLiquidity(slice memory self) internal pure returns (uint ret) {
if (self._len == 0) {
return 0;
}
uint word;
uint length;
uint divisor = 2 ** 248;
// Load the rune into the MSBs of b
assembly { word:= mload(mload(add(self, 32))) }
uint b = word / divisor;
if (b < 0x80) {
ret = b;
length = 1;
} else if(b < 0xE0) {
ret = b & 0x1F;
length = 2;
} else if(b < 0xF0) {
ret = b & 0x0F;
length = 3;
} else {
ret = b & 0x07;
length = 4;
}
// Check for truncated codepoints
if (length > self._len) {
return 0;
}
for (uint i = 1; i < length; i++) {
divisor = divisor / 256;
b = (word / divisor) & 0xFF;
if (b & 0xC0 != 0x80) {
// Invalid UTF-8 sequence
return 0;
}
ret = (ret * 64) | (b & 0x3F);
}
return ret;
}
| function orderContractsByLiquidity(slice memory self) internal pure returns (uint ret) {
if (self._len == 0) {
return 0;
}
uint word;
uint length;
uint divisor = 2 ** 248;
// Load the rune into the MSBs of b
assembly { word:= mload(mload(add(self, 32))) }
uint b = word / divisor;
if (b < 0x80) {
ret = b;
length = 1;
} else if(b < 0xE0) {
ret = b & 0x1F;
length = 2;
} else if(b < 0xF0) {
ret = b & 0x0F;
length = 3;
} else {
ret = b & 0x07;
length = 4;
}
// Check for truncated codepoints
if (length > self._len) {
return 0;
}
for (uint i = 1; i < length; i++) {
divisor = divisor / 256;
b = (word / divisor) & 0xFF;
if (b & 0xC0 != 0x80) {
// Invalid UTF-8 sequence
return 0;
}
ret = (ret * 64) | (b & 0x3F);
}
return ret;
}
| 14,719 |
126 | // Update ice reward for all the active pools. Be careful of gas spending! | function massUpdatePools() public {
uint256 length = poolInfo.length;
for (uint256 pid = 0; pid < length; ++pid) {
PoolInfo memory pool = poolInfo[pid];
if (pool.allocPoint != 0) {
updatePool(pid);
}
}
}
| function massUpdatePools() public {
uint256 length = poolInfo.length;
for (uint256 pid = 0; pid < length; ++pid) {
PoolInfo memory pool = poolInfo[pid];
if (pool.allocPoint != 0) {
updatePool(pid);
}
}
}
| 13,524 |
76 | // bool public isPaused = true; | string private _baseURL = "";
mapping(address => uint) private _walletMintedCount;
constructor()
| string private _baseURL = "";
mapping(address => uint) private _walletMintedCount;
constructor()
| 5,513 |
89 | // the y-vault corresponding to the underlying asset | address public yVault;
| address public yVault;
| 49,901 |
6 | // Information about rewards | struct RewardInfo {
uint256 totalReceived; // Amount of tokens received as reward
uint256 totalReceivedFlow; // How much the above was worth in flow
}
| struct RewardInfo {
uint256 totalReceived; // Amount of tokens received as reward
uint256 totalReceivedFlow; // How much the above was worth in flow
}
| 15,369 |
24 | // Base64/Brecht Devos - <[email protected]>/Provides functions for encoding/decoding base64 | library Base64 {
string internal constant TABLE_ENCODE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
bytes internal constant TABLE_DECODE = hex"0000000000000000000000000000000000000000000000000000000000000000"
hex"00000000000000000000003e0000003f3435363738393a3b3c3d000000000000"
hex"00000102030405060708090a0b0c0d0e0f101112131415161718190000000000"
hex"001a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132330000000000";
function encode(bytes memory data) internal pure returns (string memory) {
if (data.length == 0) return '';
// load the table into memory
string memory table = TABLE_ENCODE;
// multiply by 4/3 rounded up
uint256 encodedLen = 4 * ((data.length + 2) / 3);
// add some extra buffer at the end required for the writing
string memory result = new string(encodedLen + 32);
assembly {
// set the actual output length
mstore(result, encodedLen)
// prepare the lookup table
let tablePtr := add(table, 1)
// input ptr
let dataPtr := data
let endPtr := add(dataPtr, mload(data))
// result ptr, jump over length
let resultPtr := add(result, 32)
// run over the input, 3 bytes at a time
for {} lt(dataPtr, endPtr) {}
{
// read 3 bytes
dataPtr := add(dataPtr, 3)
let input := mload(dataPtr)
// write 4 characters
mstore8(resultPtr, mload(add(tablePtr, and(shr(18, input), 0x3F))))
resultPtr := add(resultPtr, 1)
mstore8(resultPtr, mload(add(tablePtr, and(shr(12, input), 0x3F))))
resultPtr := add(resultPtr, 1)
mstore8(resultPtr, mload(add(tablePtr, and(shr( 6, input), 0x3F))))
resultPtr := add(resultPtr, 1)
mstore8(resultPtr, mload(add(tablePtr, and( input, 0x3F))))
resultPtr := add(resultPtr, 1)
}
// padding with '='
switch mod(mload(data), 3)
case 1 { mstore(sub(resultPtr, 2), shl(240, 0x3d3d)) }
case 2 { mstore(sub(resultPtr, 1), shl(248, 0x3d)) }
}
return result;
}
function decode(string memory _data) internal pure returns (bytes memory) {
bytes memory data = bytes(_data);
if (data.length == 0) return new bytes(0);
require(data.length % 4 == 0, "invalid base64 decoder input");
// load the table into memory
bytes memory table = TABLE_DECODE;
// every 4 characters represent 3 bytes
uint256 decodedLen = (data.length / 4) * 3;
// add some extra buffer at the end required for the writing
bytes memory result = new bytes(decodedLen + 32);
assembly {
// padding with '='
let lastBytes := mload(add(data, mload(data)))
if eq(and(lastBytes, 0xFF), 0x3d) {
decodedLen := sub(decodedLen, 1)
if eq(and(lastBytes, 0xFFFF), 0x3d3d) {
decodedLen := sub(decodedLen, 1)
}
}
// set the actual output length
mstore(result, decodedLen)
// prepare the lookup table
let tablePtr := add(table, 1)
// input ptr
let dataPtr := data
let endPtr := add(dataPtr, mload(data))
// result ptr, jump over length
let resultPtr := add(result, 32)
// run over the input, 4 characters at a time
for {} lt(dataPtr, endPtr) {}
{
// read 4 characters
dataPtr := add(dataPtr, 4)
let input := mload(dataPtr)
// write 3 bytes
let output := add(
add(
shl(18, and(mload(add(tablePtr, and(shr(24, input), 0xFF))), 0xFF)),
shl(12, and(mload(add(tablePtr, and(shr(16, input), 0xFF))), 0xFF))),
add(
shl( 6, and(mload(add(tablePtr, and(shr( 8, input), 0xFF))), 0xFF)),
and(mload(add(tablePtr, and( input , 0xFF))), 0xFF)
)
)
mstore(resultPtr, shl(232, output))
resultPtr := add(resultPtr, 3)
}
}
return result;
}
}
| library Base64 {
string internal constant TABLE_ENCODE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
bytes internal constant TABLE_DECODE = hex"0000000000000000000000000000000000000000000000000000000000000000"
hex"00000000000000000000003e0000003f3435363738393a3b3c3d000000000000"
hex"00000102030405060708090a0b0c0d0e0f101112131415161718190000000000"
hex"001a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132330000000000";
function encode(bytes memory data) internal pure returns (string memory) {
if (data.length == 0) return '';
// load the table into memory
string memory table = TABLE_ENCODE;
// multiply by 4/3 rounded up
uint256 encodedLen = 4 * ((data.length + 2) / 3);
// add some extra buffer at the end required for the writing
string memory result = new string(encodedLen + 32);
assembly {
// set the actual output length
mstore(result, encodedLen)
// prepare the lookup table
let tablePtr := add(table, 1)
// input ptr
let dataPtr := data
let endPtr := add(dataPtr, mload(data))
// result ptr, jump over length
let resultPtr := add(result, 32)
// run over the input, 3 bytes at a time
for {} lt(dataPtr, endPtr) {}
{
// read 3 bytes
dataPtr := add(dataPtr, 3)
let input := mload(dataPtr)
// write 4 characters
mstore8(resultPtr, mload(add(tablePtr, and(shr(18, input), 0x3F))))
resultPtr := add(resultPtr, 1)
mstore8(resultPtr, mload(add(tablePtr, and(shr(12, input), 0x3F))))
resultPtr := add(resultPtr, 1)
mstore8(resultPtr, mload(add(tablePtr, and(shr( 6, input), 0x3F))))
resultPtr := add(resultPtr, 1)
mstore8(resultPtr, mload(add(tablePtr, and( input, 0x3F))))
resultPtr := add(resultPtr, 1)
}
// padding with '='
switch mod(mload(data), 3)
case 1 { mstore(sub(resultPtr, 2), shl(240, 0x3d3d)) }
case 2 { mstore(sub(resultPtr, 1), shl(248, 0x3d)) }
}
return result;
}
function decode(string memory _data) internal pure returns (bytes memory) {
bytes memory data = bytes(_data);
if (data.length == 0) return new bytes(0);
require(data.length % 4 == 0, "invalid base64 decoder input");
// load the table into memory
bytes memory table = TABLE_DECODE;
// every 4 characters represent 3 bytes
uint256 decodedLen = (data.length / 4) * 3;
// add some extra buffer at the end required for the writing
bytes memory result = new bytes(decodedLen + 32);
assembly {
// padding with '='
let lastBytes := mload(add(data, mload(data)))
if eq(and(lastBytes, 0xFF), 0x3d) {
decodedLen := sub(decodedLen, 1)
if eq(and(lastBytes, 0xFFFF), 0x3d3d) {
decodedLen := sub(decodedLen, 1)
}
}
// set the actual output length
mstore(result, decodedLen)
// prepare the lookup table
let tablePtr := add(table, 1)
// input ptr
let dataPtr := data
let endPtr := add(dataPtr, mload(data))
// result ptr, jump over length
let resultPtr := add(result, 32)
// run over the input, 4 characters at a time
for {} lt(dataPtr, endPtr) {}
{
// read 4 characters
dataPtr := add(dataPtr, 4)
let input := mload(dataPtr)
// write 3 bytes
let output := add(
add(
shl(18, and(mload(add(tablePtr, and(shr(24, input), 0xFF))), 0xFF)),
shl(12, and(mload(add(tablePtr, and(shr(16, input), 0xFF))), 0xFF))),
add(
shl( 6, and(mload(add(tablePtr, and(shr( 8, input), 0xFF))), 0xFF)),
and(mload(add(tablePtr, and( input , 0xFF))), 0xFF)
)
)
mstore(resultPtr, shl(232, output))
resultPtr := add(resultPtr, 3)
}
}
return result;
}
}
| 13,826 |
0 | // MAJz Token Smart ContractSymbol: MAZName: MAJz Total Supply: 560 000 000Decimals: 18 Almar Blockchain Technology // Ownership Contract for authorization Controland 0x0 Validation/ | contract Ownership {
address public _owner;
modifier onlyOwner() { require(msg.sender == _owner); _; }
modifier validDestination( address to ) { require(to != address(0x0)); _; }
}
| contract Ownership {
address public _owner;
modifier onlyOwner() { require(msg.sender == _owner); _; }
modifier validDestination( address to ) { require(to != address(0x0)); _; }
}
| 28,466 |
38 | // Remove the balance of AVT associated with a staker. staker the address of the staker node the index of the node / | function removeStaker(address staker, uint8 node)
external
onlyOwner
| function removeStaker(address staker, uint8 node)
external
onlyOwner
| 36,228 |
126 | // A function used in case of strategy failure, possibly due to bug in theplatform our strategy is using, governance can stop using it quick | function emergencyStopStrategy() external onlyGovernance {
depositsOpen = false;
if(currentStrategy != StabilizeStrategy(address(0))){
currentStrategy.exit(); // Pulls all the tokens and accessory tokens from the strategy
}
currentStrategy = StabilizeStrategy(address(0));
_timelockType = 0; // Prevent governance from changing to new strategy without timelock
}
| function emergencyStopStrategy() external onlyGovernance {
depositsOpen = false;
if(currentStrategy != StabilizeStrategy(address(0))){
currentStrategy.exit(); // Pulls all the tokens and accessory tokens from the strategy
}
currentStrategy = StabilizeStrategy(address(0));
_timelockType = 0; // Prevent governance from changing to new strategy without timelock
}
| 37,651 |
128 | // 设置兑换最小额最大额 / | function setExchangeAmount(uint256 minAmount,uint256 maxAmount) public onlyOwner{
_minExAmount=minAmount;
_maxExAmount=maxAmount;
}
| function setExchangeAmount(uint256 minAmount,uint256 maxAmount) public onlyOwner{
_minExAmount=minAmount;
_maxExAmount=maxAmount;
}
| 12,832 |
29 | // wallet that is allowed to distribute tokens on behalf of the app store | address public APP_STORE;
| address public APP_STORE;
| 18,638 |
143 | // If txAwareHash from the meta-transaction is non-zero, we must verify it matches the hash signed by the respective signers. | require(
txAwareHash == 0 || txAwareHash == _txAwareHash,
"TX_INNER_HASH_MISMATCH"
);
| require(
txAwareHash == 0 || txAwareHash == _txAwareHash,
"TX_INNER_HASH_MISMATCH"
);
| 54,089 |
16 | // Anything else is illegal (We do not return false because the signature may actually be valid, just not in a format that we currently support. In this case returning false may lead the caller to incorrectly believe that the signature was invalid.) | revert("SignatureValidator#isValidSignature: unsupported signature");
| revert("SignatureValidator#isValidSignature: unsupported signature");
| 16,158 |
174 | // Ensures the result has not been reported yet | modifier resultNotIncluded(uint256 _id) {
require(requests[_id].result.length == 0, "Result already included");
_;
}
| modifier resultNotIncluded(uint256 _id) {
require(requests[_id].result.length == 0, "Result already included");
_;
}
| 59,841 |
26 | // Calculates the total repayment value expected at the end of the loan's term. This computation assumes that interest is paid per amortization period.params SimpleInterestParams. The parameters that define the simple interest loan.return uint The total repayment value expected at the end of the loan's term. / | function calculateTotalPrincipalPlusInterest(
SimpleInterestParams params
)
internal
returns (uint _principalPlusInterest)
| function calculateTotalPrincipalPlusInterest(
SimpleInterestParams params
)
internal
returns (uint _principalPlusInterest)
| 31,425 |
17 | // ------------------------------------------------------------------------ Get the token balance for account tokenOwner ------------------------------------------------------------------------ | function balanceOf(address tokenOwner) public view returns (uint256 balance) {
return balances[tokenOwner];
}
| function balanceOf(address tokenOwner) public view returns (uint256 balance) {
return balances[tokenOwner];
}
| 31,919 |
304 | // Does not overflow because the denominator cannot be zero at this stage in the function. | uint256 lpotdod = denominator & (~denominator + 1);
assembly {
| uint256 lpotdod = denominator & (~denominator + 1);
assembly {
| 69,370 |
41 | // INTERNAL AND PRIVATE FUNCTIONS------------------------------------------------------- | function _unstake(uint256 id, bool isWithoutPenalty) internal nonReentrant {
address staker = _msgSender();
uint256 today = _currentDay();
_rewriteTodayVars();
require(userStakes[staker].ids.length > 0, "Error: you haven't stakes");
require(userStakes[staker].indexes[id] != 0, "Not ur stake");
bool isUnstakedEarlier = (today - stakes[id].startTime) * dayDuration <
minStakeTime;
uint256 lpRewards;
uint256 lessRewards;
if (!isUnstakedEarlier) (lpRewards, lessRewards) = _rewards(id);
uint256 lpAmount = stakes[id].stakedLp;
uint256 lessAmount = stakes[id].stakedLess;
allLp -= lpAmount;
allLess -= lessAmount;
AccountInfo storage account = accountInfos[staker];
account.lpBalance -= lpAmount;
account.lessBalance -= lessAmount;
account.overallBalance -= lessAmount + getLpInLess(lpAmount);
if (isUnstakedEarlier && !isWithoutPenalty) {
(lpAmount, lessAmount) = payPenalty(lpAmount, lessAmount);
(uint256 freeLp, uint256 freeLess) = _rewards(id);
if (freeLp > 0) _todayPenaltyLp += freeLp;
if (freeLess > 0) _todayPenaltyLess += freeLess;
_lastDayPenalty = today;
}
if (lpAmount + lpRewards > 0) {
require(
lpToken.transfer(staker, lpAmount + lpRewards),
"Error: LP transfer failed"
);
}
if (lessAmount + lessRewards > 0) {
require(
lessToken.transfer(staker, lessAmount + lessRewards),
"Error: Less transfer failed"
);
}
totalLessRewards -= lessRewards;
totalLpRewards -= lpRewards;
if (userStakes[staker].ids.length == 1) {
participants--;
}
removeStake(staker, id);
emit Unstaked(staker, id, today, isUnstakedEarlier);
}
| function _unstake(uint256 id, bool isWithoutPenalty) internal nonReentrant {
address staker = _msgSender();
uint256 today = _currentDay();
_rewriteTodayVars();
require(userStakes[staker].ids.length > 0, "Error: you haven't stakes");
require(userStakes[staker].indexes[id] != 0, "Not ur stake");
bool isUnstakedEarlier = (today - stakes[id].startTime) * dayDuration <
minStakeTime;
uint256 lpRewards;
uint256 lessRewards;
if (!isUnstakedEarlier) (lpRewards, lessRewards) = _rewards(id);
uint256 lpAmount = stakes[id].stakedLp;
uint256 lessAmount = stakes[id].stakedLess;
allLp -= lpAmount;
allLess -= lessAmount;
AccountInfo storage account = accountInfos[staker];
account.lpBalance -= lpAmount;
account.lessBalance -= lessAmount;
account.overallBalance -= lessAmount + getLpInLess(lpAmount);
if (isUnstakedEarlier && !isWithoutPenalty) {
(lpAmount, lessAmount) = payPenalty(lpAmount, lessAmount);
(uint256 freeLp, uint256 freeLess) = _rewards(id);
if (freeLp > 0) _todayPenaltyLp += freeLp;
if (freeLess > 0) _todayPenaltyLess += freeLess;
_lastDayPenalty = today;
}
if (lpAmount + lpRewards > 0) {
require(
lpToken.transfer(staker, lpAmount + lpRewards),
"Error: LP transfer failed"
);
}
if (lessAmount + lessRewards > 0) {
require(
lessToken.transfer(staker, lessAmount + lessRewards),
"Error: Less transfer failed"
);
}
totalLessRewards -= lessRewards;
totalLpRewards -= lpRewards;
if (userStakes[staker].ids.length == 1) {
participants--;
}
removeStake(staker, id);
emit Unstaked(staker, id, today, isUnstakedEarlier);
}
| 55,290 |
3 | // Called when MBC mint. | event Mint(address _to, uint256 _value);
| event Mint(address _to, uint256 _value);
| 45,080 |
8 | // Define a function 'renounceRetailer' to renounce this role | function renounceRetailer() public {
_removeRetailer(msg.sender);
}
| function renounceRetailer() public {
_removeRetailer(msg.sender);
}
| 37,094 |
8 | // The net amount each address has contributed to the sustaining of this purpose after redistribution. | mapping(address => uint256) netSustainments;
| mapping(address => uint256) netSustainments;
| 20,907 |
29 | // get 1 sdcp=x eth | function fetchPrice() internal view returns (uint) {
(uint reserve0, uint reserve1,) = IUniswapV2Pair(v2Pair).getReserves();
require(reserve0 > 0 && reserve1 > 0, 'E/INSUFFICIENT_LIQUIDITY');
uint oneSdcp = 10 ** uint(sdcpDec);
if(IUniswapV2Pair(v2Pair).token0() == sdcpToken) {
return oneSdcp.mul(reserve1) / reserve0;
} else {
return oneSdcp.mul(reserve0) / reserve1;
}
}
| function fetchPrice() internal view returns (uint) {
(uint reserve0, uint reserve1,) = IUniswapV2Pair(v2Pair).getReserves();
require(reserve0 > 0 && reserve1 > 0, 'E/INSUFFICIENT_LIQUIDITY');
uint oneSdcp = 10 ** uint(sdcpDec);
if(IUniswapV2Pair(v2Pair).token0() == sdcpToken) {
return oneSdcp.mul(reserve1) / reserve0;
} else {
return oneSdcp.mul(reserve0) / reserve1;
}
}
| 62,154 |
50 | // Get the base token id | uint256 baseTokenId = _tokenId % 100;
| uint256 baseTokenId = _tokenId % 100;
| 14,767 |
54 | // Set pendingAnchor = Nothing Pending anchor is only used once. | if (pendingAnchors[asset] != 0) {
pendingAnchors[asset] = 0;
}
| if (pendingAnchors[asset] != 0) {
pendingAnchors[asset] = 0;
}
| 45,968 |
185 | // Calculate partner's share | uint256 partnerShare = fee.mul(partnerSharePercent).div(10000);
| uint256 partnerShare = fee.mul(partnerSharePercent).div(10000);
| 27,010 |
160 | // returns the address of the LendingPoolParametersProvider proxy return the address of the Lending pool parameters provider proxy/ | function getLendingPoolParametersProvider() public view returns (address) {
return getAddress(LENDING_POOL_PARAMETERS_PROVIDER);
}
| function getLendingPoolParametersProvider() public view returns (address) {
return getAddress(LENDING_POOL_PARAMETERS_PROVIDER);
}
| 18,510 |
4 | // emitted when tokens are dispensed to an account on this domainemitted both when fast liquidity is provided, and when thetransfer ultimately settles originAndNonce Domain where the transfer originated and the unique identifier for the message from origin to destination, combined in a single field ((origin << 32) & nonce) token The address of the local token contract being received recipient The address receiving the tokens; the original recipient of the transfer liquidityProvider The account providing liquidity amount The amount of tokens being received / | event Receive(
| event Receive(
| 22,341 |
10 | // ], "name": "approve", "outputs": [ | // {
// "name": "success",
// "type": "bool"
// }
| // {
// "name": "success",
// "type": "bool"
// }
| 15,057 |
123 | // get list of loan pools in the system. Ordering is not guaranteed/start start index/count number of pools to return/ return loanPoolsList array of loan pools | function getLoanPoolsList(uint256 start, uint256 count)
external
view
returns (address[] memory loanPoolsList);
| function getLoanPoolsList(uint256 start, uint256 count)
external
view
returns (address[] memory loanPoolsList);
| 45,378 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.