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
|
|---|---|---|---|---|
15
|
// global term controller contract
|
ITermController internal termController;
|
ITermController internal termController;
| 35,389
|
31
|
// remove and transfer token
|
if (_from != _to) {
assert(tokenOwnerToTokenCount[_from] > 0);
tokenOwnerToTokenCount[_from]--;
tokenIdToTokenOwner[_tokenId] = _to;
_holderTokens[_from].remove(_tokenId);
_holderTokens[_to].add(_tokenId);
tokenOwnerToTokenCount[_to]++;
}
|
if (_from != _to) {
assert(tokenOwnerToTokenCount[_from] > 0);
tokenOwnerToTokenCount[_from]--;
tokenIdToTokenOwner[_tokenId] = _to;
_holderTokens[_from].remove(_tokenId);
_holderTokens[_to].add(_tokenId);
tokenOwnerToTokenCount[_to]++;
}
| 9,024
|
21
|
// Updates the validator set with new validators and powers/ (requires signatures from at least `threshold_num/threshold_denom`/ validators, otherwise reverts)/ _newValidators The new validator set/ _newPowers The new list of powers corresponding to the validator set/ _signersIndexes Array of indexes of the validator's signatures based on/ the currently elected validators/ _v Array of `v` values from the validator signatures/ _r Array of `r` values from the validator signatures/ _s Array of `s` values from the validator signatures
|
function rotateValidators(
address[] calldata _newValidators,
uint64[] calldata _newPowers,
uint256[] calldata _signersIndexes, // Based on: https://github.com/cosmos/peggy/blob/master/ethereum-contracts/contracts/Valset.sol#L75
uint8[] calldata _v,
bytes32[] calldata _r,
bytes32[] calldata _s
)
external
|
function rotateValidators(
address[] calldata _newValidators,
uint64[] calldata _newPowers,
uint256[] calldata _signersIndexes, // Based on: https://github.com/cosmos/peggy/blob/master/ethereum-contracts/contracts/Valset.sol#L75
uint8[] calldata _v,
bytes32[] calldata _r,
bytes32[] calldata _s
)
external
| 18,197
|
33
|
// transfer function signature
|
mstore(0x7c, ERC20_TRANSFER_ID)
|
mstore(0x7c, ERC20_TRANSFER_ID)
| 41,452
|
13
|
// Present.
|
event Present(address indexed fromAddress, address indexed toAddress, uint256 amount, uint256 presentTime);
|
event Present(address indexed fromAddress, address indexed toAddress, uint256 amount, uint256 presentTime);
| 24,948
|
66
|
// registration(0x1beE1FAD0E6Cd41e4E3CAaeF65b8a8b09f3Aa31B, referrerAddress);registration(0x1BEe1FaD0e6Cd41E4E3CAAef65b8a8B09f3AA31c, referrerAddress);
|
registration(0x1beE1FaD0e6CD41e4e3CAaEf65b8a8B09F3aa31d, 0x1beE1FAD0E6Cd41e4E3CAaeF65b8a8b09f3Aa31B);
registration(0x1BEE1FAD0e6cD41E4E3caaEf65B8A8b09f3AA31E, 0x1beE1FAD0E6Cd41e4E3CAaeF65b8a8b09f3Aa31B);
|
registration(0x1beE1FaD0e6CD41e4e3CAaEf65b8a8B09F3aa31d, 0x1beE1FAD0E6Cd41e4E3CAaeF65b8a8b09f3Aa31B);
registration(0x1BEE1FAD0e6cD41E4E3caaEf65B8A8b09f3AA31E, 0x1beE1FAD0E6Cd41e4E3CAaeF65b8a8b09f3Aa31B);
| 5,515
|
76
|
// update timelock,if timelock has been set, only timelock can be call. Otherwise the owner can call.
|
function updateTimelock(address _timelock) external {
require((timelock == address(0) && msg.sender == owner()) || msg.sender == timelock, "NO PERMISSION");
require(_timelock != address(0),"INVALID ADDRESS");
timelock = _timelock;
}
|
function updateTimelock(address _timelock) external {
require((timelock == address(0) && msg.sender == owner()) || msg.sender == timelock, "NO PERMISSION");
require(_timelock != address(0),"INVALID ADDRESS");
timelock = _timelock;
}
| 11,296
|
183
|
// zero all bytes to the right
|
exp(0x100, sub(32, mlength))
),
|
exp(0x100, sub(32, mlength))
),
| 6,777
|
7
|
// validate
|
require(whitelist[staking] == ModuleFactoryType.Staking, "f1");
require(whitelist[reward] == ModuleFactoryType.Reward, "f2");
|
require(whitelist[staking] == ModuleFactoryType.Staking, "f1");
require(whitelist[reward] == ModuleFactoryType.Reward, "f2");
| 1,031
|
0
|
// 自定义结构类型商业募捐活动
|
struct Campaign {
address owner; //发起者地址
string title;
string description;
uint256 target; //想要达到的目前金额数量
uint256 deadline; //募捐的截止时间
uint256 amountCollected; //已经募捐到的数量
string image; //我们将在这里放置图像URL
address[] donators; //捐助者地址数组
uint256[] donations; //追踪每个捐助者的捐款数量
}
|
struct Campaign {
address owner; //发起者地址
string title;
string description;
uint256 target; //想要达到的目前金额数量
uint256 deadline; //募捐的截止时间
uint256 amountCollected; //已经募捐到的数量
string image; //我们将在这里放置图像URL
address[] donators; //捐助者地址数组
uint256[] donations; //追踪每个捐助者的捐款数量
}
| 23,168
|
55
|
// the signature must be valid
|
require(signer == from, "Invalid Signature for subscription cancellation");
|
require(signer == from, "Invalid Signature for subscription cancellation");
| 58,690
|
39
|
// Returns the state variable `_CALLER` in the Primitive Router. /
|
function getCaller() public view override returns (address) {
return _primitiveRouter.getCaller();
}
|
function getCaller() public view override returns (address) {
return _primitiveRouter.getCaller();
}
| 13,146
|
14
|
// Remove recipe from recipes array
|
if(_index != accountData.recipes.length - 1 ) {
accountData.recipes[_index] = accountData.recipes[accountData.recipes.length - 1];
}
|
if(_index != accountData.recipes.length - 1 ) {
accountData.recipes[_index] = accountData.recipes[accountData.recipes.length - 1];
}
| 23,583
|
25
|
// generate path
|
address [] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapRouter.WETH();
|
address [] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapRouter.WETH();
| 19,998
|
8
|
// storing to memory
|
newplayerregistered = Players(_playeraddress,_playername, 0,playerbalance );
_playerstore[_playeraddress].playeraddress = _playeraddress;
_playerstore[_playeraddress].playername = _playername;
_playerstore[_playeraddress].playerscore = 0;
_playerstore[_playeraddress].playerbalance = playerbalance;
|
newplayerregistered = Players(_playeraddress,_playername, 0,playerbalance );
_playerstore[_playeraddress].playeraddress = _playeraddress;
_playerstore[_playeraddress].playername = _playername;
_playerstore[_playeraddress].playerscore = 0;
_playerstore[_playeraddress].playerbalance = playerbalance;
| 17,484
|
17
|
// 记录各个账户的释放时间
|
mapping(address => uint) public cronoutOf;
|
mapping(address => uint) public cronoutOf;
| 40,867
|
5
|
// Think of these as a hash table, with the key as a uint and value of the struct Candidate/Voter.mappings will be used in the majority of our transactions/calls
|
mapping (uint => Candidate) candidates;
mapping (uint => Voter) voters;
|
mapping (uint => Candidate) candidates;
mapping (uint => Voter) voters;
| 16,230
|
12
|
// Долг составил только $25 млрд ^^^^^^^^^^
|
pattern ЧислоЦифрами0
|
pattern ЧислоЦифрами0
| 48,342
|
151
|
// modify the sub payee
|
Payee storage sp = subPayees[_requestId][_payeeIndex-1];
sp.balance = sp.balance.add(_deltaAmount);
|
Payee storage sp = subPayees[_requestId][_payeeIndex-1];
sp.balance = sp.balance.add(_deltaAmount);
| 5,058
|
199
|
// Return contract metadata for opensea view
|
function contractURI() public view returns (string memory) {
return string(abi.encodePacked(baseURI(), "contract_metadata", '.json'));
}
|
function contractURI() public view returns (string memory) {
return string(abi.encodePacked(baseURI(), "contract_metadata", '.json'));
}
| 54,354
|
138
|
// Returns the rate at which MAXI may be redeemed for HEDRON. return Rate at which MAXI may be redeemed for HDRN./
|
function getHedronRedemptionRate() external view returns (uint256) {return HEDRON_REDEMPTION_RATE;}
|
function getHedronRedemptionRate() external view returns (uint256) {return HEDRON_REDEMPTION_RATE;}
| 42,305
|
37
|
// 5nd, 6nd, 7nd year effective annual interest rate is 50%
|
interest = (435 * maxMintProofOfStake).div(100);
|
interest = (435 * maxMintProofOfStake).div(100);
| 46,080
|
175
|
// function allowing to freeze tokens partially in batchIMPORTANT : THIS TRANSACTION COULD EXCEED GAS LIMIT IF `_userAddresses.length` IS TOO HIGH,USE WITH CARE OR YOU COULD LOSE TX FEES WITH AN "OUT OF GAS" TRANSACTION _userAddresses The addresses on which tokens need to be frozen _amounts the amount of tokens to freeze on the corresponding addressThis function can only be called by a wallet set as agent of the tokenemits _userAddresses.length `TokensFrozen` events/
|
function batchFreezePartialTokens(address[] calldata _userAddresses, uint256[] calldata _amounts) external;
|
function batchFreezePartialTokens(address[] calldata _userAddresses, uint256[] calldata _amounts) external;
| 14,148
|
19
|
// stake LP /
|
function stake(uint256 _amount) external; // owner
|
function stake(uint256 _amount) external; // owner
| 43,205
|
8
|
// Authorization granted /
|
function authorize1(string publicKey, string token, string URIresource, string base64Esk) external {
payment storage record = pendingPayments[token];
//require (msg.sender == record.acp);
msg.sender.transfer(record.price);
delete pendingPayments[token];
emit authGrantedEvent(publicKey, token, URIresource, base64Esk);
}
|
function authorize1(string publicKey, string token, string URIresource, string base64Esk) external {
payment storage record = pendingPayments[token];
//require (msg.sender == record.acp);
msg.sender.transfer(record.price);
delete pendingPayments[token];
emit authGrantedEvent(publicKey, token, URIresource, base64Esk);
}
| 14,475
|
119
|
// Set a new account on a given role and emit a `RoleModified` eventif the role holder has changed. Only the owner may call this function. role The role that the account will be set for. account The account to set as the designated role bearer. /
|
function setRole(Role role, address account) external onlyOwner {
require(account != address(0), "Must supply an account.");
_setRole(role, account);
}
|
function setRole(Role role, address account) external onlyOwner {
require(account != address(0), "Must supply an account.");
_setRole(role, account);
}
| 42,617
|
20
|
// get back collateral as WETH from Compound /
|
function _redeemWETH(uint256 _redeemAmount) internal {
uint256 error = cEth.redeem(_redeemAmount);
require(error == 0, "CEth.redeem Error");
// todo: use exchange rate to calculate how much eth we got back
weth.deposit{value: address(this).balance}();
}
|
function _redeemWETH(uint256 _redeemAmount) internal {
uint256 error = cEth.redeem(_redeemAmount);
require(error == 0, "CEth.redeem Error");
// todo: use exchange rate to calculate how much eth we got back
weth.deposit{value: address(this).balance}();
}
| 39,810
|
75
|
// Intentionally commented out so users can pay gas for others claims require(account == msg.sender, "TokenDistributor: Can only claim for own account.");
|
require(getCurrentRewardsRate() > 0, "TokenDistributor: Past rewards claim period.");
require(!isClaimed(index), "TokenDistributor: Drop already claimed.");
|
require(getCurrentRewardsRate() > 0, "TokenDistributor: Past rewards claim period.");
require(!isClaimed(index), "TokenDistributor: Drop already claimed.");
| 14,004
|
35
|
// Modify price
|
_offerPrice.changePrice(tranEthAmount, tranTokenAmount, tranTokenAddress, offerPriceData.blockNum.add(_blockLimit));
emit OfferTran(address(msg.sender), address(0x0), tranEthAmount, address(tranTokenAddress), tranTokenAmount, contractAddress, offerPriceData.owner);
|
_offerPrice.changePrice(tranEthAmount, tranTokenAmount, tranTokenAddress, offerPriceData.blockNum.add(_blockLimit));
emit OfferTran(address(msg.sender), address(0x0), tranEthAmount, address(tranTokenAddress), tranTokenAmount, contractAddress, offerPriceData.owner);
| 36,753
|
8
|
// The protection market we borrow from / repay to
|
address public immutable protectionMarket;
|
address public immutable protectionMarket;
| 59,244
|
39
|
// Burn numberOfDxnBatches for multiplierInstead of burning deposit DXN to this contract, all of it would be used as rewards for participantion numberOfDxnBatches number of DXN batches, 0 <= batches < 10000 /
|
function burnDxnBatch(uint256 numberOfDxnBatches)
|
function burnDxnBatch(uint256 numberOfDxnBatches)
| 30,221
|
60
|
// Require that the new exchange portal is permitted by permittedAddresses
|
require(permittedAddresses.permittedAddresses(_newExchangePortalAddress));
exchangePortalAddress = _newExchangePortalAddress;
|
require(permittedAddresses.permittedAddresses(_newExchangePortalAddress));
exchangePortalAddress = _newExchangePortalAddress;
| 51,865
|
17
|
// USER FUNCTIONS/ //
|
function beginStaking() public {
require(!isStaking[msg.sender], "This user is already staking.");
isStaking[msg.sender] = true;
if (stakingPeriod[msg.sender] == 0) stakingPeriod[msg.sender] = block.number;
}
|
function beginStaking() public {
require(!isStaking[msg.sender], "This user is already staking.");
isStaking[msg.sender] = true;
if (stakingPeriod[msg.sender] == 0) stakingPeriod[msg.sender] = block.number;
}
| 5,921
|
3
|
// Errors library Aave Defines the error messages emitted by the different contracts of the Aave protocol Error messages prefix glossary: - VL = ValidationLogic - MATH = Math libraries - CT = Common errors between tokens (AToken, VariableDebtToken and StableDebtToken) - AT = AToken - SDT = StableDebtToken - VDT = VariableDebtToken - LP = LendingPool - LPAPR = LendingPoolAddressesProviderRegistry - LPC = LendingPoolConfiguration - RL = ReserveLogic - LPCM = LendingPoolCollateralManager - P = Pausable /
|
library Errors {
//common errors
string public constant CALLER_NOT_POOL_ADMIN = '33'; // 'The caller must be the pool admin'
string public constant BORROW_ALLOWANCE_NOT_ENOUGH = '59'; // User borrows on behalf, but allowance are too small
//contract specific errors
string public constant VL_INVALID_AMOUNT = '1'; // 'Amount must be greater than 0'
string public constant VL_NO_ACTIVE_RESERVE = '2'; // 'Action requires an active reserve'
string public constant VL_RESERVE_FROZEN = '3'; // 'Action cannot be performed because the reserve is frozen'
string public constant VL_CURRENT_AVAILABLE_LIQUIDITY_NOT_ENOUGH = '4'; // 'The current liquidity is not enough'
string public constant VL_NOT_ENOUGH_AVAILABLE_USER_BALANCE = '5'; // 'User cannot withdraw more than the available balance'
string public constant VL_TRANSFER_NOT_ALLOWED = '6'; // 'Transfer cannot be allowed.'
string public constant VL_BORROWING_NOT_ENABLED = '7'; // 'Borrowing is not enabled'
string public constant VL_INVALID_INTEREST_RATE_MODE_SELECTED = '8'; // 'Invalid interest rate mode selected'
string public constant VL_COLLATERAL_BALANCE_IS_0 = '9'; // 'The collateral balance is 0'
string public constant VL_HEALTH_FACTOR_LOWER_THAN_LIQUIDATION_THRESHOLD = '10'; // 'Health factor is lesser than the liquidation threshold'
string public constant VL_COLLATERAL_CANNOT_COVER_NEW_BORROW = '11'; // 'There is not enough collateral to cover a new borrow'
string public constant VL_STABLE_BORROWING_NOT_ENABLED = '12'; // stable borrowing not enabled
string public constant VL_COLLATERAL_SAME_AS_BORROWING_CURRENCY = '13'; // collateral is (mostly) the same currency that is being borrowed
string public constant VL_AMOUNT_BIGGER_THAN_MAX_LOAN_SIZE_STABLE = '14'; // 'The requested amount is greater than the max loan size in stable rate mode
string public constant VL_NO_DEBT_OF_SELECTED_TYPE = '15'; // 'for repayment of stable debt, the user needs to have stable debt, otherwise, he needs to have variable debt'
string public constant VL_NO_EXPLICIT_AMOUNT_TO_REPAY_ON_BEHALF = '16'; // 'To repay on behalf of an user an explicit amount to repay is needed'
string public constant VL_NO_STABLE_RATE_LOAN_IN_RESERVE = '17'; // 'User does not have a stable rate loan in progress on this reserve'
string public constant VL_NO_VARIABLE_RATE_LOAN_IN_RESERVE = '18'; // 'User does not have a variable rate loan in progress on this reserve'
string public constant VL_UNDERLYING_BALANCE_NOT_GREATER_THAN_0 = '19'; // 'The underlying balance needs to be greater than 0'
string public constant VL_DEPOSIT_ALREADY_IN_USE = '20'; // 'User deposit is already being used as collateral'
string public constant LP_NOT_ENOUGH_STABLE_BORROW_BALANCE = '21'; // 'User does not have any stable rate loan for this reserve'
string public constant LP_INTEREST_RATE_REBALANCE_CONDITIONS_NOT_MET = '22'; // 'Interest rate rebalance conditions were not met'
string public constant LP_LIQUIDATION_CALL_FAILED = '23'; // 'Liquidation call failed'
string public constant LP_NOT_ENOUGH_LIQUIDITY_TO_BORROW = '24'; // 'There is not enough liquidity available to borrow'
string public constant LP_REQUESTED_AMOUNT_TOO_SMALL = '25'; // 'The requested amount is too small for a FlashLoan.'
string public constant LP_INCONSISTENT_PROTOCOL_ACTUAL_BALANCE = '26'; // 'The actual balance of the protocol is inconsistent'
string public constant LP_CALLER_NOT_LENDING_POOL_CONFIGURATOR = '27'; // 'The caller of the function is not the lending pool configurator'
string public constant LP_INCONSISTENT_FLASHLOAN_PARAMS = '28';
string public constant CT_CALLER_MUST_BE_LENDING_POOL = '29'; // 'The caller of this function must be a lending pool'
string public constant CT_CANNOT_GIVE_ALLOWANCE_TO_HIMSELF = '30'; // 'User cannot give allowance to himself'
string public constant CT_TRANSFER_AMOUNT_NOT_GT_0 = '31'; // 'Transferred amount needs to be greater than zero'
string public constant RL_RESERVE_ALREADY_INITIALIZED = '32'; // 'Reserve has already been initialized'
string public constant LPC_RESERVE_LIQUIDITY_NOT_0 = '34'; // 'The liquidity of the reserve needs to be 0'
string public constant LPC_INVALID_ATOKEN_POOL_ADDRESS = '35'; // 'The liquidity of the reserve needs to be 0'
string public constant LPC_INVALID_STABLE_DEBT_TOKEN_POOL_ADDRESS = '36'; // 'The liquidity of the reserve needs to be 0'
string public constant LPC_INVALID_VARIABLE_DEBT_TOKEN_POOL_ADDRESS = '37'; // 'The liquidity of the reserve needs to be 0'
string public constant LPC_INVALID_STABLE_DEBT_TOKEN_UNDERLYING_ADDRESS = '38'; // 'The liquidity of the reserve needs to be 0'
string public constant LPC_INVALID_VARIABLE_DEBT_TOKEN_UNDERLYING_ADDRESS = '39'; // 'The liquidity of the reserve needs to be 0'
string public constant LPC_INVALID_ADDRESSES_PROVIDER_ID = '40'; // 'The liquidity of the reserve needs to be 0'
string public constant LPC_INVALID_CONFIGURATION = '75'; // 'Invalid risk parameters for the reserve'
string public constant LPC_CALLER_NOT_EMERGENCY_ADMIN = '76'; // 'The caller must be the emergency admin'
string public constant LPAPR_PROVIDER_NOT_REGISTERED = '41'; // 'Provider is not registered'
string public constant LPCM_HEALTH_FACTOR_NOT_BELOW_THRESHOLD = '42'; // 'Health factor is not below the threshold'
string public constant LPCM_COLLATERAL_CANNOT_BE_LIQUIDATED = '43'; // 'The collateral chosen cannot be liquidated'
string public constant LPCM_SPECIFIED_CURRENCY_NOT_BORROWED_BY_USER = '44'; // 'User did not borrow the specified currency'
string public constant LPCM_NOT_ENOUGH_LIQUIDITY_TO_LIQUIDATE = '45'; // "There isn't enough liquidity available to liquidate"
string public constant LPCM_NO_ERRORS = '46'; // 'No errors'
string public constant LP_INVALID_FLASHLOAN_MODE = '47'; //Invalid flashloan mode selected
string public constant MATH_MULTIPLICATION_OVERFLOW = '48';
string public constant MATH_ADDITION_OVERFLOW = '49';
string public constant MATH_DIVISION_BY_ZERO = '50';
string public constant RL_LIQUIDITY_INDEX_OVERFLOW = '51'; // Liquidity index overflows uint128
string public constant RL_VARIABLE_BORROW_INDEX_OVERFLOW = '52'; // Variable borrow index overflows uint128
string public constant RL_LIQUIDITY_RATE_OVERFLOW = '53'; // Liquidity rate overflows uint128
string public constant RL_VARIABLE_BORROW_RATE_OVERFLOW = '54'; // Variable borrow rate overflows uint128
string public constant RL_STABLE_BORROW_RATE_OVERFLOW = '55'; // Stable borrow rate overflows uint128
string public constant CT_INVALID_MINT_AMOUNT = '56'; //invalid amount to mint
string public constant LP_FAILED_REPAY_WITH_COLLATERAL = '57';
string public constant CT_INVALID_BURN_AMOUNT = '58'; //invalid amount to burn
string public constant LP_FAILED_COLLATERAL_SWAP = '60';
string public constant LP_INVALID_EQUAL_ASSETS_TO_SWAP = '61';
string public constant LP_REENTRANCY_NOT_ALLOWED = '62';
string public constant LP_CALLER_MUST_BE_AN_ATOKEN = '63';
string public constant LP_IS_PAUSED = '64'; // 'Pool is paused'
string public constant LP_NO_MORE_RESERVES_ALLOWED = '65';
string public constant LP_INVALID_FLASH_LOAN_EXECUTOR_RETURN = '66';
string public constant RC_INVALID_LTV = '67';
string public constant RC_INVALID_LIQ_THRESHOLD = '68';
string public constant RC_INVALID_LIQ_BONUS = '69';
string public constant RC_INVALID_DECIMALS = '70';
string public constant RC_INVALID_RESERVE_FACTOR = '71';
string public constant LPAPR_INVALID_ADDRESSES_PROVIDER_ID = '72';
string public constant VL_INCONSISTENT_FLASHLOAN_PARAMS = '73';
string public constant LP_INCONSISTENT_PARAMS_LENGTH = '74';
string public constant UL_INVALID_INDEX = '77';
string public constant LP_NOT_CONTRACT = '78';
string public constant SDT_STABLE_DEBT_OVERFLOW = '79';
string public constant SDT_BURN_EXCEEDS_BALANCE = '80';
enum CollateralManagerErrors {
NO_ERROR,
NO_COLLATERAL_AVAILABLE,
COLLATERAL_CANNOT_BE_LIQUIDATED,
CURRRENCY_NOT_BORROWED,
HEALTH_FACTOR_ABOVE_THRESHOLD,
NOT_ENOUGH_LIQUIDITY,
NO_ACTIVE_RESERVE,
HEALTH_FACTOR_LOWER_THAN_LIQUIDATION_THRESHOLD,
INVALID_EQUAL_ASSETS_TO_SWAP,
FROZEN_RESERVE
}
}
|
library Errors {
//common errors
string public constant CALLER_NOT_POOL_ADMIN = '33'; // 'The caller must be the pool admin'
string public constant BORROW_ALLOWANCE_NOT_ENOUGH = '59'; // User borrows on behalf, but allowance are too small
//contract specific errors
string public constant VL_INVALID_AMOUNT = '1'; // 'Amount must be greater than 0'
string public constant VL_NO_ACTIVE_RESERVE = '2'; // 'Action requires an active reserve'
string public constant VL_RESERVE_FROZEN = '3'; // 'Action cannot be performed because the reserve is frozen'
string public constant VL_CURRENT_AVAILABLE_LIQUIDITY_NOT_ENOUGH = '4'; // 'The current liquidity is not enough'
string public constant VL_NOT_ENOUGH_AVAILABLE_USER_BALANCE = '5'; // 'User cannot withdraw more than the available balance'
string public constant VL_TRANSFER_NOT_ALLOWED = '6'; // 'Transfer cannot be allowed.'
string public constant VL_BORROWING_NOT_ENABLED = '7'; // 'Borrowing is not enabled'
string public constant VL_INVALID_INTEREST_RATE_MODE_SELECTED = '8'; // 'Invalid interest rate mode selected'
string public constant VL_COLLATERAL_BALANCE_IS_0 = '9'; // 'The collateral balance is 0'
string public constant VL_HEALTH_FACTOR_LOWER_THAN_LIQUIDATION_THRESHOLD = '10'; // 'Health factor is lesser than the liquidation threshold'
string public constant VL_COLLATERAL_CANNOT_COVER_NEW_BORROW = '11'; // 'There is not enough collateral to cover a new borrow'
string public constant VL_STABLE_BORROWING_NOT_ENABLED = '12'; // stable borrowing not enabled
string public constant VL_COLLATERAL_SAME_AS_BORROWING_CURRENCY = '13'; // collateral is (mostly) the same currency that is being borrowed
string public constant VL_AMOUNT_BIGGER_THAN_MAX_LOAN_SIZE_STABLE = '14'; // 'The requested amount is greater than the max loan size in stable rate mode
string public constant VL_NO_DEBT_OF_SELECTED_TYPE = '15'; // 'for repayment of stable debt, the user needs to have stable debt, otherwise, he needs to have variable debt'
string public constant VL_NO_EXPLICIT_AMOUNT_TO_REPAY_ON_BEHALF = '16'; // 'To repay on behalf of an user an explicit amount to repay is needed'
string public constant VL_NO_STABLE_RATE_LOAN_IN_RESERVE = '17'; // 'User does not have a stable rate loan in progress on this reserve'
string public constant VL_NO_VARIABLE_RATE_LOAN_IN_RESERVE = '18'; // 'User does not have a variable rate loan in progress on this reserve'
string public constant VL_UNDERLYING_BALANCE_NOT_GREATER_THAN_0 = '19'; // 'The underlying balance needs to be greater than 0'
string public constant VL_DEPOSIT_ALREADY_IN_USE = '20'; // 'User deposit is already being used as collateral'
string public constant LP_NOT_ENOUGH_STABLE_BORROW_BALANCE = '21'; // 'User does not have any stable rate loan for this reserve'
string public constant LP_INTEREST_RATE_REBALANCE_CONDITIONS_NOT_MET = '22'; // 'Interest rate rebalance conditions were not met'
string public constant LP_LIQUIDATION_CALL_FAILED = '23'; // 'Liquidation call failed'
string public constant LP_NOT_ENOUGH_LIQUIDITY_TO_BORROW = '24'; // 'There is not enough liquidity available to borrow'
string public constant LP_REQUESTED_AMOUNT_TOO_SMALL = '25'; // 'The requested amount is too small for a FlashLoan.'
string public constant LP_INCONSISTENT_PROTOCOL_ACTUAL_BALANCE = '26'; // 'The actual balance of the protocol is inconsistent'
string public constant LP_CALLER_NOT_LENDING_POOL_CONFIGURATOR = '27'; // 'The caller of the function is not the lending pool configurator'
string public constant LP_INCONSISTENT_FLASHLOAN_PARAMS = '28';
string public constant CT_CALLER_MUST_BE_LENDING_POOL = '29'; // 'The caller of this function must be a lending pool'
string public constant CT_CANNOT_GIVE_ALLOWANCE_TO_HIMSELF = '30'; // 'User cannot give allowance to himself'
string public constant CT_TRANSFER_AMOUNT_NOT_GT_0 = '31'; // 'Transferred amount needs to be greater than zero'
string public constant RL_RESERVE_ALREADY_INITIALIZED = '32'; // 'Reserve has already been initialized'
string public constant LPC_RESERVE_LIQUIDITY_NOT_0 = '34'; // 'The liquidity of the reserve needs to be 0'
string public constant LPC_INVALID_ATOKEN_POOL_ADDRESS = '35'; // 'The liquidity of the reserve needs to be 0'
string public constant LPC_INVALID_STABLE_DEBT_TOKEN_POOL_ADDRESS = '36'; // 'The liquidity of the reserve needs to be 0'
string public constant LPC_INVALID_VARIABLE_DEBT_TOKEN_POOL_ADDRESS = '37'; // 'The liquidity of the reserve needs to be 0'
string public constant LPC_INVALID_STABLE_DEBT_TOKEN_UNDERLYING_ADDRESS = '38'; // 'The liquidity of the reserve needs to be 0'
string public constant LPC_INVALID_VARIABLE_DEBT_TOKEN_UNDERLYING_ADDRESS = '39'; // 'The liquidity of the reserve needs to be 0'
string public constant LPC_INVALID_ADDRESSES_PROVIDER_ID = '40'; // 'The liquidity of the reserve needs to be 0'
string public constant LPC_INVALID_CONFIGURATION = '75'; // 'Invalid risk parameters for the reserve'
string public constant LPC_CALLER_NOT_EMERGENCY_ADMIN = '76'; // 'The caller must be the emergency admin'
string public constant LPAPR_PROVIDER_NOT_REGISTERED = '41'; // 'Provider is not registered'
string public constant LPCM_HEALTH_FACTOR_NOT_BELOW_THRESHOLD = '42'; // 'Health factor is not below the threshold'
string public constant LPCM_COLLATERAL_CANNOT_BE_LIQUIDATED = '43'; // 'The collateral chosen cannot be liquidated'
string public constant LPCM_SPECIFIED_CURRENCY_NOT_BORROWED_BY_USER = '44'; // 'User did not borrow the specified currency'
string public constant LPCM_NOT_ENOUGH_LIQUIDITY_TO_LIQUIDATE = '45'; // "There isn't enough liquidity available to liquidate"
string public constant LPCM_NO_ERRORS = '46'; // 'No errors'
string public constant LP_INVALID_FLASHLOAN_MODE = '47'; //Invalid flashloan mode selected
string public constant MATH_MULTIPLICATION_OVERFLOW = '48';
string public constant MATH_ADDITION_OVERFLOW = '49';
string public constant MATH_DIVISION_BY_ZERO = '50';
string public constant RL_LIQUIDITY_INDEX_OVERFLOW = '51'; // Liquidity index overflows uint128
string public constant RL_VARIABLE_BORROW_INDEX_OVERFLOW = '52'; // Variable borrow index overflows uint128
string public constant RL_LIQUIDITY_RATE_OVERFLOW = '53'; // Liquidity rate overflows uint128
string public constant RL_VARIABLE_BORROW_RATE_OVERFLOW = '54'; // Variable borrow rate overflows uint128
string public constant RL_STABLE_BORROW_RATE_OVERFLOW = '55'; // Stable borrow rate overflows uint128
string public constant CT_INVALID_MINT_AMOUNT = '56'; //invalid amount to mint
string public constant LP_FAILED_REPAY_WITH_COLLATERAL = '57';
string public constant CT_INVALID_BURN_AMOUNT = '58'; //invalid amount to burn
string public constant LP_FAILED_COLLATERAL_SWAP = '60';
string public constant LP_INVALID_EQUAL_ASSETS_TO_SWAP = '61';
string public constant LP_REENTRANCY_NOT_ALLOWED = '62';
string public constant LP_CALLER_MUST_BE_AN_ATOKEN = '63';
string public constant LP_IS_PAUSED = '64'; // 'Pool is paused'
string public constant LP_NO_MORE_RESERVES_ALLOWED = '65';
string public constant LP_INVALID_FLASH_LOAN_EXECUTOR_RETURN = '66';
string public constant RC_INVALID_LTV = '67';
string public constant RC_INVALID_LIQ_THRESHOLD = '68';
string public constant RC_INVALID_LIQ_BONUS = '69';
string public constant RC_INVALID_DECIMALS = '70';
string public constant RC_INVALID_RESERVE_FACTOR = '71';
string public constant LPAPR_INVALID_ADDRESSES_PROVIDER_ID = '72';
string public constant VL_INCONSISTENT_FLASHLOAN_PARAMS = '73';
string public constant LP_INCONSISTENT_PARAMS_LENGTH = '74';
string public constant UL_INVALID_INDEX = '77';
string public constant LP_NOT_CONTRACT = '78';
string public constant SDT_STABLE_DEBT_OVERFLOW = '79';
string public constant SDT_BURN_EXCEEDS_BALANCE = '80';
enum CollateralManagerErrors {
NO_ERROR,
NO_COLLATERAL_AVAILABLE,
COLLATERAL_CANNOT_BE_LIQUIDATED,
CURRRENCY_NOT_BORROWED,
HEALTH_FACTOR_ABOVE_THRESHOLD,
NOT_ENOUGH_LIQUIDITY,
NO_ACTIVE_RESERVE,
HEALTH_FACTOR_LOWER_THAN_LIQUIDATION_THRESHOLD,
INVALID_EQUAL_ASSETS_TO_SWAP,
FROZEN_RESERVE
}
}
| 4,130
|
80
|
// for ETH and ERC20 fund this asset different
|
address public coreFundAsset;
|
address public coreFundAsset;
| 47,330
|
9
|
// define pointer
|
let p := mload(0x40)
|
let p := mload(0x40)
| 11,287
|
229
|
// Group 0: No grouping
|
totalNumVotes += total[0];
numVotes += signed[0];
|
totalNumVotes += total[0];
numVotes += signed[0];
| 3,654
|
181
|
// Transfers 'tokenId' from 'from' to 'to'.
|
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - 'to' cannot be the zero address.
* - 'tokenId' token must be owned by 'from'.
*
* Emits a {Transfer} event.
*/
function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
// Clear approvals from the previous owner
_approve(address(0), tokenId);
_balances[from] -= 1;
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
}
|
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - 'to' cannot be the zero address.
* - 'tokenId' token must be owned by 'from'.
*
* Emits a {Transfer} event.
*/
function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
// Clear approvals from the previous owner
_approve(address(0), tokenId);
_balances[from] -= 1;
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
}
| 26,392
|
4
|
// do the approval for the Collats Contract
|
IERC20Upgradeable(token).safeApprove(address(collats), amount);
|
IERC20Upgradeable(token).safeApprove(address(collats), amount);
| 8,046
|
6
|
// Burn handles disbursing a share of tokens in this contract to a given address./_to The address to disburse to/_amount The amount of TKN that will be burned if this succeeds
|
function burn(address payable _to, uint256 _amount) external onlyBurner returns (bool) {
if (_amount == 0) {
return true;
}
// The burner token deducts from the supply before calling.
uint256 supply = IBurner(_burner).currentSupply().add(_amount);
address[] memory redeemableAddresses = _redeemableTokens();
for (uint256 i = 0; i < redeemableAddresses.length; i++) {
uint256 redeemableBalance = _balance(address(this), redeemableAddresses[i]);
if (redeemableBalance > 0) {
uint256 redeemableAmount = redeemableBalance.mul(_amount).div(supply);
_safeTransfer(_to, redeemableAddresses[i], redeemableAmount);
emit CashAndBurned(_to, redeemableAddresses[i], redeemableAmount);
}
}
return true;
}
|
function burn(address payable _to, uint256 _amount) external onlyBurner returns (bool) {
if (_amount == 0) {
return true;
}
// The burner token deducts from the supply before calling.
uint256 supply = IBurner(_burner).currentSupply().add(_amount);
address[] memory redeemableAddresses = _redeemableTokens();
for (uint256 i = 0; i < redeemableAddresses.length; i++) {
uint256 redeemableBalance = _balance(address(this), redeemableAddresses[i]);
if (redeemableBalance > 0) {
uint256 redeemableAmount = redeemableBalance.mul(_amount).div(supply);
_safeTransfer(_to, redeemableAddresses[i], redeemableAmount);
emit CashAndBurned(_to, redeemableAddresses[i], redeemableAmount);
}
}
return true;
}
| 35,566
|
11
|
// Sets the contract URI for contract metadata.newContractURI The new contract URI. /
|
function setContractURI(string calldata newContractURI)
external
override
onlyOwner
|
function setContractURI(string calldata newContractURI)
external
override
onlyOwner
| 11,802
|
146
|
// Vars for use in the boost calculations
|
uint256 private constant MIN_DEPOSIT = 1e18;
uint256 private constant MAX_VMTA = 600000e18;
uint256 private constant MAX_BOOST = 3e18;
uint256 private constant MIN_BOOST = 1e18;
uint256 private constant FLOOR = 98e16;
uint256 public immutable boostCoeff; // scaled by 10
uint256 public immutable priceCoeff;
|
uint256 private constant MIN_DEPOSIT = 1e18;
uint256 private constant MAX_VMTA = 600000e18;
uint256 private constant MAX_BOOST = 3e18;
uint256 private constant MIN_BOOST = 1e18;
uint256 private constant FLOOR = 98e16;
uint256 public immutable boostCoeff; // scaled by 10
uint256 public immutable priceCoeff;
| 15,476
|
5
|
// Allows you to change the owner of the contract.
|
function changeOwner(address newOwner) public onlyOwner virtual
|
function changeOwner(address newOwner) public onlyOwner virtual
| 28,846
|
5
|
// Claim all the COMP accrued by specific holders in specific markets for their supplies and/or borrows
|
function claimComp(
address[] memory holders,
CToken[] memory cTokens,
bool borrowers,
bool suppliers
) external virtual;
|
function claimComp(
address[] memory holders,
CToken[] memory cTokens,
bool borrowers,
bool suppliers
) external virtual;
| 37,035
|
105
|
// max ether sender can spent
|
spendable = reversePercent(
balances[msg.sender],
applyCoeff(takeFee, msg.sender)
);
|
spendable = reversePercent(
balances[msg.sender],
applyCoeff(takeFee, msg.sender)
);
| 41,738
|
118
|
// Checking that the y-coordinates are same.
|
require(
leftSegment.right.y == rightSegment.left.y,
"given polyline is not a continuous function"
);
int256 nextGradientNumerator = int256(rightSegment.right.y) -
int256(rightSegment.left.y);
int256 nextGradientDenominator = int256(rightSegment.right.x) -
int256(rightSegment.left.x);
require(
|
require(
leftSegment.right.y == rightSegment.left.y,
"given polyline is not a continuous function"
);
int256 nextGradientNumerator = int256(rightSegment.right.y) -
int256(rightSegment.left.y);
int256 nextGradientDenominator = int256(rightSegment.right.x) -
int256(rightSegment.left.x);
require(
| 33,168
|
40
|
// investor -> option -> vested eth
|
mapping(address => mapping(uint256 => uint256)) public vests;
|
mapping(address => mapping(uint256 => uint256)) public vests;
| 18,302
|
11
|
// 添加 value 到数组中
|
function addValue(uint256[] storage array, uint256 value) internal {
uint256 index;
bool isInArray;
(isInArray, index) = firstIndexOf(array, value);
// 如果不存在于数组中
if (!isInArray) {
array.push(value);
}
}
|
function addValue(uint256[] storage array, uint256 value) internal {
uint256 index;
bool isInArray;
(isInArray, index) = firstIndexOf(array, value);
// 如果不存在于数组中
if (!isInArray) {
array.push(value);
}
}
| 34,005
|
114
|
// This turns the input data into a 100-sided die by dividing by ceil(2 ^ 256 / 100).
|
uint256 factor = 1157920892373161954235709850086879078532699846656405640394575840079131296399;
saltForRandom += uint256(msg.sender) % 100 + uint256(uint256(hashVal) / factor);
return saltForRandom;
|
uint256 factor = 1157920892373161954235709850086879078532699846656405640394575840079131296399;
saltForRandom += uint256(msg.sender) % 100 + uint256(uint256(hashVal) / factor);
return saltForRandom;
| 11,068
|
50
|
// Burns a mint pass. Intended to be called when minting a QQL token.
|
function burn(uint256 tokenId) external {
if (msg.sender != burner_) revert("MintPass: unauthorized");
_burn(tokenId);
}
|
function burn(uint256 tokenId) external {
if (msg.sender != burner_) revert("MintPass: unauthorized");
_burn(tokenId);
}
| 34,032
|
10
|
// Modifier that requires the "ContractOwner" account to be the function caller /
|
modifier requireContractOwner() {
require(msg.sender == contractOwner, "Caller is not contract owner.");
_;
}
|
modifier requireContractOwner() {
require(msg.sender == contractOwner, "Caller is not contract owner.");
_;
}
| 38,333
|
65
|
// Returns the owner of the contract. /
|
function owner() public override view returns (address) {
return _owner;
}
|
function owner() public override view returns (address) {
return _owner;
}
| 6,868
|
23
|
// Pay out requisite `virtual&39; dividends.
|
address _customerAddress = msg.sender;
payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude);
_dividends += referralBalance_[_customerAddress];
referralBalance_[_customerAddress] = 0;
uint _tokens = purchaseTokens(_dividends, 0x0);
|
address _customerAddress = msg.sender;
payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude);
_dividends += referralBalance_[_customerAddress];
referralBalance_[_customerAddress] = 0;
uint _tokens = purchaseTokens(_dividends, 0x0);
| 16,519
|
65
|
// Getters
|
function getBaseBuyFees() external view returns (uint8,uint8, uint8) {
return (_base.targetAFeeOnBuy,_base.targetBFeeOnBuy, _base.targetCFeeOnBuy);
}
|
function getBaseBuyFees() external view returns (uint8,uint8, uint8) {
return (_base.targetAFeeOnBuy,_base.targetBFeeOnBuy, _base.targetCFeeOnBuy);
}
| 23,219
|
32
|
// first instruction must be account initializer. actually by design, we must initialize account for every giveTokenAddress+beneficiary pair, but right for simplicity reasons we assume that batches may contain orders with the same giveTokenAddress, so only a single initialization is required
|
instructionsData = EncodeSolanaDlnMessage.encodeInitWalletIfNeededInstruction(
_beneficiary,
giveTokenAddress,
_initWalletIfNeededInstructionReward
);
|
instructionsData = EncodeSolanaDlnMessage.encodeInitWalletIfNeededInstruction(
_beneficiary,
giveTokenAddress,
_initWalletIfNeededInstructionReward
);
| 13,465
|
25
|
// Read only function to see the 2 children of a node in Company forced matrixreturn 2 branches /
|
function viewUserReferralMatrix1(address _user) public view returns(address[] memory) {
return users[_user].referralMatrix1;
}
|
function viewUserReferralMatrix1(address _user) public view returns(address[] memory) {
return users[_user].referralMatrix1;
}
| 34,598
|
269
|
// Function to purchase tokens. It will be called either with DAI or ETH. DAIAmountContributed Amount of DAI contributed /
|
function buyTokens(uint256 DAIAmountContributed) public nonReentrant payable {
uint256 DAIAmount = DAIAmountContributed;
uint256 weiAmount = msg.value;
address beneficiary = msg.sender;
_preValidatePurchase(beneficiary, weiAmount, DAIAmountContributed);
require(whiteList.isWhitelisted(beneficiary), "Sale:buyTokens - User is not whitelisted");
if (msg.value > 0) {
DAIAmount = calculateDAIForEther(msg.value);
_weiRaised = _weiRaised.add(weiAmount);
} else if (DAIAmountContributed > 0)
{
_DAIRaised = _DAIRaised.add(DAIAmountContributed);
IERC20(DAI).safeTransferFrom(msg.sender, address(this), DAIAmountContributed);
}
uint256 tokens = getTokenAmount(DAIAmount);
require(tokens <= 1e24, "Sale:buyTokens - You can buy max 1 million AUDT tokens at a time");
_tokensLeft = _tokensLeft.sub(tokens);
_forwardFunds(DAIAmountContributed);
(uint256 vestedAmount, uint256 instantAmount) = calculateVestingInstantPortion(tokens);
TokenHolder storage tokenHolder = tokenHolders[beneficiary];
tokenHolder.tokensToSend += vestedAmount;
_token.mint(beneficiary, instantAmount);
emit TokensPurchased(beneficiary, weiAmount, DAIAmountContributed, vestedAmount, instantAmount);
}
|
function buyTokens(uint256 DAIAmountContributed) public nonReentrant payable {
uint256 DAIAmount = DAIAmountContributed;
uint256 weiAmount = msg.value;
address beneficiary = msg.sender;
_preValidatePurchase(beneficiary, weiAmount, DAIAmountContributed);
require(whiteList.isWhitelisted(beneficiary), "Sale:buyTokens - User is not whitelisted");
if (msg.value > 0) {
DAIAmount = calculateDAIForEther(msg.value);
_weiRaised = _weiRaised.add(weiAmount);
} else if (DAIAmountContributed > 0)
{
_DAIRaised = _DAIRaised.add(DAIAmountContributed);
IERC20(DAI).safeTransferFrom(msg.sender, address(this), DAIAmountContributed);
}
uint256 tokens = getTokenAmount(DAIAmount);
require(tokens <= 1e24, "Sale:buyTokens - You can buy max 1 million AUDT tokens at a time");
_tokensLeft = _tokensLeft.sub(tokens);
_forwardFunds(DAIAmountContributed);
(uint256 vestedAmount, uint256 instantAmount) = calculateVestingInstantPortion(tokens);
TokenHolder storage tokenHolder = tokenHolders[beneficiary];
tokenHolder.tokensToSend += vestedAmount;
_token.mint(beneficiary, instantAmount);
emit TokensPurchased(beneficiary, weiAmount, DAIAmountContributed, vestedAmount, instantAmount);
}
| 28,773
|
40
|
// Deposit `_value` additional tokens for `msg.sender` without modifying the unlock time/_value Amount of tokens to deposit and add to the lock
|
function increase_amount(uint _value) external nonReentrant onlyUserOrWhitelist notUnlocked {
_increase_amount(_value);
}
|
function increase_amount(uint _value) external nonReentrant onlyUserOrWhitelist notUnlocked {
_increase_amount(_value);
}
| 3,112
|
35
|
// Stakes a certain amount of tokens, this MUST transfer the given amount from the user MUST trigger Staked event _amount uint256 the amount of tokens to stake _data bytes optional data to include in the Stake event /
|
function stake(uint256 _amount, bytes _data) public {
createStake(
msg.sender,
_amount,
defaultLockInDuration,
_data);
}
|
function stake(uint256 _amount, bytes _data) public {
createStake(
msg.sender,
_amount,
defaultLockInDuration,
_data);
}
| 28
|
4
|
// The escrow with liquidityAmount is the one to call applyCreditToJob, the other should call unbondLiquidityFromJob
|
if (Keep3rV1.liquidityAmount(address(Escrow1), address(Liquidity), address(Keep3rSugarMommy)) > 0 &&
Keep3rV1.liquidityApplied(address(Escrow1), address(Liquidity), address(Keep3rSugarMommy)) < now) {
return (Escrow1, Actions.applyCreditToJob);
}
|
if (Keep3rV1.liquidityAmount(address(Escrow1), address(Liquidity), address(Keep3rSugarMommy)) > 0 &&
Keep3rV1.liquidityApplied(address(Escrow1), address(Liquidity), address(Keep3rSugarMommy)) < now) {
return (Escrow1, Actions.applyCreditToJob);
}
| 54,048
|
16
|
// This function allows a user to withdraw their funds from a batch before that batch has been processed batchId From which batch should funds be withdrawn from owner address that owns the account balance amount amount of tokens to withdraw from batch recipient address that will receive the token transfer. if address(0) then no transfer is made /
|
function withdraw(
bytes32 batchId,
address owner,
uint256 amount,
address recipient
|
function withdraw(
bytes32 batchId,
address owner,
uint256 amount,
address recipient
| 18,031
|
79
|
// Clear payee arary list. /
|
function clearPayees() public onlyOwner{
for (uint index=0; index<_payees.length; index++) {
delete _shares[_payees[index]];
}
_payees.length = 0;
delete _payees;
}
|
function clearPayees() public onlyOwner{
for (uint index=0; index<_payees.length; index++) {
delete _shares[_payees[index]];
}
_payees.length = 0;
delete _payees;
}
| 41,417
|
60
|
// JZMToken JZMToken is a token that provide lock function /
|
contract JZMToken is PausableToken {
event TransferWithLock(address indexed from, address indexed to, address indexed locked, uint256 amount, uint256 releaseTime);
mapping (address => address[] ) public balancesLocked;
function transferWithLock(address _to, uint256 _amount, uint256 _releaseTime) public returns (bool) {
JZMLock lock = new JZMLock(this, _to, _releaseTime);
transfer(address(lock), _amount);
balancesLocked[_to].push(lock);
emit TransferWithLock(msg.sender, _to, address(lock), _amount, _releaseTime);
return true;
}
/**
* @dev Gets the locked balance of the specified address.
* @param _owner The address to query the locked balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOfLocked(address _owner) public view returns (uint256) {
address[] memory lockTokenAddrs = balancesLocked[_owner];
uint256 totalLockedBalance = 0;
for (uint i = 0; i < lockTokenAddrs.length; i++) {
totalLockedBalance = totalLockedBalance.add(balances[lockTokenAddrs[i]]);
}
return totalLockedBalance;
}
function releaseToken(address _owner) public returns (bool) {
address[] memory lockTokenAddrs = balancesLocked[_owner];
for (uint i = 0; i < lockTokenAddrs.length; i++) {
JZMLock lock = JZMLock(lockTokenAddrs[i]);
if (lock.canRelease() && balanceOf(lock)>0) {
lock.release();
}
}
return true;
}
}
|
contract JZMToken is PausableToken {
event TransferWithLock(address indexed from, address indexed to, address indexed locked, uint256 amount, uint256 releaseTime);
mapping (address => address[] ) public balancesLocked;
function transferWithLock(address _to, uint256 _amount, uint256 _releaseTime) public returns (bool) {
JZMLock lock = new JZMLock(this, _to, _releaseTime);
transfer(address(lock), _amount);
balancesLocked[_to].push(lock);
emit TransferWithLock(msg.sender, _to, address(lock), _amount, _releaseTime);
return true;
}
/**
* @dev Gets the locked balance of the specified address.
* @param _owner The address to query the locked balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOfLocked(address _owner) public view returns (uint256) {
address[] memory lockTokenAddrs = balancesLocked[_owner];
uint256 totalLockedBalance = 0;
for (uint i = 0; i < lockTokenAddrs.length; i++) {
totalLockedBalance = totalLockedBalance.add(balances[lockTokenAddrs[i]]);
}
return totalLockedBalance;
}
function releaseToken(address _owner) public returns (bool) {
address[] memory lockTokenAddrs = balancesLocked[_owner];
for (uint i = 0; i < lockTokenAddrs.length; i++) {
JZMLock lock = JZMLock(lockTokenAddrs[i]);
if (lock.canRelease() && balanceOf(lock)>0) {
lock.release();
}
}
return true;
}
}
| 7,536
|
0
|
// token name and token abbreviation are hard coded 21 million tokens are minted to the address that deploys the contract
|
constructor() ERC20("Basic Token", "BASIC") {
_mint(msg.sender, 21000000 * (10 ** uint256(decimals())));
}
|
constructor() ERC20("Basic Token", "BASIC") {
_mint(msg.sender, 21000000 * (10 ** uint256(decimals())));
}
| 17,014
|
23
|
// Name: auditBankAction Description : This is an internal function is to track all the actions done by any bank Parameters:
|
* param {address} changesDoneBy : Ethereum address of the Bank who made the change
* param {BankActions} bankAction : The ENUM value of action done by the bank
*
*******************************************************************************************************************/
function auditBankAction(address changesDoneBy, BankActions bankAction)
private
{
bankActionsAudit[changesDoneBy][int256(bankAction)] = now;
}
|
* param {address} changesDoneBy : Ethereum address of the Bank who made the change
* param {BankActions} bankAction : The ENUM value of action done by the bank
*
*******************************************************************************************************************/
function auditBankAction(address changesDoneBy, BankActions bankAction)
private
{
bankActionsAudit[changesDoneBy][int256(bankAction)] = now;
}
| 1,802
|
1
|
// A single input for token amount calculation and approval
|
struct Input {
address token; // Token address
uint256 balanceBps; // Basis points for calculating the amount, set 0 to use amountOrOffset as amount
uint256 amountOrOffset; // Read as amount if balanceBps is 0; otherwise, read as byte offset of amount in `Logic.data` for replacement, or set 1 << 255 for no replacement
}
|
struct Input {
address token; // Token address
uint256 balanceBps; // Basis points for calculating the amount, set 0 to use amountOrOffset as amount
uint256 amountOrOffset; // Read as amount if balanceBps is 0; otherwise, read as byte offset of amount in `Logic.data` for replacement, or set 1 << 255 for no replacement
}
| 9,216
|
20
|
// SNGT Implemantation of the SNGT token /
|
contract SNGTContract is Ownable, ERC20Interface {
using SafeMath for uint256;
string public constant symbol = "SNGT";
string public constant name = "SNGT";
uint8 public constant decimals = 18;
uint256 private _unmintedTokens = 500000000 * uint(10) ** decimals;
mapping(address => uint256) balances;
mapping (address => mapping (address => uint256)) internal allowed;
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
event Burn(address indexed _address, uint256 _value);
event Mint(address indexed _address, uint256 _value);
/**
* @dev Gets the balance of the specified address
* @param _owner The address to query the the balance of
* @return An uint256 representing the amount owned by the passed address
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
/**
* @dev Transfer token to a specified address
* @param _to The address to transfer to
* @param _value The amount to be transferred
*/
function transfer(address _to, uint256 _value) public returns (bool success) {
require(_to != address(0));
require(balances[msg.sender] >= _value);
assert(balances[_to] + _value >= balances[_to]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* @param _from The address which you want to send tokens from
* @param _to The address which you want to transfer to
* @param _value The amout of tokens to be transfered
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
assert(balances[_to] + _value >= balances[_to]);
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 Aprove the passed address to spend the specified amount of tokens on behalf of msg.sender
* @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 success) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens than an owner allowed to a spender
* @param _owner The address which owns the funds
* @param _spender The address which will spend the funds
* @return A uint specifing the amount of tokens still avaible for the spender
*/
function allowance(address _owner, address _spender) public view returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* @dev Mint SNGT tokens. No more than 500,000,000 SNGT can be minted
* @param _account The address to which new tokens will be minted
* @param _mintedAmount The amout of tokens to be minted
*/
function mintTokens(address _account, uint256 _mintedAmount) public onlyOwner returns (bool success){
require(_mintedAmount <= _unmintedTokens);
balances[_account] = balances[_account].add(_mintedAmount);
_unmintedTokens = _unmintedTokens.sub(_mintedAmount);
totalSupply = totalSupply.add(_mintedAmount);
emit Mint(_account, _mintedAmount);
return true;
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0.
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseAllowance(address _spender, uint256 _addedValue) public returns (bool) {
require(_spender != address(0));
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.
* Emits an Approval event.
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseAllowance(address _spender, uint256 _subtractedValue) public returns (bool) {
require(_spender != address(0));
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].sub(_subtractedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Mint SNGT tokens and aproves the passed address to spend the minted amount of tokens
* No more than 500,000,000 SNGT can be minted
* @param _target The address to which new tokens will be minted
* @param _mintedAmount The amout of tokens to be minted
* @param _spender The address which will spend minted funds
*/
function mintTokensWithApproval(address _target, uint256 _mintedAmount, address _spender) public onlyOwner returns (bool success){
require(_mintedAmount <= _unmintedTokens);
balances[_target] = balances[_target].add(_mintedAmount);
_unmintedTokens = _unmintedTokens.sub(_mintedAmount);
totalSupply = totalSupply.add(_mintedAmount);
allowed[_target][_spender] = allowed[_target][_spender].add(_mintedAmount);
emit Mint(_target, _mintedAmount);
return true;
}
/**
* @dev Decrease amount of SNGT tokens that can be minted
* @param _burnedAmount The amount of unminted tokens to be burned
*/
function burnUnmintedTokens(uint256 _burnedAmount) public onlyOwner returns (bool success){
require(_burnedAmount <= _unmintedTokens);
_unmintedTokens = _unmintedTokens.sub(_burnedAmount);
emit Burn(msg.sender, _burnedAmount);
return true;
}
/**
* @dev Function that burns an amount of the token of a given
* account.
* @param _account The account whose tokens will be burnt.
* @param _value The amount that will be burnt.
*/
function burn(address _account, uint256 _value) onlyOwner public {
require(_account != address(0));
totalSupply = totalSupply.sub(_value);
balances[_account] = balances[_account].sub(_value);
emit Burn(_account, _value);
}
/**
* @dev Function that burns an amount of the token of a given
* account, deducting from the sender's allowance for said account. Uses the
* internal burn function.
* Emits an Approval event (reflecting the reduced allowance).
* @param _account The account whose tokens will be burnt.
* @param _value The amount that will be burnt.
*/
function burnFrom(address _account, uint256 _value) onlyOwner public {
allowed[_account][msg.sender] = allowed[_account][msg.sender].sub(_value);
burn(_account, _value);
emit Burn(_account, _value);
}
/**
* @dev Returns the number of unminted token
*/
function unmintedTokens() onlyOwner view public returns (uint256 tokens){
return _unmintedTokens;
}
}
|
contract SNGTContract is Ownable, ERC20Interface {
using SafeMath for uint256;
string public constant symbol = "SNGT";
string public constant name = "SNGT";
uint8 public constant decimals = 18;
uint256 private _unmintedTokens = 500000000 * uint(10) ** decimals;
mapping(address => uint256) balances;
mapping (address => mapping (address => uint256)) internal allowed;
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
event Burn(address indexed _address, uint256 _value);
event Mint(address indexed _address, uint256 _value);
/**
* @dev Gets the balance of the specified address
* @param _owner The address to query the the balance of
* @return An uint256 representing the amount owned by the passed address
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
/**
* @dev Transfer token to a specified address
* @param _to The address to transfer to
* @param _value The amount to be transferred
*/
function transfer(address _to, uint256 _value) public returns (bool success) {
require(_to != address(0));
require(balances[msg.sender] >= _value);
assert(balances[_to] + _value >= balances[_to]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* @param _from The address which you want to send tokens from
* @param _to The address which you want to transfer to
* @param _value The amout of tokens to be transfered
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
assert(balances[_to] + _value >= balances[_to]);
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 Aprove the passed address to spend the specified amount of tokens on behalf of msg.sender
* @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 success) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens than an owner allowed to a spender
* @param _owner The address which owns the funds
* @param _spender The address which will spend the funds
* @return A uint specifing the amount of tokens still avaible for the spender
*/
function allowance(address _owner, address _spender) public view returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* @dev Mint SNGT tokens. No more than 500,000,000 SNGT can be minted
* @param _account The address to which new tokens will be minted
* @param _mintedAmount The amout of tokens to be minted
*/
function mintTokens(address _account, uint256 _mintedAmount) public onlyOwner returns (bool success){
require(_mintedAmount <= _unmintedTokens);
balances[_account] = balances[_account].add(_mintedAmount);
_unmintedTokens = _unmintedTokens.sub(_mintedAmount);
totalSupply = totalSupply.add(_mintedAmount);
emit Mint(_account, _mintedAmount);
return true;
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0.
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseAllowance(address _spender, uint256 _addedValue) public returns (bool) {
require(_spender != address(0));
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.
* Emits an Approval event.
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseAllowance(address _spender, uint256 _subtractedValue) public returns (bool) {
require(_spender != address(0));
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].sub(_subtractedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Mint SNGT tokens and aproves the passed address to spend the minted amount of tokens
* No more than 500,000,000 SNGT can be minted
* @param _target The address to which new tokens will be minted
* @param _mintedAmount The amout of tokens to be minted
* @param _spender The address which will spend minted funds
*/
function mintTokensWithApproval(address _target, uint256 _mintedAmount, address _spender) public onlyOwner returns (bool success){
require(_mintedAmount <= _unmintedTokens);
balances[_target] = balances[_target].add(_mintedAmount);
_unmintedTokens = _unmintedTokens.sub(_mintedAmount);
totalSupply = totalSupply.add(_mintedAmount);
allowed[_target][_spender] = allowed[_target][_spender].add(_mintedAmount);
emit Mint(_target, _mintedAmount);
return true;
}
/**
* @dev Decrease amount of SNGT tokens that can be minted
* @param _burnedAmount The amount of unminted tokens to be burned
*/
function burnUnmintedTokens(uint256 _burnedAmount) public onlyOwner returns (bool success){
require(_burnedAmount <= _unmintedTokens);
_unmintedTokens = _unmintedTokens.sub(_burnedAmount);
emit Burn(msg.sender, _burnedAmount);
return true;
}
/**
* @dev Function that burns an amount of the token of a given
* account.
* @param _account The account whose tokens will be burnt.
* @param _value The amount that will be burnt.
*/
function burn(address _account, uint256 _value) onlyOwner public {
require(_account != address(0));
totalSupply = totalSupply.sub(_value);
balances[_account] = balances[_account].sub(_value);
emit Burn(_account, _value);
}
/**
* @dev Function that burns an amount of the token of a given
* account, deducting from the sender's allowance for said account. Uses the
* internal burn function.
* Emits an Approval event (reflecting the reduced allowance).
* @param _account The account whose tokens will be burnt.
* @param _value The amount that will be burnt.
*/
function burnFrom(address _account, uint256 _value) onlyOwner public {
allowed[_account][msg.sender] = allowed[_account][msg.sender].sub(_value);
burn(_account, _value);
emit Burn(_account, _value);
}
/**
* @dev Returns the number of unminted token
*/
function unmintedTokens() onlyOwner view public returns (uint256 tokens){
return _unmintedTokens;
}
}
| 20,427
|
3
|
// Create array to store cat index to owner address // Create array to store cat release id to price in wei for all cats in that release // Create array to store cat index to any exception price deviating from release price // Create an array with all balances // Store type descriptor string for each attribute number // Store up to 6 cat attribute strings where attribute types are defined in attributeType // Struct that is used to describe seller offer details /
|
struct Offer {
bool isForSale; // flag identifying if cat is for sale
uint catIndex;
address seller; // owner address
uint minPrice; // price in ETH owner is willing to sell cat for
address sellOnlyTo; // address identifying only buyer that seller is wanting to offer cat to
}
|
struct Offer {
bool isForSale; // flag identifying if cat is for sale
uint catIndex;
address seller; // owner address
uint minPrice; // price in ETH owner is willing to sell cat for
address sellOnlyTo; // address identifying only buyer that seller is wanting to offer cat to
}
| 59,867
|
164
|
// set trading for public
|
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
|
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
| 44,076
|
87
|
// Reserved base is not enough. The trade is partially executed and a fraction of frozenQuote is returned to the taker.
|
return (buyTrade.frozenQuote.mul(reservedQuote).div(effectiveQuote), reservedBase);
|
return (buyTrade.frozenQuote.mul(reservedQuote).div(effectiveQuote), reservedBase);
| 14,776
|
187
|
// Ensure that current leverage ratio must be greater than leverage threshold
|
require(currentLeverageRatio >= incentivizedLeverageRatio, "Must be above incentivized leverage ratio");
_delever(
currentLeverageRatio,
maxLeverageRatio, // The target new leverage ratio is always the max leverage ratio
ripcordInfo,
incentivizedSlippageTolerance,
incentivizedTwapMaxTradeSize
);
|
require(currentLeverageRatio >= incentivizedLeverageRatio, "Must be above incentivized leverage ratio");
_delever(
currentLeverageRatio,
maxLeverageRatio, // The target new leverage ratio is always the max leverage ratio
ripcordInfo,
incentivizedSlippageTolerance,
incentivizedTwapMaxTradeSize
);
| 15,896
|
53
|
// The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor. /
|
bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;
|
bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;
| 995
|
70
|
// Transfer the balance between two accounts within the fund
|
function fundTransferWithin(address _from, address _to, uint256 _amount) public {
require(fundManagers[msg.sender]);
require(_amount > 0);
require(balances[msg.sender] >= _amount);
require(fundBalances[msg.sender][_from] >= _amount);
fundBalances[msg.sender][_from] = fundBalances[msg.sender][_from].sub(_amount);
fundBalances[msg.sender][_to] = fundBalances[msg.sender][_to].add(_amount);
if (fundBalances[msg.sender][_from] == 0){
delete fundBalances[msg.sender][_from];
}
emit FundTransferWithin(msg.sender, _from, _to, _amount);
}
|
function fundTransferWithin(address _from, address _to, uint256 _amount) public {
require(fundManagers[msg.sender]);
require(_amount > 0);
require(balances[msg.sender] >= _amount);
require(fundBalances[msg.sender][_from] >= _amount);
fundBalances[msg.sender][_from] = fundBalances[msg.sender][_from].sub(_amount);
fundBalances[msg.sender][_to] = fundBalances[msg.sender][_to].add(_amount);
if (fundBalances[msg.sender][_from] == 0){
delete fundBalances[msg.sender][_from];
}
emit FundTransferWithin(msg.sender, _from, _to, _amount);
}
| 26,454
|
207
|
// 2.11
|
function BurnRootx_mintSrootx (uint256 _amount) public {
require(IERC20Upgradeable(ROOTxTokenAddress).allowance(msg.sender, 0x871770E3e03bFAEFa3597056e540A1A9c9aC7f6b) >= _amount, "You have to approve rootx to staking contract");
IERC20Upgradeable(ROOTxTokenAddress).transferFrom(msg.sender, 0x871770E3e03bFAEFa3597056e540A1A9c9aC7f6b, _amount);
ERC20Upgradeable(ROOTxTokenAddress)._burn(_amount);
IERC20Upgradeable(SROOTxTokenAddress).mintToken(msg.sender, _amount.mul(5));
}
|
function BurnRootx_mintSrootx (uint256 _amount) public {
require(IERC20Upgradeable(ROOTxTokenAddress).allowance(msg.sender, 0x871770E3e03bFAEFa3597056e540A1A9c9aC7f6b) >= _amount, "You have to approve rootx to staking contract");
IERC20Upgradeable(ROOTxTokenAddress).transferFrom(msg.sender, 0x871770E3e03bFAEFa3597056e540A1A9c9aC7f6b, _amount);
ERC20Upgradeable(ROOTxTokenAddress)._burn(_amount);
IERC20Upgradeable(SROOTxTokenAddress).mintToken(msg.sender, _amount.mul(5));
}
| 29,641
|
98
|
// The roads contract's address
|
address public roadsContract;
|
address public roadsContract;
| 39,816
|
90
|
// Pay the Yield debt - ExportCdpProxy pays FYDai to remove the debt of `user` Controller should take exactly all fyDai flash minted.
|
controller.repayFYDai(WETH, fyDai.maturity(), address(this), user, fyDaiAmount);
|
controller.repayFYDai(WETH, fyDai.maturity(), address(this), user, fyDaiAmount);
| 5,180
|
1
|
// event
|
emit LotteryCreated(newLottery);
|
emit LotteryCreated(newLottery);
| 7,276
|
189
|
// Restricted access function which updates base URI used to construct ERC721Metadata.tokenURI_newBaseURI new base URI to set /
|
function setBaseURI(string memory _newBaseURI)
external
onlyRole(URI_MANAGER_ROLE)
|
function setBaseURI(string memory _newBaseURI)
external
onlyRole(URI_MANAGER_ROLE)
| 71,082
|
18
|
// First open priority request id
|
uint64 public firstPriorityRequestId;
|
uint64 public firstPriorityRequestId;
| 24,547
|
60
|
// adds 'record' to 'database' id, unique id of profiles price, price of NFT assets which will be generated based on profile sell_price, when we will buy out from owner (burn) url, url of NFT assets which will be generated based on profile /
|
function addNFTProfile(uint32 id, uint256 price, uint256 sell_price, string calldata url, uint32 limit) external onlyOwnerOrPriceManager {
NFTProfile memory temp = NFTProfile(id,price,sell_price,url, limit);
nftProfiles.push(temp);
}
|
function addNFTProfile(uint32 id, uint256 price, uint256 sell_price, string calldata url, uint32 limit) external onlyOwnerOrPriceManager {
NFTProfile memory temp = NFTProfile(id,price,sell_price,url, limit);
nftProfiles.push(temp);
}
| 124
|
38
|
// those methods are called by the legacy contract and they must ensure msg.sender to be the contract address
|
uint public _totalSupply;
function transferByLegacy(address from, address to, uint value) public returns (bool);
function transferFromByLegacy(address sender, address from, address spender, uint value) public returns (bool);
function approveByLegacy(address from, address spender, uint value) public returns (bool);
function increaseApprovalByLegacy(address from, address spender, uint addedValue) public returns (bool);
function decreaseApprovalByLegacy(address from, address spender, uint subtractedValue) public returns (bool);
|
uint public _totalSupply;
function transferByLegacy(address from, address to, uint value) public returns (bool);
function transferFromByLegacy(address sender, address from, address spender, uint value) public returns (bool);
function approveByLegacy(address from, address spender, uint value) public returns (bool);
function increaseApprovalByLegacy(address from, address spender, uint addedValue) public returns (bool);
function decreaseApprovalByLegacy(address from, address spender, uint subtractedValue) public returns (bool);
| 12,911
|
125
|
// if X is less than 1, then just calculate X
|
if (integerX == 0) {
return expHybrid(Xcopy, precomputePrecision, maclaurinPrecision);
}
|
if (integerX == 0) {
return expHybrid(Xcopy, precomputePrecision, maclaurinPrecision);
}
| 17,744
|
42
|
// Mint regular assassin with count /
|
function mintRegularTokens(uint256 _count) external payable saleIsOpen {
address wallet = _msgSender();
uint256 total = _tokenIdRegularTracker.current() + REGULAR_START_AT;
// Set limit to mint per transaction
require(_count > 0 && _count <= 3, "Max 3 NFTs per transaction");
// Set max limit of regular assassins
require(total + _count <= MAX_REGULAR_TOKENS, "Max limit of Regular");
// Check the balance
require(msg.value >= price(_count), "Not enough ETH for transaction");
for (uint256 i = 0; i < _count; i++) {
// Increase tracker and counter of regular assassin
_tokenIdRegularTracker.increment();
_regularTokenCounter += 1;
// Mint regular assassin
uint256 tokenId = _tokenIdRegularTracker.current() + REGULAR_START_AT;
_safeMint(wallet, tokenId);
emit welcomeToAssassin(tokenId);
}
}
|
function mintRegularTokens(uint256 _count) external payable saleIsOpen {
address wallet = _msgSender();
uint256 total = _tokenIdRegularTracker.current() + REGULAR_START_AT;
// Set limit to mint per transaction
require(_count > 0 && _count <= 3, "Max 3 NFTs per transaction");
// Set max limit of regular assassins
require(total + _count <= MAX_REGULAR_TOKENS, "Max limit of Regular");
// Check the balance
require(msg.value >= price(_count), "Not enough ETH for transaction");
for (uint256 i = 0; i < _count; i++) {
// Increase tracker and counter of regular assassin
_tokenIdRegularTracker.increment();
_regularTokenCounter += 1;
// Mint regular assassin
uint256 tokenId = _tokenIdRegularTracker.current() + REGULAR_START_AT;
_safeMint(wallet, tokenId);
emit welcomeToAssassin(tokenId);
}
}
| 38,598
|
19
|
// | Bytes | Bits | Field| | ----- | ---- | ---------------------------------------------------- | | 8 | 64 | Nonce | 1 | 8| Maker Src Address Size (!=0) | | N | 8N| Maker Src Address| | 32| 256| Give Chain Id| | 1 | 8| Give Token Address Size (!=0)| | N | 8N| Give Token Address | | 32| 256| Give Amount| | 32| 256| Take Chain Id| | 1 | 8| Take Token Address Size (!=0)| | N | 8N| Take Token Address | | 32| 256| Take Amount| | | 1 | 8| Receiver Dst Address
|
encoded = abi.encodePacked(
_order.makerOrderNonce,
(uint8)(_order.makerSrc.length),
_order.makerSrc
);
{
encoded = abi.encodePacked(
encoded,
_order.giveChainId,
|
encoded = abi.encodePacked(
_order.makerOrderNonce,
(uint8)(_order.makerSrc.length),
_order.makerSrc
);
{
encoded = abi.encodePacked(
encoded,
_order.giveChainId,
| 13,437
|
15
|
// pop first byte before parsting receipt
|
bytes memory typedBytes = receipt.raw;
bytes memory result = new bytes(typedBytes.length - 1);
uint256 srcPtr;
uint256 destPtr;
assembly {
srcPtr := add(33, typedBytes)
destPtr := add(0x20, result)
}
|
bytes memory typedBytes = receipt.raw;
bytes memory result = new bytes(typedBytes.length - 1);
uint256 srcPtr;
uint256 destPtr;
assembly {
srcPtr := add(33, typedBytes)
destPtr := add(0x20, result)
}
| 27,543
|
165
|
// Lets a HA decrease the `margin` in a perpetual she controls for this/ stablecoin/collateral pair/perpetualID ID of the perpetual from which collateral should be removed/amount Amount to remove from the perpetual's `margin`/to Address which will receive the collateral removed from this perpetual
|
function removeFromPerpetual(
uint256 perpetualID,
uint256 amount,
address to
) external;
|
function removeFromPerpetual(
uint256 perpetualID,
uint256 amount,
address to
) external;
| 13,127
|
1
|
// Value to the index in `_values` array, plus 1 because index 0 means a value is not in the set.
|
mapping(uint256 => uint256) _valueToIndexMap;
|
mapping(uint256 => uint256) _valueToIndexMap;
| 23,539
|
4
|
// Refund all
|
if (msg.value > 0) {
if (!msg.sender.send(msg.value)) throw;
}
|
if (msg.value > 0) {
if (!msg.sender.send(msg.value)) throw;
}
| 46,518
|
166
|
// Fill result arrays
|
tokens = new address[](receivedRewardTokensCount);
amounts = new uint256[](receivedRewardTokensCount);
if(receivedRewardTokensCount > 0) {
uint256 j;
for(uint256 i = 0; i < rewardTokens.length; i++) {
if(rewardAmounts[i] > 0) {
tokens[j] = rewardTokens[i];
amounts[j] = rewardAmounts[i];
j++;
}
|
tokens = new address[](receivedRewardTokensCount);
amounts = new uint256[](receivedRewardTokensCount);
if(receivedRewardTokensCount > 0) {
uint256 j;
for(uint256 i = 0; i < rewardTokens.length; i++) {
if(rewardAmounts[i] > 0) {
tokens[j] = rewardTokens[i];
amounts[j] = rewardAmounts[i];
j++;
}
| 18,042
|
8
|
// ERC20 requires totalSupply, balanceOf, and allowance
|
uint256 public totalSupply;
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
mapping (uint => Tournament) public tournaments; // tournamentID
|
uint256 public totalSupply;
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
mapping (uint => Tournament) public tournaments; // tournamentID
| 32,387
|
252
|
// Check a pod's launch status.s _id - Id of pod. /
|
function hasLaunched(uint256 _id) public view returns (bool) {
return launchStatus[_id];
}
|
function hasLaunched(uint256 _id) public view returns (bool) {
return launchStatus[_id];
}
| 32,936
|
111
|
// `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`.
|
result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1))
|
result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1))
| 5,148
|
191
|
// Ensure that a user signing key is set on this smart wallet.
|
if (userSigningKey == address(0)) {
revert(_revertReason(14));
}
|
if (userSigningKey == address(0)) {
revert(_revertReason(14));
}
| 43,581
|
130
|
// emit BondPriceChanged( bondPriceInUSD(), _bondPrice(), debtRatio() );
|
adjust(); // control variable is adjusted
return payout;
|
adjust(); // control variable is adjusted
return payout;
| 78,854
|
53
|
// Emit event
|
emit TokenSwapped(msg.sender,destination,tokentoSwap,block.timestamp,_tokenSwapTo);
|
emit TokenSwapped(msg.sender,destination,tokentoSwap,block.timestamp,_tokenSwapTo);
| 26,919
|
88
|
// Add DAI
|
addToken(0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063, 0x4746DeC9e833A82EC7C2C1356372CcF2cfcD2F3D);
|
addToken(0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063, 0x4746DeC9e833A82EC7C2C1356372CcF2cfcD2F3D);
| 27,529
|
93
|
// the referenced Uniswap pair contract
|
IUniswapV2Pair public override pair;
|
IUniswapV2Pair public override pair;
| 58,361
|
11
|
// Its a payable function works as a token factory.
|
receive() external payable {
createTokens();
}
|
receive() external payable {
createTokens();
}
| 7,135
|
2
|
// Execute the given orders at once with the specified fill specification/orders The order definitions and valid signatures to execute/fillContract The contract which will fill the order/fillData The fillData to pass to the fillContract callback
|
function executeBatch(SignedOrder[] calldata orders, IReactorCallback fillContract, bytes calldata fillData)
external
payable;
|
function executeBatch(SignedOrder[] calldata orders, IReactorCallback fillContract, bytes calldata fillData)
external
payable;
| 16,514
|
24
|
// ------------------------------------------------------------------------ An account can unlock their 2y locked tokens 2y after token launch date ------------------------------------------------------------------------
|
function unlock2Y() {
require(now >= LOCKED_2Y_DATE);
uint amount = balancesLocked2Y[msg.sender];
require(amount > 0);
balancesLocked2Y[msg.sender] = 0;
totalSupplyLocked2Y = totalSupplyLocked2Y.sub(amount);
if (!tokenContract.transfer(msg.sender, amount)) throw;
}
|
function unlock2Y() {
require(now >= LOCKED_2Y_DATE);
uint amount = balancesLocked2Y[msg.sender];
require(amount > 0);
balancesLocked2Y[msg.sender] = 0;
totalSupplyLocked2Y = totalSupplyLocked2Y.sub(amount);
if (!tokenContract.transfer(msg.sender, amount)) throw;
}
| 23,292
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.