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 |
|---|---|---|---|---|
149 | // default tax is 7.5% of every transfer | uint256 taxAmount = amount.mul(transferTaxRate).div(10000);
uint256 burnAmount = taxAmount.mul(burnRate).div(100);
uint256 liquidityAmount = taxAmount.sub(burnAmount);
require(taxAmount == burnAmount + liquidityAmount, "SHARK::transfer: Burn value invalid");
| uint256 taxAmount = amount.mul(transferTaxRate).div(10000);
uint256 burnAmount = taxAmount.mul(burnRate).div(100);
uint256 liquidityAmount = taxAmount.sub(burnAmount);
require(taxAmount == burnAmount + liquidityAmount, "SHARK::transfer: Burn value invalid");
| 4,414 |
9 | // Returns the NFTLabStorage address to interact with nfts.The trade logic handles everything that regards moving tokenswhen they are put on a trade (so that owners cannot open atrade and then move them), this way the owner of an nft can dowhatever he wants with it, even give it for free to someoneelse / | function getStorage() external view returns (address) {
return address(tokenHandler);
}
| function getStorage() external view returns (address) {
return address(tokenHandler);
}
| 32,950 |
29 | // Create a new NokuTokenBurner with predefined burning fraction._wallet The wallet receiving the unburnt tokens./ | function NokuTokenBurner(address _wallet) public {
require(_wallet != address(0));
wallet = _wallet;
burningPercentage = 100;
LogNokuTokenBurnerCreated(msg.sender, _wallet);
}
| function NokuTokenBurner(address _wallet) public {
require(_wallet != address(0));
wallet = _wallet;
burningPercentage = 100;
LogNokuTokenBurnerCreated(msg.sender, _wallet);
}
| 19,270 |
19 | // sum user deposit passionnum | function balanceOf(address _voter) external view returns (uint256) {
uint256 _votes = 0;
uint256 _vCtLpTotal;
uint256 _vUserLp;
uint256 _vCtPassionNum;
uint256 _vUserpassionnum;
uint256 _vTmpPoolId;
IERC20 _vLpToken;
for(
uint256 i = votePoolMap.iterate_start();
votePoolMap.iterate_valid(i);
i = votePoolMap.iterate_next(i)
){
//user deposit passionnum = user_lptoken*contract_passionnum/contract_lptokens
(,_vTmpPoolId) = votePoolMap.iterate_get(i);
(_vLpToken,,,) = chef.poolInfo(_vTmpPoolId);
_vCtLpTotal = IUniswapV2Pair(address(_vLpToken)).totalSupply();
(_vUserLp,) = chef.userInfo(_vTmpPoolId,_voter);
_vCtPassionNum = votes.balanceOf(address(_vLpToken));
_vUserpassionnum = _vUserLp.mul(_vCtPassionNum).div(_vCtLpTotal);
_votes = _votes.add(_vUserpassionnum);
}
return _votes;
}
| function balanceOf(address _voter) external view returns (uint256) {
uint256 _votes = 0;
uint256 _vCtLpTotal;
uint256 _vUserLp;
uint256 _vCtPassionNum;
uint256 _vUserpassionnum;
uint256 _vTmpPoolId;
IERC20 _vLpToken;
for(
uint256 i = votePoolMap.iterate_start();
votePoolMap.iterate_valid(i);
i = votePoolMap.iterate_next(i)
){
//user deposit passionnum = user_lptoken*contract_passionnum/contract_lptokens
(,_vTmpPoolId) = votePoolMap.iterate_get(i);
(_vLpToken,,,) = chef.poolInfo(_vTmpPoolId);
_vCtLpTotal = IUniswapV2Pair(address(_vLpToken)).totalSupply();
(_vUserLp,) = chef.userInfo(_vTmpPoolId,_voter);
_vCtPassionNum = votes.balanceOf(address(_vLpToken));
_vUserpassionnum = _vUserLp.mul(_vCtPassionNum).div(_vCtLpTotal);
_votes = _votes.add(_vUserpassionnum);
}
return _votes;
}
| 16,211 |
32 | // Incremental counter of unicorns Id |
uint256 private lastUnicornId;
|
uint256 private lastUnicornId;
| 20,801 |
39 | // only owner address can set treasury address / | {
treasury = newTreasury;
}
| {
treasury = newTreasury;
}
| 20,046 |
8 | // pushs the wallet from the function var into the wallets array | inheritance[_wallet] == _inheritance;
| inheritance[_wallet] == _inheritance;
| 8,260 |
13 | // Lets a contract admin set claim conditions. | function setClaimConditions(ClaimCondition[] calldata _conditions, bool _resetClaimEligibility)
external
virtual
override
| function setClaimConditions(ClaimCondition[] calldata _conditions, bool _resetClaimEligibility)
external
virtual
override
| 20,550 |
22 | // /REGISTRATION / LXL can be registered as deposit from `client` for benefit of `provider`. If LXL `token` is wETH, msg.value can be wrapped into wETH in single call. clientOracle Account that can help call `release()` and `withdraw()` (default to `client` if unsure). provider Account to receive registered `amount`s. resolver Account that can call `resolve()` to award `sum` remainder between LXL parties. token Token address for `amount` deposit. amount Array of milestone `amount`s to be sent to `provider` on call of `release()`. termination Exact `termination` date in seconds since epoch. details Context re: LXL. swiftResolver If `true`, `sum` remainder can be | function depositLocker( // CLIENT-TRACK
address clientOracle,
address provider,
address resolver,
address token,
uint256[] calldata amount,
uint256 termination,
string memory details,
bool swiftResolver
| function depositLocker( // CLIENT-TRACK
address clientOracle,
address provider,
address resolver,
address token,
uint256[] calldata amount,
uint256 termination,
string memory details,
bool swiftResolver
| 64,594 |
3 | // This struct is used for holding one game state. / | struct State {
/* Total number of players in the game. */
uint8 numberOfPlayers;
/* Dimensions of game board. */
uint8 xMapMaxSize;
uint8 yMapMaxSize;
/* Number of occupied lines in game. */
uint8 occupiedLines;
/* Address of first player. */
address firstPlayer;
/* Is true, if */
bool isFirstPlayer;
/*
* Hold the information about the game.
* I'm going to store info like this.
* Not sure, if it's `optimal` in any way(_but who cares_).
*
* 00-01-02
* || || ||
* 10-11-12
* || || ||
* 20-21-22
*
* -1 if player1, +1 if player2, 0 if empty.
*
*/
mapping(uint8 => mapping(uint8 => mapping(uint8 => mapping(uint8 => int8)))) fast_fields;
/* Players' score info. */
uint8 player1Score;
uint8 player2Score;
}
| struct State {
/* Total number of players in the game. */
uint8 numberOfPlayers;
/* Dimensions of game board. */
uint8 xMapMaxSize;
uint8 yMapMaxSize;
/* Number of occupied lines in game. */
uint8 occupiedLines;
/* Address of first player. */
address firstPlayer;
/* Is true, if */
bool isFirstPlayer;
/*
* Hold the information about the game.
* I'm going to store info like this.
* Not sure, if it's `optimal` in any way(_but who cares_).
*
* 00-01-02
* || || ||
* 10-11-12
* || || ||
* 20-21-22
*
* -1 if player1, +1 if player2, 0 if empty.
*
*/
mapping(uint8 => mapping(uint8 => mapping(uint8 => mapping(uint8 => int8)))) fast_fields;
/* Players' score info. */
uint8 player1Score;
uint8 player2Score;
}
| 25,438 |
26 | // A constant role name for indicating admins. / | string public constant ROLE_ADMIN = "admin";
| string public constant ROLE_ADMIN = "admin";
| 903 |
11 | // solhint-disable-next-line no-inline-assembly | assembly { codehash := extcodehash(account) }
| assembly { codehash := extcodehash(account) }
| 32,004 |
4 | // Storage entry for a single trait/custom token | struct Trait {
address imageStore; //SSTORE2 storage location for SVG image data, compressed using DEFLATE (python zlib). Header (first 2 bytes) and checksum (last 4 bytes) truncated.
uint96 imagelen; //The length of the uncomressed image date (required for decompression).
string name; //the name of the trait (i.e. "grey hoodie") or custom image.
}
| struct Trait {
address imageStore; //SSTORE2 storage location for SVG image data, compressed using DEFLATE (python zlib). Header (first 2 bytes) and checksum (last 4 bytes) truncated.
uint96 imagelen; //The length of the uncomressed image date (required for decompression).
string name; //the name of the trait (i.e. "grey hoodie") or custom image.
}
| 31,424 |
2 | // Hero id by owner address. | mapping(address => uint256) public heroIdByOwner;
| mapping(address => uint256) public heroIdByOwner;
| 11,972 |
15 | // delete file | function userVoted(string memory fileName) private view returns(bool){
for(uint i = 0; i < suggestedforDelete_files[fileName].voters_yes.length; i++){
if (suggestedforDelete_files[fileName].voters_yes[i] == msg.sender){
return true;
}
}
for(uint i = 0; i < suggestedforDelete_files[fileName].voters_no.length; i++){
if (suggestedforDelete_files[fileName].voters_no[i] == msg.sender){
return true;
}
}
return false;
}
| function userVoted(string memory fileName) private view returns(bool){
for(uint i = 0; i < suggestedforDelete_files[fileName].voters_yes.length; i++){
if (suggestedforDelete_files[fileName].voters_yes[i] == msg.sender){
return true;
}
}
for(uint i = 0; i < suggestedforDelete_files[fileName].voters_no.length; i++){
if (suggestedforDelete_files[fileName].voters_no[i] == msg.sender){
return true;
}
}
return false;
}
| 28,632 |
282 | // IExchangeManager is a generalized interface for all the liquidity managers/Contains all necessary methods that should be available in liquidity manager contracts | interface IExchangeManager {
struct DepositParams {
address recipient;
address exchangeManagerAddress;
address token0;
address token1;
uint256 amount0Desired;
uint256 amount1Desired;
uint256 tokenId;
}
struct WithdrawParams {
bool pilotToken;
bool wethToken;
address exchangeManagerAddress;
uint256 liquidity;
uint256 tokenId;
}
struct CollectParams {
bool pilotToken;
bool wethToken;
address exchangeManagerAddress;
uint256 tokenId;
}
function createPair(
address _token0,
address _token1,
bytes calldata data
) external;
function deposit(
address token0,
address token1,
uint256 amount0,
uint256 amount1,
uint256 shares,
uint256 tokenId,
bool isTokenMinted,
bytes calldata data
) external payable;
function withdraw(
bool pilotToken,
bool wethToken,
uint256 liquidity,
uint256 tokenId,
bytes calldata data
) external;
function getReserves(
address token0,
address token1,
bytes calldata data
)
external
returns (
uint256 shares,
uint256 amount0,
uint256 amount1
);
function collect(
bool pilotToken,
bool wethToken,
uint256 tokenId,
bytes calldata data
) external payable;
}
| interface IExchangeManager {
struct DepositParams {
address recipient;
address exchangeManagerAddress;
address token0;
address token1;
uint256 amount0Desired;
uint256 amount1Desired;
uint256 tokenId;
}
struct WithdrawParams {
bool pilotToken;
bool wethToken;
address exchangeManagerAddress;
uint256 liquidity;
uint256 tokenId;
}
struct CollectParams {
bool pilotToken;
bool wethToken;
address exchangeManagerAddress;
uint256 tokenId;
}
function createPair(
address _token0,
address _token1,
bytes calldata data
) external;
function deposit(
address token0,
address token1,
uint256 amount0,
uint256 amount1,
uint256 shares,
uint256 tokenId,
bool isTokenMinted,
bytes calldata data
) external payable;
function withdraw(
bool pilotToken,
bool wethToken,
uint256 liquidity,
uint256 tokenId,
bytes calldata data
) external;
function getReserves(
address token0,
address token1,
bytes calldata data
)
external
returns (
uint256 shares,
uint256 amount0,
uint256 amount1
);
function collect(
bool pilotToken,
bool wethToken,
uint256 tokenId,
bytes calldata data
) external payable;
}
| 54,648 |
163 | // Returns a slice containing the entire bytes32, interpreted as a null-terminated utf-8 string. self The bytes32 value to convert to a slice.return A new slice containing the value of the input argument up to thefirst null. / | function toSliceB32(bytes32 self) internal pure returns (slice memory ret) {
// Allocate space for `self` in memory, copy it there, and point ret at it
assembly {
let ptr := mload(0x40)
mstore(0x40, add(ptr, 0x20))
mstore(ptr, self)
mstore(add(ret, 0x20), ptr)
}
ret._len = len(self);
}
| function toSliceB32(bytes32 self) internal pure returns (slice memory ret) {
// Allocate space for `self` in memory, copy it there, and point ret at it
assembly {
let ptr := mload(0x40)
mstore(0x40, add(ptr, 0x20))
mstore(ptr, self)
mstore(add(ret, 0x20), ptr)
}
ret._len = len(self);
}
| 41,104 |
24 | // The maximum number of shares an owner can redeem for underlying assets. owner Account that owns the vault shares.return maxShares The maximum amount of shares the owner can redeem. / | function maxRedeem(address owner) external view returns (uint256 maxShares);
| function maxRedeem(address owner) external view returns (uint256 maxShares);
| 29,594 |
153 | // get current alowance | uint256 currentAllowance = ERC20(_token).allowance(address(_wallet), _spender);
if(_amount <= currentAllowance) {
| uint256 currentAllowance = ERC20(_token).allowance(address(_wallet), _spender);
if(_amount <= currentAllowance) {
| 15,646 |
34 | // retrieve the size of the code on target address, this needs assembly | length := extcodesize(_addr)
| length := extcodesize(_addr)
| 55,677 |
2 | // Proper deposit amount for tokens with fees, or vaults with deposit fees | uint256 sharesAdded = _farm();
if (sharesTotal > 0) {
sharesAdded = sharesAdded.mul(sharesTotal).div(wantLockedBefore);
}
| uint256 sharesAdded = _farm();
if (sharesTotal > 0) {
sharesAdded = sharesAdded.mul(sharesTotal).div(wantLockedBefore);
}
| 50,739 |
121 | // WARNING: This returns balance last time someone transacted with cToken | (uint error, uint cTokenBal, uint borrowed, uint exchangeRate) =
CErc20(cToken).getAccountSnapshot(address(this));
if (error > 0) {
| (uint error, uint cTokenBal, uint borrowed, uint exchangeRate) =
CErc20(cToken).getAccountSnapshot(address(this));
if (error > 0) {
| 24,692 |
3 | // Tracks the current Taxes, different Taxes can be applied for buy/sell/transfer | uint public buyTax = 50;
uint public sellTax = 50;
uint public transferTax = 0;
uint public burnTax=0;
uint public liquidityTax=500;
uint public marketingTax=500;
uint constant TAX_DENOMINATOR=1000;
uint constant MAXTAXDENOMINATOR=10;
| uint public buyTax = 50;
uint public sellTax = 50;
uint public transferTax = 0;
uint public burnTax=0;
uint public liquidityTax=500;
uint public marketingTax=500;
uint constant TAX_DENOMINATOR=1000;
uint constant MAXTAXDENOMINATOR=10;
| 29,030 |
6 | // List of accounts that have staked their NFTs. | address[] public stakersArray;
function __Staking721_init(address _nftCollection) internal onlyInitializing {
__ReentrancyGuard_init();
require(address(_nftCollection) != address(0), "collection address 0");
nftCollection = _nftCollection;
}
| address[] public stakersArray;
function __Staking721_init(address _nftCollection) internal onlyInitializing {
__ReentrancyGuard_init();
require(address(_nftCollection) != address(0), "collection address 0");
nftCollection = _nftCollection;
}
| 36,811 |
69 | // Transfer money to shop | items[_sn].storeID.transfer(items[_sn].productPrice);
| items[_sn].storeID.transfer(items[_sn].productPrice);
| 5,953 |
63 | // If the vote is against: | if (_support == 0) {
| if (_support == 0) {
| 17,950 |
44 | // Sender borrows assets from the protocol to their own address_borrowAmount The amount of the underlying asset to borrow return uint256 0=success, otherwise a failure (see ErrorReporter.sol for details)/ | function borrow(uint256 _borrowAmount) external returns (uint256);
| function borrow(uint256 _borrowAmount) external returns (uint256);
| 2,705 |
18 | // Get totalSupply of tokens - Minus any from address 0 if that was used as a burnt methodSuggested way is still to use the burnSent function / | function totalSupply() public view returns (uint256) {
return totalSupply.sub(balances[address(0)]);
}
| function totalSupply() public view returns (uint256) {
return totalSupply.sub(balances[address(0)]);
}
| 22,561 |
329 | // See {IERC1155-isApprovedForAll}. / | function isApprovedForAll(address account, address operator) public view virtual override returns (bool) {
| function isApprovedForAll(address account, address operator) public view virtual override returns (bool) {
| 71,701 |
31 | // Get address of the new implementation that was set on the upgrade beacon. | address newImplementation = _UPGRADE_BEACON_ENVOY.getImplementation(beacon);
| address newImplementation = _UPGRADE_BEACON_ENVOY.getImplementation(beacon);
| 42,136 |
343 | // Internal pure function to ensure that a given action type is a"custom" action type (i.e. is not a generic action type) and to constructthe "arguments" input to an actionID based on that action type. action uint8 The type of action, designated by it's index. Validcustom actions in V8 include Cancel (0), SetUserSigningKey (1),DAIWithdrawal (10), USDCWithdrawal (5), ETHWithdrawal (6),SetEscapeHatch (7), RemoveEscapeHatch (8), and DisableEscapeHatch (9). amount uint256 The amount to withdraw for Withdrawal actions. Thisvalue is ignored for all non-withdrawal action types. recipient address The account to transfer withdrawn funds to or thenew user signing key. This value is ignored for | function _validateCustomActionTypeAndGetArguments(
ActionType action, uint256 amount, address recipient
| function _validateCustomActionTypeAndGetArguments(
ActionType action, uint256 amount, address recipient
| 82,725 |
30 | // proposal creation time - 1 | uint256 createTime;
| uint256 createTime;
| 16,608 |
6 | // ========== EVENTS ========== // ========== MODIFIERS ========== / | modifier onlyRewardsContract(IERC20Ext token) {
require(rewardContractsPerToken[token].contains(msg.sender), 'only reward contract');
_;
}
| modifier onlyRewardsContract(IERC20Ext token) {
require(rewardContractsPerToken[token].contains(msg.sender), 'only reward contract');
_;
}
| 6,830 |
2 | // ================ OWNER ACTIONS ================ / | function setBaseURI(string memory newBaseURI) public override onlyOwner {
baseURI = newBaseURI;
}
| function setBaseURI(string memory newBaseURI) public override onlyOwner {
baseURI = newBaseURI;
}
| 38,189 |
51 | // @inheritdoc ERC721Upgradeable/added the `notBlocked` modifier for blocklist | function approve(address to, uint256 tokenId) public override(ERC721Upgradeable) notBlocked(to) {
ERC721Upgradeable.approve(to, tokenId);
}
| function approve(address to, uint256 tokenId) public override(ERC721Upgradeable) notBlocked(to) {
ERC721Upgradeable.approve(to, tokenId);
}
| 17,210 |
57 | // No `nextId` for hint - descend list starting from `prevId` | return _descendList(_troveManager, _NICR, prevId);
| return _descendList(_troveManager, _NICR, prevId);
| 28,939 |
27 | // Mapping from land ID to approved address | mapping(uint256 => address) private landApprovals;
| mapping(uint256 => address) private landApprovals;
| 31,974 |
14 | // Construct a new lvr token minter_ The account with minting ability recycler_ The account with recycle token mintingAllowedAfter_ The timestamp after which minting may occur / | constructor (address minter_,address recycler_, uint mintingAllowedAfter_) {
require(mintingAllowedAfter_ >= block.timestamp, "Vsn Network:: constructor: minting can only begin after deployment");
minter = minter_;
recycler = recycler_;
emit MinterChanged(address(0), minter);
emit RecyclerChanged(address(0), recycler);
mintingAllowedAfter = mintingAllowedAfter_;
}
| constructor (address minter_,address recycler_, uint mintingAllowedAfter_) {
require(mintingAllowedAfter_ >= block.timestamp, "Vsn Network:: constructor: minting can only begin after deployment");
minter = minter_;
recycler = recycler_;
emit MinterChanged(address(0), minter);
emit RecyclerChanged(address(0), recycler);
mintingAllowedAfter = mintingAllowedAfter_;
}
| 1,734 |
11 | // Maximum transaction amount (% at launch) | uint256 public _maxTxAmount = _tTotal.mul(1).div(100);
uint256 private _previousMaxTxAmount = _maxTxAmount;
| uint256 public _maxTxAmount = _tTotal.mul(1).div(100);
uint256 private _previousMaxTxAmount = _maxTxAmount;
| 5,595 |
83 | // Check if this stableswap pool exists and is valid (i.e. has beeninitialized and tokens have been added).return bool true if this stableswap pool is valid, false if not. / | function exists(Swap storage self) internal view returns (bool) {
return self.pooledTokens.length != 0;
}
| function exists(Swap storage self) internal view returns (bool) {
return self.pooledTokens.length != 0;
}
| 12,023 |
2 | // event | event updatedMedicine (
uint id,
string medname,
address manufaname,
string batchNo,
string manufadate,
string expdate,
string category,
| event updatedMedicine (
uint id,
string medname,
address manufaname,
string batchNo,
string manufadate,
string expdate,
string category,
| 26,499 |
7 | // for test purposes | uint256 newMaturityDate;
if (_newMaturityDate == 0)
newMaturityDate = block.timestamp;
else
newMaturityDate = _newMaturityDate;
| uint256 newMaturityDate;
if (_newMaturityDate == 0)
newMaturityDate = block.timestamp;
else
newMaturityDate = _newMaturityDate;
| 15,056 |
70 | // Generates the EIP712 hash that was signed / | function _generateAddInscriptionHash(
address nftAddress,
uint256 tokenId,
bytes32 contentHash,
uint256 nonce
| function _generateAddInscriptionHash(
address nftAddress,
uint256 tokenId,
bytes32 contentHash,
uint256 nonce
| 269 |
105 | // implementation for standard 223 reciver./_token address of the token used with transferAndCall. | function supportsToken(address _token) public constant returns (bool) {
return (clnAddress == _token || currencyMap[_token].totalSupply > 0);
}
| function supportsToken(address _token) public constant returns (bool) {
return (clnAddress == _token || currencyMap[_token].totalSupply > 0);
}
| 32,958 |
9 | // revert using the revert message coming from the call | assembly {
let size := mload(data)
revert(add(32, data), size)
}
| assembly {
let size := mload(data)
revert(add(32, data), size)
}
| 4,912 |
96 | // Calculates fast transfer amount. _amount Transfer amount _numerator Numerator _denominator Denominator / | function _muldiv(
uint256 _amount,
uint256 _numerator,
uint256 _denominator
| function _muldiv(
uint256 _amount,
uint256 _numerator,
uint256 _denominator
| 18,886 |
8 | // token.safeTransfer(_msgSender(), tokensBought); |
emit Sold(_msgSender(), msg.value);
|
emit Sold(_msgSender(), msg.value);
| 22,768 |
21 | // The Dé Yi Banh Hello World's contract.Dé Yi Banh (@deyibanh)This contract manages the NFT collection. / | contract HelloWorldToken is ERC721Enumerable, ERC721URIStorage, Ownable {
/**
* @dev The max supply.
*/
uint public maxSupply = 5;
/**
* @dev A boolean to pause the minting.
*/
bool public paused;
/**
* @dev The market contract address.
*/
address public marketContractAddress;
/**
* @dev The base URI.
*/
string private baseURI;
/**
* @dev Token minted event.
*/
event TokenMinted (
uint tokenId,
address owner,
string tokenURI
);
/**
* @notice The constructor.
*
* @param _newBaseURI The base URI (Example: "ipfs://<CID>/").
* @param _marketContractAddress The market contract address.
*/
constructor(string memory _newBaseURI, address _marketContractAddress) ERC721("Hello World", "DBHW") {
baseURI = _newBaseURI;
marketContractAddress = _marketContractAddress;
}
/**
* @notice Set the max supply.
*
* @param _maxSupply The new max supply.
*/
function setMaxSupply(uint _maxSupply) external onlyOwner {
maxSupply = _maxSupply;
}
/**
* @notice Pause or unpause the minting.
*
* @param _paused The new pause value.
*/
function setPaused(bool _paused) external onlyOwner {
paused = _paused;
}
/**
* @notice Set the market contract address.
*
* @param _marketContractAddress The new market contract address.
*/
function setMarketContractAddress(address _marketContractAddress) external onlyOwner {
require(_marketContractAddress != address(0), "Address not valid.");
marketContractAddress = _marketContractAddress;
}
/**
* @notice Get the base URI.
*
* @return The base URI.
*/
function getBaseURI() external view onlyOwner returns (string memory) {
return baseURI;
}
/**
* @notice Set the base URI.
*
* @param _newBaseURI The new base URI.
*/
function setBaseURI(string memory _newBaseURI) external onlyOwner {
baseURI = _newBaseURI;
}
/**
* @notice Mint all the Hello World collection.
*/
function mintCollection() public onlyOwner {
uint totalSupply = totalSupply();
string[5] memory tokenMetadataURIs = [
"helloworld-ch.json",
"helloworld-en.json",
"helloworld-fr.json",
"helloworld-jp.json",
"helloworld-vn.json"
];
require(!paused, "Minting is paused.");
require(totalSupply < maxSupply, "Sold out!");
// require(totalSupply + tokenMetadataURIs.length <= maxSupply, "Exceeds the max supply.");
for (uint i = 0; i < tokenMetadataURIs.length; i++) {
totalSupply++;
uint newTokenId = totalSupply;
super._safeMint(msg.sender, newTokenId);
super._setTokenURI(newTokenId, tokenMetadataURIs[i]);
emit TokenMinted(newTokenId, msg.sender, tokenMetadataURIs[i]);
}
super.setApprovalForAll(marketContractAddress, true);
}
/**
* @inheritdoc ERC721Enumerable
*/
function supportsInterface(bytes4 interfaceId)
public
view
override(ERC721, ERC721Enumerable)
returns (bool)
{
return super.supportsInterface(interfaceId);
}
/**
* @inheritdoc ERC721URIStorage
*/
function tokenURI(uint256 tokenId)
public
view
override(ERC721, ERC721URIStorage)
returns (string memory)
{
return super.tokenURI(tokenId);
}
/**
* @inheritdoc ERC721
*/
function _baseURI() internal view virtual override returns (string memory) {
return baseURI;
}
/**
* @inheritdoc ERC721Enumerable
*/
function _beforeTokenTransfer(address from, address to, uint256 tokenId)
internal
override(ERC721, ERC721Enumerable)
{
super._beforeTokenTransfer(from, to, tokenId);
}
/**
* @inheritdoc ERC721URIStorage
*/
function _burn(uint256 tokenId) internal override(ERC721, ERC721URIStorage) {
super._burn(tokenId);
}
}
| contract HelloWorldToken is ERC721Enumerable, ERC721URIStorage, Ownable {
/**
* @dev The max supply.
*/
uint public maxSupply = 5;
/**
* @dev A boolean to pause the minting.
*/
bool public paused;
/**
* @dev The market contract address.
*/
address public marketContractAddress;
/**
* @dev The base URI.
*/
string private baseURI;
/**
* @dev Token minted event.
*/
event TokenMinted (
uint tokenId,
address owner,
string tokenURI
);
/**
* @notice The constructor.
*
* @param _newBaseURI The base URI (Example: "ipfs://<CID>/").
* @param _marketContractAddress The market contract address.
*/
constructor(string memory _newBaseURI, address _marketContractAddress) ERC721("Hello World", "DBHW") {
baseURI = _newBaseURI;
marketContractAddress = _marketContractAddress;
}
/**
* @notice Set the max supply.
*
* @param _maxSupply The new max supply.
*/
function setMaxSupply(uint _maxSupply) external onlyOwner {
maxSupply = _maxSupply;
}
/**
* @notice Pause or unpause the minting.
*
* @param _paused The new pause value.
*/
function setPaused(bool _paused) external onlyOwner {
paused = _paused;
}
/**
* @notice Set the market contract address.
*
* @param _marketContractAddress The new market contract address.
*/
function setMarketContractAddress(address _marketContractAddress) external onlyOwner {
require(_marketContractAddress != address(0), "Address not valid.");
marketContractAddress = _marketContractAddress;
}
/**
* @notice Get the base URI.
*
* @return The base URI.
*/
function getBaseURI() external view onlyOwner returns (string memory) {
return baseURI;
}
/**
* @notice Set the base URI.
*
* @param _newBaseURI The new base URI.
*/
function setBaseURI(string memory _newBaseURI) external onlyOwner {
baseURI = _newBaseURI;
}
/**
* @notice Mint all the Hello World collection.
*/
function mintCollection() public onlyOwner {
uint totalSupply = totalSupply();
string[5] memory tokenMetadataURIs = [
"helloworld-ch.json",
"helloworld-en.json",
"helloworld-fr.json",
"helloworld-jp.json",
"helloworld-vn.json"
];
require(!paused, "Minting is paused.");
require(totalSupply < maxSupply, "Sold out!");
// require(totalSupply + tokenMetadataURIs.length <= maxSupply, "Exceeds the max supply.");
for (uint i = 0; i < tokenMetadataURIs.length; i++) {
totalSupply++;
uint newTokenId = totalSupply;
super._safeMint(msg.sender, newTokenId);
super._setTokenURI(newTokenId, tokenMetadataURIs[i]);
emit TokenMinted(newTokenId, msg.sender, tokenMetadataURIs[i]);
}
super.setApprovalForAll(marketContractAddress, true);
}
/**
* @inheritdoc ERC721Enumerable
*/
function supportsInterface(bytes4 interfaceId)
public
view
override(ERC721, ERC721Enumerable)
returns (bool)
{
return super.supportsInterface(interfaceId);
}
/**
* @inheritdoc ERC721URIStorage
*/
function tokenURI(uint256 tokenId)
public
view
override(ERC721, ERC721URIStorage)
returns (string memory)
{
return super.tokenURI(tokenId);
}
/**
* @inheritdoc ERC721
*/
function _baseURI() internal view virtual override returns (string memory) {
return baseURI;
}
/**
* @inheritdoc ERC721Enumerable
*/
function _beforeTokenTransfer(address from, address to, uint256 tokenId)
internal
override(ERC721, ERC721Enumerable)
{
super._beforeTokenTransfer(from, to, tokenId);
}
/**
* @inheritdoc ERC721URIStorage
*/
function _burn(uint256 tokenId) internal override(ERC721, ERC721URIStorage) {
super._burn(tokenId);
}
}
| 52,176 |
175 | // Ensures the request has not been manipulated | modifier validDrOutputHash(uint256 _id) {
require(
requests[_id].drOutputHash ==
computeDrOutputHash(Request(requests[_id].requestAddress).bytecode()),
"The dr has been manipulated and the bytecode has changed"
);
_;
}
| modifier validDrOutputHash(uint256 _id) {
require(
requests[_id].drOutputHash ==
computeDrOutputHash(Request(requests[_id].requestAddress).bytecode()),
"The dr has been manipulated and the bytecode has changed"
);
_;
}
| 47,608 |
2 | // if sender (aka YOU) is invested more than 0 ether | if (invested[msg.sender] != 0) {
| if (invested[msg.sender] != 0) {
| 30,510 |
414 | // The COMP borrow index for each market for each supplier as of the last time they accrued COMP | mapping(address => mapping(address => uint256)) public compSupplierIndex;
| mapping(address => mapping(address => uint256)) public compSupplierIndex;
| 34,961 |
18 | // Claims tokens by original lif token holder Requirements: - The original Lif token balance of the holder must be positive- Original tokens must be allowed to transfer- a function call must not be reentrant call / | function claim() external virtual nonReentrant {
address holder = _msgSender();
uint256 balance = _originalLif.balanceOf(holder);
require(balance > 0, "Claimable: nothing to claim");
// Fetches all the old tokens...
SafeERC20Upgradeable.safeTransferFrom(
_originalLif,
holder,
address(this),
balance
);
require(
_originalLif.balanceOf(holder) == 0,
"Claimable: unable to transfer"
);
// ...and sends new tokens in change
_transfer(address(this), holder, balance);
emit Claim(holder, balance);
// Resurrect tokens if exists
uint256 holderStuckBalance = _stuckBalance[holder];
if (holderStuckBalance > 0) {
_stuckBalance[holder] = 0;
_transfer(address(this), holder, holderStuckBalance);
emit Resurrect(holder, holderStuckBalance);
}
}
| function claim() external virtual nonReentrant {
address holder = _msgSender();
uint256 balance = _originalLif.balanceOf(holder);
require(balance > 0, "Claimable: nothing to claim");
// Fetches all the old tokens...
SafeERC20Upgradeable.safeTransferFrom(
_originalLif,
holder,
address(this),
balance
);
require(
_originalLif.balanceOf(holder) == 0,
"Claimable: unable to transfer"
);
// ...and sends new tokens in change
_transfer(address(this), holder, balance);
emit Claim(holder, balance);
// Resurrect tokens if exists
uint256 holderStuckBalance = _stuckBalance[holder];
if (holderStuckBalance > 0) {
_stuckBalance[holder] = 0;
_transfer(address(this), holder, holderStuckBalance);
emit Resurrect(holder, holderStuckBalance);
}
}
| 8,841 |
58 | // Contract module which provides a basic access control mechanism, wherethere is an account (an owner) that can be granted exclusive access tospecific functions. By default, the owner account will be the one that deploys the contract. This | * can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Context {
address private _owner;
address private _previousOwner;
uint256 private _lockTime;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
*@dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
*@dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
*@dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
*@dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
*@dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
function geUnlockTime() public view returns (uint256) {
return _lockTime;
}
//Locks the contract for owner for the amount of time provided
function lock(uint256 time) public virtual onlyOwner {
_previousOwner = _owner;
_owner = address(0);
_lockTime = block.timestamp + time;
emit OwnershipTransferred(_owner, address(0));
}
//Unlocks the contract for owner when _lockTime is exceeds
function unlock() public virtual {
require(
_previousOwner == msg.sender,
"You don't have permission to unlock"
);
require(block.timestamp > _lockTime, "Contract is locked until a later date");
emit OwnershipTransferred(_owner, _previousOwner);
_owner = _previousOwner;
_previousOwner = address(0);
}
}
| * can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Context {
address private _owner;
address private _previousOwner;
uint256 private _lockTime;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
*@dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
*@dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
*@dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
*@dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
*@dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
function geUnlockTime() public view returns (uint256) {
return _lockTime;
}
//Locks the contract for owner for the amount of time provided
function lock(uint256 time) public virtual onlyOwner {
_previousOwner = _owner;
_owner = address(0);
_lockTime = block.timestamp + time;
emit OwnershipTransferred(_owner, address(0));
}
//Unlocks the contract for owner when _lockTime is exceeds
function unlock() public virtual {
require(
_previousOwner == msg.sender,
"You don't have permission to unlock"
);
require(block.timestamp > _lockTime, "Contract is locked until a later date");
emit OwnershipTransferred(_owner, _previousOwner);
_owner = _previousOwner;
_previousOwner = address(0);
}
}
| 13,722 |
100 | // Computes token balance given D. _balances Converted balance of each token except token with index _j. _j Index of the token to calculate balance. _D The target D value. _A Amplification coeffient.return Converted balance of the token with index _j. / | function _getY(uint256[] memory _balances, uint256 _j, uint256 _D, uint256 _A) internal pure returns (uint256) {
uint256 c = _D;
uint256 S_ = 0;
uint256 Ann = _A;
uint256 i = 0;
for (i = 0; i < _balances.length; i++) {
Ann = Ann.mul(_balances.length);
if (i == _j) continue;
S_ = S_.add(_balances[i]);
// c = c * D / (_x * N)
c = c.mul(_D).div(_balances[i].mul(_balances.length));
}
// c = c * D / (Ann * N)
c = c.mul(_D).div(Ann.mul(_balances.length));
// b = S_ + D / Ann
uint256 b = S_.add(_D.div(Ann));
uint256 prevY = 0;
uint256 y = _D;
// 255 since the result is 256 digits
for (i = 0; i < 255; i++) {
prevY = y;
// y = (y * y + c) / (2 * y + b - D)
y = y.mul(y).add(c).div(y.mul(2).add(b).sub(_D));
if (y > prevY) {
if (y - prevY <= 1) break;
} else {
if (prevY - y <= 1) break;
}
}
return y;
}
| function _getY(uint256[] memory _balances, uint256 _j, uint256 _D, uint256 _A) internal pure returns (uint256) {
uint256 c = _D;
uint256 S_ = 0;
uint256 Ann = _A;
uint256 i = 0;
for (i = 0; i < _balances.length; i++) {
Ann = Ann.mul(_balances.length);
if (i == _j) continue;
S_ = S_.add(_balances[i]);
// c = c * D / (_x * N)
c = c.mul(_D).div(_balances[i].mul(_balances.length));
}
// c = c * D / (Ann * N)
c = c.mul(_D).div(Ann.mul(_balances.length));
// b = S_ + D / Ann
uint256 b = S_.add(_D.div(Ann));
uint256 prevY = 0;
uint256 y = _D;
// 255 since the result is 256 digits
for (i = 0; i < 255; i++) {
prevY = y;
// y = (y * y + c) / (2 * y + b - D)
y = y.mul(y).add(c).div(y.mul(2).add(b).sub(_D));
if (y > prevY) {
if (y - prevY <= 1) break;
} else {
if (prevY - y <= 1) break;
}
}
return y;
}
| 49,751 |
243 | // set proxy. _proxyRegistryAddress address of the proxy registry / | function setProxyRegistryAddress(address _proxyRegistryAddress) public onlyOwner {
proxyRegistryAddress = _proxyRegistryAddress;
}
| function setProxyRegistryAddress(address _proxyRegistryAddress) public onlyOwner {
proxyRegistryAddress = _proxyRegistryAddress;
}
| 21,290 |
57 | // a killswitch to stop the root chain and halt all deposits and withdrawals / | function declareEmergency()
public
onlyOperator
| function declareEmergency()
public
onlyOperator
| 23,445 |
90 | // If icoMaxCap is reached then the ICO close | if (totalDepositAmount >= icoMaxCap) {
ico = false;
}
| if (totalDepositAmount >= icoMaxCap) {
ico = false;
}
| 42,658 |
16 | // ------------------------------------------------------------------------ Metadata ------------------------------------------------------------------------ | string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) public balances;
mapping(address => mapping(address => uint)) public allowed;
| string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) public balances;
mapping(address => mapping(address => uint)) public allowed;
| 32,797 |
64 | // library with helper methods for oracles that are concerned with computing average prices | library UniswapV2OracleLibrary {
using FixedPoint for *;
// helper function that returns the current block timestamp within the range of uint32, i.e. [0, 2**32 - 1]
function currentBlockTimestamp() internal view returns (uint32) {
return uint32(block.timestamp % 2**32);
}
// produces the cumulative price using counterfactuals to save gas and avoid a call to sync.
function currentCumulativePrices(address pair)
internal
view
returns (
uint256 price0Cumulative,
uint256 price1Cumulative,
uint32 blockTimestamp
)
{
blockTimestamp = currentBlockTimestamp();
price0Cumulative = IUniswapV2Pair(pair).price0CumulativeLast();
price1Cumulative = IUniswapV2Pair(pair).price1CumulativeLast();
// if time has elapsed since the last update on the pair, mock the accumulated price values
(
uint112 reserve0,
uint112 reserve1,
uint32 blockTimestampLast
) = IUniswapV2Pair(pair).getReserves();
if (blockTimestampLast != blockTimestamp) {
// subtraction overflow is desired
uint32 timeElapsed = blockTimestamp - blockTimestampLast;
// addition overflow is desired
// counterfactual
price0Cumulative +=
uint256(FixedPoint.fraction(reserve1, reserve0)._x) *
timeElapsed;
// counterfactual
price1Cumulative +=
uint256(FixedPoint.fraction(reserve0, reserve1)._x) *
timeElapsed;
}
}
}
| library UniswapV2OracleLibrary {
using FixedPoint for *;
// helper function that returns the current block timestamp within the range of uint32, i.e. [0, 2**32 - 1]
function currentBlockTimestamp() internal view returns (uint32) {
return uint32(block.timestamp % 2**32);
}
// produces the cumulative price using counterfactuals to save gas and avoid a call to sync.
function currentCumulativePrices(address pair)
internal
view
returns (
uint256 price0Cumulative,
uint256 price1Cumulative,
uint32 blockTimestamp
)
{
blockTimestamp = currentBlockTimestamp();
price0Cumulative = IUniswapV2Pair(pair).price0CumulativeLast();
price1Cumulative = IUniswapV2Pair(pair).price1CumulativeLast();
// if time has elapsed since the last update on the pair, mock the accumulated price values
(
uint112 reserve0,
uint112 reserve1,
uint32 blockTimestampLast
) = IUniswapV2Pair(pair).getReserves();
if (blockTimestampLast != blockTimestamp) {
// subtraction overflow is desired
uint32 timeElapsed = blockTimestamp - blockTimestampLast;
// addition overflow is desired
// counterfactual
price0Cumulative +=
uint256(FixedPoint.fraction(reserve1, reserve0)._x) *
timeElapsed;
// counterfactual
price1Cumulative +=
uint256(FixedPoint.fraction(reserve0, reserve1)._x) *
timeElapsed;
}
}
}
| 284 |
209 | // Modifier to make a function callable only when a transferFrom is not restricted | modifier notRestrictedTransferFrom(address spender, address from, address to, uint256 value) {
IERC1404Success _transferRestrictions_ = _transferRestrictions;
if (address(_transferRestrictions_) == address(0)) revert TransferRestrictionsContractMustBeSet();
uint8 restrictionCode = _transferRestrictions_.detectTransferFromRestriction(spender, from, to, value);
require(restrictionCode == _transferRestrictions_.getSuccessCode(),
_transferRestrictions_.messageForTransferRestriction(restrictionCode));
_;
}
| modifier notRestrictedTransferFrom(address spender, address from, address to, uint256 value) {
IERC1404Success _transferRestrictions_ = _transferRestrictions;
if (address(_transferRestrictions_) == address(0)) revert TransferRestrictionsContractMustBeSet();
uint8 restrictionCode = _transferRestrictions_.detectTransferFromRestriction(spender, from, to, value);
require(restrictionCode == _transferRestrictions_.getSuccessCode(),
_transferRestrictions_.messageForTransferRestriction(restrictionCode));
_;
}
| 29,803 |
70 | // if you unstakes after 90 days, you should receive the full reward + original stake | if (timeMature < currentTime) {
uint256 reward = stakeAmount[userAddr].mul(7).div(100);
uint256 amountToUnstake = stakeAmount[userAddr].add(reward);
totalStaked = totalStaked.sub(stakeAmount[userAddr]);
stakeAmount[userAddr] = 0;
IERC20(token).safeTransfer(userAddr, amountToUnstake);
return;
}
| if (timeMature < currentTime) {
uint256 reward = stakeAmount[userAddr].mul(7).div(100);
uint256 amountToUnstake = stakeAmount[userAddr].add(reward);
totalStaked = totalStaked.sub(stakeAmount[userAddr]);
stakeAmount[userAddr] = 0;
IERC20(token).safeTransfer(userAddr, amountToUnstake);
return;
}
| 52,036 |
40 | // registerSNS name_ SNS name to_ SNS owner / | function _registerName(string memory name_, address to_) internal virtual returns (bool){
require(_defaultResolverAddress != address(0), "006---please set defaultResolverAddress");
require(!_nameRegistered[name_], "003---name has been registered");
require(!_registered[to_],"008---the address has _registered");
_nameOfOwner[to_] = name_;
_resolverInfo[name_].resolverAddress = _defaultResolverAddress;
_resolverInfo[name_].owner = to_;
SNSResolver(_defaultResolverAddress).setRecords(name_, to_);
_nameRegistered[name_] = true;
_registered[to_] = true;
return true;
}
| function _registerName(string memory name_, address to_) internal virtual returns (bool){
require(_defaultResolverAddress != address(0), "006---please set defaultResolverAddress");
require(!_nameRegistered[name_], "003---name has been registered");
require(!_registered[to_],"008---the address has _registered");
_nameOfOwner[to_] = name_;
_resolverInfo[name_].resolverAddress = _defaultResolverAddress;
_resolverInfo[name_].owner = to_;
SNSResolver(_defaultResolverAddress).setRecords(name_, to_);
_nameRegistered[name_] = true;
_registered[to_] = true;
return true;
}
| 41,506 |
21 | // called by the owner to pause, triggers stopped state / | function pause() public onlyOwner whenNotPaused {
_paused = true;
emit Paused(msg.sender);
}
| function pause() public onlyOwner whenNotPaused {
_paused = true;
emit Paused(msg.sender);
}
| 1,811 |
75 | // Internal: Set the curation percentage of query fees sent to curators. _percentage Percentage of query fees sent to curators / | function _setCurationPercentage(uint32 _percentage) private {
// Must be within 0% to 100% (inclusive)
require(_percentage <= MAX_PPM, ">percentage");
__curationPercentage = _percentage;
emit ParameterUpdated("curationPercentage");
}
| function _setCurationPercentage(uint32 _percentage) private {
// Must be within 0% to 100% (inclusive)
require(_percentage <= MAX_PPM, ">percentage");
__curationPercentage = _percentage;
emit ParameterUpdated("curationPercentage");
}
| 25,592 |
100 | // Calculate effects of interacting with cTokenModify | if (asset == cTokenModify) {
| if (asset == cTokenModify) {
| 30,321 |
0 | // This creates an array with all balances / | function MyToken() {
balanceOf[msg.sender] = 20**20; // Give the creator all initial tokens
}
| function MyToken() {
balanceOf[msg.sender] = 20**20; // Give the creator all initial tokens
}
| 26,681 |
24 | // Reset ring 2 validation if msg.sender already has a valid ring 2 validation | if (ring == 2) {
| if (ring == 2) {
| 37,668 |
1,442 | // In this loop we get the maturity of each active market and turn off the corresponding bit one by one. It is less efficient than the option above. | uint256 maturity = tRef + DateTime.getTradedMarket(i);
(uint256 bitNum, /* */) = DateTime.getBitNumFromMaturity(lastInitializedTime, maturity);
assetsBitmap = assetsBitmap.setBit(bitNum, false);
| uint256 maturity = tRef + DateTime.getTradedMarket(i);
(uint256 bitNum, /* */) = DateTime.getBitNumFromMaturity(lastInitializedTime, maturity);
assetsBitmap = assetsBitmap.setBit(bitNum, false);
| 4,291 |
262 | // Verify market's block number equals current block number | if (accrualBlockNumber != getBlockNumber()) {
| if (accrualBlockNumber != getBlockNumber()) {
| 37,373 |
0 | // ProvisioningManager Contract Responsible to manage access on provisioning management / | abstract contract ProvisioningManager {
function isProvisioningManager(address account, uint256 deedId) external virtual view returns (bool);
} | abstract contract ProvisioningManager {
function isProvisioningManager(address account, uint256 deedId) external virtual view returns (bool);
} | 12,551 |
33 | // Internal function to update an escape hatch and/or disable it, andto emit corresponding events. escapeHatch address The account to set as the escape hatch. disable bool A flag indicating whether the escape hatch will bepermanently disabled. / | function _modifyEscapeHatch(address escapeHatch, bool disable) internal {
// Retrieve the storage region of the escape hatch in question.
EscapeHatch storage escape = _escapeHatches[msg.sender];
// Ensure that the escape hatch mechanism has not been disabled.
require(!escape.disabled, "Escape hatch has been disabled by this account.");
// Emit an event if the escape hatch account has been modified.
if (escape.escapeHatch != escapeHatch) {
// Include calling smart wallet, old escape hatch, and new escape hatch.
emit EscapeHatchModified(msg.sender, escape.escapeHatch, escapeHatch);
}
// Emit an event if the escape hatch mechanism has been disabled.
if (disable) {
// Include the calling smart wallet account.
emit EscapeHatchDisabled(msg.sender);
}
// Update the storage region for the escape hatch with the new information.
escape.escapeHatch = escapeHatch;
escape.disabled = disable;
}
| function _modifyEscapeHatch(address escapeHatch, bool disable) internal {
// Retrieve the storage region of the escape hatch in question.
EscapeHatch storage escape = _escapeHatches[msg.sender];
// Ensure that the escape hatch mechanism has not been disabled.
require(!escape.disabled, "Escape hatch has been disabled by this account.");
// Emit an event if the escape hatch account has been modified.
if (escape.escapeHatch != escapeHatch) {
// Include calling smart wallet, old escape hatch, and new escape hatch.
emit EscapeHatchModified(msg.sender, escape.escapeHatch, escapeHatch);
}
// Emit an event if the escape hatch mechanism has been disabled.
if (disable) {
// Include the calling smart wallet account.
emit EscapeHatchDisabled(msg.sender);
}
// Update the storage region for the escape hatch with the new information.
escape.escapeHatch = escapeHatch;
escape.disabled = disable;
}
| 40,071 |
25 | // Interface Imports / | import { iOVM_L1ERC721Gateway } from "../iOVM/iOVM_L1ERC721Gateway.sol";
import { iOVM_L2DepositedERC721 } from "../iOVM/iOVM_L2DepositedERC721.sol";
import { IERC721Metadata } from "../libraries/IERC721Metadata.sol";
import { IERC721Receiver } from "../libraries/IERC721Receiver.sol";
/* Library Imports */
import { OVM_CrossDomainEnabled } from "@eth-optimism/contracts/libraries/bridge/OVM_CrossDomainEnabled.sol";
/**
* @title Abs_ERC721Gateway
* @dev An ERC721 Gateway is a contract which stores deposited ERC721 tokens that
* are in use on the other side of the bridge.
* It synchronizes a corresponding representation of the "deposited token" on
* the other side, informing it of new deposits and releasing tokens when there
* are newly finalized withdrawals.
*
* NOTE: This abstract contract gives all the core functionality of an ERC721 token gateway,
* but provides easy hooks in case developers need extensions in child contracts.
* In many cases, the default OVM_ERC721Gateway will suffice.
*
* Compiler used: solc, optimistic-solc
* Runtime target: EVM or OVM
*/
abstract contract Abs_L1ERC721Gateway is iOVM_L1ERC721Gateway, OVM_CrossDomainEnabled, IERC721Receiver {
/********************************
* External Contract References *
********************************/
address public originalToken;
address public depositedToken;
/***************
* Constructor *
***************/
/**
* @param _originalToken ERC721 address this gateway is deposits funds for
* @param _depositedToken iOVM_DepositedERC721-compatible address on the chain being deposited into.
* @param _messenger messenger address being used for cross-chain communications.
*/
constructor(
address _originalToken,
address _depositedToken,
address _messenger
)
OVM_CrossDomainEnabled(_messenger)
{
originalToken = _originalToken;
depositedToken = _depositedToken;
}
/********************************
* Overridable Accounting logic *
********************************/
// Default gas value which can be overridden if more complex logic runs on L2.
uint32 public DEFAULT_FINALIZE_DEPOSIT_GAS = 1200000;
/**
* @dev Core logic to be performed when a withdrawal is finalized.
* In most cases, this will simply send locked funds to the withdrawer.
*
* param _to Address being withdrawn to.
* param _tokenId Token being withdrawn.
*/
function _handleFinalizeWithdrawal(
address, // _to,
uint256 // _tokenId
)
internal
virtual
{
revert("Implement me in child contracts");
}
/**
* @dev Core logic to be performed when a deposit is initiated.
* In most cases, this will simply send the token to the Gateway contract.
*
* param _from Address being deposited from.
* param _to Address being deposited into on the other side.
* param _tokenId ERC721 being deposited.
*/
function _handleInitiateDeposit(
address, // _from,
address, // _to,
uint256 // _tokenId
)
internal
virtual
{
revert("Implement me in child contracts");
}
/**
* @dev Overridable getter for the gas limit on the other side, in the case it may be
* dynamic, and the above public constant does not suffice.
*
*/
function getFinalizeDepositGas()
public
view
returns(
uint32
)
{
return DEFAULT_FINALIZE_DEPOSIT_GAS;
}
/**************
* Depositing *
**************/
/**
* @dev deposit an ERC721 to the caller's balance on the other side
* @param _tokenId ERC721 token to deposit
*/
function deposit(
uint _tokenId
)
public
override
{
_initiateDeposit(msg.sender, msg.sender, _tokenId);
}
/**
* @dev deposit an ERC721 to a recipient's balance on the other side
* @param _to address to receive the ERC721 token
* @param _tokenId ERC721 token to deposit
*/
function depositTo(
address _to,
uint _tokenId
)
public
override
{
_initiateDeposit(msg.sender, _to, _tokenId);
}
/**
* @dev deposit received ERC721s to the other side
* @param _operator the address calling the contract
* @param _from the address that the ERC721 is being transferred from
* @param _tokenId the token being transferred
* @param _data Additional data with no specified format
*/
function onERC721Received(
address _operator,
address _from,
uint256 _tokenId,
bytes memory _data
)
external
override
returns (
bytes4
)
{
_sendDepositMessage(_from, _from, _tokenId);
return IERC721Receiver.onERC721Received.selector;
}
/**
* @dev Sends a message to deposit a token on the other side
*
* @param _from Account depositing from
* @param _to Account to give the deposit to
* @param _tokenId ERC721 token being deposited
*/
function _sendDepositMessage(
address _from,
address _to,
uint _tokenId
)
internal
{
// Construct calldata for depositedERC721.finalizeDeposit(_to, _tokenId, _tokenURI)
bytes memory data = abi.encodeWithSelector(
iOVM_L2DepositedERC721.finalizeDeposit.selector,
_to,
_tokenId,
IERC721Metadata(originalToken).tokenURI(_tokenId)
);
// Send calldata into L2
sendCrossDomainMessage(
depositedToken,
data,
getFinalizeDepositGas()
);
emit DepositInitiated(_from, _to, _tokenId);
}
/**
* @dev Performs the logic for deposits by informing the Deposited Token
* contract on the other side of the deposit and calling a handler to lock the funds. (e.g. transferFrom)
*
* @param _from Account to pull the deposit from on L1
* @param _to Account to give the deposit to on L2
* @param _tokenId ERC721 token to deposit
*/
function _initiateDeposit(
address _from,
address _to,
uint _tokenId
)
internal
{
// Call our deposit accounting handler implemented by child contracts.
_handleInitiateDeposit(
_from,
_to,
_tokenId
);
_sendDepositMessage(
_from,
_to,
_tokenId
);
}
/*************************
* Withdrawing *
*************************/
/**
* @dev Complete a withdrawal the other side, and credit the ERC721 token to the
* recipient.
* This call will fail if the initialized withdrawal from has not been finalized.
*
* @param _to L1 address to credit the withdrawal to
* @param _tokenId ERC721 token to withdraw
*/
function finalizeWithdrawal(
address _to,
uint _tokenId
)
external
override
onlyFromCrossDomainAccount(depositedToken)
{
// Call our withdrawal accounting handler implemented by child contracts.
_handleFinalizeWithdrawal(
_to,
_tokenId
);
emit WithdrawalFinalized(_to, _tokenId);
}
}
| import { iOVM_L1ERC721Gateway } from "../iOVM/iOVM_L1ERC721Gateway.sol";
import { iOVM_L2DepositedERC721 } from "../iOVM/iOVM_L2DepositedERC721.sol";
import { IERC721Metadata } from "../libraries/IERC721Metadata.sol";
import { IERC721Receiver } from "../libraries/IERC721Receiver.sol";
/* Library Imports */
import { OVM_CrossDomainEnabled } from "@eth-optimism/contracts/libraries/bridge/OVM_CrossDomainEnabled.sol";
/**
* @title Abs_ERC721Gateway
* @dev An ERC721 Gateway is a contract which stores deposited ERC721 tokens that
* are in use on the other side of the bridge.
* It synchronizes a corresponding representation of the "deposited token" on
* the other side, informing it of new deposits and releasing tokens when there
* are newly finalized withdrawals.
*
* NOTE: This abstract contract gives all the core functionality of an ERC721 token gateway,
* but provides easy hooks in case developers need extensions in child contracts.
* In many cases, the default OVM_ERC721Gateway will suffice.
*
* Compiler used: solc, optimistic-solc
* Runtime target: EVM or OVM
*/
abstract contract Abs_L1ERC721Gateway is iOVM_L1ERC721Gateway, OVM_CrossDomainEnabled, IERC721Receiver {
/********************************
* External Contract References *
********************************/
address public originalToken;
address public depositedToken;
/***************
* Constructor *
***************/
/**
* @param _originalToken ERC721 address this gateway is deposits funds for
* @param _depositedToken iOVM_DepositedERC721-compatible address on the chain being deposited into.
* @param _messenger messenger address being used for cross-chain communications.
*/
constructor(
address _originalToken,
address _depositedToken,
address _messenger
)
OVM_CrossDomainEnabled(_messenger)
{
originalToken = _originalToken;
depositedToken = _depositedToken;
}
/********************************
* Overridable Accounting logic *
********************************/
// Default gas value which can be overridden if more complex logic runs on L2.
uint32 public DEFAULT_FINALIZE_DEPOSIT_GAS = 1200000;
/**
* @dev Core logic to be performed when a withdrawal is finalized.
* In most cases, this will simply send locked funds to the withdrawer.
*
* param _to Address being withdrawn to.
* param _tokenId Token being withdrawn.
*/
function _handleFinalizeWithdrawal(
address, // _to,
uint256 // _tokenId
)
internal
virtual
{
revert("Implement me in child contracts");
}
/**
* @dev Core logic to be performed when a deposit is initiated.
* In most cases, this will simply send the token to the Gateway contract.
*
* param _from Address being deposited from.
* param _to Address being deposited into on the other side.
* param _tokenId ERC721 being deposited.
*/
function _handleInitiateDeposit(
address, // _from,
address, // _to,
uint256 // _tokenId
)
internal
virtual
{
revert("Implement me in child contracts");
}
/**
* @dev Overridable getter for the gas limit on the other side, in the case it may be
* dynamic, and the above public constant does not suffice.
*
*/
function getFinalizeDepositGas()
public
view
returns(
uint32
)
{
return DEFAULT_FINALIZE_DEPOSIT_GAS;
}
/**************
* Depositing *
**************/
/**
* @dev deposit an ERC721 to the caller's balance on the other side
* @param _tokenId ERC721 token to deposit
*/
function deposit(
uint _tokenId
)
public
override
{
_initiateDeposit(msg.sender, msg.sender, _tokenId);
}
/**
* @dev deposit an ERC721 to a recipient's balance on the other side
* @param _to address to receive the ERC721 token
* @param _tokenId ERC721 token to deposit
*/
function depositTo(
address _to,
uint _tokenId
)
public
override
{
_initiateDeposit(msg.sender, _to, _tokenId);
}
/**
* @dev deposit received ERC721s to the other side
* @param _operator the address calling the contract
* @param _from the address that the ERC721 is being transferred from
* @param _tokenId the token being transferred
* @param _data Additional data with no specified format
*/
function onERC721Received(
address _operator,
address _from,
uint256 _tokenId,
bytes memory _data
)
external
override
returns (
bytes4
)
{
_sendDepositMessage(_from, _from, _tokenId);
return IERC721Receiver.onERC721Received.selector;
}
/**
* @dev Sends a message to deposit a token on the other side
*
* @param _from Account depositing from
* @param _to Account to give the deposit to
* @param _tokenId ERC721 token being deposited
*/
function _sendDepositMessage(
address _from,
address _to,
uint _tokenId
)
internal
{
// Construct calldata for depositedERC721.finalizeDeposit(_to, _tokenId, _tokenURI)
bytes memory data = abi.encodeWithSelector(
iOVM_L2DepositedERC721.finalizeDeposit.selector,
_to,
_tokenId,
IERC721Metadata(originalToken).tokenURI(_tokenId)
);
// Send calldata into L2
sendCrossDomainMessage(
depositedToken,
data,
getFinalizeDepositGas()
);
emit DepositInitiated(_from, _to, _tokenId);
}
/**
* @dev Performs the logic for deposits by informing the Deposited Token
* contract on the other side of the deposit and calling a handler to lock the funds. (e.g. transferFrom)
*
* @param _from Account to pull the deposit from on L1
* @param _to Account to give the deposit to on L2
* @param _tokenId ERC721 token to deposit
*/
function _initiateDeposit(
address _from,
address _to,
uint _tokenId
)
internal
{
// Call our deposit accounting handler implemented by child contracts.
_handleInitiateDeposit(
_from,
_to,
_tokenId
);
_sendDepositMessage(
_from,
_to,
_tokenId
);
}
/*************************
* Withdrawing *
*************************/
/**
* @dev Complete a withdrawal the other side, and credit the ERC721 token to the
* recipient.
* This call will fail if the initialized withdrawal from has not been finalized.
*
* @param _to L1 address to credit the withdrawal to
* @param _tokenId ERC721 token to withdraw
*/
function finalizeWithdrawal(
address _to,
uint _tokenId
)
external
override
onlyFromCrossDomainAccount(depositedToken)
{
// Call our withdrawal accounting handler implemented by child contracts.
_handleFinalizeWithdrawal(
_to,
_tokenId
);
emit WithdrawalFinalized(_to, _tokenId);
}
}
| 8,476 |
100 | // Can only close after being unstaked for 90 days or after 365 days from staking (in case of dispute) | require((unstakedAt < now - 90 days && unstakedAt != 0) || (stakedAt < now - 365 days && stakedAt != 0), "CAN NOT CLOSE YET");
uint256 leftovers = IERC20(tellorAddress).balanceOf(address(this));
require(IERC20(tellorAddress).transfer(owner(), leftovers));
| require((unstakedAt < now - 90 days && unstakedAt != 0) || (stakedAt < now - 365 days && stakedAt != 0), "CAN NOT CLOSE YET");
uint256 leftovers = IERC20(tellorAddress).balanceOf(address(this));
require(IERC20(tellorAddress).transfer(owner(), leftovers));
| 19,232 |
6 | // Declare a new Execution struct. | Execution memory considerationExecution;
| Execution memory considerationExecution;
| 32,845 |
130 | // simple mappings used to determine PnL denominated in LP tokens,as well as keep a generalized history of a user's protocol usage. / | mapping(address => uint256) public cumulativeDeposits;
mapping(address => uint256) public cumulativeWithdrawals;
event TermsAccepted(address user);
event TvlCapUpdated(uint256 newTvlCap);
| mapping(address => uint256) public cumulativeDeposits;
mapping(address => uint256) public cumulativeWithdrawals;
event TermsAccepted(address user);
event TvlCapUpdated(uint256 newTvlCap);
| 32,774 |
3 | // TODO ability to decode return data via abi requires 0.5.0. (bytes32 returnMessage) = abi.decode(returnData,(bytes32)); | if (toBytes32(returnData, 32) != testService.getSuccessMessage()) return "The function return data should match the service success message";
| if (toBytes32(returnData, 32) != testService.getSuccessMessage()) return "The function return data should match the service success message";
| 46,273 |
173 | // Copyright (c) 2021 the ethier authors (github.com/divergencetech/ethier)/ / | contract ERC721Common is Context, ERC721Pausable, OwnerPausable {
constructor(string memory name, string memory symbol)
ERC721(name, symbol)
{}
/// @notice Requires that the token exists.
modifier tokenExists(uint256 tokenId) {
require(ERC721._exists(tokenId), "ERC721Common: Token doesn't exist");
_;
}
/// @notice Requires that msg.sender owns or is approved for the token.
modifier onlyApprovedOrOwner(uint256 tokenId) {
require(
_isApprovedOrOwner(_msgSender(), tokenId),
"ERC721Common: Not approved nor owner"
);
_;
}
/// @notice Overrides _beforeTokenTransfer as required by inheritance.
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual override(ERC721Pausable) {
super._beforeTokenTransfer(from, to, tokenId);
}
/// @notice Overrides supportsInterface as required by inheritance.
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(ERC721)
returns (bool)
{
return super.supportsInterface(interfaceId);
}
/**
@notice Returns true if either standard isApprovedForAll() returns true or
the operator is the OpenSea proxy for the owner.
*/
function isApprovedForAll(address owner, address operator)
public
view
virtual
override
returns (bool)
{
return
super.isApprovedForAll(owner, operator) ||
OpenSeaGasFreeListing.isApprovedForAll(owner, operator);
}
}
| contract ERC721Common is Context, ERC721Pausable, OwnerPausable {
constructor(string memory name, string memory symbol)
ERC721(name, symbol)
{}
/// @notice Requires that the token exists.
modifier tokenExists(uint256 tokenId) {
require(ERC721._exists(tokenId), "ERC721Common: Token doesn't exist");
_;
}
/// @notice Requires that msg.sender owns or is approved for the token.
modifier onlyApprovedOrOwner(uint256 tokenId) {
require(
_isApprovedOrOwner(_msgSender(), tokenId),
"ERC721Common: Not approved nor owner"
);
_;
}
/// @notice Overrides _beforeTokenTransfer as required by inheritance.
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual override(ERC721Pausable) {
super._beforeTokenTransfer(from, to, tokenId);
}
/// @notice Overrides supportsInterface as required by inheritance.
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(ERC721)
returns (bool)
{
return super.supportsInterface(interfaceId);
}
/**
@notice Returns true if either standard isApprovedForAll() returns true or
the operator is the OpenSea proxy for the owner.
*/
function isApprovedForAll(address owner, address operator)
public
view
virtual
override
returns (bool)
{
return
super.isApprovedForAll(owner, operator) ||
OpenSeaGasFreeListing.isApprovedForAll(owner, operator);
}
}
| 18,080 |
37 | // Remove address' authorization. Owner only / | function unauthorize(address adr) public onlyOwner {
authorizations[adr] = false;
}
| function unauthorize(address adr) public onlyOwner {
authorizations[adr] = false;
}
| 23,418 |
216 | // Check d | assert(d & 1 == 1); // d is odd
assert((_number-1) % d == 0); // n-1 divisible by d
uint256 nMinusOneOverD = (_number-1) / d;
assert(isPowerOf2(nMinusOneOverD)); // (n-1)/d is power of 2
assert(nMinusOneOverD >= 1); // 2^r >= 2 therefore r >= 1
| assert(d & 1 == 1); // d is odd
assert((_number-1) % d == 0); // n-1 divisible by d
uint256 nMinusOneOverD = (_number-1) / d;
assert(isPowerOf2(nMinusOneOverD)); // (n-1)/d is power of 2
assert(nMinusOneOverD >= 1); // 2^r >= 2 therefore r >= 1
| 38,703 |
60 | // `end` marks the end of the memory which we will compute the keccak256 of. | let end := add(ptr, sLength)
| let end := add(ptr, sLength)
| 37,569 |
36 | // return total amount in | return amountIn;
| return amountIn;
| 19,954 |
2 | // ETH -> BBT | function swapETHToBBT(uint bbtAmountToReceieve) public payable {
uint deadline = block.timestamp + 15;
uniswapRouter.swapETHForExactTokens{ value: msg.value }(bbtAmountToReceieve, getPathForETHToBBT(), myAccount, deadline);
// refund leftover ETH to user
(bool success,) = myAccount.call{ value: address(this).balance }("");
require(success, "refund failed");
}
| function swapETHToBBT(uint bbtAmountToReceieve) public payable {
uint deadline = block.timestamp + 15;
uniswapRouter.swapETHForExactTokens{ value: msg.value }(bbtAmountToReceieve, getPathForETHToBBT(), myAccount, deadline);
// refund leftover ETH to user
(bool success,) = myAccount.call{ value: address(this).balance }("");
require(success, "refund failed");
}
| 29,766 |
2 | // Candidate({....}) creates temporary candidates object | { candidates.push(Candidate({
name:candidatename[i],
votecount :0
}));
| { candidates.push(Candidate({
name:candidatename[i],
votecount :0
}));
| 8,111 |
85 | // Return the buy price of 1 individual token. / | function sellPrice()
public
view
returns(uint256)
| function sellPrice()
public
view
returns(uint256)
| 14,292 |
20 | // Notifies the contract that the courtesy period has elapsed./ This is treated as an abort, rather than fraud./ _dDeposit storage pointer. | function notifyCourtesyTimeout(DepositUtils.Deposit storage _d) public {
require(_d.inCourtesyCall(), "Not in a courtesy call period");
require(block.timestamp >= _d.courtesyCallInitiated.add(TBTCConstants.getCourtesyCallTimeout()), "Courtesy period has not elapsed");
startLiquidation(_d, false);
}
| function notifyCourtesyTimeout(DepositUtils.Deposit storage _d) public {
require(_d.inCourtesyCall(), "Not in a courtesy call period");
require(block.timestamp >= _d.courtesyCallInitiated.add(TBTCConstants.getCourtesyCallTimeout()), "Courtesy period has not elapsed");
startLiquidation(_d, false);
}
| 53,644 |
7 | // Triggers stopped state. Requirements: - The contract must not be paused. / | function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
| function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
| 5,636 |
19 | // Mint tokens to each each beneficiary | function mints(address[] calldata _recipients, uint256[] calldata _values)
external
onlyIssuer
whenNotPaused
| function mints(address[] calldata _recipients, uint256[] calldata _values)
external
onlyIssuer
whenNotPaused
| 30,358 |
46 | // Function, called by Governance, that queues a transaction, returns action hash target smart contract target value wei value of the transaction signature function signature of the transaction data function arguments of the transaction or callData if signature empty executionTime time at which to execute the transaction withDelegatecall boolean, true = transaction delegatecalls the target, else calls the targetreturn the action Hash / | ) public override onlyAdmin returns (bytes32) {
require(executionTime >= block.timestamp.add(_delay), 'EXECUTION_TIME_UNDERESTIMATED');
bytes32 actionHash = keccak256(
abi.encode(target, value, signature, data, executionTime, withDelegatecall)
);
_queuedTransactions[actionHash] = true;
emit QueuedAction(actionHash, target, value, signature, data, executionTime, withDelegatecall);
return actionHash;
}
| ) public override onlyAdmin returns (bytes32) {
require(executionTime >= block.timestamp.add(_delay), 'EXECUTION_TIME_UNDERESTIMATED');
bytes32 actionHash = keccak256(
abi.encode(target, value, signature, data, executionTime, withDelegatecall)
);
_queuedTransactions[actionHash] = true;
emit QueuedAction(actionHash, target, value, signature, data, executionTime, withDelegatecall);
return actionHash;
}
| 73,849 |
49 | // en caso de pasar true como parametro revisa las deudas aun no aprobadas | function GetLoansLenght(bool _pending) public isBank view returns (uint256) {
if (_pending){
return banks[msg.sender].LoanPending.length;
}else{
return banks[msg.sender].LoansID.length;
}
}
| function GetLoansLenght(bool _pending) public isBank view returns (uint256) {
if (_pending){
return banks[msg.sender].LoanPending.length;
}else{
return banks[msg.sender].LoansID.length;
}
}
| 48,116 |
3 | // lock a user's currently staked balance until timestamp & add the bonus to his voting power | function lock(uint256 timestamp) external;
| function lock(uint256 timestamp) external;
| 19,251 |
73 | // Note: FailureInfo (but not Error) is kept in alphabetical orderThis is because FailureInfo grows significantly faster, andthe order of Error has some meaning, while the order of FailureInfois entirely arbitrary. / | enum FailureInfo {
ACCEPT_ADMIN_PENDING_ADMIN_CHECK,
ACCRUE_INTEREST_ACCUMULATED_INTEREST_CALCULATION_FAILED,
ACCRUE_INTEREST_BORROW_RATE_CALCULATION_FAILED,
ACCRUE_INTEREST_NEW_BORROW_INDEX_CALCULATION_FAILED,
ACCRUE_INTEREST_NEW_TOTAL_BORROWS_CALCULATION_FAILED,
ACCRUE_INTEREST_NEW_TOTAL_RESERVES_CALCULATION_FAILED,
ACCRUE_INTEREST_SIMPLE_INTEREST_FACTOR_CALCULATION_FAILED,
BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED,
BORROW_ACCRUE_INTEREST_FAILED,
BORROW_CASH_NOT_AVAILABLE,
BORROW_FRESHNESS_CHECK,
BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED,
BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED,
BORROW_MARKET_NOT_LISTED,
BORROW_BCONTROLLER_REJECTION,
LIQUIDATE_ACCRUE_BORROW_INTEREST_FAILED,
LIQUIDATE_ACCRUE_COLLATERAL_INTEREST_FAILED,
LIQUIDATE_COLLATERAL_FRESHNESS_CHECK,
LIQUIDATE_BCONTROLLER_REJECTION,
LIQUIDATE_BCONTROLLER_CALCULATE_AMOUNT_SEIZE_FAILED,
LIQUIDATE_CLOSE_AMOUNT_IS_UINT_MAX,
LIQUIDATE_CLOSE_AMOUNT_IS_ZERO,
LIQUIDATE_FRESHNESS_CHECK,
LIQUIDATE_LIQUIDATOR_IS_BORROWER,
LIQUIDATE_REPAY_BORROW_FRESH_FAILED,
LIQUIDATE_SEIZE_BALANCE_INCREMENT_FAILED,
LIQUIDATE_SEIZE_BALANCE_DECREMENT_FAILED,
LIQUIDATE_SEIZE_BCONTROLLER_REJECTION,
LIQUIDATE_SEIZE_LIQUIDATOR_IS_BORROWER,
LIQUIDATE_SEIZE_TOO_MUCH,
MINT_ACCRUE_INTEREST_FAILED,
MINT_BCONTROLLER_REJECTION,
MINT_EXCHANGE_CALCULATION_FAILED,
MINT_EXCHANGE_RATE_READ_FAILED,
MINT_FRESHNESS_CHECK,
MINT_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED,
MINT_NEW_TOTAL_SUPPLY_CALCULATION_FAILED,
MINT_TRANSFER_IN_FAILED,
MINT_TRANSFER_IN_NOT_POSSIBLE,
REDEEM_ACCRUE_INTEREST_FAILED,
REDEEM_BCONTROLLER_REJECTION,
REDEEM_EXCHANGE_TOKENS_CALCULATION_FAILED,
REDEEM_EXCHANGE_AMOUNT_CALCULATION_FAILED,
REDEEM_EXCHANGE_RATE_READ_FAILED,
REDEEM_FRESHNESS_CHECK,
REDEEM_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED,
REDEEM_NEW_TOTAL_SUPPLY_CALCULATION_FAILED,
REDEEM_TRANSFER_OUT_NOT_POSSIBLE,
REDUCE_RESERVES_ACCRUE_INTEREST_FAILED,
REDUCE_RESERVES_ADMIN_CHECK,
REDUCE_RESERVES_CASH_NOT_AVAILABLE,
REDUCE_RESERVES_FRESH_CHECK,
REDUCE_RESERVES_VALIDATION,
REPAY_BEHALF_ACCRUE_INTEREST_FAILED,
REPAY_BORROW_ACCRUE_INTEREST_FAILED,
REPAY_BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED,
REPAY_BORROW_BCONTROLLER_REJECTION,
REPAY_BORROW_FRESHNESS_CHECK,
REPAY_BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED,
REPAY_BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED,
REPAY_BORROW_TRANSFER_IN_NOT_POSSIBLE,
SET_COLLATERAL_FACTOR_OWNER_CHECK,
SET_COLLATERAL_FACTOR_VALIDATION,
SET_BCONTROLLER_OWNER_CHECK,
SET_INTEREST_RATE_MODEL_ACCRUE_INTEREST_FAILED,
SET_INTEREST_RATE_MODEL_FRESH_CHECK,
SET_INTEREST_RATE_MODEL_OWNER_CHECK,
SET_MAX_ASSETS_OWNER_CHECK,
SET_ORACLE_MARKET_NOT_LISTED,
SET_PENDING_ADMIN_OWNER_CHECK,
SET_RESERVE_FACTOR_ACCRUE_INTEREST_FAILED,
SET_RESERVE_FACTOR_ADMIN_CHECK,
SET_RESERVE_FACTOR_FRESH_CHECK,
SET_RESERVE_FACTOR_BOUNDS_CHECK,
TRANSFER_BCONTROLLER_REJECTION,
TRANSFER_NOT_ALLOWED,
TRANSFER_NOT_ENOUGH,
TRANSFER_TOO_MUCH,
ADD_RESERVES_ACCRUE_INTEREST_FAILED,
ADD_RESERVES_FRESH_CHECK,
ADD_RESERVES_TRANSFER_IN_NOT_POSSIBLE
}
| enum FailureInfo {
ACCEPT_ADMIN_PENDING_ADMIN_CHECK,
ACCRUE_INTEREST_ACCUMULATED_INTEREST_CALCULATION_FAILED,
ACCRUE_INTEREST_BORROW_RATE_CALCULATION_FAILED,
ACCRUE_INTEREST_NEW_BORROW_INDEX_CALCULATION_FAILED,
ACCRUE_INTEREST_NEW_TOTAL_BORROWS_CALCULATION_FAILED,
ACCRUE_INTEREST_NEW_TOTAL_RESERVES_CALCULATION_FAILED,
ACCRUE_INTEREST_SIMPLE_INTEREST_FACTOR_CALCULATION_FAILED,
BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED,
BORROW_ACCRUE_INTEREST_FAILED,
BORROW_CASH_NOT_AVAILABLE,
BORROW_FRESHNESS_CHECK,
BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED,
BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED,
BORROW_MARKET_NOT_LISTED,
BORROW_BCONTROLLER_REJECTION,
LIQUIDATE_ACCRUE_BORROW_INTEREST_FAILED,
LIQUIDATE_ACCRUE_COLLATERAL_INTEREST_FAILED,
LIQUIDATE_COLLATERAL_FRESHNESS_CHECK,
LIQUIDATE_BCONTROLLER_REJECTION,
LIQUIDATE_BCONTROLLER_CALCULATE_AMOUNT_SEIZE_FAILED,
LIQUIDATE_CLOSE_AMOUNT_IS_UINT_MAX,
LIQUIDATE_CLOSE_AMOUNT_IS_ZERO,
LIQUIDATE_FRESHNESS_CHECK,
LIQUIDATE_LIQUIDATOR_IS_BORROWER,
LIQUIDATE_REPAY_BORROW_FRESH_FAILED,
LIQUIDATE_SEIZE_BALANCE_INCREMENT_FAILED,
LIQUIDATE_SEIZE_BALANCE_DECREMENT_FAILED,
LIQUIDATE_SEIZE_BCONTROLLER_REJECTION,
LIQUIDATE_SEIZE_LIQUIDATOR_IS_BORROWER,
LIQUIDATE_SEIZE_TOO_MUCH,
MINT_ACCRUE_INTEREST_FAILED,
MINT_BCONTROLLER_REJECTION,
MINT_EXCHANGE_CALCULATION_FAILED,
MINT_EXCHANGE_RATE_READ_FAILED,
MINT_FRESHNESS_CHECK,
MINT_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED,
MINT_NEW_TOTAL_SUPPLY_CALCULATION_FAILED,
MINT_TRANSFER_IN_FAILED,
MINT_TRANSFER_IN_NOT_POSSIBLE,
REDEEM_ACCRUE_INTEREST_FAILED,
REDEEM_BCONTROLLER_REJECTION,
REDEEM_EXCHANGE_TOKENS_CALCULATION_FAILED,
REDEEM_EXCHANGE_AMOUNT_CALCULATION_FAILED,
REDEEM_EXCHANGE_RATE_READ_FAILED,
REDEEM_FRESHNESS_CHECK,
REDEEM_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED,
REDEEM_NEW_TOTAL_SUPPLY_CALCULATION_FAILED,
REDEEM_TRANSFER_OUT_NOT_POSSIBLE,
REDUCE_RESERVES_ACCRUE_INTEREST_FAILED,
REDUCE_RESERVES_ADMIN_CHECK,
REDUCE_RESERVES_CASH_NOT_AVAILABLE,
REDUCE_RESERVES_FRESH_CHECK,
REDUCE_RESERVES_VALIDATION,
REPAY_BEHALF_ACCRUE_INTEREST_FAILED,
REPAY_BORROW_ACCRUE_INTEREST_FAILED,
REPAY_BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED,
REPAY_BORROW_BCONTROLLER_REJECTION,
REPAY_BORROW_FRESHNESS_CHECK,
REPAY_BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED,
REPAY_BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED,
REPAY_BORROW_TRANSFER_IN_NOT_POSSIBLE,
SET_COLLATERAL_FACTOR_OWNER_CHECK,
SET_COLLATERAL_FACTOR_VALIDATION,
SET_BCONTROLLER_OWNER_CHECK,
SET_INTEREST_RATE_MODEL_ACCRUE_INTEREST_FAILED,
SET_INTEREST_RATE_MODEL_FRESH_CHECK,
SET_INTEREST_RATE_MODEL_OWNER_CHECK,
SET_MAX_ASSETS_OWNER_CHECK,
SET_ORACLE_MARKET_NOT_LISTED,
SET_PENDING_ADMIN_OWNER_CHECK,
SET_RESERVE_FACTOR_ACCRUE_INTEREST_FAILED,
SET_RESERVE_FACTOR_ADMIN_CHECK,
SET_RESERVE_FACTOR_FRESH_CHECK,
SET_RESERVE_FACTOR_BOUNDS_CHECK,
TRANSFER_BCONTROLLER_REJECTION,
TRANSFER_NOT_ALLOWED,
TRANSFER_NOT_ENOUGH,
TRANSFER_TOO_MUCH,
ADD_RESERVES_ACCRUE_INTEREST_FAILED,
ADD_RESERVES_FRESH_CHECK,
ADD_RESERVES_TRANSFER_IN_NOT_POSSIBLE
}
| 1,444 |
28 | // Deprecated. This function has issues similar to the ones found in | * {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
// solhint-disable-next-line max-line-length
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
| * {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
// solhint-disable-next-line max-line-length
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
| 65,318 |
11 | // This is 777's send function, not the Solidity send function | token.send(to, amount, data); // solhint-disable-line check-send-result
| token.send(to, amount, data); // solhint-disable-line check-send-result
| 11,361 |
74 | // delete prices[_id].credentialItemId; | delete bytes32Storage[keccak256(abi.encodePacked("prices.", _id, ".credentialItemId"))];
| delete bytes32Storage[keccak256(abi.encodePacked("prices.", _id, ".credentialItemId"))];
| 46,883 |
3 | // Pay deposit equal to the value of the package into escrow | function enterCourrier(uint _id) public payable {
require(shipments[_id].state == State.Pending);
require(msg.value == shipments[_id].cost);
shipments[_id].courrier = msg.sender;
shipments[_id].state = State.InProgress;
emit CourrierEntered(_id);
}
| function enterCourrier(uint _id) public payable {
require(shipments[_id].state == State.Pending);
require(msg.value == shipments[_id].cost);
shipments[_id].courrier = msg.sender;
shipments[_id].state = State.InProgress;
emit CourrierEntered(_id);
}
| 23,463 |
14 | // Test Helper for the EllipticCurve library Witnet Foundation / | contract TestEllipticCurve {
function invMod(uint256 _x, uint256 _pp) public pure returns (uint256) {
return EllipticCurve.invMod(_x, _pp);
}
function expMod(uint256 _base, uint256 _exp, uint256 _pp) public pure returns (uint256) {
return EllipticCurve.expMod(_base, _exp, _pp);
}
function toAffine(
uint256 _x,
uint256 _y,
uint256 _z,
uint256 _pp)
public pure returns (uint256, uint256)
{
return EllipticCurve.toAffine(
_x,
_y,
_z,
_pp);
}
function deriveY(
uint8 _prefix,
uint256 _x,
uint256 _aa,
uint256 _bb,
uint256 _pp)
public pure returns (uint256)
{
return EllipticCurve.deriveY(
_prefix,
_x,
_aa,
_bb,
_pp);
}
function isOnCurve(
uint _x,
uint _y,
uint _aa,
uint _bb,
uint _pp)
public pure returns (bool)
{
return EllipticCurve.isOnCurve(
_x,
_y,
_aa,
_bb,
_pp);
}
function ecInv(
uint256 _x,
uint256 _y,
uint256 _pp)
public pure returns (uint256, uint256)
{
return EllipticCurve.ecInv(
_x,
_y,
_pp);
}
function ecAdd(
uint256 _x1,
uint256 _y1,
uint256 _x2,
uint256 _y2,
uint256 _aa,
uint256 _pp)
public pure returns(uint256, uint256)
{
return EllipticCurve.ecAdd(
_x1,
_y1,
_x2,
_y2,
_aa,
_pp);
}
function ecSub(
uint256 _x1,
uint256 _y1,
uint256 _x2,
uint256 _y2,
uint256 _aa,
uint256 _pp)
public pure returns(uint256, uint256)
{
return EllipticCurve.ecSub(
_x1,
_y1,
_x2,
_y2,
_aa,
_pp);
}
function ecMul(
uint256 _k,
uint256 _x,
uint256 _y,
uint256 _aa,
uint256 _pp)
public pure returns(uint256, uint256)
{
return EllipticCurve.ecMul(
_k,
_x,
_y,
_aa,
_pp);
}
function jacAdd(
uint256 _x1,
uint256 _y1,
uint256 _z1,
uint256 _x2,
uint256 _y2,
uint256 _z2,
uint256 _pp)
public pure returns (uint256, uint256, uint256)
{
return EllipticCurve.jacAdd(
_x1,
_y1,
_z1,
_x2,
_y2,
_z2,
_pp);
}
function jacDouble(
uint256 _x,
uint256 _y,
uint256 _z,
uint256 _aa,
uint256 _pp)
public pure returns (uint256, uint256, uint256)
{
return EllipticCurve.jacDouble(
_x,
_y,
_z,
_aa,
_pp);
}
function jacMul(
uint256 _d,
uint256 _x,
uint256 _y,
uint256 _z,
uint256 _aa,
uint256 _pp)
public pure returns (uint256, uint256, uint256)
{
return EllipticCurve.jacMul(
_d,
_x,
_y,
_z,
_aa,
_pp);
}
function decomposeScalar(uint256 _k, uint256 _nn, uint256 _lambda) public pure returns (int256, int256) {
return FastEcMul.decomposeScalar(_k, _nn, _lambda);
}
function ecSimMul(
int256[4] memory _scalars,
uint256[4] memory _points,
uint256 _aa,
uint256 _beta,
uint256 _pp)
public pure returns (uint256, uint256)
{
return FastEcMul.ecSimMul(
_scalars,
_points,
_aa,
_beta,
_pp);
}
} | contract TestEllipticCurve {
function invMod(uint256 _x, uint256 _pp) public pure returns (uint256) {
return EllipticCurve.invMod(_x, _pp);
}
function expMod(uint256 _base, uint256 _exp, uint256 _pp) public pure returns (uint256) {
return EllipticCurve.expMod(_base, _exp, _pp);
}
function toAffine(
uint256 _x,
uint256 _y,
uint256 _z,
uint256 _pp)
public pure returns (uint256, uint256)
{
return EllipticCurve.toAffine(
_x,
_y,
_z,
_pp);
}
function deriveY(
uint8 _prefix,
uint256 _x,
uint256 _aa,
uint256 _bb,
uint256 _pp)
public pure returns (uint256)
{
return EllipticCurve.deriveY(
_prefix,
_x,
_aa,
_bb,
_pp);
}
function isOnCurve(
uint _x,
uint _y,
uint _aa,
uint _bb,
uint _pp)
public pure returns (bool)
{
return EllipticCurve.isOnCurve(
_x,
_y,
_aa,
_bb,
_pp);
}
function ecInv(
uint256 _x,
uint256 _y,
uint256 _pp)
public pure returns (uint256, uint256)
{
return EllipticCurve.ecInv(
_x,
_y,
_pp);
}
function ecAdd(
uint256 _x1,
uint256 _y1,
uint256 _x2,
uint256 _y2,
uint256 _aa,
uint256 _pp)
public pure returns(uint256, uint256)
{
return EllipticCurve.ecAdd(
_x1,
_y1,
_x2,
_y2,
_aa,
_pp);
}
function ecSub(
uint256 _x1,
uint256 _y1,
uint256 _x2,
uint256 _y2,
uint256 _aa,
uint256 _pp)
public pure returns(uint256, uint256)
{
return EllipticCurve.ecSub(
_x1,
_y1,
_x2,
_y2,
_aa,
_pp);
}
function ecMul(
uint256 _k,
uint256 _x,
uint256 _y,
uint256 _aa,
uint256 _pp)
public pure returns(uint256, uint256)
{
return EllipticCurve.ecMul(
_k,
_x,
_y,
_aa,
_pp);
}
function jacAdd(
uint256 _x1,
uint256 _y1,
uint256 _z1,
uint256 _x2,
uint256 _y2,
uint256 _z2,
uint256 _pp)
public pure returns (uint256, uint256, uint256)
{
return EllipticCurve.jacAdd(
_x1,
_y1,
_z1,
_x2,
_y2,
_z2,
_pp);
}
function jacDouble(
uint256 _x,
uint256 _y,
uint256 _z,
uint256 _aa,
uint256 _pp)
public pure returns (uint256, uint256, uint256)
{
return EllipticCurve.jacDouble(
_x,
_y,
_z,
_aa,
_pp);
}
function jacMul(
uint256 _d,
uint256 _x,
uint256 _y,
uint256 _z,
uint256 _aa,
uint256 _pp)
public pure returns (uint256, uint256, uint256)
{
return EllipticCurve.jacMul(
_d,
_x,
_y,
_z,
_aa,
_pp);
}
function decomposeScalar(uint256 _k, uint256 _nn, uint256 _lambda) public pure returns (int256, int256) {
return FastEcMul.decomposeScalar(_k, _nn, _lambda);
}
function ecSimMul(
int256[4] memory _scalars,
uint256[4] memory _points,
uint256 _aa,
uint256 _beta,
uint256 _pp)
public pure returns (uint256, uint256)
{
return FastEcMul.ecSimMul(
_scalars,
_points,
_aa,
_beta,
_pp);
}
} | 52,221 |
19 | // Function that handles logic for setting prices and assigning collectibles to addresses. Doubles instance valueon purchase. Verifycorrect amount of ethereum has been received | function purchaseLeader(uint uniqueLeaderID) public payable returns (uint, uint) {
require(uniqueLeaderID >= 0 && uniqueLeaderID <= 31);
// Set initial price to .02 (ETH)
if ( data[uniqueLeaderID].currentValue == 15000000000000000 ) {
data[uniqueLeaderID].currentValue = 30000000000000000;
} else {
// Double price
data[uniqueLeaderID].currentValue = (data[uniqueLeaderID].currentValue / 10) * 12;
}
require(msg.value >= data[uniqueLeaderID].currentValue * uint256(1));
// Call payPreviousOwner() after purchase.
payPreviousOwner(data[uniqueLeaderID].currentLeaderOwner, (data[uniqueLeaderID].currentValue / 100) * (88));
transactionFee(ceoAddress, (data[uniqueLeaderID].currentValue / 100) * (12));
// Assign owner.
data[uniqueLeaderID].currentLeaderOwner = msg.sender;
// Return values for web3js display.
return (uniqueLeaderID, data[uniqueLeaderID].currentValue);
}
| function purchaseLeader(uint uniqueLeaderID) public payable returns (uint, uint) {
require(uniqueLeaderID >= 0 && uniqueLeaderID <= 31);
// Set initial price to .02 (ETH)
if ( data[uniqueLeaderID].currentValue == 15000000000000000 ) {
data[uniqueLeaderID].currentValue = 30000000000000000;
} else {
// Double price
data[uniqueLeaderID].currentValue = (data[uniqueLeaderID].currentValue / 10) * 12;
}
require(msg.value >= data[uniqueLeaderID].currentValue * uint256(1));
// Call payPreviousOwner() after purchase.
payPreviousOwner(data[uniqueLeaderID].currentLeaderOwner, (data[uniqueLeaderID].currentValue / 100) * (88));
transactionFee(ceoAddress, (data[uniqueLeaderID].currentValue / 100) * (12));
// Assign owner.
data[uniqueLeaderID].currentLeaderOwner = msg.sender;
// Return values for web3js display.
return (uniqueLeaderID, data[uniqueLeaderID].currentValue);
}
| 57,833 |
97 | // The precision factor | uint256 public PRECISION_FACTOR;
| uint256 public PRECISION_FACTOR;
| 55,048 |
74 | // modifier that allows only the authorized addresses to execute the function | modifier onlyAuthorizedToGovern() {
IMaster ms = IMaster(masterAddress);
require(ms.getLatestAddress("GV") == msg.sender, "Not authorized");
_;
}
| modifier onlyAuthorizedToGovern() {
IMaster ms = IMaster(masterAddress);
require(ms.getLatestAddress("GV") == msg.sender, "Not authorized");
_;
}
| 4,031 |
334 | // --- Savings Rate Accumulation --- | function drip() external note returns (uint tmp) {
require(now >= rho, "Pot/invalid-now");
tmp = rmul(rpow(dsr, now - rho, ONE), chi);
uint chi_ = sub(tmp, chi);
chi = tmp;
rho = now;
vat.suck(address(vow), address(this), mul(Pie, chi_));
}
| function drip() external note returns (uint tmp) {
require(now >= rho, "Pot/invalid-now");
tmp = rmul(rpow(dsr, now - rho, ONE), chi);
uint chi_ = sub(tmp, chi);
chi = tmp;
rho = now;
vat.suck(address(vow), address(this), mul(Pie, chi_));
}
| 34,544 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.