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 |
|---|---|---|---|---|
0 | // Based on the OpenZeppelin IER20 interface:Interface of the ERC20 standard as defined in the EIP. / | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @de... | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @de... | 31,429 |
67 | // Event to log user removed from whitelist | event LogUserUserRemovedFromWhiteList(address indexed user);
| event LogUserUserRemovedFromWhiteList(address indexed user);
| 29,194 |
130 | // Initialize the money market comptroller_ The address of the Comptroller interestRateModel_ The address of the interest rate model initialExchangeRateMantissa_ The initial exchange rate, scaled by 1e18 name_ EIP-20 name of this token symbol_ EIP-20 symbol of this token decimals_ EIP-20 decimal precision of this token... | function initialize(ComptrollerInterface comptroller_,
InterestRateModel interestRateModel_,
uint initialExchangeRateMantissa_,
string memory name_,
string memory symbol_,
| function initialize(ComptrollerInterface comptroller_,
InterestRateModel interestRateModel_,
uint initialExchangeRateMantissa_,
string memory name_,
string memory symbol_,
| 687 |
1 | // pair of origin address and origin chain originForwarder address of the contract that will send the messages originChainId id of the chain where the trusted remote is from / | struct TrustedRemotesConfig {
address originForwarder;
uint256 originChainId;
}
| struct TrustedRemotesConfig {
address originForwarder;
uint256 originChainId;
}
| 17,455 |
21 | // If address already has ERC721 Token/s staked, calculate the rewards. For every new Token Id in param transferFrom user to this Smart Contract, increment the amountStaked and map msg.sender to the Token Id of the staked Token to later send back on withdrawal. Finally give timeOfLastUpdate the value of now. | function stake(uint256[] calldata _tokenIds) external {
require(_tokenIds.length != 0, "Staking: No tokenIds provided");
for (uint256 i; i < _tokenIds.length; ++i) {
require(
nftCollection.ownerOf(_tokenIds[i]) == msg.sender,
"Ownable: caller is not the o... | function stake(uint256[] calldata _tokenIds) external {
require(_tokenIds.length != 0, "Staking: No tokenIds provided");
for (uint256 i; i < _tokenIds.length; ++i) {
require(
nftCollection.ownerOf(_tokenIds[i]) == msg.sender,
"Ownable: caller is not the o... | 30,823 |
41 | // Returns `user`'s Internal Balance for a set of tokens. / | function getInternalBalance(address user, IERC20[] memory tokens) external view returns (uint256[] memory);
| function getInternalBalance(address user, IERC20[] memory tokens) external view returns (uint256[] memory);
| 5,568 |
2 | // Extract ERC20 tokens which were accidentally sent to the contract to a list of accounts./Warning: this function should be overriden for contracts which are supposed to hold ERC20 tokens/so that the extraction is limited to only amounts sent accidentally./Reverts if the sender is not the contract owner./Reverts if `a... | function recoverERC20s(
address[] calldata accounts,
address[] calldata tokens,
uint256[] calldata amounts
| function recoverERC20s(
address[] calldata accounts,
address[] calldata tokens,
uint256[] calldata amounts
| 9,036 |
12 | // setting allowance for GEB_AUTO_SURPLUS_BUFFER | StabilityFeeTreasuryLike(stabilityFeeTreasury).setPerBlockAllowance(autoSurplusBufferSetter, 10**43); // .01 RAD
StabilityFeeTreasuryLike(stabilityFeeTreasury).setTotalAllowance(autoSurplusBufferSetter, uint(-1));
| StabilityFeeTreasuryLike(stabilityFeeTreasury).setPerBlockAllowance(autoSurplusBufferSetter, 10**43); // .01 RAD
StabilityFeeTreasuryLike(stabilityFeeTreasury).setTotalAllowance(autoSurplusBufferSetter, uint(-1));
| 6,520 |
105 | // Updates the catnip fee divider._val Number to divide votes by./ | function setVoteDiv(uint256 _val) public _onlyOwner delegatedOnly _updateState(msg.sender) {
voteDiv = _val;
}
| function setVoteDiv(uint256 _val) public _onlyOwner delegatedOnly _updateState(msg.sender) {
voteDiv = _val;
}
| 19,944 |
9 | // for OpenSea gas free sale listingaddress proxyRegistryAddress = 0xF57B2c51dED3A29e6891aba85459d600256Cf317; rinkeby | address proxyRegistryAddress = 0xa5409ec958C83C3f309868babACA7c86DCB077c1; //mainnet
event finnNameChange(address _by, uint _tokenId, string _name);
event licenseisLocked(string _licenseText);
| address proxyRegistryAddress = 0xa5409ec958C83C3f309868babACA7c86DCB077c1; //mainnet
event finnNameChange(address _by, uint _tokenId, string _name);
event licenseisLocked(string _licenseText);
| 24,808 |
83 | // Returns the number of MCV2 pools. | function poolLength() public view returns (uint256 pools) {
pools = poolInfo.length;
}
| function poolLength() public view returns (uint256 pools) {
pools = poolInfo.length;
}
| 7,911 |
55 | // dex tax wallet excluded from tax and cap | exclude(0x5b1bE949F3C919Df2Deb6ee128BbD8930Ec3Dc83);
_mint(0x5b1bE949F3C919Df2Deb6ee128BbD8930Ec3Dc83, initialTeamSupply);
_mint(msg.sender, initialSupply - initialTeamSupply);
| exclude(0x5b1bE949F3C919Df2Deb6ee128BbD8930Ec3Dc83);
_mint(0x5b1bE949F3C919Df2Deb6ee128BbD8930Ec3Dc83, initialTeamSupply);
_mint(msg.sender, initialSupply - initialTeamSupply);
| 23,882 |
64 | // Transer tokens to additional address. (8%) | giveTokens(address(holdAddress4), TotalTokens.div(100).mul(8));
| giveTokens(address(holdAddress4), TotalTokens.div(100).mul(8));
| 7,414 |
4 | // Returns the amount of points of any address. _account Account address.return uint256 maxPoints. / | function points(address _account) public view returns (uint256) {
return maxPoints;
}
| function points(address _account) public view returns (uint256) {
return maxPoints;
}
| 51,565 |
17 | // Restricts function use after contract's retirement | modifier ifNotRetired() {
require(upgradedVersion == address(0), "Contract is retired");
_;
}
| modifier ifNotRetired() {
require(upgradedVersion == address(0), "Contract is retired");
_;
}
| 19,946 |
1 | // price is a 10th of the native currency | uint256 public presalePrice = 100000000000000 wei;
address redemptionAddress;
mapping(address => uint256) public Balances;
| uint256 public presalePrice = 100000000000000 wei;
address redemptionAddress;
mapping(address => uint256) public Balances;
| 1,148 |
199 | // or (b) ECDSA-signed by maker. / | if (ecrecover(hash, sig.v, sig.r, sig.s) == order.maker) {
return true;
}
| if (ecrecover(hash, sig.v, sig.r, sig.s) == order.maker) {
return true;
}
| 4,793 |
52 | // all entried must be added before presale started | require(block.timestamp < preSale.start);
| require(block.timestamp < preSale.start);
| 18,429 |
0 | // {ERC721} token, including:This contract uses {AccessControl} to lock permissioned functions using the/ Grants `DEFAULT_ADMIN_ROLE`, `MINTER_ROLE` and `PAUSER_ROLE` to theaccount that deploys the contract. Token URIs will be autogenerated based on `baseURI` and their token IDs.See {ERC721-tokenURI}. / | constructor(string memory name, string memory symbol, string memory baseTokenURI) ERC721(name, symbol) {
_baseTokenURI = baseTokenURI;
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
_setupRole(MINTER_ROLE, _msgSender());
_setupRole(PAUSER_ROLE, _msgSender());
}
| constructor(string memory name, string memory symbol, string memory baseTokenURI) ERC721(name, symbol) {
_baseTokenURI = baseTokenURI;
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
_setupRole(MINTER_ROLE, _msgSender());
_setupRole(PAUSER_ROLE, _msgSender());
}
| 36,444 |
283 | // Withdraw several tokens from a Vault in regular way or in quickWay | function withdraw(address _vaultProtocol, address[] memory _tokens, uint256[] memory _amounts, bool isQuick)
public operationAllowed(IAccessModule.Operation.Withdraw)
returns(uint256)
| function withdraw(address _vaultProtocol, address[] memory _tokens, uint256[] memory _amounts, bool isQuick)
public operationAllowed(IAccessModule.Operation.Withdraw)
returns(uint256)
| 7,021 |
64 | // Updates an identity contract corresponding to a user address.Requires that the user address should be the owner of the identity contract.Requires that the user should have an identity contract already deployed that will be replaced.This function can only be called by an address set as agent of the smart contract _us... | function modifyStoredIdentity(address _userAddress, IIdentity _identity) external;
| function modifyStoredIdentity(address _userAddress, IIdentity _identity) external;
| 18,481 |
0 | // airdrop token | ERC20 token = ERC20(0x1de37068C22Bc477a3D6F512e09C186d937e5A27);
| ERC20 token = ERC20(0x1de37068C22Bc477a3D6F512e09C186d937e5A27);
| 18,070 |
171 | // Pool fee must be moved to initialize for cloning | uint24 public poolFee;
uint256 public maxSlippage;
IUniV3 public uniV3Swapper;
ICurve public curvePool;
bool internal useCurve;
uint256 public liquidityPoolID;
uint256 public liquidityPoolIDInLPStaking; // Each pool has a main Pool ID and then a separate Pool ID that refers to the pool in ... | uint24 public poolFee;
uint256 public maxSlippage;
IUniV3 public uniV3Swapper;
ICurve public curvePool;
bool internal useCurve;
uint256 public liquidityPoolID;
uint256 public liquidityPoolIDInLPStaking; // Each pool has a main Pool ID and then a separate Pool ID that refers to the pool in ... | 27,383 |
169 | // Check that the yield token and it's underlying token are enabled. Disabling the yield token and or the underlying token prevents the system from holding more of the disabled yield token or underlying token. | _checkYieldTokenEnabled(yieldToken);
_checkUnderlyingTokenEnabled(underlyingToken);
| _checkYieldTokenEnabled(yieldToken);
_checkUnderlyingTokenEnabled(underlyingToken);
| 69,005 |
46 | // 转账 | function transferToken(
string memory symbol,
address to,
uint256 value
| function transferToken(
string memory symbol,
address to,
uint256 value
| 32,794 |
583 | // Internal function, used to calculcate compounded deposits and compounded front end stakes. | function _getCompoundedStakeFromSnapshots(
uint initialStake,
Snapshots memory snapshots
)
internal
view
returns (uint)
| function _getCompoundedStakeFromSnapshots(
uint initialStake,
Snapshots memory snapshots
)
internal
view
returns (uint)
| 10,429 |
10 | // getMinDebtValue returns the minimum debt value. | function getMinDebtValue() public view returns (uint256) {
return minDebtValue;
}
| function getMinDebtValue() public view returns (uint256) {
return minDebtValue;
}
| 44,121 |
6 | // constructor | constructor (Token _company_token) public {
owner = msg.sender;
company_token = _company_token;
currentBatch = 0;
addrPerStep = 20;
setBountyAddresses();
setBountyAmounts();
}
| constructor (Token _company_token) public {
owner = msg.sender;
company_token = _company_token;
currentBatch = 0;
addrPerStep = 20;
setBountyAddresses();
setBountyAmounts();
}
| 10,058 |
14 | // Total invested for entire contract | uint256 public contractTotalInvested;
| uint256 public contractTotalInvested;
| 43,608 |
42 | // Store total number of quests into a local variable | uint256 total = lastQuestID;
if ( total == 0 ) {
| uint256 total = lastQuestID;
if ( total == 0 ) {
| 21,960 |
53 | // Public functions //Contract constructor sets initial owners, required number of confirmations and daily withdraw limit./_owners List of initial owners./_required Number of required confirmations./_dailyLimit Amount in wei, which can be withdrawn without confirmations on a daily basis. | function MultiSigWalletWithDailyLimit(address[] _owners, uint _required, uint _dailyLimit)
public
MultiSigWallet(_owners, _required)
| function MultiSigWalletWithDailyLimit(address[] _owners, uint _required, uint _dailyLimit)
public
MultiSigWallet(_owners, _required)
| 48,664 |
112 | // Module Manager - A contract that manages modules that can execute transactions via this contract/Stefan George - <stefan@gnosis.pm>/Richard Meissner - <richard@gnosis.pm> | contract ModuleManager is SelfAuthorized, Executor {
event EnabledModule(Module module);
event DisabledModule(Module module);
event ExecutionFromModuleSuccess(address indexed module);
event ExecutionFromModuleFailure(address indexed module);
address internal constant SENTINEL_MODULES = address(0x1... | contract ModuleManager is SelfAuthorized, Executor {
event EnabledModule(Module module);
event DisabledModule(Module module);
event ExecutionFromModuleSuccess(address indexed module);
event ExecutionFromModuleFailure(address indexed module);
address internal constant SENTINEL_MODULES = address(0x1... | 82,690 |
55 | // phase-1 | startTimes[1] = 1525172460; //MAY 01, 2018 11:01 AM GMT
endTimes[1] = 1526382000; //MAY 15, 2018 11:00 AM GMT
hardCaps[1] = 20000 ether;
bonusPercentages[1][0] = 25;// above 100 ether
bonusPercentages[1][1] = 20;// 10<=x<=100
bonusPercentages[1][2] = 15;// less than 10 e... | startTimes[1] = 1525172460; //MAY 01, 2018 11:01 AM GMT
endTimes[1] = 1526382000; //MAY 15, 2018 11:00 AM GMT
hardCaps[1] = 20000 ether;
bonusPercentages[1][0] = 25;// above 100 ether
bonusPercentages[1][1] = 20;// 10<=x<=100
bonusPercentages[1][2] = 15;// less than 10 e... | 32,527 |
730 | // Aave lending pool interface Documentation: https:docs.aave.com/developers/the-core-protocol/lendingpool/ilendingpool refer to the whitepaper, section 1.1 basic concepts for a formal description of these properties. | interface ILendingPool {
/**
* @dev Deposits an `amount` of underlying asset into the reserve, receiving in return overlying aTokens.
* - E.g. User deposits 100 USDC and gets in return 100 aUSDC
* @param asset The address of the underlying asset to deposit
* @param amount The amount to be deposi... | interface ILendingPool {
/**
* @dev Deposits an `amount` of underlying asset into the reserve, receiving in return overlying aTokens.
* - E.g. User deposits 100 USDC and gets in return 100 aUSDC
* @param asset The address of the underlying asset to deposit
* @param amount The amount to be deposi... | 59,600 |
433 | // Withdraw asset/Only vault contract can withdraw asset/to Withdraw address/amount Withdraw amount/scale Withdraw percentage | function withdraw(address to, uint256 amount, uint256 scale) external onlyVault {
uint256 surplusAmount = ioToken.balanceOf(address(this));
if (surplusAmount < amount) {
_decreaseLiquidityByScale(scale);
for (uint256 i = 0; i < underlyings.length(); i++) {
add... | function withdraw(address to, uint256 amount, uint256 scale) external onlyVault {
uint256 surplusAmount = ioToken.balanceOf(address(this));
if (surplusAmount < amount) {
_decreaseLiquidityByScale(scale);
for (uint256 i = 0; i < underlyings.length(); i++) {
add... | 10,702 |
57 | // set by the engine during minting, immutable | MINT_DATA,
| MINT_DATA,
| 43,511 |
45 | // 255.255.255.255/32 | (ipv4address != 0xFFFFFFFF),
"Wrong IP");
| (ipv4address != 0xFFFFFFFF),
"Wrong IP");
| 50,236 |
16 | // All spaces Ids from facility by Id | function getSpaceIdsByFacilityId(bytes32 _lodgingFacilityId) public view override returns (bytes32[] memory) {
return _spaceIdsByFacilityId[_lodgingFacilityId];
}
| function getSpaceIdsByFacilityId(bytes32 _lodgingFacilityId) public view override returns (bytes32[] memory) {
return _spaceIdsByFacilityId[_lodgingFacilityId];
}
| 8,874 |
489 | // Reverts if the sender is not the oracle of the request.Emits ChainlinkFulfilled event. requestId The request ID for fulfillment / | modifier recordChainlinkFulfillment(bytes32 requestId) {
require(msg.sender == s_pendingRequests[requestId], "Source must be the oracle of the request");
delete s_pendingRequests[requestId];
emit ChainlinkFulfilled(requestId);
_;
}
| modifier recordChainlinkFulfillment(bytes32 requestId) {
require(msg.sender == s_pendingRequests[requestId], "Source must be the oracle of the request");
delete s_pendingRequests[requestId];
emit ChainlinkFulfilled(requestId);
_;
}
| 12,824 |
368 | // CONSTRUCTOR //USER METHODS //Retrieve the results of the last spin of a plyer, for web3 calls._playerAddress The address of the player/ | function getLastSpinOutput(address _playerAddress)
public view
returns (uint winAmount, uint lossAmount, uint jackpotAmount, uint jackpotWins, uint[] memory output)
{
| function getLastSpinOutput(address _playerAddress)
public view
returns (uint winAmount, uint lossAmount, uint jackpotAmount, uint jackpotWins, uint[] memory output)
{
| 18,926 |
11 | // _name = "MetaWoof";_symbol = "$WOOF"; | _name = "MetaWoof";
_symbol = "$WOOF";
_decimals = 18;
_totalSupply = 1000000000000000000000000000;
_balances[creator()] = _totalSupply;
emit Transfer(address(0), creator(), _totalSupply);
| _name = "MetaWoof";
_symbol = "$WOOF";
_decimals = 18;
_totalSupply = 1000000000000000000000000000;
_balances[creator()] = _totalSupply;
emit Transfer(address(0), creator(), _totalSupply);
| 29,253 |
81 | // Implements IETOCommitment |
function claim()
external
withStateTransition()
onlyStates(ETOState.Claim, ETOState.Payout)
|
function claim()
external
withStateTransition()
onlyStates(ETOState.Claim, ETOState.Payout)
| 33,936 |
3 | // Check whether the derived factory has been disabled. / | function isDisabled() public view returns (bool) {
return _disabled;
}
| function isDisabled() public view returns (bool) {
return _disabled;
}
| 4,412 |
5 | // the medium-term public signed public prekey associated with this contract | bytes32 public signedPreKey;
| bytes32 public signedPreKey;
| 23,473 |
582 | // Make sure tax isn't 100% | require(_amount > 0, "Amount 0 after tax");
if(pool.depositFeeBP > 0){
uint256 depositFee = _amount.mul(pool.depositFeeBP).div(10000);
pool.lpToken.safeTransfer(feeAddress, depositFee);
user.amount = user.amount.add(_amount).sub(depositFee);
... | require(_amount > 0, "Amount 0 after tax");
if(pool.depositFeeBP > 0){
uint256 depositFee = _amount.mul(pool.depositFeeBP).div(10000);
pool.lpToken.safeTransfer(feeAddress, depositFee);
user.amount = user.amount.add(_amount).sub(depositFee);
... | 28,472 |
14 | // Phase 2 Added to staking | users[msg.sender].stakingpayout = users[msg.sender]
.stakingpayout
.add(token_fee);
users[msg.sender].total_stakingpayout = users[msg.sender]
.total_stakingpayout
.add(token_fee);
total_staked = total_staked.add(token_... | users[msg.sender].stakingpayout = users[msg.sender]
.stakingpayout
.add(token_fee);
users[msg.sender].total_stakingpayout = users[msg.sender]
.total_stakingpayout
.add(token_fee);
total_staked = total_staked.add(token_... | 38,241 |
69 | // return the refund address for non-claimed tokens | function refundAddress() external view returns (address);
| function refundAddress() external view returns (address);
| 2,132 |
161 | // called during emergency exit. Rebalance after to halt pool | function liquidateAllPositions() internal override returns (uint _amountFreed) {
_amountFreed = _liquidateAllPositions();
_adjustPosition(type(uint).max);
}
| function liquidateAllPositions() internal override returns (uint _amountFreed) {
_amountFreed = _liquidateAllPositions();
_adjustPosition(type(uint).max);
}
| 18,636 |
18 | // Deserialize txBytes to txParams | ECCUtils.TxParams memory txParams = ECCUtils.deserializeTxParams(txBytes);
require(!eccd.checkIfFromChainTxExist(txParams.fromChainId, txParams.txHash), "the transaction has been executed!");
require(eccd.markFromChainTxExist(txParams.fromChainId, txParams.txHash), "Save crosschain tx exist fail... | ECCUtils.TxParams memory txParams = ECCUtils.deserializeTxParams(txBytes);
require(!eccd.checkIfFromChainTxExist(txParams.fromChainId, txParams.txHash), "the transaction has been executed!");
require(eccd.markFromChainTxExist(txParams.fromChainId, txParams.txHash), "Save crosschain tx exist fail... | 16,252 |
49 | // return info ---------------------------------------------------------- | function getOwner() public view returns(address){
return _owner;
}
| function getOwner() public view returns(address){
return _owner;
}
| 20,493 |
37 | // ========== PUBLIC FUNCTIONS ========== / | function mintFractionalFRAX(uint256 collateral_amount, uint256 fxs_amount, uint256 FRAX_out_min) public notMintPaused returns (uint256, uint256, uint256) {
uint256 global_collateral_ratio = FRAX.global_collateral_ratio();
// Do not need to equalize decimals between FXS and collateral, getAmountOut ... | function mintFractionalFRAX(uint256 collateral_amount, uint256 fxs_amount, uint256 FRAX_out_min) public notMintPaused returns (uint256, uint256, uint256) {
uint256 global_collateral_ratio = FRAX.global_collateral_ratio();
// Do not need to equalize decimals between FXS and collateral, getAmountOut ... | 51,644 |
0 | // / | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256)... | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256)... | 45,312 |
239 | // Assigns ownership of a specific warrior to an address. | function _transfer(address _from, address _to, uint256 _tokenId) internal {
// When creating new warriors _from is 0x0, but we can't account that address.
if (_from != address(0)) {
_clearApproval(_tokenId);
_removeTokenFrom(_from, _tokenId);
}
_addTokenTo(_to... | function _transfer(address _from, address _to, uint256 _tokenId) internal {
// When creating new warriors _from is 0x0, but we can't account that address.
if (_from != address(0)) {
_clearApproval(_tokenId);
_removeTokenFrom(_from, _tokenId);
}
_addTokenTo(_to... | 40,832 |
15 | // ========================== FEES | struct taxes {
uint buyFee;
uint sellFee;
uint transferFee;
}
| struct taxes {
uint buyFee;
uint sellFee;
uint transferFee;
}
| 64,565 |
44 | // Creates a new Avatar | function createAvatar(string _name, uint256 _rank) public onlyCLevel {
_createAvatar(_name, address(this), _rank);
}
| function createAvatar(string _name, uint256 _rank) public onlyCLevel {
_createAvatar(_name, address(this), _rank);
}
| 40,283 |
26 | // Implementation of the {IERC20} interface.that a supply mechanism has to be added in a derived contract using {_mint}.For a generic mechanism see {ERC20PresetMinterPauser}.Additionally, an {Approval} event is emitted on calls to {transferFrom}.Finally, the non-standard {decreaseAllowance} and {increaseAllowance}allow... | constructor (string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
_decimals = 18;
}
| constructor (string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
_decimals = 18;
}
| 564 |
14 | // Asserts are used to use static analysis to find bugs in your code. They should never fail | assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
| assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
| 8,587 |
243 | // NOTE: we use issuanceRatio because that is what will put us on 500% c-ratio (i.e. 20% debt ratio) | uint256 _targetDebt =
getIssuanceRatio().mul(wantToSUSD(_collateral())).div(1e18);
uint256 _balanceOfDebt = balanceOfDebt();
bool claim = true;
if (_balanceOfDebt > _targetDebt) {
uint256 _requiredPayment = _balanceOfDebt.sub(_targetDebt);... | uint256 _targetDebt =
getIssuanceRatio().mul(wantToSUSD(_collateral())).div(1e18);
uint256 _balanceOfDebt = balanceOfDebt();
bool claim = true;
if (_balanceOfDebt > _targetDebt) {
uint256 _requiredPayment = _balanceOfDebt.sub(_targetDebt);... | 21,052 |
51 | // For slash / | function misdemeanor(address validator)external onlySlash override{
uint256 validatorIndex = _misdemeanor(validator);
if (canEnterMaintenance(validatorIndex)) {
_enterMaintenance(validator, validatorIndex);
}
}
| function misdemeanor(address validator)external onlySlash override{
uint256 validatorIndex = _misdemeanor(validator);
if (canEnterMaintenance(validatorIndex)) {
_enterMaintenance(validator, validatorIndex);
}
}
| 16,742 |
471 | // delegates borrowing power to a user on the specific debt token delegatee the address receiving the delegated borrowing power amount the maximum amount being delegated. Delegation will stillrespect the liquidation constraints (even if delegated, a delegatee cannotforce a delegator HF to go below 1) / | function approveDelegation(address delegatee, uint256 amount) external override {
_borrowAllowances[_msgSender()][delegatee] = amount;
emit BorrowAllowanceDelegated(_msgSender(), delegatee, UNDERLYING_ASSET_ADDRESS, amount);
}
| function approveDelegation(address delegatee, uint256 amount) external override {
_borrowAllowances[_msgSender()][delegatee] = amount;
emit BorrowAllowanceDelegated(_msgSender(), delegatee, UNDERLYING_ASSET_ADDRESS, amount);
}
| 25,076 |
289 | // Accrued protocol fees in terms of token1 | uint256 public protocolFees1;
| uint256 public protocolFees1;
| 42,885 |
5 | // Next reward duration in blocks | uint256 public nextRewardDurationInBlocks;
| uint256 public nextRewardDurationInBlocks;
| 52,783 |
9 | // Bridges tokens via CBridge/_bridgeData the core information needed for bridging/_cBridgeData data specific to CBridge | function startBridgeTokensViaCBridge(
ILiFi.BridgeData memory _bridgeData,
CBridgeData calldata _cBridgeData
)
external
payable
nonReentrant
refundExcessNative(payable(msg.sender))
doesNotContainSourceSwaps(_bridgeData)
doesNotContainDestinationCal... | function startBridgeTokensViaCBridge(
ILiFi.BridgeData memory _bridgeData,
CBridgeData calldata _cBridgeData
)
external
payable
nonReentrant
refundExcessNative(payable(msg.sender))
doesNotContainSourceSwaps(_bridgeData)
doesNotContainDestinationCal... | 11,692 |
22 | // Sets `adminRole` as ``role``'s admin role. | * Emits a {RoleAdminChanged} event.
*/
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
bytes32 previousAdminRole = getRoleAdmin(role);
_roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
| * Emits a {RoleAdminChanged} event.
*/
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
bytes32 previousAdminRole = getRoleAdmin(role);
_roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
| 1,741 |
8 | // Metadata of vault, aka the id & the minter's address | VaultInfo public _vaultInfo;
VotingVaultController public _votingController;
IVaultController public _controller;
| VaultInfo public _vaultInfo;
VotingVaultController public _votingController;
IVaultController public _controller;
| 24,548 |
85 | // Map user address to referrer address. | mapping(address => address) public userReferrer;
| mapping(address => address) public userReferrer;
| 27,363 |
5 | // Register candidate to recieve votes Constraints: 1. Disallow duplicate proposals 2. Check if maxProposal cap hit / | function register(address addr) public isChairperson {
require(getProposalId(addr) == -1, "Duplicate proposal");
require(addr != chairperson, "Chairperson not allowed to stand");
proposals.push(Proposal(addr, 0));
assert(proposals.length <= numProposals); // To check whether cap li... | function register(address addr) public isChairperson {
require(getProposalId(addr) == -1, "Duplicate proposal");
require(addr != chairperson, "Chairperson not allowed to stand");
proposals.push(Proposal(addr, 0));
assert(proposals.length <= numProposals); // To check whether cap li... | 18,454 |
19 | // A helper variable to track match easily on the backend web server | uint matchNumber;
| uint matchNumber;
| 58,343 |
91 | // This method can be used by the controller to extract mistakenlysent tokens to this contract.dst The address that will be receiving the tokenswad The amount of tokens to transfer_token The address of the token contract that you want to recover | function transferTokens(address dst, uint wad, address _token) public onlyWithdrawer {
require( _token != address(key));
if (wad > 0) {
ERC20 token = ERC20(_token);
token.transfer(dst, wad);
}
}
| function transferTokens(address dst, uint wad, address _token) public onlyWithdrawer {
require( _token != address(key));
if (wad > 0) {
ERC20 token = ERC20(_token);
token.transfer(dst, wad);
}
}
| 50,302 |
101 | // write-off group: 4 - 100% write off | setWriteOff(4, WRITE_OFF_PHASE_E, ONE, 0);
| setWriteOff(4, WRITE_OFF_PHASE_E, ONE, 0);
| 37,259 |
16 | // set rock as not-for-sale | rocks.sellRock(id, type(uint256).max);
| rocks.sellRock(id, type(uint256).max);
| 22,306 |
69 | // MultiMint to allow multiple tokens to be minted at the same time. Price is .0777e per count/_count Total number of tokens to mint/ return _tokenIds An array of tokenids, 1 entry per token minted. | function multiMint(uint256 _count) public payable isMode(SalesState.Active) returns (uint256[] memory _tokenIds) {
uint256 price = sale.pricePerToken * _count;
require(msg.value >= price, "GG: Ether amount is under set price");
require(_count >= 1, "GG: Token count must be 1 or more");
... | function multiMint(uint256 _count) public payable isMode(SalesState.Active) returns (uint256[] memory _tokenIds) {
uint256 price = sale.pricePerToken * _count;
require(msg.value >= price, "GG: Ether amount is under set price");
require(_count >= 1, "GG: Token count must be 1 or more");
... | 29,075 |
201 | // verify that the protected liquidity is not removed on the same block in which it was added | require(liquidity.timestamp < time(), "ERR_TOO_EARLY");
if (_portion == PPM_RESOLUTION) {
| require(liquidity.timestamp < time(), "ERR_TOO_EARLY");
if (_portion == PPM_RESOLUTION) {
| 43,218 |
105 | // Iterate over each execution. | for (uint256 i = 0; i < totalExecutions; ) {
| for (uint256 i = 0; i < totalExecutions; ) {
| 14,587 |
7 | // Default Callback Handler - Handles supported tokens' callbacks, allowing Safes receiving these tokens. Richard Meissner - @rmeissner / | contract TokenCallbackHandler is ERC1155TokenReceiver, ERC777TokensRecipient, ERC721TokenReceiver, IERC165 {
string public constant NAME = "Default Callback Handler";
string public constant VERSION = "1.0.0";
/**
* @notice Handles ERC1155 Token callback.
* return Standardized onERC1155Received re... | contract TokenCallbackHandler is ERC1155TokenReceiver, ERC777TokensRecipient, ERC721TokenReceiver, IERC165 {
string public constant NAME = "Default Callback Handler";
string public constant VERSION = "1.0.0";
/**
* @notice Handles ERC1155 Token callback.
* return Standardized onERC1155Received re... | 30,611 |
34 | // Check the validity of an order (Make sure order make has sufficient balance + allowance for required tokens)/_order The order from which to check the validity/ return Whether the order is valid or not | function isOrderValid(Order memory _order) public view returns(bool) {
bytes32 hash = getOrderHash(_order);
uint256 amountLeft = amounts[hash];
if (amountLeft == 0) return false;
// Expired
if (_order.expirationTime == 0 || block.timestamp > _order.expirationTime) return fa... | function isOrderValid(Order memory _order) public view returns(bool) {
bytes32 hash = getOrderHash(_order);
uint256 amountLeft = amounts[hash];
if (amountLeft == 0) return false;
// Expired
if (_order.expirationTime == 0 || block.timestamp > _order.expirationTime) return fa... | 50,514 |
1 | // The Constructor assigns the message sender to be `owner` | constructor() public{
owner = msg.sender;
}
| constructor() public{
owner = msg.sender;
}
| 7,758 |
240 | // Only the actual admin operator can change the address / | function setAdminOperator(address adminOperator_) public {
require(msg.sender == adminOperator, "Only the actual admin operator can change the address");
emit AdminOperatorChange(adminOperator, adminOperator_);
adminOperator = adminOperator_;
}
| function setAdminOperator(address adminOperator_) public {
require(msg.sender == adminOperator, "Only the actual admin operator can change the address");
emit AdminOperatorChange(adminOperator, adminOperator_);
adminOperator = adminOperator_;
}
| 43,397 |
77 | // Sets the address of the ERC-20 token to be used as the fee. newToken The new address of the ERC-20 token to be used as the fee. / | function setErc20TokenAddress(address newToken) external onlyOwner {
require(newToken != address(0), "ACG: Invalid ERC-20 token address");
require(
newToken != erc20TokenFeeAddress,
"ACG: Token address is the same."
);
// Check if a WBNNB pair exists for the ... | function setErc20TokenAddress(address newToken) external onlyOwner {
require(newToken != address(0), "ACG: Invalid ERC-20 token address");
require(
newToken != erc20TokenFeeAddress,
"ACG: Token address is the same."
);
// Check if a WBNNB pair exists for the ... | 5,242 |
2 | // / | interface IFlashLoanReceiver {
function executeOperation(
address[] calldata assets,
uint256[] calldata amounts,
uint256[] calldata premiums,
address initiator,
bytes calldata params
) external returns (bool);
}
| interface IFlashLoanReceiver {
function executeOperation(
address[] calldata assets,
uint256[] calldata amounts,
uint256[] calldata premiums,
address initiator,
bytes calldata params
) external returns (bool);
}
| 9,027 |
400 | // ensure that we don't try to share too much | if(timePlusFee < timeRemaining) {
| if(timePlusFee < timeRemaining) {
| 32,377 |
8 | // console.log('file: LoveNotes.sol ~ line 110 ~ )purereturns ~ i2', i); | uint256 y = marginTop + ((fontSize * 6) / 5) * i;
| uint256 y = marginTop + ((fontSize * 6) / 5) * i;
| 8,034 |
50 | // Recalc issuing and burning prices/ | function recalcPrices() private {
issue_price = collateral() * fmk / _totalSupply;
burn_price = issue_price * burn_ratio / fmk;
issue_price = issue_price + issue_price * issue_increase_ratio / fmk;
}
| function recalcPrices() private {
issue_price = collateral() * fmk / _totalSupply;
burn_price = issue_price * burn_ratio / fmk;
issue_price = issue_price + issue_price * issue_increase_ratio / fmk;
}
| 41,671 |
197 | // compute unstake amount in shares | uint256 shares = totalStakingShares.mul(amount).div(totalStaked());
require(shares > 0, "Geyser: preview amount too small");
uint256 rawShareSeconds = 0;
uint256 timeBonusShareSeconds = 0;
| uint256 shares = totalStakingShares.mul(amount).div(totalStaked());
require(shares > 0, "Geyser: preview amount too small");
uint256 rawShareSeconds = 0;
uint256 timeBonusShareSeconds = 0;
| 2,940 |
32 | // is it new participant? | if (p.index == 0) {
p.index = ++ico.totalParticipants;
ico.participantsList[ico.totalParticipants] = msg.sender;
p.needReward = true;
p.needCalc = true;
}
| if (p.index == 0) {
p.index = ++ico.totalParticipants;
ico.participantsList[ico.totalParticipants] = msg.sender;
p.needReward = true;
p.needCalc = true;
}
| 54,092 |
23 | // ability for owner to suspend / resume the contract is necessary _suspended to suspend or resume the contract / | function suspend(bool _suspended) external onlyOwner {
suspended = _suspended;
}
| function suspend(bool _suspended) external onlyOwner {
suspended = _suspended;
}
| 35,470 |
14 | // Return address of the pooled token at given index. Reverts if tokenIndex is out of range. index the index of the tokenreturn address of the token at given index / | function getToken(uint8 index) public view returns (IERC20) {
require(index < swapStorage.pooledTokens.length, "Out of range");
return swapStorage.pooledTokens[index];
}
| function getToken(uint8 index) public view returns (IERC20) {
require(index < swapStorage.pooledTokens.length, "Out of range");
return swapStorage.pooledTokens[index];
}
| 9,978 |
54 | // ------------------------------------overridden methods------------------------------------// Overridder modifier to allow exceptions for pausing for a given addressThis modifier is added to all transfer methods by PausableToken and only allows if paused is set to false.With this override the function allows either i... | modifier whenNotPaused() {
require(!paused || allowedTransfers[msg.sender]);
_;
}
| modifier whenNotPaused() {
require(!paused || allowedTransfers[msg.sender]);
_;
}
| 1,372 |
11 | // Internal function to stake given token ID tokenId token ID of the asset that is asked to be staked user user that wants to stake given token ID Logic of this function is simple. We set stake owner of given token ID as sender, and incrementnumber of staked tokens of that address. Total staked token counter is also in... | * The last but not least, we emit {Transfer} event to let outside world know that the given
* token ID is transferred to this contract.
*
* CONSTRAINTS:
* 1) Given token ID should not be staked beforehand
* 2) User should be the owner of the given token ID
*/
function _stake(uint... | * The last but not least, we emit {Transfer} event to let outside world know that the given
* token ID is transferred to this contract.
*
* CONSTRAINTS:
* 1) Given token ID should not be staked beforehand
* 2) User should be the owner of the given token ID
*/
function _stake(uint... | 35,579 |
10 | // Starts the contract. All functions but required to execute only inemergency continue the execution / | function start() onlyStopper public {
stopped = false;
}
| function start() onlyStopper public {
stopped = false;
}
| 52,114 |
6 | // Maps address to ability ids. / | mapping(address => uint256) public addressToAbility;
| mapping(address => uint256) public addressToAbility;
| 16,307 |
62 | // Update reward variables of the given pool./pid The index of the pool. See `poolInfo`./ return pool Returns the pool that was updated. | function updatePool(uint256 pid) public returns (PoolInfo memory pool) {
pool = poolInfo[pid];
if (block.timestamp > pool.lastRewardTime) {
uint256 lpSupply = IMasterChefV2(MASTERCHEF_V2).lpToken(pid).balanceOf(MASTERCHEF_V2);
if (lpSupply > 0) {
uint256 time... | function updatePool(uint256 pid) public returns (PoolInfo memory pool) {
pool = poolInfo[pid];
if (block.timestamp > pool.lastRewardTime) {
uint256 lpSupply = IMasterChefV2(MASTERCHEF_V2).lpToken(pid).balanceOf(MASTERCHEF_V2);
if (lpSupply > 0) {
uint256 time... | 8,167 |
135 | // Burns (destroys) the given amount of Bridge tokens on behalf of another account | * @dev see {ERC20-_burn} and {ERC20-allowance}
* @dev the caller must have allowance for ``accounts``'s tokens
* @param from the address that owns the tokens to be burned
* @param amount the amount of tokens to be burned
* @dev emits event Transfer
*/
function burnFrom(address from, uint256 amount) ... | * @dev see {ERC20-_burn} and {ERC20-allowance}
* @dev the caller must have allowance for ``accounts``'s tokens
* @param from the address that owns the tokens to be burned
* @param amount the amount of tokens to be burned
* @dev emits event Transfer
*/
function burnFrom(address from, uint256 amount) ... | 33,039 |
7 | // called when user wants to withdraw tokens back to root chain Should burn user's tokens. This transaction will be verified when exiting on root chain amount amount of tokens to withdraw / | function withdraw(uint256 amount) external virtual {
_burn(_msgSender(), amount);
}
| function withdraw(uint256 amount) external virtual {
_burn(_msgSender(), amount);
}
| 30,291 |
33 | // This function makes it easy to get the total number of reputation/ return The total number of reputation | function totalSupply() public view returns (uint256) {
return totalSupplyAt(block.number);
}
| function totalSupply() public view returns (uint256) {
return totalSupplyAt(block.number);
}
| 10,577 |
7 | // withdraw only as much as needed from the vault | uint _withdraw = _yCrv.sub(here).mul(1e18).div(controller.getPricePerFullShare(address(yCrv)));
controller.vaultWithdraw(yCrv, _withdraw);
_yCrv = yCrv.balanceOf(address(this));
| uint _withdraw = _yCrv.sub(here).mul(1e18).div(controller.getPricePerFullShare(address(yCrv)));
controller.vaultWithdraw(yCrv, _withdraw);
_yCrv = yCrv.balanceOf(address(this));
| 41,100 |
23 | // From https:github.com/Arachnid/solidity-stringutils/blob/b9a6f6615cf18a87a823cbc461ce9e140a61c305/src/strings.sol | function _memcpy(
uint256 dest,
uint256 src,
uint256 len
| function _memcpy(
uint256 dest,
uint256 src,
uint256 len
| 24,443 |
86 | // Creates `amount` tokens and assigns them to `msg.sender`, increasingthe total supply. Requirements - `msg.sender` must be the token owner / | function mint(uint256 amount) public onlyOwner returns (bool) {
_mint(_msgSender(), amount);
return true;
}
| function mint(uint256 amount) public onlyOwner returns (bool) {
_mint(_msgSender(), amount);
return true;
}
| 7,588 |
161 | // Emit event tracking current full price per share/Provides a pure on-chain way of approximating APY | function trackFullPricePerShare() external {
_onlyAuthorizedActors();
emit FullPricePerShareUpdated(getPricePerFullShare(), now, block.number);
}
| function trackFullPricePerShare() external {
_onlyAuthorizedActors();
emit FullPricePerShareUpdated(getPricePerFullShare(), now, block.number);
}
| 28,932 |
13 | // Transfer shares from a user account to another one./token The ERC-20 token to transfer./from which user to pull the tokens./to which user to push the tokens./share The amount of `token` in shares. | function transfer(
address token,
address from,
address to,
uint256 share
) external;
| function transfer(
address token,
address from,
address to,
uint256 share
) external;
| 3,962 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.