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 |
|---|---|---|---|---|
1 | // Returns a unique type ID for the instrument.Instrument Type ID is used to identify the type of the instrument. Instrument ID is instead assigned byInstrument Manager and used to identify an instance of the instrument. / | function getInstrumentTypeID() public pure override returns (bytes4) {
return bytes4(keccak256('nuts.finance.lending-v1'));
}
| function getInstrumentTypeID() public pure override returns (bytes4) {
return bytes4(keccak256('nuts.finance.lending-v1'));
}
| 29,158 |
44 | // total volume eth per data contracts | mapping(address => uint256) private _totalVolumeEth;
| mapping(address => uint256) private _totalVolumeEth;
| 14,457 |
3 | // Constructor function to set the contract owner | constructor() {
contractOwner = msg.sender;
}
| constructor() {
contractOwner = msg.sender;
}
| 18,164 |
28 | // 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} ... | constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
| constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
| 8,551 |
11 | // Entry point to deposit tokens into the Wrapped Position contract/ Transfers tokens on behalf of caller so the caller must set/ allowance on the contract prior to call./_amount The amount of underlying tokens to deposit/_destination The address to mint to/ return Returns the number of Wrapped Position tokens minted | function deposit(address _destination, uint256 _amount)
external
override
returns (uint256)
| function deposit(address _destination, uint256 _amount)
external
override
returns (uint256)
| 16,146 |
9 | // The AO set the TAOAncestry Address _taoAncestryAddress The address of TAOAncestry / | function setTAOAncestryAddress(address _taoAncestryAddress) public onlyTheAO {
require (_taoAncestryAddress != address(0));
taoAncestryAddress = _taoAncestryAddress;
_taoAncestry = ITAOAncestry(taoAncestryAddress);
}
| function setTAOAncestryAddress(address _taoAncestryAddress) public onlyTheAO {
require (_taoAncestryAddress != address(0));
taoAncestryAddress = _taoAncestryAddress;
_taoAncestry = ITAOAncestry(taoAncestryAddress);
}
| 34,998 |
6 | // PUAN ISLEMLERI | struct PuanIslemleri {
uint id;
uint toplamPuan;
address kisiAdres;
uint gorevSayisi;
}
| struct PuanIslemleri {
uint id;
uint toplamPuan;
address kisiAdres;
uint gorevSayisi;
}
| 12,190 |
10 | // Transfer the tokens on IERC20, they should be already Approved for the bridge Address to use them | IERC20(tokenToUse).safeTransferFrom(_msgSender(), address(this), amount);
crossTokens(tokenToUse, sender, amount, "");
return true;
| IERC20(tokenToUse).safeTransferFrom(_msgSender(), address(this), amount);
crossTokens(tokenToUse, sender, amount, "");
return true;
| 26,500 |
3 | // Function to Donate to the Campaign | function donateToCampaign(uint256 _id) public payable {
//This function takes the ID of the campaign that the donator wants to donate to and is payable, meaning that amount can be tranferred
uint256 amount = msg.value; //We will get this from the Frontend
Campaign storage campaign = campai... | function donateToCampaign(uint256 _id) public payable {
//This function takes the ID of the campaign that the donator wants to donate to and is payable, meaning that amount can be tranferred
uint256 amount = msg.value; //We will get this from the Frontend
Campaign storage campaign = campai... | 28,237 |
206 | // Returns whether a race is pending / | function isRacePending(uint256 raceId) external view returns (bool);
| function isRacePending(uint256 raceId) external view returns (bool);
| 41,532 |
68 | // check that target contract was approved by the dao to prevent possible fraud | require(
dao.isSchemeRegistered(_newStaking, avatar),
"not DAO approved upgrade"
);
(
uint256 goodRewards,
uint256 gdRewards,
uint256 actualRewardsSent,
uint256 depositComponent
| require(
dao.isSchemeRegistered(_newStaking, avatar),
"not DAO approved upgrade"
);
(
uint256 goodRewards,
uint256 gdRewards,
uint256 actualRewardsSent,
uint256 depositComponent
| 27,348 |
219 | // Calculate the auctioneer's cut. (NOTE: _computeCut() is guaranteed to return a value <= price, so this subtraction can't go negative.) | uint256 auctioneerCut = _computeCut(price);
uint256 sellerProceeds = price - auctioneerCut;
| uint256 auctioneerCut = _computeCut(price);
uint256 sellerProceeds = price - auctioneerCut;
| 68,069 |
46 | // See {ERC20-balanceOf}. / | function balanceOf(address account) external view virtual override returns (uint256) {
return _balances[account];
}
| function balanceOf(address account) external view virtual override returns (uint256) {
return _balances[account];
}
| 24,207 |
5 | // For each account, a mapping of its operators and revoked default operators. | mapping(address => mapping(address => bool)) private _operators;
mapping(address => mapping(address => bool)) private _revokedDefaultOperators;
| mapping(address => mapping(address => bool)) private _operators;
mapping(address => mapping(address => bool)) private _revokedDefaultOperators;
| 19,427 |
91 | // list of unique investors | address[] public m_investors;
address public m_owner80;
address public m_owner20;
| address[] public m_investors;
address public m_owner80;
address public m_owner20;
| 42,900 |
5 | // should include a private function to deal with lawer address, should use this as a wrapper/ | {
require(msg.sender == owner);
lawyer = _lawerAddress;
}
| {
require(msg.sender == owner);
lawyer = _lawerAddress;
}
| 71 |
1 | // Emitted when a Loot Box is plundered | event Plundered(address indexed erc721, uint256 indexed tokenId, address indexed operator);
| event Plundered(address indexed erc721, uint256 indexed tokenId, address indexed operator);
| 1,589 |
29 | // require (_value <= _allowance); |
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
Transfer(_from, _to, _value);
|
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
Transfer(_from, _to, _value);
| 5,452 |
457 | // public function to call the deposit with allowance and mint | function wrap(address to, uint256 amt) noNullAddress(to) public { // works as wrap for
_depositUnderlying( amt);
_mintWrap(to, amt); // No need to check underlying?
}
| function wrap(address to, uint256 amt) noNullAddress(to) public { // works as wrap for
_depositUnderlying( amt);
_mintWrap(to, amt); // No need to check underlying?
}
| 25,312 |
41 | // String operations. / | library Strings {
/**
* @dev Converts a `uint256` to its ASCII `string` representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6e... | library Strings {
/**
* @dev Converts a `uint256` to its ASCII `string` representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6e... | 110 |
1 | // Multiplies two numbers, reverts on overflow./ | function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
... | function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
... | 3,964 |
32 | // remove the tokenID from stakedTokens | stakedTokens[stakedTokenIndex[tokenId]] = stakedTokens[
stakedTokens.length - 1
];
| stakedTokens[stakedTokenIndex[tokenId]] = stakedTokens[
stakedTokens.length - 1
];
| 49,864 |
88 | // _tokens: The number of tokens to buy.This function will check if the buy will push the token over its threshold, thus moving the token to uniswap. If the buy willpush the supply in excess of the threshold, only the tokensneeded to reach the threshold will be bought.This function will be blocked after the market has ... | function buy(uint256 _tokens) external freeMarket() {
_transitionCheck(true, _tokens);
// The token can transition
if(transitionConditionsMet) {
// TODO check what happens here on min threshold
if(
this.totalSupply() + _tokens >= tokenThreshold
... | function buy(uint256 _tokens) external freeMarket() {
_transitionCheck(true, _tokens);
// The token can transition
if(transitionConditionsMet) {
// TODO check what happens here on min threshold
if(
this.totalSupply() + _tokens >= tokenThreshold
... | 4,567 |
46 | // An event emitted when an user has staked and delegated | event Staked(
address indexed delegator,
address indexed delegatee,
uint256 amount
);
| event Staked(
address indexed delegator,
address indexed delegatee,
uint256 amount
);
| 35,132 |
45 | // Safely converts a uint256 to an int256. / | function toInt256Safe(uint256 a) internal pure returns (int256) {
require(a <= MAX_INT256);
return int256(a);
}
| function toInt256Safe(uint256 a) internal pure returns (int256) {
require(a <= MAX_INT256);
return int256(a);
}
| 20,636 |
20 | // Accumulate CToken interest | return super.accrueInterest();
| return super.accrueInterest();
| 4,272 |
15 | // The proposal has already been queued. / | error GovernorAlreadyQueuedProposal(uint256 proposalId);
| error GovernorAlreadyQueuedProposal(uint256 proposalId);
| 1,452 |
15 | // Transfer `tokens` tokens from `src` to `dst` by `spender` Called by both `transfer` and `transferFrom` internally spender The address of the account performing the transfer src The address of the source account dst The address of the destination account tokens The number of tokens to transfer / | function transferTokens(address spender, address src, address dst, uint tokens) internal{
/* Fail if transfer not allowed */
comptroller.transferAllowed(address(this), src, dst, tokens);
/* Do not allow self-transfers */
if (src == dst) {
revert ("BAD_INPUT");
... | function transferTokens(address spender, address src, address dst, uint tokens) internal{
/* Fail if transfer not allowed */
comptroller.transferAllowed(address(this), src, dst, tokens);
/* Do not allow self-transfers */
if (src == dst) {
revert ("BAD_INPUT");
... | 8,147 |
0 | // uint256 public constant tokenPrice = 200000000000;0.00002 ETH price for testing | uint256 public maxNftSupply = 10000;
bool public publicSale = false;
string public _baseURIextended = "ipfs://QmeGRGymLZus4bThvyUnQeGD2SWREZTZuPrsGddepKPnvA/";
string public baseExtension = ".json";
| uint256 public maxNftSupply = 10000;
bool public publicSale = false;
string public _baseURIextended = "ipfs://QmeGRGymLZus4bThvyUnQeGD2SWREZTZuPrsGddepKPnvA/";
string public baseExtension = ".json";
| 69,741 |
30 | // Burn 1 OPEN token from the winner's balance | _burn(winner, TOKENID_COMMON, 1);
| _burn(winner, TOKENID_COMMON, 1);
| 42,761 |
42 | // Only run if player has at least some amount of tokens frozen/_owner The owner of the tokens/_tokens The amount of frozen tokens required | modifier hasFrozenTokens(address _owner, uint _tokens)
| modifier hasFrozenTokens(address _owner, uint _tokens)
| 52,421 |
317 | // solhint-enable private-vars-leading-underscore / Rebind BPool and pull tokens from address bPool is a contract interface; function calls on it are external | function _pullUnderlying(address erc20, address from, uint amount) internal needsBPool {
// Gets current Balance of token i, Bi, and weight of token i, Wi, from BPool.
uint tokenBalance = bPool.getBalance(erc20);
uint tokenWeight = bPool.getDenormalizedWeight(erc20);
bool xfer = IER... | function _pullUnderlying(address erc20, address from, uint amount) internal needsBPool {
// Gets current Balance of token i, Bi, and weight of token i, Wi, from BPool.
uint tokenBalance = bPool.getBalance(erc20);
uint tokenWeight = bPool.getDenormalizedWeight(erc20);
bool xfer = IER... | 33,642 |
10 | // PRIVATE METHODS / | function _changePermission(
address target,
bool isWhitelisted,
Role role
| function _changePermission(
address target,
bool isWhitelisted,
Role role
| 2,793 |
14 | // Set the merkle-root for eligible minters. | _setMerkleRootAndCid(
merkleRoot,
ipfsCid
);
| _setMerkleRootAndCid(
merkleRoot,
ipfsCid
);
| 15,311 |
36 | // all team property content | function allOf (uint256 _itemId) external view returns (address _owner, uint256 _price, uint256 _nextPrice) {
return (ownerOf(_itemId), priceOf(_itemId), nextPriceOf(_itemId));
}
| function allOf (uint256 _itemId) external view returns (address _owner, uint256 _price, uint256 _nextPrice) {
return (ownerOf(_itemId), priceOf(_itemId), nextPriceOf(_itemId));
}
| 29,965 |
2 | // Set the address of the new owner of the contract/Set _newOwner to address(0) to renounce any ownership./_newOwner The address of the new owner of the contract | function transferOwnership(address _newOwner) external;
| function transferOwnership(address _newOwner) external;
| 28,764 |
88 | // Registers and enables a new module. | function registerModule(address module) external;
| function registerModule(address module) external;
| 27,485 |
60 | // 函數:查詢召集陣列(Array)裡狀態是審核中(Auditing)的id(場主限定) | function getArrayAuditingIds()
public
view
onlyHost
returns (uint256[] memory)
| function getArrayAuditingIds()
public
view
onlyHost
returns (uint256[] memory)
| 26,536 |
36 | // onlyWhenInited | updateState
onlyWhenCallerIsZoneOwner
onlyWhenHasTeller
| updateState
onlyWhenCallerIsZoneOwner
onlyWhenHasTeller
| 28,903 |
9 | // require(patients[msg.sender]); | HealthInfo memory healthInfo = HealthInfo({
date : _date,
heartBeat : _heartBeat,
steps : _steps,
calories : _calories
});
| HealthInfo memory healthInfo = HealthInfo({
date : _date,
heartBeat : _heartBeat,
steps : _steps,
calories : _calories
});
| 12,267 |
9 | // A special id that indicating the subscription is not approved yet | uint32 private constant _UNALLOCATED_SUB_ID = type(uint32).max;
| uint32 private constant _UNALLOCATED_SUB_ID = type(uint32).max;
| 21,831 |
627 | // Deposits tokens into the vault.//_amount the amount of tokens to deposit into the vault. | function deposit(uint256 _amount) external override {
vault.deposit(_amount);
}
| function deposit(uint256 _amount) external override {
vault.deposit(_amount);
}
| 47,764 |
26 | // We need to bootstrap the pool with liquidity to pay interest | function addLiquidity(address _reserve, address _bank, address _addr, uint256 _amount) public {
IERC20 reserve = IERC20(_reserve);
reserve.transferFrom(_addr, address(this), _amount);
_mint(_bank, _amount);
}
| function addLiquidity(address _reserve, address _bank, address _addr, uint256 _amount) public {
IERC20 reserve = IERC20(_reserve);
reserve.transferFrom(_addr, address(this), _amount);
_mint(_bank, _amount);
}
| 23,874 |
30 | // Amount of wei that will be distributed on this dividends period./ | uint256 public totalDividends;
| uint256 public totalDividends;
| 2,094 |
14 | // Tally number of contract deployments that'll result in a win. We tally the cost of deploying blank contracts. | if((_seed - ((_seed / 1000) * 1000)) >= _tracker) {
_newSender = address(keccak256(abi.encodePacked(0xd6, 0x94, _newSender, 0x01)));
_nContracts++;
_pwnCost+= blankContractCost;
} else {
| if((_seed - ((_seed / 1000) * 1000)) >= _tracker) {
_newSender = address(keccak256(abi.encodePacked(0xd6, 0x94, _newSender, 0x01)));
_nContracts++;
_pwnCost+= blankContractCost;
} else {
| 70,638 |
7 | // NOTE: Caller must guarantee that the `recipient` is the expected NFT receiver. | _tranferNFT(tokenAddress, address(this), recipient, tokenId, amount);
if (payToken == address(0)) {
| _tranferNFT(tokenAddress, address(this), recipient, tokenId, amount);
if (payToken == address(0)) {
| 13,945 |
11 | // HighstackVestingVault HighstackVestingVault is a vesting contract that vests tokensover a period of time via predefined intervals and percentages perinterval. / | contract HighstackVestingVault is Ownable, ReentrancyGuard {
using SafeMath for uint256;
// ERC20 token being held by this contract
ERC20 public vestingToken;
// Vesting configuration
uint64 public vestStartTime; // seconds
uint256 public vestIntervalCount;
uint256 public vestIntervalDurat... | contract HighstackVestingVault is Ownable, ReentrancyGuard {
using SafeMath for uint256;
// ERC20 token being held by this contract
ERC20 public vestingToken;
// Vesting configuration
uint64 public vestStartTime; // seconds
uint256 public vestIntervalCount;
uint256 public vestIntervalDurat... | 72,658 |
54 | // Emits an {Approval} event. Requirements: - `owner` cannot be the zero address. - `spender` cannot be the zero address./ | function _approve(address owner_, address spender, uint256 amount) internal {
require(owner_ != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner_][spender] = amount;
emit Approval(owner_, spender, amo... | function _approve(address owner_, address spender, uint256 amount) internal {
require(owner_ != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner_][spender] = amount;
emit Approval(owner_, spender, amo... | 29,335 |
38 | // remove an account's access to this role / | function remove(Role storage role, address account) internal {
require(account != address(0));
require(has(role, account));
role.bearer[account] = false;
}
| function remove(Role storage role, address account) internal {
require(account != address(0));
require(has(role, account));
role.bearer[account] = false;
}
| 34,374 |
0 | // authority's manager | Manager public manager;
| Manager public manager;
| 27,394 |
18 | // updateAllowance / | function updateAllowances(
ITokenProxy _token,
address[] memory _spenders,
uint256[] memory _allowances)
override public onlyProxyOperator(_token) returns (bool)
| function updateAllowances(
ITokenProxy _token,
address[] memory _spenders,
uint256[] memory _allowances)
override public onlyProxyOperator(_token) returns (bool)
| 50,807 |
3 | // Testing the tokensOfOwner() function | /*function testTokensOfOwner() public {
uint256[] memoryownerTokens = cryptoCards.tokensOfOwner(this);
Assert.equal(ownerTokens.length, 1, "Test should own one token via tokensOfOwner");
}*/
| /*function testTokensOfOwner() public {
uint256[] memoryownerTokens = cryptoCards.tokensOfOwner(this);
Assert.equal(ownerTokens.length, 1, "Test should own one token via tokensOfOwner");
}*/
| 17,867 |
4 | // Used when attempting to unlock stCelo when there is no stCelo to unlock. account The account's address. / | error NothingToUnlock(address account);
| error NothingToUnlock(address account);
| 22,618 |
73 | // Delete the index for the deleted slot | delete set._indexes[value];
return true;
| delete set._indexes[value];
return true;
| 896 |
16 | // Important: Validate the hint. (1) The role from hint should be validated. | require(_hasRole(transaction, role), Errors.INVALID_HINT);
| require(_hasRole(transaction, role), Errors.INVALID_HINT);
| 28,556 |
1 | // 存錢進合約 | function deposit() public payable{
balances[msg.sender]+=msg.value;
}
| function deposit() public payable{
balances[msg.sender]+=msg.value;
}
| 31,691 |
403 | // The maximum RiskParam values that can be set | struct RiskLimits {
uint64 marginRatioMax;
uint64 liquidationSpreadMax;
uint64 earningsRateMax;
uint64 marginPremiumMax;
uint64 spreadPremiumMax;
uint128 minBorrowedValueMax;
}
| struct RiskLimits {
uint64 marginRatioMax;
uint64 liquidationSpreadMax;
uint64 earningsRateMax;
uint64 marginPremiumMax;
uint64 spreadPremiumMax;
uint128 minBorrowedValueMax;
}
| 31,273 |
295 | // if insufficient balance and no∏t shutdown, return false | if (IERC20(_lockData.token).balanceOf(address(this)) < _lockData.balance) return false;
| if (IERC20(_lockData.token).balanceOf(address(this)) < _lockData.balance) return false;
| 72,066 |
199 | // according to the argument in the definition of totalLINKDue, totalLINKDue is never greater than 2172, so this cast is safe | int256 due = int256(totalLINKDue());
| int256 due = int256(totalLINKDue());
| 44,728 |
5 | // Sets the value for {initialBloc}. Sets ownership to the given `_owner`./ | constructor() {
initialBlock = block.number;
lastClaimedBlock = block.number;
}
| constructor() {
initialBlock = block.number;
lastClaimedBlock = block.number;
}
| 49,809 |
0 | // The ETH balance of the account is not enough to perform the operation. / | error AddressInsufficientBalance(address account);
| error AddressInsufficientBalance(address account);
| 6,432 |
82 | // staker => snapshots// staker => next claim // tokenId => token info // period => rewardsPerCycle / | modifier hasStarted() {
require(startTimestamp != 0, "NftStaking: staking not started");
_;
}
| modifier hasStarted() {
require(startTimestamp != 0, "NftStaking: staking not started");
_;
}
| 46,437 |
1 | // The basics of a proxy read call Note that msg.sender in the underlying will always be the address of this contract. | assembly {
calldatacopy(0, 0, calldatasize)
| assembly {
calldatacopy(0, 0, calldatasize)
| 21,987 |
93 | // Auto enable on launch | function toggleAntibotEnable(bool enable) external onlyOwner {
_isAntibotEnabled = enable;
}
| function toggleAntibotEnable(bool enable) external onlyOwner {
_isAntibotEnabled = enable;
}
| 3,051 |
4 | // FIELDS:---------------------------------------------------- | ERC20 public lessToken;
ERC20 public lpToken;
uint256 public contractStart;
uint256 public minStakeTime;
uint256 public dayDuration;
uint256 public participants;
uint16 public penaltyDistributed = 25; //100% = PERCENT_FACTOR
uint16 public penaltyBurned = 25; //100% = PERCENT_FACTOR
... | ERC20 public lessToken;
ERC20 public lpToken;
uint256 public contractStart;
uint256 public minStakeTime;
uint256 public dayDuration;
uint256 public participants;
uint16 public penaltyDistributed = 25; //100% = PERCENT_FACTOR
uint16 public penaltyBurned = 25; //100% = PERCENT_FACTOR
... | 55,282 |
46 | // Returns the specific group total stCELO.return total The total stCELO amount.return overflow The stCELO amount that is overflowed to default strategy. / | function getStCeloInStrategy(address strategy)
public
view
returns (uint256 total, uint256 overflow)
| function getStCeloInStrategy(address strategy)
public
view
returns (uint256 total, uint256 overflow)
| 20,158 |
27 | // renounce ownership of contract / | function renounceOwnership() public owned() {
transferOwnership(address(0));
}
| function renounceOwnership() public owned() {
transferOwnership(address(0));
}
| 64,668 |
1 | // 如果写成 Sandwich mySandwich = sandwiches[_index]; Solidity 将会给出警告,告诉你应该明确在这里定义 `storage` 或者 `memory`。 这里定义为 `storage`: | Sandwich storage mySandwich = sandwiches[_index];
| Sandwich storage mySandwich = sandwiches[_index];
| 34,525 |
18 | // Reclaim all ERC20Basic compatible tokens token ERC20Basic The address of the token contract / | function reclaimToken(ERC20Basic token) external onlyOwner {
uint256 balance = token.balanceOf(this);
token.safeTransfer(owner, balance);
}
| function reclaimToken(ERC20Basic token) external onlyOwner {
uint256 balance = token.balanceOf(this);
token.safeTransfer(owner, balance);
}
| 7,413 |
201 | // set beneficiary newBeneficiary new beneficiary / | function setBeneficiary(address newBeneficiary) external onlyOwner {
require(newBeneficiary != address(0), "TrueFiPool: Beneficiary address cannot be set to 0");
beneficiary = newBeneficiary;
emit BeneficiaryChanged(newBeneficiary);
}
| function setBeneficiary(address newBeneficiary) external onlyOwner {
require(newBeneficiary != address(0), "TrueFiPool: Beneficiary address cannot be set to 0");
beneficiary = newBeneficiary;
emit BeneficiaryChanged(newBeneficiary);
}
| 13,309 |
0 | // Derives initial state of the asset terms and stores together withterms, schedule, ownership, engine, admin of the asset in the contract types specific AssetRegistry. Can only be called by a whitelisted issuer. terms asset specific terms schedule schedule of the asset engine address of the ACTUS engine used for the s... | function initialize(
CECTerms calldata terms,
bytes32[] calldata schedule,
address engine,
address admin,
address custodian,
address underlyingRegistry
)
external
onlyRegisteredIssuer
| function initialize(
CECTerms calldata terms,
bytes32[] calldata schedule,
address engine,
address admin,
address custodian,
address underlyingRegistry
)
external
onlyRegisteredIssuer
| 946 |
107 | // Owner can add liquidity to the 1-UP/ETH pool/If ETH balance of the contract is 0 transaction will be declined | function addLiquidity() public override onlyOwner {
uint256 balance = address(this).balance;
require(balance > 0, 'addLiquidity: ETH balance is zero!');
uint256 amountTokenDesired = balance.mul(UNISWAP_TOKEN_PRICE);
oneUpToken.mint(address(this), amountTokenDesired);
oneUpTo... | function addLiquidity() public override onlyOwner {
uint256 balance = address(this).balance;
require(balance > 0, 'addLiquidity: ETH balance is zero!');
uint256 amountTokenDesired = balance.mul(UNISWAP_TOKEN_PRICE);
oneUpToken.mint(address(this), amountTokenDesired);
oneUpTo... | 20,179 |
36 | // Sets permissions via signature This method works similarly to `modifyMany`, but instead of being executed by the owner, it can be set by signature permissions The permissions to set for the different positions deadline The deadline timestamp by which the call must be mined for the approve to work v Must produce vali... | function multiPermissionPermit(
| function multiPermissionPermit(
| 36,158 |
19 | // tokens bought | _minReturn,
| _minReturn,
| 39,763 |
13 | // Issue a single token directly to receiver with a custom tokenURI, only callable by ISSUER_ROLE./ Emits TokenIssued event. | function issueWithTokenURI(address receiver, string calldata tokenURI) external;
| function issueWithTokenURI(address receiver, string calldata tokenURI) external;
| 43,758 |
14 | // set public resolver for this domain | registries[_topdomain].setResolver(subdomainNamehash, resolvers[_topdomain]);
| registries[_topdomain].setResolver(subdomainNamehash, resolvers[_topdomain]);
| 30,720 |
0 | // Only orders signed using an offerer's current counter are fulfillable. | mapping(address => uint256) private _counters;
| mapping(address => uint256) private _counters;
| 16,429 |
31 | // reject transaction if signee isnt any of the parties involved | require(msg.sender == escrowLedger[id].sender.signee ||
msg.sender == escrowLedger[id].recipient.signee ||
msg.sender == escrowLedger[id].witness.signee,
"You don't own this piece");
bool allHaveSigned = true;
if(msg.sender == escrowLedger[id].sender.s... | require(msg.sender == escrowLedger[id].sender.signee ||
msg.sender == escrowLedger[id].recipient.signee ||
msg.sender == escrowLedger[id].witness.signee,
"You don't own this piece");
bool allHaveSigned = true;
if(msg.sender == escrowLedger[id].sender.s... | 51,107 |
115 | // Share of seized collateral that is added to reserves / | uint public constant protocolSeizeShareMantissa = 2.8e16; //2.8%
| uint public constant protocolSeizeShareMantissa = 2.8e16; //2.8%
| 21,242 |
462 | // Set active currency to true if either balance is non-zero | balanceState.storedCashBalance != 0 || balanceState.storedNTokenBalance != 0,
Constants.ACTIVE_IN_BALANCES
);
if (balanceState.storedCashBalance < 0) {
| balanceState.storedCashBalance != 0 || balanceState.storedNTokenBalance != 0,
Constants.ACTIVE_IN_BALANCES
);
if (balanceState.storedCashBalance < 0) {
| 63,157 |
49 | // ERC20 TransferFrom _from - source address _to - destination address _value - valuereturn True if success / | function transferFrom(address _from, address _to, uint256 _value)
public
blockLock(_from)
returns (bool)
| function transferFrom(address _from, address _to, uint256 _value)
public
blockLock(_from)
returns (bool)
| 28,658 |
88 | // update balance & number of deposits of user | uint active = (amount * 100)
.sub(referralFee)
.sub(serviceFee)
.sub(investorsFee);
token.mint(client, active / 100 * token.rate() / token.mrate());
| uint active = (amount * 100)
.sub(referralFee)
.sub(serviceFee)
.sub(investorsFee);
token.mint(client, active / 100 * token.rate() / token.mrate());
| 76,090 |
104 | // This is an auxiliary contract meant to be assigned as the admin of a {TransparentUpgradeableProxy}. For anexplanation of why you would want to use this see the documentation for {TransparentUpgradeableProxy}./ Returns the current implementation of `proxy`. Requirements: - This contract must be the admin of `proxy`. ... | function getProxyImplementation(TransparentUpgradeableProxy proxy) public view virtual returns (address) {
| function getProxyImplementation(TransparentUpgradeableProxy proxy) public view virtual returns (address) {
| 7,062 |
158 | // Returns an in-memory copy of a Fraction128 aThe Fraction128 to copyreturnA copy of the Fraction128 / | function copy(
Fraction.Fraction128 memory a
)
internal
pure
returns (Fraction.Fraction128 memory)
| function copy(
Fraction.Fraction128 memory a
)
internal
pure
returns (Fraction.Fraction128 memory)
| 67,194 |
4 | // cpToken address to it's corresponding pool address | function poolsByCpToken(
address
) external view returns (address pool, address currency, bool isListed);
| function poolsByCpToken(
address
) external view returns (address pool, address currency, bool isListed);
| 40,733 |
45 | // Roles are often managed via {grantRole} and {revokeRole}: this function'spurpose is to provide a mechanism for accounts to lose their privilegesif they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked}event. Requirements: - the caller ... | function renounceRole(bytes32 role, address account) public virtual override {
require(account == _msgSender(), "AccessControl: can only renounce roles for self");
_revokeRole(role, account);
}
| function renounceRole(bytes32 role, address account) public virtual override {
require(account == _msgSender(), "AccessControl: can only renounce roles for self");
_revokeRole(role, account);
}
| 67,189 |
4 | // Community Multisig Wallet Address | address public a4 = 0xBF600B4339F3dBe86f70ad1B171FD4Da2D2BA841; // Community Wallet
| address public a4 = 0xBF600B4339F3dBe86f70ad1B171FD4Da2D2BA841; // Community Wallet
| 19,885 |
2 | // The ether balance of all users of the smart contract | mapping(address => uint) public BalanceOfEther;
mapping(uint => uint) public tokenToSalePrice; // if equals zero, it's not up for sale
| mapping(address => uint) public BalanceOfEther;
mapping(uint => uint) public tokenToSalePrice; // if equals zero, it's not up for sale
| 37,683 |
5 | // swap using 1inch API | function swapOneInch(
address tokenIn,
address tokenOut,
uint256 amount,
uint256 minReturn,
bytes32[] calldata pools
| function swapOneInch(
address tokenIn,
address tokenOut,
uint256 amount,
uint256 minReturn,
bytes32[] calldata pools
| 19,385 |
159 | // return result Square root of the number / | function sqrt(uint256 x) private pure returns (uint256 result) {
result = x;
uint256 k = x.div(2).add(1);
while (k < result) (result, k) = (k, x.div(k).add(k).div(2));
}
| function sqrt(uint256 x) private pure returns (uint256 result) {
result = x;
uint256 k = x.div(2).add(1);
while (k < result) (result, k) = (k, x.div(k).add(k).div(2));
}
| 9,434 |
156 | // Internal function to add special users./ | function _addSpecialUsers() internal {
IQissaFactory.UserInput[] memory _specialUsers = new IQissaFactory.UserInput[](2);
// DGC firma account
_specialUsers[0] = IQissaFactory.UserInput(factory.dgcFirma(), FIXED_DGC_BPS, IQissaFactory.UserType.User, 0);
// add special funding accou... | function _addSpecialUsers() internal {
IQissaFactory.UserInput[] memory _specialUsers = new IQissaFactory.UserInput[](2);
// DGC firma account
_specialUsers[0] = IQissaFactory.UserInput(factory.dgcFirma(), FIXED_DGC_BPS, IQissaFactory.UserType.User, 0);
// add special funding accou... | 32,570 |
51 | // Decrease the amount of tokens that an holder allowed to a spender. approve should be called when allowed[_spender] == 0. To decrementallowed value is better to use this function to avoid 2 calls (and wait untilthe first transaction is mined)From MonolithDAO Token.sol _spender The address which will spend the funds. ... | function decreaseApproval(
address _spender,
uint256 _subtractedValue
| function decreaseApproval(
address _spender,
uint256 _subtractedValue
| 49,795 |
16 | // If two players sent ETH the jacpot is split between them | playersAddresses[playersAddresses.length - 1].send(jackpot * 70 / 100);
playersAddresses[playersAddresses.length - 2].send(jackpot * 30 / 100);
| playersAddresses[playersAddresses.length - 1].send(jackpot * 70 / 100);
playersAddresses[playersAddresses.length - 2].send(jackpot * 30 / 100);
| 43,254 |
149 | // Set the amount of time before an auction resets. | setAuctionTimeBeforeReset(co.ilk, co.auctionDuration);
| setAuctionTimeBeforeReset(co.ilk, co.auctionDuration);
| 47,196 |
846 | // Initializes the debt token. pool The address of the lending pool where this aToken will be used underlyingAsset The address of the underlying asset of this aToken (E.g. WETH for aWETH) incentivesController The smart contract managing potential incentives distribution debtTokenDecimals The decimals of the debtToken, ... | function initialize(
ILendingPool pool,
address underlyingAsset,
IAaveIncentivesController incentivesController,
uint8 debtTokenDecimals,
string memory debtTokenName,
string memory debtTokenSymbol,
bytes calldata params
) public override initializer {
_setName(debtTokenName);
| function initialize(
ILendingPool pool,
address underlyingAsset,
IAaveIncentivesController incentivesController,
uint8 debtTokenDecimals,
string memory debtTokenName,
string memory debtTokenSymbol,
bytes calldata params
) public override initializer {
_setName(debtTokenName);
| 15,379 |
467 | // Helper function for calculating totals sqrtRatioX96 Current or virtual sqrtPriceX96 realTick Current tick, for calculating tokensOwed correctly mainData Main position data rangeData Range position dataN.B realTick must be provided because tokensOwed calculation needsthe current correct tick because the ticks are onl... | function _calculateTotalsFromTick(
uint160 sqrtRatioX96,
int24 realTick,
DepositPositionData memory mainData,
DepositPositionData memory rangeData
)
internal
view
returns (
uint256 total0,
| function _calculateTotalsFromTick(
uint160 sqrtRatioX96,
int24 realTick,
DepositPositionData memory mainData,
DepositPositionData memory rangeData
)
internal
view
returns (
uint256 total0,
| 50,387 |
19 | // transfer balance to owner | function withdraw() external onlyOwner{
require(msg.sender == owner);
msg.sender.transfer(address(this).balance);
emit Withdraw(msg.sender,address(this).balance);
}
| function withdraw() external onlyOwner{
require(msg.sender == owner);
msg.sender.transfer(address(this).balance);
emit Withdraw(msg.sender,address(this).balance);
}
| 41,036 |
12 | // Define a modifier that checks if an item.state of a upc is Uninitialized | modifier uninitialized(uint _upc) {
require(items[_upc].itemState == State.Uninitialized);
_;
}
| modifier uninitialized(uint _upc) {
require(items[_upc].itemState == State.Uninitialized);
_;
}
| 43,703 |
1 | // Used for authentication | address public monetaryPolicy;
uint256 public rebaseStartTime;
| address public monetaryPolicy;
uint256 public rebaseStartTime;
| 52,490 |
78 | // Calculate how much ETH are available for this stage | uint256 ethAvailable = getRemainingEthersForCurrentRound();
uint rate = getBCDTRateForCurrentRound();
| uint256 ethAvailable = getRemainingEthersForCurrentRound();
uint rate = getBCDTRateForCurrentRound();
| 41,356 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.