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 |
|---|---|---|---|---|
342 | // apply the high fee only if the ratio between the effective weight and the external (target) weight is below the high fee upper bound | uint32 feeFactor;
if (uint256(_targetWeight).mul(PPM_RESOLUTION) < uint256(_targetExternalWeight).mul(HIGH_FEE_UPPER_BOUND)) {
feeFactor = highFeeFactor;
}
| uint32 feeFactor;
if (uint256(_targetWeight).mul(PPM_RESOLUTION) < uint256(_targetExternalWeight).mul(HIGH_FEE_UPPER_BOUND)) {
feeFactor = highFeeFactor;
}
| 10,159 |
38 | // ===Interactions=== make sure msg value >= amountReceive | uint256 amountReturn = msg.value.sub(amountReceive);
| uint256 amountReturn = msg.value.sub(amountReceive);
| 34,328 |
123 | // Typically there wouldn't be any amount here however, it is possible because of the emergencyExit | if(amount > underlying.balanceOf(address(this))){
| if(amount > underlying.balanceOf(address(this))){
| 46,883 |
95 | // Max harvest interval: 14 days | uint256 public constant MAXIMUM_HARVEST_INTERVAL = 14 days;
| uint256 public constant MAXIMUM_HARVEST_INTERVAL = 14 days;
| 14,496 |
155 | // Construct a new Compound reward token name ERC-20 name of this token symbol ERC-20 symbol of this token _cToken The address of cToken contract delegate The address of reward owner / | constructor(
string memory name,
string memory symbol,
ICToken _cToken,
address delegate
| constructor(
string memory name,
string memory symbol,
ICToken _cToken,
address delegate
| 83,249 |
141 | // the Metadata extension, but not including the Enumerable extension, which is available separately as | * {ERC721Enumerable}.
*/
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping(uint256 => address) private _owners;
// Mapping owner address to token count
mapping(address => uint256) private _balances;
// Mapping from token ID to approved address
mapping(uint256 => address) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
/**
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view virtual override returns (uint256) {
require(owner != address(0), "ERC721: balance query for the zero address");
return _balances[owner];
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
address owner = _owners[tokenId];
require(owner != address(0), "ERC721: owner query for nonexistent token");
return owner;
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overriden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return "";
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
require(operator != _msgSender(), "ERC721: approve to caller");
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_safeTransfer(from, to, tokenId, _data);
}
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* `_data` is additional data, it has no specified format and it is sent in call to `to`.
*
* This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
* implement alternative mechanisms to perform token transfer, such as signature-based.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
* and stop existing when they are burned (`_burn`).
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _owners[tokenId] != address(0);
}
/**
* @dev Returns whether `spender` is allowed to manage `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
address owner = ERC721.ownerOf(tokenId);
return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
}
/**
* @dev Safely mints `tokenId` and transfers it to `to`.
*
* Requirements:
*
* - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
/**
* @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
*/
function _safeMint(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
/**
* @dev Mints `tokenId` and transfers it to `to`.
*
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
// Clear approvals
_approve(address(0), tokenId);
_balances[owner] -= 1;
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
// Clear approvals from the previous owner
_approve(address(0), tokenId);
_balances[from] -= 1;
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
* The call is not executed if the target address is not a contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes optional data to send along with the call
* @return bool whether the call correctly returned the expected magic value
*/
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
return retval == IERC721Receiver(to).onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC721: transfer to non ERC721Receiver implementer");
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, ``from``'s `tokenId` will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
}
| * {ERC721Enumerable}.
*/
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping(uint256 => address) private _owners;
// Mapping owner address to token count
mapping(address => uint256) private _balances;
// Mapping from token ID to approved address
mapping(uint256 => address) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
/**
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view virtual override returns (uint256) {
require(owner != address(0), "ERC721: balance query for the zero address");
return _balances[owner];
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
address owner = _owners[tokenId];
require(owner != address(0), "ERC721: owner query for nonexistent token");
return owner;
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overriden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return "";
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
require(operator != _msgSender(), "ERC721: approve to caller");
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_safeTransfer(from, to, tokenId, _data);
}
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* `_data` is additional data, it has no specified format and it is sent in call to `to`.
*
* This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
* implement alternative mechanisms to perform token transfer, such as signature-based.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
* and stop existing when they are burned (`_burn`).
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _owners[tokenId] != address(0);
}
/**
* @dev Returns whether `spender` is allowed to manage `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
address owner = ERC721.ownerOf(tokenId);
return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
}
/**
* @dev Safely mints `tokenId` and transfers it to `to`.
*
* Requirements:
*
* - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
/**
* @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
*/
function _safeMint(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
/**
* @dev Mints `tokenId` and transfers it to `to`.
*
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
// Clear approvals
_approve(address(0), tokenId);
_balances[owner] -= 1;
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
// Clear approvals from the previous owner
_approve(address(0), tokenId);
_balances[from] -= 1;
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
* The call is not executed if the target address is not a contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes optional data to send along with the call
* @return bool whether the call correctly returned the expected magic value
*/
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
return retval == IERC721Receiver(to).onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC721: transfer to non ERC721Receiver implementer");
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, ``from``'s `tokenId` will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
}
| 2,229 |
173 | // Struct storing variables used in calculation in addLiquidity function to avoid stack too deep error | struct AddLiquidityInfo {
uint256 d0;
uint256 d1;
uint256 d2;
uint256 preciseA;
}
| struct AddLiquidityInfo {
uint256 d0;
uint256 d1;
uint256 d2;
uint256 preciseA;
}
| 19,597 |
45 | // Mutative | function addListing(
IERC721 _tokenAddress,
uint256 _id,
uint256 _price,
address _targetBuyer
)
public
| function addListing(
IERC721 _tokenAddress,
uint256 _id,
uint256 _price,
address _targetBuyer
)
public
| 30,649 |
45 | // Function to get the current stage number.return A uint256 specifing the current stage number. / | function getCurrentStage() public view returns(uint256) {
for(uint256 i=0; i < stages.length; i++) {
if(stages[i].closed == 0) {
return i;
}
}
revert();
}
| function getCurrentStage() public view returns(uint256) {
for(uint256 i=0; i < stages.length; i++) {
if(stages[i].closed == 0) {
return i;
}
}
revert();
}
| 49,721 |
27 | // 0x11: The script contains too many calls. | ScriptTooManyCalls,
| ScriptTooManyCalls,
| 23,234 |
3 | // 所有投票人 | mapping(address => Voter) public voters;
| mapping(address => Voter) public voters;
| 17,629 |
90 | // Liquidity/Liquidation Calculations // Local vars for avoiding stack-depth limits in calculating account liquidity. Note that `cTokenBalance` is the number of cTokens the account owns in the market, whereas `borrowBalance` is the amount of underlying that the account has borrowed. / | struct AccountLiquidityLocalVars {
uint sumCollateral;
uint sumBorrowPlusEffects;
uint cTokenBalance;
uint borrowBalance;
uint exchangeRateMantissa;
uint oraclePriceMantissa;
Exp collateralFactor;
Exp exchangeRate;
Exp oraclePrice;
Exp tokensToDenom;
}
| struct AccountLiquidityLocalVars {
uint sumCollateral;
uint sumBorrowPlusEffects;
uint cTokenBalance;
uint borrowBalance;
uint exchangeRateMantissa;
uint oraclePriceMantissa;
Exp collateralFactor;
Exp exchangeRate;
Exp oraclePrice;
Exp tokensToDenom;
}
| 9,099 |
176 | // Calculates all unclaimed reward data, finding both immediately unlocked rewards and those that have passed their time lock._account User address return amount Total units of unclaimed rewards return first Index of the first userReward that has unlocked return last Index of the last userReward that has unlocked | function unclaimedRewards(address _account)
external
view
returns (
uint256 amount,
uint256 first,
uint256 last
);
| function unclaimedRewards(address _account)
external
view
returns (
uint256 amount,
uint256 first,
uint256 last
);
| 18,639 |
2 | // / | function deposit(uint256 amount) public {
par.safeTransferFrom(msg.sender, address(this), amount);
_increaseStake(msg.sender, amount);
}
| function deposit(uint256 amount) public {
par.safeTransferFrom(msg.sender, address(this), amount);
_increaseStake(msg.sender, amount);
}
| 33,408 |
192 | // Nonces for permit / meta-transactions owner Token owner's addressreturn Next nonce / | function nonces(address owner) external view returns (uint256) {
return _nonces[owner];
}
| function nonces(address owner) external view returns (uint256) {
return _nonces[owner];
}
| 8,893 |
14 | // frames | [250, 150, 300, 200, 40, 10, 80, 70, 400, 100, 8400, maxChanceValue],
| [250, 150, 300, 200, 40, 10, 80, 70, 400, 100, 8400, maxChanceValue],
| 12,616 |
18 | // E18 for dollars, not E6 Assumes $1 FRAX and $1 USDC | return (mintedBalance()).mul(FRAX.global_collateral_ratio()).div(PRICE_PRECISION);
| return (mintedBalance()).mul(FRAX.global_collateral_ratio()).div(PRICE_PRECISION);
| 74,553 |
245 | // Network analytics contract address | address public immutable networkAnalyticsAddress;
| address public immutable networkAnalyticsAddress;
| 69,520 |
211 | // Calculates free collateral and will revert if it falls below zero. If the account context/ must be updated due to changes in debt settings, will update. Cannot check free collateral if assets/ need to be settled first./Cannot be called directly by users, used during various actions that require an FC check. Must be/ called before the end of any transaction for accounts where FC can decrease./account account to calculate free collateral for | function checkFreeCollateralAndRevert(address account) external {
AccountContext memory accountContext = AccountContextHandler.getAccountContext(account);
require(!accountContext.mustSettleAssets(), "Assets not settled");
(int256 ethDenominatedFC, bool updateContext) =
FreeCollateral.getFreeCollateralStateful(account, accountContext, block.timestamp);
if (updateContext) {
accountContext.setAccountContext(account);
}
require(ethDenominatedFC >= 0, "Insufficient free collateral");
}
| function checkFreeCollateralAndRevert(address account) external {
AccountContext memory accountContext = AccountContextHandler.getAccountContext(account);
require(!accountContext.mustSettleAssets(), "Assets not settled");
(int256 ethDenominatedFC, bool updateContext) =
FreeCollateral.getFreeCollateralStateful(account, accountContext, block.timestamp);
if (updateContext) {
accountContext.setAccountContext(account);
}
require(ethDenominatedFC >= 0, "Insufficient free collateral");
}
| 3,493 |
115 | // _name Name these shares/_symbol Symbol of shares/_decimal Amount of decimals sharePrice is denominated in, defined to be equal as deciamls in REFERENCE_ASSET contract/_creationTime Timestamp of share creation | function Shares(bytes32 _name, bytes8 _symbol, uint _decimal, uint _creationTime) {
name = _name;
symbol = _symbol;
decimal = _decimal;
creationTime = _creationTime;
}
| function Shares(bytes32 _name, bytes8 _symbol, uint _decimal, uint _creationTime) {
name = _name;
symbol = _symbol;
decimal = _decimal;
creationTime = _creationTime;
}
| 25,004 |
209 | // unrealized pnl after open position | SignedDecimal.signedDecimal unrealizedPnlAfter;
| SignedDecimal.signedDecimal unrealizedPnlAfter;
| 30,811 |
10 | // Sets a Chainlink price feed. It is not an error to set a feed twice. | * @dev Emits a {SetFeed} event.
*
* Requirements:
*
* - The caller must be the admin.
* - The number of decimals of the feed must be 8.
*
* @param asset The address of the Erc20 contract for which to get the price.
* @param feed The address of the Chainlink price feed contract.
* @return true = success, otherwise it reverts.
*/
function setFeed(Erc20Interface asset, AggregatorV3Interface feed) external override onlyAdmin returns (bool) {
string memory symbol = asset.symbol();
/* Checks: price precision. */
uint8 decimals = feed.decimals();
require(decimals == pricePrecision, "ERR_FEED_INCORRECT_DECIMALS");
/* Effects: put the feed into storage. */
feeds[symbol] = Feed({ asset: asset, id: feed, isSet: true });
emit SetFeed(asset, feed);
return true;
}
| * @dev Emits a {SetFeed} event.
*
* Requirements:
*
* - The caller must be the admin.
* - The number of decimals of the feed must be 8.
*
* @param asset The address of the Erc20 contract for which to get the price.
* @param feed The address of the Chainlink price feed contract.
* @return true = success, otherwise it reverts.
*/
function setFeed(Erc20Interface asset, AggregatorV3Interface feed) external override onlyAdmin returns (bool) {
string memory symbol = asset.symbol();
/* Checks: price precision. */
uint8 decimals = feed.decimals();
require(decimals == pricePrecision, "ERR_FEED_INCORRECT_DECIMALS");
/* Effects: put the feed into storage. */
feeds[symbol] = Feed({ asset: asset, id: feed, isSet: true });
emit SetFeed(asset, feed);
return true;
}
| 21,883 |
6 | // register first airline when contract is deployed | _registerAirline(deployingAccount);
| _registerAirline(deployingAccount);
| 48,551 |
34 | // Withdraw dividends | withdraw();
| withdraw();
| 78,060 |
134 | // Returns the division of two unsigned integers, with a division by zero flag. _Available since v3.4._ / | function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a / b);
}
| function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a / b);
}
| 2,322 |
2 | // Processes a comment action referencing a given publication. This can only be called by the hub.profileId The token ID of the profile associated with the publication being published. profileIdPointed The profile ID of the profile associated the publication being referenced. pubIdPointed The publication ID of the publication being referenced. / | function processComment(
uint256 profileId,
uint256 profileIdPointed,
uint256 pubIdPointed
| function processComment(
uint256 profileId,
uint256 profileIdPointed,
uint256 pubIdPointed
| 52,045 |
15 | // Reduce the max supply of tokens _newMaxSupply The new maximum supply of tokens available to mint / | function reduceMaxSupply(uint256 _newMaxSupply) external onlyOwner {
require(_newMaxSupply < MAX_SUPPLY, "NEW_MAX_SUPPLY_TOO_HIGH");
require(
_newMaxSupply >= totalSupply(),
"SUPPLY_LOWER_THAN_MINTED_TOKENS"
);
MAX_SUPPLY = _newMaxSupply;
}
| function reduceMaxSupply(uint256 _newMaxSupply) external onlyOwner {
require(_newMaxSupply < MAX_SUPPLY, "NEW_MAX_SUPPLY_TOO_HIGH");
require(
_newMaxSupply >= totalSupply(),
"SUPPLY_LOWER_THAN_MINTED_TOKENS"
);
MAX_SUPPLY = _newMaxSupply;
}
| 20,477 |
0 | // Pairs to market NFT _id => price / | struct Pair {
uint256 pair_id;
uint256 amount;
address collection;
uint256 token_id;
address creator;
address owner;
uint256 price;
bool bValid;
}
| struct Pair {
uint256 pair_id;
uint256 amount;
address collection;
uint256 token_id;
address creator;
address owner;
uint256 price;
bool bValid;
}
| 22,212 |
96 | // The value is stored at length-1, but we add 1 to all indexes and use 0 as a sentinel value | set._indexes[value] = set._values.length;
return true;
| set._indexes[value] = set._values.length;
return true;
| 25,406 |
17 | // This is an alternative to {approve} that can be used as a mitigation forproblems described in {IBEP20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `_spender` cannot be the zero address. / | function increaseAllowance(address _spender, uint256 _addVal) external returns (bool) {
require(_spender != address(0), "approve to 0");
_approve(_msgSender(), _spender, _allowances[_msgSender()][_spender].add(_addVal));
return true;
}
| function increaseAllowance(address _spender, uint256 _addVal) external returns (bool) {
require(_spender != address(0), "approve to 0");
_approve(_msgSender(), _spender, _allowances[_msgSender()][_spender].add(_addVal));
return true;
}
| 48,297 |
57 | // This emits when the equipment&39;s attributes changed | event ChangeFashion(address indexed owner, uint256 tokenId, uint16 changeType);
| event ChangeFashion(address indexed owner, uint256 tokenId, uint16 changeType);
| 30,419 |
32 | // 目前正在二級市場交易的票數加 1。 | tradings++;
| tradings++;
| 30,252 |
48 | // Set the referrer, if no referrer has been set yet, and the player/ and referrer are not the same address. | referrerOf[newReferral] = referrer;
| referrerOf[newReferral] = referrer;
| 18,544 |
12 | // Updates royalties for the collection.receiver New address of the royalties receiver. feeNumerator Royalties amount %. / | function updateRoyalties(address receiver, uint96 feeNumerator) external;
| function updateRoyalties(address receiver, uint96 feeNumerator) external;
| 24,857 |
271 | // Locate Vault by hashing metadata about the product | mapping(uint256 => Vault) private Vaults;
| mapping(uint256 => Vault) private Vaults;
| 66,979 |
1 | // instantiate ERC20 & ERC721 contracts | qt = QuestCoinLoom(ERC20contract);
ql = QuestLootLoom(ERC721contract);
| qt = QuestCoinLoom(ERC20contract);
ql = QuestLootLoom(ERC721contract);
| 30,059 |
0 | // Set elixor contract address | elixor elixorContract=elixor(0x898bF39cd67658bd63577fB00A2A3571dAecbC53);
| elixor elixorContract=elixor(0x898bF39cd67658bd63577fB00A2A3571dAecbC53);
| 41,529 |
5 | // compute end of script / next location | location = startOffset + calldataLength;
require(location <= _script.length, ERROR_INVALID_LENGTH);
bool success;
assembly {
success := call(
sub(gas, 5000), // forward gas left - 5000
contractAddress, // address
0, // no value
calldataStart, // calldata start
| location = startOffset + calldataLength;
require(location <= _script.length, ERROR_INVALID_LENGTH);
bool success;
assembly {
success := call(
sub(gas, 5000), // forward gas left - 5000
contractAddress, // address
0, // no value
calldataStart, // calldata start
| 32,797 |
26 | // This will assign ownership, and also emit the Transfer event as per ERC721 draft | _transfer(0, _owner, newFishId);
return newFishId;
| _transfer(0, _owner, newFishId);
return newFishId;
| 35,047 |
4 | // Trade logic called when items are purchased by a user/_itemId id of the item to fetch/_numberOfItems number of the items purchased/the function will trade amount from buyer to seller , also any left over amount will be transfered to buyer itself | modifier trade (string memory _itemId, uint _numberOfItems) {
_;
uint totalAmount = _numberOfItems.mul(items[_itemId].price);
require(msg.value >= totalAmount, 'Amount less than required');
uint amountToRefund = msg.value.sub(items[_itemId].price);
if(amountToRefund>0){
msg.sender.transfer(amountToRefund); // transfer left over to buyer
}
items[_itemId].seller.transfer(items[_itemId].price); // send the money to seller
}
| modifier trade (string memory _itemId, uint _numberOfItems) {
_;
uint totalAmount = _numberOfItems.mul(items[_itemId].price);
require(msg.value >= totalAmount, 'Amount less than required');
uint amountToRefund = msg.value.sub(items[_itemId].price);
if(amountToRefund>0){
msg.sender.transfer(amountToRefund); // transfer left over to buyer
}
items[_itemId].seller.transfer(items[_itemId].price); // send the money to seller
}
| 5,274 |
86 | // Vesting users token by default parameters account address of the useramount the amount to be vested / | function setDefaultVestingToken(address account, uint256 amount) external onlyOwner returns(bool){
vestingContractAddress.setDefaultVesting(account, amount);
_transfer(msg.sender,address(vestingContractAddress), amount);
return true;
}
| function setDefaultVestingToken(address account, uint256 amount) external onlyOwner returns(bool){
vestingContractAddress.setDefaultVesting(account, amount);
_transfer(msg.sender,address(vestingContractAddress), amount);
return true;
}
| 30,719 |
218 | // It allows owner to set the fee (1000 == 10% of gained interest)_fee : fee amount where 100000 is 100%, max settable is 10% / | function setFee(uint256 _fee)
| function setFee(uint256 _fee)
| 39,726 |
13 | // Propose a new owner for a subscription.Only callable by the Subscription's ownersubscriptionId - ID of the subscriptionnewOwner - proposed new owner of the subscription | function proposeSubscriptionOwnerTransfer(uint64 subscriptionId, address newOwner) external;
| function proposeSubscriptionOwnerTransfer(uint64 subscriptionId, address newOwner) external;
| 15,894 |
437 | // Returns a slice of the original array, with the BPT token address removed. This mutates the original array, which should not be used anymore after calling this function.It's recommended to call this function such that the calling function either immediately returns or overwritesthe original array variable so it cannot be accessed. / | function dropBptFromTokens(IERC20[] memory registeredTokens) internal pure returns (IERC20[] memory tokens) {
assembly {
// An array's memory representation is a 32 byte word for the length followed by 32 byte words for
// each element, with the stack variable pointing to the length. Since there's no memory deallocation,
// and we are free to mutate the received array, the cheapest way to remove the first element is to
// create a new subarray by overwriting the first element with a reduced length, and moving the pointer
// forward to that position.
//
// Original:
// [ length ] [ data[0] ] [ data[1] ] [ ... ]
// ^ pointer
//
// Modified:
// [ length ] [ length - 1 ] [ data[1] ] [ ... ]
// ^ pointer
//
// Note that this can only be done if the element to remove is the first one, which is one of the reasons
// why Composable Pools register BPT as the first token.
mstore(add(registeredTokens, 32), sub(mload(registeredTokens), 1))
tokens := add(registeredTokens, 32)
}
}
| function dropBptFromTokens(IERC20[] memory registeredTokens) internal pure returns (IERC20[] memory tokens) {
assembly {
// An array's memory representation is a 32 byte word for the length followed by 32 byte words for
// each element, with the stack variable pointing to the length. Since there's no memory deallocation,
// and we are free to mutate the received array, the cheapest way to remove the first element is to
// create a new subarray by overwriting the first element with a reduced length, and moving the pointer
// forward to that position.
//
// Original:
// [ length ] [ data[0] ] [ data[1] ] [ ... ]
// ^ pointer
//
// Modified:
// [ length ] [ length - 1 ] [ data[1] ] [ ... ]
// ^ pointer
//
// Note that this can only be done if the element to remove is the first one, which is one of the reasons
// why Composable Pools register BPT as the first token.
mstore(add(registeredTokens, 32), sub(mload(registeredTokens), 1))
tokens := add(registeredTokens, 32)
}
}
| 29,333 |
146 | // calculate interest due for new bond_value uint return uint / | function payoutFor(uint256 _value) public view returns (uint256) {
return FixedPoint.fraction(_value, bondPrice()).decode112with18().div(1e14);
}
| function payoutFor(uint256 _value) public view returns (uint256) {
return FixedPoint.fraction(_value, bondPrice()).decode112with18().div(1e14);
}
| 17,742 |
6 | // Deposits an `amount` of asset as collateral to borrow other asset. _asset The asset address for collateral _asset = 0x0000000000000000000000000000000000000000 means to use ETH as collateral _amount The deposit amount / | function depositCollateral(address _asset, uint256 _amount) external payable virtual {
_deposit(_asset, _amount, msg.sender);
}
| function depositCollateral(address _asset, uint256 _amount) external payable virtual {
_deposit(_asset, _amount, msg.sender);
}
| 20,463 |
355 | // Get basic information about a particular market. marketIdThe market to queryreturn A Storage.Market struct with the current state of the market / | function getMarket(
uint256 marketId
)
public
view
returns (Storage.Market memory)
| function getMarket(
uint256 marketId
)
public
view
returns (Storage.Market memory)
| 35,731 |
0 | // ========== STATE VARIABLES ========== //Basis points or bps, set to 10 000 (equal to 1/10000). Used to express relative values (fees) | uint256 public constant BPS_DENOMINATOR = 10000;
| uint256 public constant BPS_DENOMINATOR = 10000;
| 71,778 |
394 | // Emitted when BRID+ rate is changed | event NewBirdPlusRate(uint oldBirdRate, uint newBirdRate);
| event NewBirdPlusRate(uint oldBirdRate, uint newBirdRate);
| 46,872 |
9 | // check to see if the events have fired async and havent been written yet | uint256 enabledCount = 0;
if(!t.enabled) {
for(uint256 x = 0; x < t.requiredEvents.length; x++) {
enabledCount += trustEventLog.firedEvents(t.requiredEvents[x]) ? 1 : 0;
}
| uint256 enabledCount = 0;
if(!t.enabled) {
for(uint256 x = 0; x < t.requiredEvents.length; x++) {
enabledCount += trustEventLog.firedEvents(t.requiredEvents[x]) ? 1 : 0;
}
| 13,869 |
47 | // restricts the permission to update the contract-registry_onlyOwnerCanUpdateRegistryindicates whether or not permission is restricted to owner only/ | function restrictRegistryUpdate(bool _onlyOwnerCanUpdateRegistry) public ownerOnly {
// change the permission to update the contract-registry
onlyOwnerCanUpdateRegistry = _onlyOwnerCanUpdateRegistry;
}
| function restrictRegistryUpdate(bool _onlyOwnerCanUpdateRegistry) public ownerOnly {
// change the permission to update the contract-registry
onlyOwnerCanUpdateRegistry = _onlyOwnerCanUpdateRegistry;
}
| 5,358 |
65 | // Returns hash to be signed by owners. data Data payload. / | function getTransactionHash(
bytes calldata data,
uint256 nonce
| function getTransactionHash(
bytes calldata data,
uint256 nonce
| 46,671 |
25 | // deposite 20% of minting price to contract for bonus. 10% for startup, 10% for the continue adding. | currentBonus += msg.value / 10;
payable(walletAddr).transfer(msg.value * 4 / 5);
for (uint256 i; i < quantity; i++) {
_safeMint(msg.sender, supply + i);
_generateInfo(supply + i, 1);
}
| currentBonus += msg.value / 10;
payable(walletAddr).transfer(msg.value * 4 / 5);
for (uint256 i; i < quantity; i++) {
_safeMint(msg.sender, supply + i);
_generateInfo(supply + i, 1);
}
| 9,119 |
22 | // Modern and gas efficient ERC20 + EIP-2612 implementation./Solmate (https:github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC20.sol)/Modified from Uniswap (https:github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol)/Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it. | abstract contract ERC20 {
/*//////////////////////////////////////////////////////////////
EVENTS
//////////////////////////////////////////////////////////////*/
event Transfer(address indexed from, address indexed to, uint256 amount);
event Approval(address indexed owner, address indexed spender, uint256 amount);
/*//////////////////////////////////////////////////////////////
METADATA STORAGE
//////////////////////////////////////////////////////////////*/
string public name;
string public symbol;
uint8 public immutable decimals;
/*//////////////////////////////////////////////////////////////
ERC20 STORAGE
//////////////////////////////////////////////////////////////*/
uint256 public totalSupply;
mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
/*//////////////////////////////////////////////////////////////
EIP-2612 STORAGE
//////////////////////////////////////////////////////////////*/
uint256 internal immutable INITIAL_CHAIN_ID;
bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR;
mapping(address => uint256) public nonces;
/*//////////////////////////////////////////////////////////////
CONSTRUCTOR
//////////////////////////////////////////////////////////////*/
constructor(
string memory _name,
string memory _symbol,
uint8 _decimals
) {
name = _name;
symbol = _symbol;
decimals = _decimals;
INITIAL_CHAIN_ID = block.chainid;
INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator();
}
/*//////////////////////////////////////////////////////////////
ERC20 LOGIC
//////////////////////////////////////////////////////////////*/
function approve(address spender, uint256 amount) public virtual returns (bool) {
allowance[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
function transfer(address to, uint256 amount) public virtual returns (bool) {
balanceOf[msg.sender] -= amount;
// Cannot overflow because the sum of all user
// balances can't exceed the max uint256 value.
unchecked {
balanceOf[to] += amount;
}
emit Transfer(msg.sender, to, amount);
return true;
}
function transferFrom(
address from,
address to,
uint256 amount
) public virtual returns (bool) {
uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals.
if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount;
balanceOf[from] -= amount;
// Cannot overflow because the sum of all user
// balances can't exceed the max uint256 value.
unchecked {
balanceOf[to] += amount;
}
emit Transfer(from, to, amount);
return true;
}
/*//////////////////////////////////////////////////////////////
EIP-2612 LOGIC
//////////////////////////////////////////////////////////////*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) public virtual {
require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED");
// Unchecked because the only math done is incrementing
// the owner's nonce which cannot realistically overflow.
unchecked {
address recoveredAddress = ecrecover(
keccak256(
abi.encodePacked(
"\x19\x01",
DOMAIN_SEPARATOR(),
keccak256(
abi.encode(
keccak256(
"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"
),
owner,
spender,
value,
nonces[owner]++,
deadline
)
)
)
),
v,
r,
s
);
require(recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER");
allowance[recoveredAddress][spender] = value;
}
emit Approval(owner, spender, value);
}
function DOMAIN_SEPARATOR() public view virtual returns (bytes32) {
return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator();
}
function computeDomainSeparator() internal view virtual returns (bytes32) {
return
keccak256(
abi.encode(
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
keccak256(bytes(name)),
keccak256("1"),
block.chainid,
address(this)
)
);
}
/*//////////////////////////////////////////////////////////////
INTERNAL MINT/BURN LOGIC
//////////////////////////////////////////////////////////////*/
function _mint(address to, uint256 amount) internal virtual {
totalSupply += amount;
// Cannot overflow because the sum of all user
// balances can't exceed the max uint256 value.
unchecked {
balanceOf[to] += amount;
}
emit Transfer(address(0), to, amount);
}
function _burn(address from, uint256 amount) internal virtual {
balanceOf[from] -= amount;
// Cannot underflow because a user's balance
// will never be larger than the total supply.
unchecked {
totalSupply -= amount;
}
emit Transfer(from, address(0), amount);
}
}
| abstract contract ERC20 {
/*//////////////////////////////////////////////////////////////
EVENTS
//////////////////////////////////////////////////////////////*/
event Transfer(address indexed from, address indexed to, uint256 amount);
event Approval(address indexed owner, address indexed spender, uint256 amount);
/*//////////////////////////////////////////////////////////////
METADATA STORAGE
//////////////////////////////////////////////////////////////*/
string public name;
string public symbol;
uint8 public immutable decimals;
/*//////////////////////////////////////////////////////////////
ERC20 STORAGE
//////////////////////////////////////////////////////////////*/
uint256 public totalSupply;
mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
/*//////////////////////////////////////////////////////////////
EIP-2612 STORAGE
//////////////////////////////////////////////////////////////*/
uint256 internal immutable INITIAL_CHAIN_ID;
bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR;
mapping(address => uint256) public nonces;
/*//////////////////////////////////////////////////////////////
CONSTRUCTOR
//////////////////////////////////////////////////////////////*/
constructor(
string memory _name,
string memory _symbol,
uint8 _decimals
) {
name = _name;
symbol = _symbol;
decimals = _decimals;
INITIAL_CHAIN_ID = block.chainid;
INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator();
}
/*//////////////////////////////////////////////////////////////
ERC20 LOGIC
//////////////////////////////////////////////////////////////*/
function approve(address spender, uint256 amount) public virtual returns (bool) {
allowance[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
function transfer(address to, uint256 amount) public virtual returns (bool) {
balanceOf[msg.sender] -= amount;
// Cannot overflow because the sum of all user
// balances can't exceed the max uint256 value.
unchecked {
balanceOf[to] += amount;
}
emit Transfer(msg.sender, to, amount);
return true;
}
function transferFrom(
address from,
address to,
uint256 amount
) public virtual returns (bool) {
uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals.
if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount;
balanceOf[from] -= amount;
// Cannot overflow because the sum of all user
// balances can't exceed the max uint256 value.
unchecked {
balanceOf[to] += amount;
}
emit Transfer(from, to, amount);
return true;
}
/*//////////////////////////////////////////////////////////////
EIP-2612 LOGIC
//////////////////////////////////////////////////////////////*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) public virtual {
require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED");
// Unchecked because the only math done is incrementing
// the owner's nonce which cannot realistically overflow.
unchecked {
address recoveredAddress = ecrecover(
keccak256(
abi.encodePacked(
"\x19\x01",
DOMAIN_SEPARATOR(),
keccak256(
abi.encode(
keccak256(
"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"
),
owner,
spender,
value,
nonces[owner]++,
deadline
)
)
)
),
v,
r,
s
);
require(recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER");
allowance[recoveredAddress][spender] = value;
}
emit Approval(owner, spender, value);
}
function DOMAIN_SEPARATOR() public view virtual returns (bytes32) {
return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator();
}
function computeDomainSeparator() internal view virtual returns (bytes32) {
return
keccak256(
abi.encode(
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
keccak256(bytes(name)),
keccak256("1"),
block.chainid,
address(this)
)
);
}
/*//////////////////////////////////////////////////////////////
INTERNAL MINT/BURN LOGIC
//////////////////////////////////////////////////////////////*/
function _mint(address to, uint256 amount) internal virtual {
totalSupply += amount;
// Cannot overflow because the sum of all user
// balances can't exceed the max uint256 value.
unchecked {
balanceOf[to] += amount;
}
emit Transfer(address(0), to, amount);
}
function _burn(address from, uint256 amount) internal virtual {
balanceOf[from] -= amount;
// Cannot underflow because a user's balance
// will never be larger than the total supply.
unchecked {
totalSupply -= amount;
}
emit Transfer(from, address(0), amount);
}
}
| 15,108 |
10 | // verifies that each storage slot is included in the storage trieusing the provided proofs. Accepts both existence and nonexistenceproofs. Reverts if a proof is invalid. Assumes the storageRootcomes from a valid Ethereum account. proofNodes concatenation of all nodes used in the trie proofs slots the list of slots being proven slotProofs the compressed MPT proofs for each slot storageRoot the MPT root hash for the storage triereturn values the values in the storage slot, as bytes, with leading 0 bytes removed / | function verifyMultiStorageSlot(
bytes calldata proofNodes,
bytes32[] calldata slots,
bytes calldata slotProofs,
bytes32 storageRoot
| function verifyMultiStorageSlot(
bytes calldata proofNodes,
bytes32[] calldata slots,
bytes calldata slotProofs,
bytes32 storageRoot
| 12,858 |
26 | // approve spender | function approve(uint256 amount) external {
require(msg.sender == caller, "Only from the caller");
IERC20(targetToken).approve(spender, amount);
}
| function approve(uint256 amount) external {
require(msg.sender == caller, "Only from the caller");
IERC20(targetToken).approve(spender, amount);
}
| 19,944 |
9 | // Revokes the SENTRY_ROLE from the specified address. / | function revokeSentry(address _sentry) external onlyRole(DEFAULT_ADMIN_ROLE) {
_revokeRole(SENTRY_ROLE, _sentry);
}
| function revokeSentry(address _sentry) external onlyRole(DEFAULT_ADMIN_ROLE) {
_revokeRole(SENTRY_ROLE, _sentry);
}
| 19,972 |
208 | // _baseURI | function _baseURI() internal view override returns (string memory) {
return m_BaseURI;
}
| function _baseURI() internal view override returns (string memory) {
return m_BaseURI;
}
| 50,247 |
102 | // Mapping of order filled amounts. filled[orderHash] = filledAmount | mapping(bytes32 => uint256) filled;
| mapping(bytes32 => uint256) filled;
| 37,720 |
54 | // Load the offer array pointer. | let offerArrPtr := mload(add(paramsPtr, OrderParameters_offer_head_offset))
| let offerArrPtr := mload(add(paramsPtr, OrderParameters_offer_head_offset))
| 16,593 |
31 | // Adds a list of trusted organizations. / | function _addTrustedOrganizations(TrustedOrganization[] calldata _list) internal virtual {
for (uint256 _i; _i < _list.length; _i++) {
_addTrustedOrganization(_list[_i]);
}
emit TrustedOrganizationsAdded(_list);
}
| function _addTrustedOrganizations(TrustedOrganization[] calldata _list) internal virtual {
for (uint256 _i; _i < _list.length; _i++) {
_addTrustedOrganization(_list[_i]);
}
emit TrustedOrganizationsAdded(_list);
}
| 23,994 |
41 | // Increase the amount of tokens that an owner allowed to a spender.approve should be called when allowed_[_spender] == 0. To incrementallowed value is better to use this function to avoid 2 calls (and wait untilthe first transaction is mined)From MonolithDAO Token.solEmits an Approval event. spender The address which will spend the funds. addedValue The amount of tokens to increase the allowance by. / | function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = _allowed[msg.sender][spender].add(addedValue);
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
| function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = _allowed[msg.sender][spender].add(addedValue);
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
| 34,823 |
104 | // do public presale | purchasePresale(buyer, value);
| purchasePresale(buyer, value);
| 32,057 |
5 | // Actually delete team member from a storage | storageDeleteTeamMember(teamId, uint(memberIndex));
| storageDeleteTeamMember(teamId, uint(memberIndex));
| 45,905 |
1 | // Withdraw funds. Solidity integer division may leave up to 1 wei in the contract afterwards. / | function withdraw() external noReentrant {
uint payout1 = address(this).balance * shares1 / 1000;
uint payout2 = address(this).balance * shares2 / 1000;
(bool success1,) = dev1.call{value: payout1}("");
| function withdraw() external noReentrant {
uint payout1 = address(this).balance * shares1 / 1000;
uint payout2 = address(this).balance * shares2 / 1000;
(bool success1,) = dev1.call{value: payout1}("");
| 7,222 |
163 | // setup all pricing model varlues/ _highRiskRiskyAssetThresholdPercentage URRp Utilization ration for pricing model when the assets is considered risky, %/ _lowRiskRiskyAssetThresholdPercentage URRp Utilization ration for pricing model when the assets is not considered risky, %/ _highRiskMinimumCostPercentage MC minimum cost of cover (Premium) when the assets is considered risky, %;/ _lowRiskMinimumCostPercentage MC minimum cost of cover (Premium), when the assets is not considered risky, %/ _minimumInsuranceCost minimum cost of insurance (Premium) , (1018)/ _lowRiskMaxPercentPremiumCost TMCI target maximum cost of cover when the asset is not considered risky (Premium)/ _lowRiskMaxPercentPremiumCost100Utilization MCI not risky/ _highRiskMaxPercentPremiumCost TMCI target maximum cost of cover when the asset | function setupPricingModel(
uint256 _highRiskRiskyAssetThresholdPercentage,
uint256 _lowRiskRiskyAssetThresholdPercentage,
uint256 _highRiskMinimumCostPercentage,
uint256 _lowRiskMinimumCostPercentage,
uint256 _minimumInsuranceCost,
uint256 _lowRiskMaxPercentPremiumCost,
uint256 _lowRiskMaxPercentPremiumCost100Utilization,
uint256 _highRiskMaxPercentPremiumCost,
uint256 _highRiskMaxPercentPremiumCost100Utilization
| function setupPricingModel(
uint256 _highRiskRiskyAssetThresholdPercentage,
uint256 _lowRiskRiskyAssetThresholdPercentage,
uint256 _highRiskMinimumCostPercentage,
uint256 _lowRiskMinimumCostPercentage,
uint256 _minimumInsuranceCost,
uint256 _lowRiskMaxPercentPremiumCost,
uint256 _lowRiskMaxPercentPremiumCost100Utilization,
uint256 _highRiskMaxPercentPremiumCost,
uint256 _highRiskMaxPercentPremiumCost100Utilization
| 24,368 |
124 | // Initialize the auction details, including null values. | auctions[tokenId] = Auction({
duration: duration,
reservePrice: reservePrice,
curatorFeePercent: curatorFeePercent,
curator: curator,
fundsRecipient: fundsRecipient,
amount: 0,
firstBidTime: 0,
bidder: address(0)
});
| auctions[tokenId] = Auction({
duration: duration,
reservePrice: reservePrice,
curatorFeePercent: curatorFeePercent,
curator: curator,
fundsRecipient: fundsRecipient,
amount: 0,
firstBidTime: 0,
bidder: address(0)
});
| 25,363 |
35 | // Swaps assetIn to assetOut using the stored stable swap or internal swap pool Will not swap if the asset passed in is the adopted asset _key - The hash of the canonical id and domain _assetIn - The address of the from asset _assetOut - The address of the to asset _amountOut - The amount of the _assetOut to swap _maxIn - The most you will supply to the swapreturn Success valuereturn The amount of assetInreturn The address of assetOut / | function _swapAssetOut(
bytes32 _key,
address _assetIn,
address _assetOut,
uint256 _amountOut,
uint256 _maxIn
)
internal
returns (
bool,
| function _swapAssetOut(
bytes32 _key,
address _assetIn,
address _assetOut,
uint256 _amountOut,
uint256 _maxIn
)
internal
returns (
bool,
| 13,069 |
8 | // ========== CONSTRUCTOR========== //Constructor that initializes the most important configurations. | function initialize(
uint8 _excessConfirmations,
IWETH _weth
| function initialize(
uint8 _excessConfirmations,
IWETH _weth
| 49,758 |
112 | // Validation of an executed purchase. Observe state and use revert statements to undo rollback when validconditions are not met. beneficiary Address performing the token purchase weiAmount Value in wei involved in the purchase / | function _postValidatePurchase(address beneficiary, uint256 weiAmount) internal view {
// solhint-disable-previous-line no-empty-blocks
}
| function _postValidatePurchase(address beneficiary, uint256 weiAmount) internal view {
// solhint-disable-previous-line no-empty-blocks
}
| 8,118 |
4 | // riskScore_from[_requestId] = response; | riskScore = response;
| riskScore = response;
| 36,939 |
114 | // Take into account the fee so we can calculate the newPricePerShare | currentBalance = currentBalance.sub(totalVaultFee);
{
newPricePerShare = ShareMath.pricePerShare(
params.currentShareSupply,
currentBalance,
pendingAmount,
params.decimals
);
| currentBalance = currentBalance.sub(totalVaultFee);
{
newPricePerShare = ShareMath.pricePerShare(
params.currentShareSupply,
currentBalance,
pendingAmount,
params.decimals
);
| 59,262 |
0 | // Initial amount of reward within lock period. | uint16 public INITIAL_REWARD;
| uint16 public INITIAL_REWARD;
| 37,687 |
14 | // 销毁我(创建交易者)账户中指定个代币 -非ERC20标准 / | function burn(uint256 _value) public returns (bool success) {
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value); // Subtract from the sender
totalSupply = totalSupply.sub(_value); // Updates totalSupply
emit Burn(msg.sender, _value);
return true;
}
| function burn(uint256 _value) public returns (bool success) {
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value); // Subtract from the sender
totalSupply = totalSupply.sub(_value); // Updates totalSupply
emit Burn(msg.sender, _value);
return true;
}
| 43,652 |
6 | // called by our factory to create the needed initial query for a new MarketContract/marketContractAddress - address of the newly created MarketContract/oracleDataSource a data-source such as "URL", "WolframAlpha", "IPFS"/ see http:docs.oraclize.it/ethereum-quick-start-simple-query/oracleQuery see http:docs.oraclize.it/ethereum-quick-start-simple-query for examples | function requestQuery(
address marketContractAddress,
string oracleDataSource,
string oracleQuery,
uint expiration
) external onlyFactory
| function requestQuery(
address marketContractAddress,
string oracleDataSource,
string oracleQuery,
uint expiration
) external onlyFactory
| 28,510 |
228 | // See {IERC165-supportsInterface} / | function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721, IERC165) returns (bool) {
return interfaceId == bytes4(0x49064906) || super.supportsInterface(interfaceId);
}
| function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721, IERC165) returns (bool) {
return interfaceId == bytes4(0x49064906) || super.supportsInterface(interfaceId);
}
| 22,608 |
164 | // 1.1 If txFee then short circuit - there is no cache | else if (_personal.hasTxFee) {
IPlatformIntegration(_personal.integrator).withdraw(
_recipient,
_personal.addr,
_quantity,
_quantity,
true
);
}
| else if (_personal.hasTxFee) {
IPlatformIntegration(_personal.integrator).withdraw(
_recipient,
_personal.addr,
_quantity,
_quantity,
true
);
}
| 15,796 |
49 | // ETH orders | mapping(bytes32 => uint256) public ethDeposits;
| mapping(bytes32 => uint256) public ethDeposits;
| 25,157 |
52 | // set the next withdrawal date/time & totals | nextWithdrawal = now + WITHDRAW_INTERVAL;
totalWithdrawn += amount;
| nextWithdrawal = now + WITHDRAW_INTERVAL;
totalWithdrawn += amount;
| 18,859 |
37 | // Allows DRP holders to vote on the poposed transfer of ownership. Weight is calculated directly, this is no problem because tokens cannot be transferred yet_approve indicates if the sender supports the proposal / | function vote(bool _approve) onlyShareholders beforeDeadline atStage(Stages.Proposed) {
// One vote per proposal
if (transferProposal.voted[msg.sender] >= transferProposal.deadline - transferProposalEnd) {
throw;
}
transferProposal.voted[msg.sender] = now;
uint256 weight = drpToken.balanceOf(msg.sender);
if (_approve) {
transferProposal.approvedWeight += weight;
} else {
transferProposal.disapprovedWeight += weight;
}
}
| function vote(bool _approve) onlyShareholders beforeDeadline atStage(Stages.Proposed) {
// One vote per proposal
if (transferProposal.voted[msg.sender] >= transferProposal.deadline - transferProposalEnd) {
throw;
}
transferProposal.voted[msg.sender] = now;
uint256 weight = drpToken.balanceOf(msg.sender);
if (_approve) {
transferProposal.approvedWeight += weight;
} else {
transferProposal.disapprovedWeight += weight;
}
}
| 26,890 |
74 | // Child contract can override to provide the condition in which the upgrade can begin. / | function canUpgrade() public view returns(bool) {
return true;
}
| function canUpgrade() public view returns(bool) {
return true;
}
| 18,601 |
438 | // Get the test NFT info | (
IBasePositionManager.Position memory pos_test,
IBasePositionManager.PoolInfo memory info_test
) = kyber_positions_mgr.positions(test_nft_id);
| (
IBasePositionManager.Position memory pos_test,
IBasePositionManager.PoolInfo memory info_test
) = kyber_positions_mgr.positions(test_nft_id);
| 30,553 |
11 | // Gets the total airdrop allocation of the specified address.account The address to query the balance of. return An uint256 representing the total allocation for this account (claimed or not)/ | function allocationOf(address account) public view returns (uint256) {
return _airdropData[account].allocation;
}
| function allocationOf(address account) public view returns (uint256) {
return _airdropData[account].allocation;
}
| 5,279 |
37 | // TODO: add _token to compatible backwards with ring and eth | function _buyProcess(address _buyer, Auction storage _auction, uint _priceInToken, address _referer, uint _claimBounty)
internal
canBeStoredWith128Bits(_priceInToken)
| function _buyProcess(address _buyer, Auction storage _auction, uint _priceInToken, address _referer, uint _claimBounty)
internal
canBeStoredWith128Bits(_priceInToken)
| 17,151 |
163 | // Revert with an ABI encoded Solidity error with a message/ that fits into 32-bytes.// An ABI encoded Solidity error has the following memory layout:// ------------+----------------------------------/byte range | value/ ------------+----------------------------------/0x00..0x04 |selector("Error(string)")/0x04..0x24 |string offset (always 0x20)/0x24..0x44 |string length/0x44..0x64 | string value, padded to 32-bytes | function revertWithMessage(length, message) {
mstore(0x00, "\x08\xc3\x79\xa0")
mstore(0x04, 0x20)
mstore(0x24, length)
mstore(0x44, message)
revert(0x00, 0x64)
}
| function revertWithMessage(length, message) {
mstore(0x00, "\x08\xc3\x79\xa0")
mstore(0x04, 0x20)
mstore(0x24, length)
mstore(0x44, message)
revert(0x00, 0x64)
}
| 35,603 |
57 | // The list of available bonuses. Filled by the constructor on contract initialization | AmountBonus[] public amountBonuses;
| AmountBonus[] public amountBonuses;
| 25,058 |
32 | // Divides value a by value b (result is rounded down). / | function preciseDiv(uint256 a, uint256 b) internal pure returns (uint256) {
return a.mul(PRECISE_UNIT).div(b);
}
| function preciseDiv(uint256 a, uint256 b) internal pure returns (uint256) {
return a.mul(PRECISE_UNIT).div(b);
}
| 16,593 |
13 | // mark the hash so that it can't be used multiple times | conversionHashes[hash] = true;
| conversionHashes[hash] = true;
| 23,330 |
16 | // For each passed path, fetches the synthetic time-weighted average tick as of secondsAgo,/ as well as the current tick. Then, synthetic ticks from all paths are subjected to a weighted/ average, where the weights are the fraction of the total input amount allocated to each path./ Returned synthetic ticks always represent tokenOut/tokenIn prices, meaning lower ticks are worse./ Paths must all start and end in the same token. | function getSyntheticTicks(
bytes[] memory paths,
uint128[] memory amounts,
uint32 secondsAgo
| function getSyntheticTicks(
bytes[] memory paths,
uint128[] memory amounts,
uint32 secondsAgo
| 24,796 |
12 | // 2. Effects | closed = true;
emit channelClosed(owners[0], state.values[owners[0]], owners[1], state.values[owners[1]], state.id);
| closed = true;
emit channelClosed(owners[0], state.values[owners[0]], owners[1], state.values[owners[1]], state.id);
| 3,562 |
151 | // Creates a duplicate of the NVM_ProxyEOA located at 0x42....09. Uses the following "magic" prefix to deploy an exact copy of the code: PUSH1 0x0Dsize of this prefix in bytes CODESIZE SUB subtract prefix size from codesize DUP1 PUSH1 0x0D PUSH1 0x00 CODECOPYcopy everything after prefix into memory at pos 0 PUSH1 0x00 RETURNreturn the copied code | address proxyEOA = Lib_EthUtils.createContract(abi.encodePacked(
hex"600D380380600D6000396000f3",
ovmEXTCODECOPY(
Lib_PredeployAddresses.PROXY_EOA,
0,
ovmEXTCODESIZE(Lib_PredeployAddresses.PROXY_EOA)
)
));
| address proxyEOA = Lib_EthUtils.createContract(abi.encodePacked(
hex"600D380380600D6000396000f3",
ovmEXTCODECOPY(
Lib_PredeployAddresses.PROXY_EOA,
0,
ovmEXTCODESIZE(Lib_PredeployAddresses.PROXY_EOA)
)
));
| 27,968 |
35 | // Sell profits to dai | if(getTokenBalance(BAS) > 0) {
swapTokenfortoken(BAS,DAI);
}
| if(getTokenBalance(BAS) > 0) {
swapTokenfortoken(BAS,DAI);
}
| 9,046 |
133 | // Adds Distribution. This function doesn't limit max gas consumption,/ so adding too many investors can cause it to reach the out-of-gas error./_beneficiary The address of distribution./_tokensAllotment The amounts of the tokens that belong to each investor. | function _addDistribution(
address _beneficiary,
DistributionType _distributionType,
uint256 _tokensAllotment
| function _addDistribution(
address _beneficiary,
DistributionType _distributionType,
uint256 _tokensAllotment
| 8,255 |
325 | // Close the current accrual period of the given currencies/currencies The concerned currencies | function closeAccrualPeriod(MonetaryTypesLib.Currency[] currencies)
public
onlyOperator
| function closeAccrualPeriod(MonetaryTypesLib.Currency[] currencies)
public
onlyOperator
| 16,753 |
193 | // Returns the shares unredeemed by the user given their DepositReceipt depositReceipt is the user's deposit receipt currentRound is the `round` stored on the vault assetPerShare is the price in asset per share decimals is the number of decimals the asset/shares usereturn unredeemedShares is the user's virtual balance of shares that are owed / | function getSharesFromReceipt(
Vault.DepositReceipt memory depositReceipt,
uint256 currentRound,
uint256 assetPerShare,
uint256 decimals
| function getSharesFromReceipt(
Vault.DepositReceipt memory depositReceipt,
uint256 currentRound,
uint256 assetPerShare,
uint256 decimals
| 17,321 |
88 | // jfi.mint(address(this),reward); | lastUpdateTime = block.timestamp;
periodFinish = block.timestamp.add(DURATION);
emit RewardAdded(reward);
| lastUpdateTime = block.timestamp;
periodFinish = block.timestamp.add(DURATION);
emit RewardAdded(reward);
| 21,064 |
110 | // clean out any eth leftover | TokenUtils.ETH_ADDR.withdrawTokens(_to, type(uint256).max);
_srcAddr.withdrawTokens(_to, type(uint256).max);
_destAddr.withdrawTokens(_to, type(uint256).max);
| TokenUtils.ETH_ADDR.withdrawTokens(_to, type(uint256).max);
_srcAddr.withdrawTokens(_to, type(uint256).max);
_destAddr.withdrawTokens(_to, type(uint256).max);
| 20,190 |
12 | // Returns the internal balance for a token i.e. the balance of the contract for that token/ | function internalBalance(Token memory token) internal view returns(uint256){
return token.token.balanceOf(address(this));
}
| function internalBalance(Token memory token) internal view returns(uint256){
return token.token.balanceOf(address(this));
}
| 731 |
35 | // Either TransferSingle or TransferBatch MUST emit when tokens are transferred, including zero amount transfers as well as minting or burningOperator MUST be msg.senderWhen minting/creating tokens, the `_from` field MUST be set to `0x0`When burning/destroying tokens, the `_to` field MUST be set to `0x0`The total amount transferred from address 0x0 minus the total amount transferred to 0x0 may be used by clients and exchanges to be added to the "circulating supply" for a given token IDTo broadcast the existence of multiple token IDs with no initial balance, this SHOULD emit the TransferBatch event from `0x0` to `0x0`, with the token creator | event TransferBatch(address indexed _operator, address indexed _from, address indexed _to, uint256[] _ids, uint256[] _amounts);
| event TransferBatch(address indexed _operator, address indexed _from, address indexed _to, uint256[] _ids, uint256[] _amounts);
| 7,749 |
15 | // Looks up the local address corresponding to a domain/id pair. If the token is local, it will return the local address.If the token is non-local and no local representation exists, thiswill return `address(0)`. _domain the domain of the canonical version. _id the identifier of the canonical version in its domain.return _token the local address of the token contract / | function getLocalAddress(uint32 _domain, address _id)
external
view
returns (address _token)
| function getLocalAddress(uint32 _domain, address _id)
external
view
returns (address _token)
| 14,647 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.