contract_name
stringlengths
1
61
file_path
stringlengths
5
50.4k
contract_address
stringlengths
42
42
language
stringclasses
1 value
class_name
stringlengths
1
61
class_code
stringlengths
4
330k
class_documentation
stringlengths
0
29.1k
class_documentation_type
stringclasses
6 values
func_name
stringlengths
0
62
func_code
stringlengths
1
303k
func_documentation
stringlengths
2
14.9k
func_documentation_type
stringclasses
4 values
compiler_version
stringlengths
15
42
license_type
stringclasses
14 values
swarm_source
stringlengths
0
71
meta
dict
__index_level_0__
int64
0
60.4k
Skraps
Skraps.sol
0xfdfe8b7ab6cf1bd1e3d14538ef40686296c42052
Solidity
Crowdsale
contract Crowdsale is AdvancedToken { uint internal endOfFreeze = 1522569600; // Sun, 01 Apr 2018 00:00:00 PST uint private tokensForSalePhase2; uint public tokensPerEther; address internal reserve = 0x4B046B05C29E535E152A3D9c8FB7540a8e15c7A6; function Crowdsale() internal { assert...
closeICO
function closeICO() public onlyOwner { require(state == State.ICO); state = State.Running; NewState(state); }
// Since a contracts can not call itself, we must manually close the ICO
LineComment
v0.4.20+commit.3155dd80
bzzr://b8ece78acfc7f5a80fe3a6dc139e5772225c589ca46f007597d561ab2ab3e5e4
{ "func_code_index": [ 2757, 2903 ] }
57,961
Skraps
Skraps.sol
0xfdfe8b7ab6cf1bd1e3d14538ef40686296c42052
Solidity
Crowdsale
contract Crowdsale is AdvancedToken { uint internal endOfFreeze = 1522569600; // Sun, 01 Apr 2018 00:00:00 PST uint private tokensForSalePhase2; uint public tokensPerEther; address internal reserve = 0x4B046B05C29E535E152A3D9c8FB7540a8e15c7A6; function Crowdsale() internal { assert...
refundTokens
function refundTokens(address _from, uint _value) public onlyOwner { require(state == State.ICO); require(balances[_from] >= _value); balances[_from] = balances[_from].sub(_value); balances[address(this)] = balances[address(this)].add(_value); Transfer(_from, address(this), _value); }
// Anti-scam function, if the tokens are obtained by dishonest means, can be used only during ICO
LineComment
v0.4.20+commit.3155dd80
bzzr://b8ece78acfc7f5a80fe3a6dc139e5772225c589ca46f007597d561ab2ab3e5e4
{ "func_code_index": [ 3009, 3349 ] }
57,962
MetaZooGames
contracts/MetaZooGames.sol
0x2d366be8fa4d15c289964dd4adf7be6cc5e896e8
Solidity
MetaZooGames
contract MetaZooGames is ERC721Enumerable, Ownable { using Strings for uint256; uint256 public sales_end; modifier onlyAllowed() { require( permitted[msg.sender] || (msg.sender == owner()), "Unauthorised" ); _; } constructor(uint256 _sales_start) ERC...
//// @author: Blockchain platform powered by Ether Cards - https://ether.cards
NatSpecSingleLine
setAllowed
function setAllowed(address _addr, bool _state) external onlyOwner { permitted[_addr] = _state; }
// https://metazoo-metadata-server.herokuapp.com/api/metadata/<id>
LineComment
v0.8.0+commit.c7dfd78e
{ "func_code_index": [ 1790, 1903 ] }
57,963
StrategyStEth
contracts/strategies/StrategyStEth.sol
0x2cf1ab3a110ed495e38df9b5f67ee2381c7bb572
Solidity
StrategyStEth
contract StrategyStEth is StrategyETH { // Uniswap // address private constant UNISWAP = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; address private constant SUSHI = 0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F; address private constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; // Curv...
_deposit
function _deposit() internal override { uint bal = address(this).balance; if (bal > 0) { uint stEthAmount = _getStEthDepositAmount(bal); if (stEthAmount > 0) { StETH(ST_ETH).submit{value: stEthAmount}(address(this)); } uint ethBal = address(this).balance; ...
/* @notice Deposits ETH to LiquidityGaugeV2 */
Comment
v0.6.11+commit.5ef660b1
Unknown
ipfs://b6ba645a470307459caa5d8c87e70ea0efd7f2cce82473b17587258c4c8803be
{ "func_code_index": [ 3739, 4996 ] }
57,964
StrategyStEth
contracts/strategies/StrategyStEth.sol
0x2cf1ab3a110ed495e38df9b5f67ee2381c7bb572
Solidity
StrategyStEth
contract StrategyStEth is StrategyETH { // Uniswap // address private constant UNISWAP = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; address private constant SUSHI = 0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F; address private constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; // Curv...
_swapToEth
function _swapToEth(address _from, uint _amount) private { // create dynamic array with 2 elements address[] memory path = new address[](2); path[0] = _from; path[1] = WETH; Uniswap(SUSHI).swapExactTokensForETH( _amount, 1, path, address(this), blo...
/* @dev SUSHI fails with zero address so no check is necessary here */
Comment
v0.6.11+commit.5ef660b1
Unknown
ipfs://b6ba645a470307459caa5d8c87e70ea0efd7f2cce82473b17587258c4c8803be
{ "func_code_index": [ 5854, 6250 ] }
57,965
StrategyStEth
contracts/strategies/StrategyStEth.sol
0x2cf1ab3a110ed495e38df9b5f67ee2381c7bb572
Solidity
StrategyStEth
contract StrategyStEth is StrategyETH { // Uniswap // address private constant UNISWAP = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; address private constant SUSHI = 0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F; address private constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; // Curv...
harvest
function harvest() external override onlyAuthorized { _claimRewards(); uint bal = address(this).balance; if (bal > 0) { // transfer fee to treasury uint fee = bal.mul(performanceFee) / PERFORMANCE_FEE_MAX; if (fee > 0) { address treasury = IController(controller)...
/* @notice Claim CRV and deposit most premium token into Curve */
Comment
v0.6.11+commit.5ef660b1
Unknown
ipfs://b6ba645a470307459caa5d8c87e70ea0efd7f2cce82473b17587258c4c8803be
{ "func_code_index": [ 6855, 7527 ] }
57,966
StrategyStEth
contracts/strategies/StrategyStEth.sol
0x2cf1ab3a110ed495e38df9b5f67ee2381c7bb572
Solidity
StrategyStEth
contract StrategyStEth is StrategyETH { // Uniswap // address private constant UNISWAP = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; address private constant SUSHI = 0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F; address private constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; // Curv...
exit
function exit() external override onlyAuthorized { if (forceExit) { return; } _claimRewards(); _withdrawAll(); }
/* @notice Exit strategy by harvesting CRV to underlying token and then withdrawing all underlying to vault @dev Must return all underlying token to vault @dev Caller should implement guard agains slippage */
Comment
v0.6.11+commit.5ef660b1
Unknown
ipfs://b6ba645a470307459caa5d8c87e70ea0efd7f2cce82473b17587258c4c8803be
{ "func_code_index": [ 7777, 7948 ] }
57,967
TutellusPartnerCrowdsale
contracts/TokenVesting.sol
0x65bcf8de5c59ee18a69733759c3b8040416c8fa2
Solidity
TokenVesting
contract TokenVesting is Ownable { using SafeMath for uint256; using SafeERC20 for ERC20Basic; event KYCValid(address beneficiary); event Released(uint256 amount); event Revoked(); // beneficiary of tokens after they are released address public beneficiary; uint256 public cliff; uint256...
/** * @title TokenVesting * @dev A token holder contract that can release its token balance gradually like a * typical vesting scheme, with a cliff and vesting period. Optionally revocable by the * owner. */
NatSpecMultiLine
TokenVesting
function TokenVesting(address _beneficiary, uint256 _start, uint256 _cliff, uint256 _duration, bool _revocable) public { require(_beneficiary != address(0)); require(_cliff <= _duration); beneficiary = _beneficiary; revocable = _revocable; duration = _duration; cliff = _start.add(_cliff); start =...
/** * @dev Creates a vesting contract that vests its balance of any ERC20 token to the * _beneficiary, gradually in a linear fashion until _start + _duration. By then all * of the balance will have vested. * @param _beneficiary address of the beneficiary to whom vested tokens are transferred * @param _cliff d...
NatSpecMultiLine
v0.4.15+commit.bbb8e64f
bzzr://f756ca5d67067c854166a83cf1ccb99adca0788bb88a0aab7e3b1d845ead5c4e
{ "func_code_index": [ 1099, 1449 ] }
57,968
TutellusPartnerCrowdsale
contracts/TokenVesting.sol
0x65bcf8de5c59ee18a69733759c3b8040416c8fa2
Solidity
TokenVesting
contract TokenVesting is Ownable { using SafeMath for uint256; using SafeERC20 for ERC20Basic; event KYCValid(address beneficiary); event Released(uint256 amount); event Revoked(); // beneficiary of tokens after they are released address public beneficiary; uint256 public cliff; uint256...
/** * @title TokenVesting * @dev A token holder contract that can release its token balance gradually like a * typical vesting scheme, with a cliff and vesting period. Optionally revocable by the * owner. */
NatSpecMultiLine
release
function release(ERC20Basic token) public { require(kycValid); uint256 unreleased = releasableAmount(token); require(unreleased > 0); released[token] = released[token].add(unreleased); token.safeTransfer(beneficiary, unreleased); Released(unreleased); }
/** * @notice Transfers vested tokens to beneficiary. * @param token ERC20 token which is being vested */
NatSpecMultiLine
v0.4.15+commit.bbb8e64f
bzzr://f756ca5d67067c854166a83cf1ccb99adca0788bb88a0aab7e3b1d845ead5c4e
{ "func_code_index": [ 1573, 1870 ] }
57,969
TutellusPartnerCrowdsale
contracts/TokenVesting.sol
0x65bcf8de5c59ee18a69733759c3b8040416c8fa2
Solidity
TokenVesting
contract TokenVesting is Ownable { using SafeMath for uint256; using SafeERC20 for ERC20Basic; event KYCValid(address beneficiary); event Released(uint256 amount); event Revoked(); // beneficiary of tokens after they are released address public beneficiary; uint256 public cliff; uint256...
/** * @title TokenVesting * @dev A token holder contract that can release its token balance gradually like a * typical vesting scheme, with a cliff and vesting period. Optionally revocable by the * owner. */
NatSpecMultiLine
revoke
function revoke(ERC20Basic token) public onlyOwner { require(revocable); require(!revoked[token]); uint256 balance = token.balanceOf(this); uint256 unreleased = releasableAmount(token); uint256 refund = balance.sub(unreleased); revoked[token] = true; token.safeTransfer(owner, refund); ...
/** * @notice Allows the owner to revoke the vesting. Tokens already vested * remain in the contract, the rest are returned to the owner. * @param token ERC20 token which is being vested */
NatSpecMultiLine
v0.4.15+commit.bbb8e64f
bzzr://f756ca5d67067c854166a83cf1ccb99adca0788bb88a0aab7e3b1d845ead5c4e
{ "func_code_index": [ 2082, 2436 ] }
57,970
TutellusPartnerCrowdsale
contracts/TokenVesting.sol
0x65bcf8de5c59ee18a69733759c3b8040416c8fa2
Solidity
TokenVesting
contract TokenVesting is Ownable { using SafeMath for uint256; using SafeERC20 for ERC20Basic; event KYCValid(address beneficiary); event Released(uint256 amount); event Revoked(); // beneficiary of tokens after they are released address public beneficiary; uint256 public cliff; uint256...
/** * @title TokenVesting * @dev A token holder contract that can release its token balance gradually like a * typical vesting scheme, with a cliff and vesting period. Optionally revocable by the * owner. */
NatSpecMultiLine
releasableAmount
function releasableAmount(ERC20Basic token) public returns (uint256) { return vestedAmount(token).sub(released[token]); }
/** * @dev Calculates the amount that has already vested but hasn't been released yet. * @param token ERC20 token which is being vested */
NatSpecMultiLine
v0.4.15+commit.bbb8e64f
bzzr://f756ca5d67067c854166a83cf1ccb99adca0788bb88a0aab7e3b1d845ead5c4e
{ "func_code_index": [ 2593, 2725 ] }
57,971
TutellusPartnerCrowdsale
contracts/TokenVesting.sol
0x65bcf8de5c59ee18a69733759c3b8040416c8fa2
Solidity
TokenVesting
contract TokenVesting is Ownable { using SafeMath for uint256; using SafeERC20 for ERC20Basic; event KYCValid(address beneficiary); event Released(uint256 amount); event Revoked(); // beneficiary of tokens after they are released address public beneficiary; uint256 public cliff; uint256...
/** * @title TokenVesting * @dev A token holder contract that can release its token balance gradually like a * typical vesting scheme, with a cliff and vesting period. Optionally revocable by the * owner. */
NatSpecMultiLine
vestedAmount
function vestedAmount(ERC20Basic token) public returns (uint256) { uint256 currentBalance = token.balanceOf(this); uint256 totalBalance = currentBalance.add(released[token]); if (now < cliff) { return 0; } else if (now >= start.add(duration) || revoked[token]) { return totalBalance; } else { ...
/** * @dev Calculates the amount that has already vested. * @param token ERC20 token which is being vested */
NatSpecMultiLine
v0.4.15+commit.bbb8e64f
bzzr://f756ca5d67067c854166a83cf1ccb99adca0788bb88a0aab7e3b1d845ead5c4e
{ "func_code_index": [ 2853, 3263 ] }
57,972
HumansFactoryPass
/contracts/HumansFactoryPass.sol
0x5f6809f90b6ca15663b1fd791d548631df3664a8
Solidity
HumansFactoryPass
contract HumansFactoryPass is ERC1155Supply, Ownable, PaymentSplitter, ReentrancyGuard { using ECDSA for bytes32; using Strings for uint256; using Address for address payable; struct saleParams { string name; bool requireSignature; uint256 startTime; uint256 endTime; ...
// @author: Array // dsc: Array#0007 // tw: @arraythedev // Contact me on twitter
LineComment
_setBaseURI
function _setBaseURI(string memory _newBaseURI) public onlyOwner { baseURI = _newBaseURI; }
// ADMIN
LineComment
v0.8.9+commit.e5eed63a
{ "func_code_index": [ 1926, 2033 ] }
57,973
HumansFactoryPass
/contracts/HumansFactoryPass.sol
0x5f6809f90b6ca15663b1fd791d548631df3664a8
Solidity
HumansFactoryPass
contract HumansFactoryPass is ERC1155Supply, Ownable, PaymentSplitter, ReentrancyGuard { using ECDSA for bytes32; using Strings for uint256; using Address for address payable; struct saleParams { string name; bool requireSignature; uint256 startTime; uint256 endTime; ...
// @author: Array // dsc: Array#0007 // tw: @arraythedev // Contact me on twitter
LineComment
airdrop
function airdrop( address _to, uint256 _nb, uint256 _tokenId ) external onlyOwner { require(totalSupply(_tokenId) + _nb <= maxSupplyOf(_tokenId), "HF: Not enough tokens left."); _mint(_to, _tokenId, _nb, ""); }
// MINT
LineComment
v0.8.9+commit.e5eed63a
{ "func_code_index": [ 3099, 3361 ] }
57,974
HumansFactoryPass
/contracts/HumansFactoryPass.sol
0x5f6809f90b6ca15663b1fd791d548631df3664a8
Solidity
HumansFactoryPass
contract HumansFactoryPass is ERC1155Supply, Ownable, PaymentSplitter, ReentrancyGuard { using ECDSA for bytes32; using Strings for uint256; using Address for address payable; struct saleParams { string name; bool requireSignature; uint256 startTime; uint256 endTime; ...
// @author: Array // dsc: Array#0007 // tw: @arraythedev // Contact me on twitter
LineComment
maxSupplyOf
function maxSupplyOf(uint256 _tokenId) public pure returns (uint256) { if (_tokenId == 0) return 333; else if (_tokenId == 1) return 3333; else return 0; }
// PUBLIC
LineComment
v0.8.9+commit.e5eed63a
{ "func_code_index": [ 4919, 5106 ] }
57,975
HumansFactoryPass
/contracts/HumansFactoryPass.sol
0x5f6809f90b6ca15663b1fd791d548631df3664a8
Solidity
HumansFactoryPass
contract HumansFactoryPass is ERC1155Supply, Ownable, PaymentSplitter, ReentrancyGuard { using ECDSA for bytes32; using Strings for uint256; using Address for address payable; struct saleParams { string name; bool requireSignature; uint256 startTime; uint256 endTime; ...
// @author: Array // dsc: Array#0007 // tw: @arraythedev // Contact me on twitter
LineComment
verifyAddressSigner
function verifyAddressSigner(bytes32 _messageHash, bytes memory _signature) private view returns (bool) { return signerAddress == _messageHash.toEthSignedMessageHash().recover(_signature); }
// PRIVATE
LineComment
v0.8.9+commit.e5eed63a
{ "func_code_index": [ 5317, 5523 ] }
57,976
HumansFactoryPass
/contracts/HumansFactoryPass.sol
0x5f6809f90b6ca15663b1fd791d548631df3664a8
Solidity
HumansFactoryPass
contract HumansFactoryPass is ERC1155Supply, Ownable, PaymentSplitter, ReentrancyGuard { using ECDSA for bytes32; using Strings for uint256; using Address for address payable; struct saleParams { string name; bool requireSignature; uint256 startTime; uint256 endTime; ...
// @author: Array // dsc: Array#0007 // tw: @arraythedev // Contact me on twitter
LineComment
_beforeTokenTransfer
function _beforeTokenTransfer( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual override { super._beforeTokenTransfer(operator, from, to, ids, amounts, data); require(!isPaused, "ERC1155Pausable: token trans...
/** * @dev See {ERC1155-_beforeTokenTransfer}. * * Requirements: * * - the contract must not be paused. */
NatSpecMultiLine
v0.8.9+commit.e5eed63a
{ "func_code_index": [ 5782, 6167 ] }
57,977
PoolTogetherEVMBridgeRoot
contracts/libraries/RLPReader.sol
0xfe6c5ae087366a7119f12946d07e04c94bb7a048
Solidity
RLPReader
library RLPReader { uint8 constant STRING_SHORT_START = 0x80; uint8 constant STRING_LONG_START = 0xb8; uint8 constant LIST_SHORT_START = 0xc0; uint8 constant LIST_LONG_START = 0xf8; uint8 constant WORD_SIZE = 32; struct RLPItem { uint256 len; uint256 memPtr; } /* *...
toRlpItem
function toRlpItem(bytes memory item) internal pure returns (RLPItem memory) { require(item.length > 0, "RLPReader: INVALID_BYTES_LENGTH"); uint256 memPtr; assembly { memPtr := add(item, 0x20) } return RLPItem(item.length, memPtr); }
/* * @param item RLP encoded bytes */
Comment
v0.7.3+commit.9bfce1f6
MIT
{ "func_code_index": [ 359, 681 ] }
57,978
PoolTogetherEVMBridgeRoot
contracts/libraries/RLPReader.sol
0xfe6c5ae087366a7119f12946d07e04c94bb7a048
Solidity
RLPReader
library RLPReader { uint8 constant STRING_SHORT_START = 0x80; uint8 constant STRING_LONG_START = 0xb8; uint8 constant LIST_SHORT_START = 0xc0; uint8 constant LIST_LONG_START = 0xf8; uint8 constant WORD_SIZE = 32; struct RLPItem { uint256 len; uint256 memPtr; } /* *...
toList
function toList(RLPItem memory item) internal pure returns (RLPItem[] memory) { require(isList(item), "RLPReader: ITEM_NOT_LIST"); uint256 items = numItems(item); RLPItem[] memory result = new RLPItem[](items); uint256 listLength = _itemLength(item.memPtr); require(listLength == item.le...
/* * @param item RLP encoded list in bytes */
Comment
v0.7.3+commit.9bfce1f6
MIT
{ "func_code_index": [ 743, 1461 ] }
57,979
PoolTogetherEVMBridgeRoot
contracts/libraries/RLPReader.sol
0xfe6c5ae087366a7119f12946d07e04c94bb7a048
Solidity
RLPReader
library RLPReader { uint8 constant STRING_SHORT_START = 0x80; uint8 constant STRING_LONG_START = 0xb8; uint8 constant LIST_SHORT_START = 0xc0; uint8 constant LIST_LONG_START = 0xf8; uint8 constant WORD_SIZE = 32; struct RLPItem { uint256 len; uint256 memPtr; } /* *...
isList
function isList(RLPItem memory item) internal pure returns (bool) { uint8 byte0; uint256 memPtr = item.memPtr; assembly { byte0 := byte(0, mload(memPtr)) } if (byte0 < LIST_SHORT_START) return false; return true; }
// @return indicator whether encoded payload is a list. negate this function call for isData.
LineComment
v0.7.3+commit.9bfce1f6
MIT
{ "func_code_index": [ 1561, 1844 ] }
57,980
PoolTogetherEVMBridgeRoot
contracts/libraries/RLPReader.sol
0xfe6c5ae087366a7119f12946d07e04c94bb7a048
Solidity
RLPReader
library RLPReader { uint8 constant STRING_SHORT_START = 0x80; uint8 constant STRING_LONG_START = 0xb8; uint8 constant LIST_SHORT_START = 0xc0; uint8 constant LIST_LONG_START = 0xf8; uint8 constant WORD_SIZE = 32; struct RLPItem { uint256 len; uint256 memPtr; } /* *...
toRlpBytes
function toRlpBytes(RLPItem memory item) internal pure returns (bytes memory) { bytes memory result = new bytes(item.len); uint256 ptr; assembly { ptr := add(0x20, result) } copy(item.memPtr, ptr, item.len); return result; }
// @returns raw rlp encoding in bytes
LineComment
v0.7.3+commit.9bfce1f6
MIT
{ "func_code_index": [ 1937, 2259 ] }
57,981
PoolTogetherEVMBridgeRoot
contracts/libraries/RLPReader.sol
0xfe6c5ae087366a7119f12946d07e04c94bb7a048
Solidity
RLPReader
library RLPReader { uint8 constant STRING_SHORT_START = 0x80; uint8 constant STRING_LONG_START = 0xb8; uint8 constant LIST_SHORT_START = 0xc0; uint8 constant LIST_LONG_START = 0xf8; uint8 constant WORD_SIZE = 32; struct RLPItem { uint256 len; uint256 memPtr; } /* *...
toUintStrict
function toUintStrict(RLPItem memory item) internal pure returns (uint256) { uint256 itemLength = _itemLength(item.memPtr); require(itemLength == item.len, "RLPReader: UINT_STRICT_DECODED_LENGTH_MISMATCH"); // one byte prefix require(item.len == 33, "RLPReader: INVALID_UINT_STRICT_LENGTH"); uint256...
// enforces 32 byte length
LineComment
v0.7.3+commit.9bfce1f6
MIT
{ "func_code_index": [ 3374, 3863 ] }
57,982
PoolTogetherEVMBridgeRoot
contracts/libraries/RLPReader.sol
0xfe6c5ae087366a7119f12946d07e04c94bb7a048
Solidity
RLPReader
library RLPReader { uint8 constant STRING_SHORT_START = 0x80; uint8 constant STRING_LONG_START = 0xb8; uint8 constant LIST_SHORT_START = 0xc0; uint8 constant LIST_LONG_START = 0xf8; uint8 constant WORD_SIZE = 32; struct RLPItem { uint256 len; uint256 memPtr; } /* *...
numItems
function numItems(RLPItem memory item) private pure returns (uint256) { // add `isList` check if `item` is expected to be passsed without a check from calling function // require(isList(item), "RLPReader: NUM_ITEMS_NOT_LIST"); uint256 count = 0; uint256 currPtr = item.memPtr + _payloadOffset(item.memPt...
// @return number of payload items inside an encoded list.
LineComment
v0.7.3+commit.9bfce1f6
MIT
{ "func_code_index": [ 4522, 5172 ] }
57,983
PoolTogetherEVMBridgeRoot
contracts/libraries/RLPReader.sol
0xfe6c5ae087366a7119f12946d07e04c94bb7a048
Solidity
RLPReader
library RLPReader { uint8 constant STRING_SHORT_START = 0x80; uint8 constant STRING_LONG_START = 0xb8; uint8 constant LIST_SHORT_START = 0xc0; uint8 constant LIST_LONG_START = 0xf8; uint8 constant WORD_SIZE = 32; struct RLPItem { uint256 len; uint256 memPtr; } /* *...
_itemLength
function _itemLength(uint256 memPtr) private pure returns (uint256) { uint256 itemLen; uint256 byte0; assembly { byte0 := byte(0, mload(memPtr)) } if (byte0 < STRING_SHORT_START) itemLen = 1; else if (byte0 < STRING_LONG_START) itemLen = byte0 - STRING_SHORT_START + 1; else ...
// @return entire rlp item byte length
LineComment
v0.7.3+commit.9bfce1f6
MIT
{ "func_code_index": [ 5217, 6464 ] }
57,984
PoolTogetherEVMBridgeRoot
contracts/libraries/RLPReader.sol
0xfe6c5ae087366a7119f12946d07e04c94bb7a048
Solidity
RLPReader
library RLPReader { uint8 constant STRING_SHORT_START = 0x80; uint8 constant STRING_LONG_START = 0xb8; uint8 constant LIST_SHORT_START = 0xc0; uint8 constant LIST_LONG_START = 0xf8; uint8 constant WORD_SIZE = 32; struct RLPItem { uint256 len; uint256 memPtr; } /* *...
_payloadOffset
function _payloadOffset(uint256 memPtr) private pure returns (uint256) { uint256 byte0; assembly { byte0 := byte(0, mload(memPtr)) } if (byte0 < STRING_SHORT_START) return 0; else if ( byte0 < STRING_LONG_START || (byte0 >= LIST_SHORT_START && byte0 < LIST_LONG_START) ) ...
// @return number of bytes until the data
LineComment
v0.7.3+commit.9bfce1f6
MIT
{ "func_code_index": [ 6512, 7071 ] }
57,985
PoolTogetherEVMBridgeRoot
contracts/libraries/RLPReader.sol
0xfe6c5ae087366a7119f12946d07e04c94bb7a048
Solidity
RLPReader
library RLPReader { uint8 constant STRING_SHORT_START = 0x80; uint8 constant STRING_LONG_START = 0xb8; uint8 constant LIST_SHORT_START = 0xc0; uint8 constant LIST_LONG_START = 0xf8; uint8 constant WORD_SIZE = 32; struct RLPItem { uint256 len; uint256 memPtr; } /* *...
copy
function copy( uint256 src, uint256 dest, uint256 len ) private pure { if (len == 0) return; // copy as many word sizes as possible for (; len >= WORD_SIZE; len -= WORD_SIZE) { assembly { mstore(dest, mload(src)) } src += WORD_SIZE; dest += WORD_SIZE...
/* * @param src Pointer to source * @param dest Pointer to destination * @param len Amount of memory to copy from the source */
Comment
v0.7.3+commit.9bfce1f6
MIT
{ "func_code_index": [ 7225, 7966 ] }
57,986
CompoundProtocolAdapter
contracts/interfaces/CompoundInterfaces.sol
0x7f77389b868718b5351433d8031d49921cd72ace
Solidity
ICToken
interface ICToken { function comptroller() external view returns (address); function underlying() external view returns (address); function name() external view returns (string memory); function totalSupply() external view returns (uint256); function supplyRatePerBlock() external view returns (uint256); fu...
sushi
function sushi() external view returns (address);
// Used to check if a cream market is for an SLP token
LineComment
v0.7.6+commit.7338295f
MIT
{ "func_code_index": [ 1480, 1531 ] }
57,987
BatchExchange
contracts/BatchExchange.sol
0x46f3f2f9662f66a6ddd6a8d1ddec3cd9ae5e87b5
Solidity
BatchExchange
contract BatchExchange is EpochTokenLocker { using SafeCast for uint256; using SafeMath for uint128; using BytesLib for bytes32; using BytesLib for bytes; using TokenConservation for int256[]; using TokenConservation for uint16[]; using IterableAppendOnlySet for IterableAppendOnlySet....
/** @title BatchExchange - A decentralized exchange for any ERC20 token as a multi-token batch * auction with uniform clearing prices. * For more information visit: <https://github.com/gnosis/dex-contracts> * @author @gnosis/dfusion-team <https://github.com/orgs/gnosis/teams/dfusion-team/members> */
NatSpecMultiLine
addToken
function addToken(address token) public { require(numTokens < MAX_TOKENS, "Max tokens reached"); if (numTokens > 0) { // Only charge fees for tokens other than the fee token itself feeToken.burnOWL(msg.sender, FEE_FOR_LISTING_TOKEN_IN_OWL); } require(IdToAddressBiMap.insert(registe...
/** @dev Used to list a new token on the contract: Hence, making it available for exchange in an auction. * @param token ERC20 token to be listed. * * Requirements: * - `maxTokens` has not already been reached * - `token` has not already been added */
NatSpecMultiLine
v0.5.6+commit.b259423e
GNU GPLv3
bzzr://d75d8f06b335b5c4398c51039c6bbb9a0b7d2e34f3a8a69428935ad3326899cb
{ "func_code_index": [ 5165, 5601 ] }
57,988
BatchExchange
contracts/BatchExchange.sol
0x46f3f2f9662f66a6ddd6a8d1ddec3cd9ae5e87b5
Solidity
BatchExchange
contract BatchExchange is EpochTokenLocker { using SafeCast for uint256; using SafeMath for uint128; using BytesLib for bytes32; using BytesLib for bytes; using TokenConservation for int256[]; using TokenConservation for uint16[]; using IterableAppendOnlySet for IterableAppendOnlySet....
/** @title BatchExchange - A decentralized exchange for any ERC20 token as a multi-token batch * auction with uniform clearing prices. * For more information visit: <https://github.com/gnosis/dex-contracts> * @author @gnosis/dfusion-team <https://github.com/orgs/gnosis/teams/dfusion-team/members> */
NatSpecMultiLine
placeOrder
function placeOrder(uint16 buyToken, uint16 sellToken, uint32 validUntil, uint128 buyAmount, uint128 sellAmount) public returns (uint256) { return placeOrderInternal(buyToken, sellToken, getCurrentBatchId(), validUntil, buyAmount, sellAmount); }
/** @dev A user facing function used to place limit sell orders in auction with expiry defined by batchId * @param buyToken id of token to be bought * @param sellToken id of token to be sold * @param validUntil batchId represnting order's expiry * @param buyAmount relative minimum amount of requested buy amount...
NatSpecMultiLine
v0.5.6+commit.b259423e
GNU GPLv3
bzzr://d75d8f06b335b5c4398c51039c6bbb9a0b7d2e34f3a8a69428935ad3326899cb
{ "func_code_index": [ 6174, 6461 ] }
57,989
BatchExchange
contracts/BatchExchange.sol
0x46f3f2f9662f66a6ddd6a8d1ddec3cd9ae5e87b5
Solidity
BatchExchange
contract BatchExchange is EpochTokenLocker { using SafeCast for uint256; using SafeMath for uint128; using BytesLib for bytes32; using BytesLib for bytes; using TokenConservation for int256[]; using TokenConservation for uint16[]; using IterableAppendOnlySet for IterableAppendOnlySet....
/** @title BatchExchange - A decentralized exchange for any ERC20 token as a multi-token batch * auction with uniform clearing prices. * For more information visit: <https://github.com/gnosis/dex-contracts> * @author @gnosis/dfusion-team <https://github.com/orgs/gnosis/teams/dfusion-team/members> */
NatSpecMultiLine
placeValidFromOrders
function placeValidFromOrders( uint16[] memory buyTokens, uint16[] memory sellTokens, uint32[] memory validFroms, uint32[] memory validUntils, uint128[] memory buyAmounts, uint128[] memory sellAmounts ) public returns (uint256[] memory orderIds) { orderIds = new uint256[](buyTokens.l...
/** @dev A user facing function used to place limit sell orders in auction with expiry defined by batchId * Note that parameters are passed as arrays and the indices correspond to each order. * @param buyTokens ids of tokens to be bought * @param sellTokens ids of tokens to be sold * @param validFroms batchIds ...
NatSpecMultiLine
v0.5.6+commit.b259423e
GNU GPLv3
bzzr://d75d8f06b335b5c4398c51039c6bbb9a0b7d2e34f3a8a69428935ad3326899cb
{ "func_code_index": [ 7250, 7945 ] }
57,990
BatchExchange
contracts/BatchExchange.sol
0x46f3f2f9662f66a6ddd6a8d1ddec3cd9ae5e87b5
Solidity
BatchExchange
contract BatchExchange is EpochTokenLocker { using SafeCast for uint256; using SafeMath for uint128; using BytesLib for bytes32; using BytesLib for bytes; using TokenConservation for int256[]; using TokenConservation for uint16[]; using IterableAppendOnlySet for IterableAppendOnlySet....
/** @title BatchExchange - A decentralized exchange for any ERC20 token as a multi-token batch * auction with uniform clearing prices. * For more information visit: <https://github.com/gnosis/dex-contracts> * @author @gnosis/dfusion-team <https://github.com/orgs/gnosis/teams/dfusion-team/members> */
NatSpecMultiLine
cancelOrders
function cancelOrders(uint256[] memory ids) public { for (uint256 i = 0; i < ids.length; i++) { if (!checkOrderValidity(orders[msg.sender][ids[i]], getCurrentBatchId() - 1)) { delete orders[msg.sender][ids[i]]; emit OrderDeletion(msg.sender, ids[i]); } else { ...
/** @dev a user facing function used to cancel orders. If the order is valid for the batch that is currently * being solved, it sets order expiry to that batchId. Otherwise it removes it from storage. Can be called * multiple times (e.g. to eventually free storage once order is expired). * * @param ids referenc...
NatSpecMultiLine
v0.5.6+commit.b259423e
GNU GPLv3
bzzr://d75d8f06b335b5c4398c51039c6bbb9a0b7d2e34f3a8a69428935ad3326899cb
{ "func_code_index": [ 8447, 8955 ] }
57,991
BatchExchange
contracts/BatchExchange.sol
0x46f3f2f9662f66a6ddd6a8d1ddec3cd9ae5e87b5
Solidity
BatchExchange
contract BatchExchange is EpochTokenLocker { using SafeCast for uint256; using SafeMath for uint128; using BytesLib for bytes32; using BytesLib for bytes; using TokenConservation for int256[]; using TokenConservation for uint16[]; using IterableAppendOnlySet for IterableAppendOnlySet....
/** @title BatchExchange - A decentralized exchange for any ERC20 token as a multi-token batch * auction with uniform clearing prices. * For more information visit: <https://github.com/gnosis/dex-contracts> * @author @gnosis/dfusion-team <https://github.com/orgs/gnosis/teams/dfusion-team/members> */
NatSpecMultiLine
replaceOrders
function replaceOrders( uint256[] memory cancellations, uint16[] memory buyTokens, uint16[] memory sellTokens, uint32[] memory validFroms, uint32[] memory validUntils, uint128[] memory buyAmounts, uint128[] memory sellAmounts ) public returns (uint256[] memory orderIds) { cancel...
/** @dev A user facing wrapper to cancel and place new orders in the same transaction. * @param cancellations ids of orders to be cancelled * @param buyTokens ids of tokens to be bought in new orders * @param sellTokens ids of tokens to be sold in new orders * @param validFroms batchIds representing order's val...
NatSpecMultiLine
v0.5.6+commit.b259423e
GNU GPLv3
bzzr://d75d8f06b335b5c4398c51039c6bbb9a0b7d2e34f3a8a69428935ad3326899cb
{ "func_code_index": [ 9837, 10338 ] }
57,992
BatchExchange
contracts/BatchExchange.sol
0x46f3f2f9662f66a6ddd6a8d1ddec3cd9ae5e87b5
Solidity
BatchExchange
contract BatchExchange is EpochTokenLocker { using SafeCast for uint256; using SafeMath for uint128; using BytesLib for bytes32; using BytesLib for bytes; using TokenConservation for int256[]; using TokenConservation for uint16[]; using IterableAppendOnlySet for IterableAppendOnlySet....
/** @title BatchExchange - A decentralized exchange for any ERC20 token as a multi-token batch * auction with uniform clearing prices. * For more information visit: <https://github.com/gnosis/dex-contracts> * @author @gnosis/dfusion-team <https://github.com/orgs/gnosis/teams/dfusion-team/members> */
NatSpecMultiLine
submitSolution
function submitSolution( uint32 batchIndex, uint256 claimedObjectiveValue, address[] memory owners, uint16[] memory orderIds, uint128[] memory buyVolumes, uint128[] memory prices, uint16[] memory tokenIdsForPrice ) public returns (uint256) { require(acceptingSolutions(batchIndex...
/** @dev a solver facing function called for auction settlement * @param batchIndex index of auction solution is referring to * @param owners array of addresses corresponding to touched orders * @param orderIds array of order ids used in parallel with owners to identify touched order * @param buyVolumes execute...
NatSpecMultiLine
v0.5.6+commit.b259423e
GNU GPLv3
bzzr://d75d8f06b335b5c4398c51039c6bbb9a0b7d2e34f3a8a69428935ad3326899cb
{ "func_code_index": [ 11939, 16091 ] }
57,993
BatchExchange
contracts/BatchExchange.sol
0x46f3f2f9662f66a6ddd6a8d1ddec3cd9ae5e87b5
Solidity
BatchExchange
contract BatchExchange is EpochTokenLocker { using SafeCast for uint256; using SafeMath for uint128; using BytesLib for bytes32; using BytesLib for bytes; using TokenConservation for int256[]; using TokenConservation for uint16[]; using IterableAppendOnlySet for IterableAppendOnlySet....
/** @title BatchExchange - A decentralized exchange for any ERC20 token as a multi-token batch * auction with uniform clearing prices. * For more information visit: <https://github.com/gnosis/dex-contracts> * @author @gnosis/dfusion-team <https://github.com/orgs/gnosis/teams/dfusion-team/members> */
NatSpecMultiLine
tokenAddressToIdMap
function tokenAddressToIdMap(address addr) public view returns (uint16) { return IdToAddressBiMap.getId(registeredTokens, addr); }
/** @dev View returning ID of listed tokens * @param addr address of listed token. * @return tokenId as stored within the contract. */
NatSpecMultiLine
v0.5.6+commit.b259423e
GNU GPLv3
bzzr://d75d8f06b335b5c4398c51039c6bbb9a0b7d2e34f3a8a69428935ad3326899cb
{ "func_code_index": [ 16301, 16450 ] }
57,994
BatchExchange
contracts/BatchExchange.sol
0x46f3f2f9662f66a6ddd6a8d1ddec3cd9ae5e87b5
Solidity
BatchExchange
contract BatchExchange is EpochTokenLocker { using SafeCast for uint256; using SafeMath for uint128; using BytesLib for bytes32; using BytesLib for bytes; using TokenConservation for int256[]; using TokenConservation for uint16[]; using IterableAppendOnlySet for IterableAppendOnlySet....
/** @title BatchExchange - A decentralized exchange for any ERC20 token as a multi-token batch * auction with uniform clearing prices. * For more information visit: <https://github.com/gnosis/dex-contracts> * @author @gnosis/dfusion-team <https://github.com/orgs/gnosis/teams/dfusion-team/members> */
NatSpecMultiLine
tokenIdToAddressMap
function tokenIdToAddressMap(uint16 id) public view returns (address) { return IdToAddressBiMap.getAddressAt(registeredTokens, id); }
/** @dev View returning address of listed token by ID * @param id tokenId as stored, via BiMap, within the contract. * @return address of (listed) token */
NatSpecMultiLine
v0.5.6+commit.b259423e
GNU GPLv3
bzzr://d75d8f06b335b5c4398c51039c6bbb9a0b7d2e34f3a8a69428935ad3326899cb
{ "func_code_index": [ 16635, 16787 ] }
57,995
BatchExchange
contracts/BatchExchange.sol
0x46f3f2f9662f66a6ddd6a8d1ddec3cd9ae5e87b5
Solidity
BatchExchange
contract BatchExchange is EpochTokenLocker { using SafeCast for uint256; using SafeMath for uint128; using BytesLib for bytes32; using BytesLib for bytes; using TokenConservation for int256[]; using TokenConservation for uint16[]; using IterableAppendOnlySet for IterableAppendOnlySet....
/** @title BatchExchange - A decentralized exchange for any ERC20 token as a multi-token batch * auction with uniform clearing prices. * For more information visit: <https://github.com/gnosis/dex-contracts> * @author @gnosis/dfusion-team <https://github.com/orgs/gnosis/teams/dfusion-team/members> */
NatSpecMultiLine
hasToken
function hasToken(address addr) public view returns (bool) { return IdToAddressBiMap.hasAddress(registeredTokens, addr); }
/** @dev View returning a bool attesting whether token was already added * @param addr address of the token to be checked * @return bool attesting whether token was already added */
NatSpecMultiLine
v0.5.6+commit.b259423e
GNU GPLv3
bzzr://d75d8f06b335b5c4398c51039c6bbb9a0b7d2e34f3a8a69428935ad3326899cb
{ "func_code_index": [ 16998, 17139 ] }
57,996
BatchExchange
contracts/BatchExchange.sol
0x46f3f2f9662f66a6ddd6a8d1ddec3cd9ae5e87b5
Solidity
BatchExchange
contract BatchExchange is EpochTokenLocker { using SafeCast for uint256; using SafeMath for uint128; using BytesLib for bytes32; using BytesLib for bytes; using TokenConservation for int256[]; using TokenConservation for uint16[]; using IterableAppendOnlySet for IterableAppendOnlySet....
/** @title BatchExchange - A decentralized exchange for any ERC20 token as a multi-token batch * auction with uniform clearing prices. * For more information visit: <https://github.com/gnosis/dex-contracts> * @author @gnosis/dfusion-team <https://github.com/orgs/gnosis/teams/dfusion-team/members> */
NatSpecMultiLine
getEncodedUserOrders
function getEncodedUserOrders(address user) public view returns (bytes memory elements) { for (uint256 i = 0; i < orders[user].length; i++) { elements = elements.concat( encodeAuctionElement(user, getBalance(user, tokenIdToAddressMap(orders[user][i].sellToken)), orders[user][i]) ); ...
/** @dev View returning all byte-encoded sell orders for specified user * @param user address of user whose orders are being queried * @return encoded bytes representing all orders */
NatSpecMultiLine
v0.5.6+commit.b259423e
GNU GPLv3
bzzr://d75d8f06b335b5c4398c51039c6bbb9a0b7d2e34f3a8a69428935ad3326899cb
{ "func_code_index": [ 17352, 17735 ] }
57,997
BatchExchange
contracts/BatchExchange.sol
0x46f3f2f9662f66a6ddd6a8d1ddec3cd9ae5e87b5
Solidity
BatchExchange
contract BatchExchange is EpochTokenLocker { using SafeCast for uint256; using SafeMath for uint128; using BytesLib for bytes32; using BytesLib for bytes; using TokenConservation for int256[]; using TokenConservation for uint16[]; using IterableAppendOnlySet for IterableAppendOnlySet....
/** @title BatchExchange - A decentralized exchange for any ERC20 token as a multi-token batch * auction with uniform clearing prices. * For more information visit: <https://github.com/gnosis/dex-contracts> * @author @gnosis/dfusion-team <https://github.com/orgs/gnosis/teams/dfusion-team/members> */
NatSpecMultiLine
getEncodedOrders
function getEncodedOrders() public view returns (bytes memory elements) { if (allUsers.size() > 0) { address user = allUsers.first(); bool stop = false; while (!stop) { elements = elements.concat(getEncodedUserOrders(user)); if (user == allUsers.last) { ...
/** @dev View returning all byte-encoded sell orders * @return encoded bytes representing all orders ordered by (user, index) */
NatSpecMultiLine
v0.5.6+commit.b259423e
GNU GPLv3
bzzr://d75d8f06b335b5c4398c51039c6bbb9a0b7d2e34f3a8a69428935ad3326899cb
{ "func_code_index": [ 17886, 18413 ] }
57,998
BatchExchange
contracts/BatchExchange.sol
0x46f3f2f9662f66a6ddd6a8d1ddec3cd9ae5e87b5
Solidity
BatchExchange
contract BatchExchange is EpochTokenLocker { using SafeCast for uint256; using SafeMath for uint128; using BytesLib for bytes32; using BytesLib for bytes; using TokenConservation for int256[]; using TokenConservation for uint16[]; using IterableAppendOnlySet for IterableAppendOnlySet....
/** @title BatchExchange - A decentralized exchange for any ERC20 token as a multi-token batch * auction with uniform clearing prices. * For more information visit: <https://github.com/gnosis/dex-contracts> * @author @gnosis/dfusion-team <https://github.com/orgs/gnosis/teams/dfusion-team/members> */
NatSpecMultiLine
getCurrentObjectiveValue
function getCurrentObjectiveValue() public view returns (uint256) { if (latestSolution.batchId == getCurrentBatchId() - 1) { return latestSolution.objectiveValue; } else { return 0; } }
/** @dev gets the objective value of currently winning solution. * @return objective function evaluation of the currently winning solution, or zero if no solution proposed. */
NatSpecMultiLine
v0.5.6+commit.b259423e
GNU GPLv3
bzzr://d75d8f06b335b5c4398c51039c6bbb9a0b7d2e34f3a8a69428935ad3326899cb
{ "func_code_index": [ 18801, 19049 ] }
57,999
BatchExchange
contracts/BatchExchange.sol
0x46f3f2f9662f66a6ddd6a8d1ddec3cd9ae5e87b5
Solidity
BatchExchange
contract BatchExchange is EpochTokenLocker { using SafeCast for uint256; using SafeMath for uint128; using BytesLib for bytes32; using BytesLib for bytes; using TokenConservation for int256[]; using TokenConservation for uint16[]; using IterableAppendOnlySet for IterableAppendOnlySet....
/** @title BatchExchange - A decentralized exchange for any ERC20 token as a multi-token batch * auction with uniform clearing prices. * For more information visit: <https://github.com/gnosis/dex-contracts> * @author @gnosis/dfusion-team <https://github.com/orgs/gnosis/teams/dfusion-team/members> */
NatSpecMultiLine
placeOrderInternal
function placeOrderInternal( uint16 buyToken, uint16 sellToken, uint32 validFrom, uint32 validUntil, uint128 buyAmount, uint128 sellAmount ) private returns (uint256) { require(buyToken != sellToken, "Exchange tokens not distinct"); require(validFrom >= getCurrentBatchId(), "Ord...
/** * Private Functions */
NatSpecMultiLine
v0.5.6+commit.b259423e
GNU GPLv3
bzzr://d75d8f06b335b5c4398c51039c6bbb9a0b7d2e34f3a8a69428935ad3326899cb
{ "func_code_index": [ 19096, 20107 ] }
58,000
BatchExchange
contracts/BatchExchange.sol
0x46f3f2f9662f66a6ddd6a8d1ddec3cd9ae5e87b5
Solidity
BatchExchange
contract BatchExchange is EpochTokenLocker { using SafeCast for uint256; using SafeMath for uint128; using BytesLib for bytes32; using BytesLib for bytes; using TokenConservation for int256[]; using TokenConservation for uint16[]; using IterableAppendOnlySet for IterableAppendOnlySet....
/** @title BatchExchange - A decentralized exchange for any ERC20 token as a multi-token batch * auction with uniform clearing prices. * For more information visit: <https://github.com/gnosis/dex-contracts> * @author @gnosis/dfusion-team <https://github.com/orgs/gnosis/teams/dfusion-team/members> */
NatSpecMultiLine
grantRewardToSolutionSubmitter
function grantRewardToSolutionSubmitter(uint256 feeReward) private { latestSolution.feeReward = feeReward; addBalanceAndBlockWithdrawForThisBatch(msg.sender, tokenIdToAddressMap(0), feeReward); }
/** @dev called at the end of submitSolution with a value of tokenConservation / 2 * @param feeReward amount to be rewarded to the solver */
NatSpecMultiLine
v0.5.6+commit.b259423e
GNU GPLv3
bzzr://d75d8f06b335b5c4398c51039c6bbb9a0b7d2e34f3a8a69428935ad3326899cb
{ "func_code_index": [ 20270, 20493 ] }
58,001
BatchExchange
contracts/BatchExchange.sol
0x46f3f2f9662f66a6ddd6a8d1ddec3cd9ae5e87b5
Solidity
BatchExchange
contract BatchExchange is EpochTokenLocker { using SafeCast for uint256; using SafeMath for uint128; using BytesLib for bytes32; using BytesLib for bytes; using TokenConservation for int256[]; using TokenConservation for uint16[]; using IterableAppendOnlySet for IterableAppendOnlySet....
/** @title BatchExchange - A decentralized exchange for any ERC20 token as a multi-token batch * auction with uniform clearing prices. * For more information visit: <https://github.com/gnosis/dex-contracts> * @author @gnosis/dfusion-team <https://github.com/orgs/gnosis/teams/dfusion-team/members> */
NatSpecMultiLine
burnPreviousAuctionFees
function burnPreviousAuctionFees() private { if (!currentBatchHasSolution()) { feeToken.burnOWL(address(this), latestSolution.feeReward); } }
/** @dev called during solution submission to burn fees from previous auction */
NatSpecMultiLine
v0.5.6+commit.b259423e
GNU GPLv3
bzzr://d75d8f06b335b5c4398c51039c6bbb9a0b7d2e34f3a8a69428935ad3326899cb
{ "func_code_index": [ 20589, 20771 ] }
58,002
BatchExchange
contracts/BatchExchange.sol
0x46f3f2f9662f66a6ddd6a8d1ddec3cd9ae5e87b5
Solidity
BatchExchange
contract BatchExchange is EpochTokenLocker { using SafeCast for uint256; using SafeMath for uint128; using BytesLib for bytes32; using BytesLib for bytes; using TokenConservation for int256[]; using TokenConservation for uint16[]; using IterableAppendOnlySet for IterableAppendOnlySet....
/** @title BatchExchange - A decentralized exchange for any ERC20 token as a multi-token batch * auction with uniform clearing prices. * For more information visit: <https://github.com/gnosis/dex-contracts> * @author @gnosis/dfusion-team <https://github.com/orgs/gnosis/teams/dfusion-team/members> */
NatSpecMultiLine
updateCurrentPrices
function updateCurrentPrices(uint128[] memory prices, uint16[] memory tokenIdsForPrice) private { for (uint256 i = 0; i < latestSolution.tokenIdsForPrice.length; i++) { currentPrices[latestSolution.tokenIdsForPrice[i]] = 0; } for (uint256 i = 0; i < tokenIdsForPrice.length; i++) { curre...
/** @dev Called from within submitSolution to update the token prices. * @param prices list of prices for touched tokens only, first price is always fee token price * @param tokenIdsForPrice price[i] is the price for the token with tokenID tokenIdsForPrice[i] */
NatSpecMultiLine
v0.5.6+commit.b259423e
GNU GPLv3
bzzr://d75d8f06b335b5c4398c51039c6bbb9a0b7d2e34f3a8a69428935ad3326899cb
{ "func_code_index": [ 21063, 21468 ] }
58,003
BatchExchange
contracts/BatchExchange.sol
0x46f3f2f9662f66a6ddd6a8d1ddec3cd9ae5e87b5
Solidity
BatchExchange
contract BatchExchange is EpochTokenLocker { using SafeCast for uint256; using SafeMath for uint128; using BytesLib for bytes32; using BytesLib for bytes; using TokenConservation for int256[]; using TokenConservation for uint16[]; using IterableAppendOnlySet for IterableAppendOnlySet....
/** @title BatchExchange - A decentralized exchange for any ERC20 token as a multi-token batch * auction with uniform clearing prices. * For more information visit: <https://github.com/gnosis/dex-contracts> * @author @gnosis/dfusion-team <https://github.com/orgs/gnosis/teams/dfusion-team/members> */
NatSpecMultiLine
updateRemainingOrder
function updateRemainingOrder(address owner, uint256 orderId, uint128 executedAmount) private { orders[owner][orderId].usedAmount = orders[owner][orderId].usedAmount.add(executedAmount).toUint128(); }
/** @dev Updates an order's remaing requested sell amount upon (partial) execution of a standing order * @param owner order's corresponding user address * @param orderId index of order in list of owner's orders * @param executedAmount proportion of order's requested sellAmount that was filled. */
NatSpecMultiLine
v0.5.6+commit.b259423e
GNU GPLv3
bzzr://d75d8f06b335b5c4398c51039c6bbb9a0b7d2e34f3a8a69428935ad3326899cb
{ "func_code_index": [ 21802, 22021 ] }
58,004
BatchExchange
contracts/BatchExchange.sol
0x46f3f2f9662f66a6ddd6a8d1ddec3cd9ae5e87b5
Solidity
BatchExchange
contract BatchExchange is EpochTokenLocker { using SafeCast for uint256; using SafeMath for uint128; using BytesLib for bytes32; using BytesLib for bytes; using TokenConservation for int256[]; using TokenConservation for uint16[]; using IterableAppendOnlySet for IterableAppendOnlySet....
/** @title BatchExchange - A decentralized exchange for any ERC20 token as a multi-token batch * auction with uniform clearing prices. * For more information visit: <https://github.com/gnosis/dex-contracts> * @author @gnosis/dfusion-team <https://github.com/orgs/gnosis/teams/dfusion-team/members> */
NatSpecMultiLine
revertRemainingOrder
function revertRemainingOrder(address owner, uint256 orderId, uint128 executedAmount) private { orders[owner][orderId].usedAmount = orders[owner][orderId].usedAmount.sub(executedAmount).toUint128(); }
/** @dev The inverse of updateRemainingOrder, called when reverting a solution in favour of a better one. * @param owner order's corresponding user address * @param orderId index of order in list of owner's orders * @param executedAmount proportion of order's requested sellAmount that was filled. */
NatSpecMultiLine
v0.5.6+commit.b259423e
GNU GPLv3
bzzr://d75d8f06b335b5c4398c51039c6bbb9a0b7d2e34f3a8a69428935ad3326899cb
{ "func_code_index": [ 22358, 22577 ] }
58,005
BatchExchange
contracts/BatchExchange.sol
0x46f3f2f9662f66a6ddd6a8d1ddec3cd9ae5e87b5
Solidity
BatchExchange
contract BatchExchange is EpochTokenLocker { using SafeCast for uint256; using SafeMath for uint128; using BytesLib for bytes32; using BytesLib for bytes; using TokenConservation for int256[]; using TokenConservation for uint16[]; using IterableAppendOnlySet for IterableAppendOnlySet....
/** @title BatchExchange - A decentralized exchange for any ERC20 token as a multi-token batch * auction with uniform clearing prices. * For more information visit: <https://github.com/gnosis/dex-contracts> * @author @gnosis/dfusion-team <https://github.com/orgs/gnosis/teams/dfusion-team/members> */
NatSpecMultiLine
documentTrades
function documentTrades( uint32 batchIndex, address[] memory owners, uint16[] memory orderIds, uint128[] memory volumes, uint16[] memory tokenIdsForPrice ) private { latestSolution.batchId = batchIndex; for (uint256 i = 0; i < owners.length; i++) { latestSolution.trades.push...
/** @dev This function writes solution information into contract storage * @param batchIndex index of referenced auction * @param owners array of addresses corresponding to touched orders * @param orderIds array of order ids used in parallel with owners to identify touched order * @param volumes executed buy am...
NatSpecMultiLine
v0.5.6+commit.b259423e
GNU GPLv3
bzzr://d75d8f06b335b5c4398c51039c6bbb9a0b7d2e34f3a8a69428935ad3326899cb
{ "func_code_index": [ 23102, 23672 ] }
58,006
BatchExchange
contracts/BatchExchange.sol
0x46f3f2f9662f66a6ddd6a8d1ddec3cd9ae5e87b5
Solidity
BatchExchange
contract BatchExchange is EpochTokenLocker { using SafeCast for uint256; using SafeMath for uint128; using BytesLib for bytes32; using BytesLib for bytes; using TokenConservation for int256[]; using TokenConservation for uint16[]; using IterableAppendOnlySet for IterableAppendOnlySet....
/** @title BatchExchange - A decentralized exchange for any ERC20 token as a multi-token batch * auction with uniform clearing prices. * For more information visit: <https://github.com/gnosis/dex-contracts> * @author @gnosis/dfusion-team <https://github.com/orgs/gnosis/teams/dfusion-team/members> */
NatSpecMultiLine
undoCurrentSolution
function undoCurrentSolution() private { if (currentBatchHasSolution()) { for (uint256 i = 0; i < latestSolution.trades.length; i++) { address owner = latestSolution.trades[i].owner; uint256 orderId = latestSolution.trades[i].orderId; Order memory order = orders[owne...
/** @dev reverts all relevant contract storage relating to an overwritten auction solution. */
NatSpecMultiLine
v0.5.6+commit.b259423e
GNU GPLv3
bzzr://d75d8f06b335b5c4398c51039c6bbb9a0b7d2e34f3a8a69428935ad3326899cb
{ "func_code_index": [ 23782, 25146 ] }
58,007
BatchExchange
contracts/BatchExchange.sol
0x46f3f2f9662f66a6ddd6a8d1ddec3cd9ae5e87b5
Solidity
BatchExchange
contract BatchExchange is EpochTokenLocker { using SafeCast for uint256; using SafeMath for uint128; using BytesLib for bytes32; using BytesLib for bytes; using TokenConservation for int256[]; using TokenConservation for uint16[]; using IterableAppendOnlySet for IterableAppendOnlySet....
/** @title BatchExchange - A decentralized exchange for any ERC20 token as a multi-token batch * auction with uniform clearing prices. * For more information visit: <https://github.com/gnosis/dex-contracts> * @author @gnosis/dfusion-team <https://github.com/orgs/gnosis/teams/dfusion-team/members> */
NatSpecMultiLine
checkAndOverrideObjectiveValue
function checkAndOverrideObjectiveValue(uint256 newObjectiveValue) private { require( isObjectiveValueSufficientlyImproved(newObjectiveValue), "New objective doesn't sufficiently improve current solution" ); latestSolution.objectiveValue = newObjectiveValue; }
/** @dev determines if value is better than currently and updates if it is. * @param newObjectiveValue proposed value to be updated if a great enough improvement on the current objective value */
NatSpecMultiLine
v0.5.6+commit.b259423e
GNU GPLv3
bzzr://d75d8f06b335b5c4398c51039c6bbb9a0b7d2e34f3a8a69428935ad3326899cb
{ "func_code_index": [ 25364, 25687 ] }
58,008
BatchExchange
contracts/BatchExchange.sol
0x46f3f2f9662f66a6ddd6a8d1ddec3cd9ae5e87b5
Solidity
BatchExchange
contract BatchExchange is EpochTokenLocker { using SafeCast for uint256; using SafeMath for uint128; using BytesLib for bytes32; using BytesLib for bytes; using TokenConservation for int256[]; using TokenConservation for uint16[]; using IterableAppendOnlySet for IterableAppendOnlySet....
/** @title BatchExchange - A decentralized exchange for any ERC20 token as a multi-token batch * auction with uniform clearing prices. * For more information visit: <https://github.com/gnosis/dex-contracts> * @author @gnosis/dfusion-team <https://github.com/orgs/gnosis/teams/dfusion-team/members> */
NatSpecMultiLine
evaluateUtility
function evaluateUtility(uint128 execBuy, Order memory order) private view returns (uint256) { // Utility = ((execBuy * order.sellAmt - execSell * order.buyAmt) * price.buyToken) / order.sellAmt uint256 execSellTimesBuy = getExecutedSellAmount(execBuy, currentPrices[order.buyToken], currentPrices[order.sellTo...
/** @dev Evaluates utility of executed trade * @param execBuy represents proportion of order executed (in terms of buy amount) * @param order the sell order whose utility is being evaluated * @return Utility = ((execBuy * order.sellAmt - execSell * order.buyAmt) * price.buyToken) / order.sellAmt */
NatSpecMultiLine
v0.5.6+commit.b259423e
GNU GPLv3
bzzr://d75d8f06b335b5c4398c51039c6bbb9a0b7d2e34f3a8a69428935ad3326899cb
{ "func_code_index": [ 26044, 26787 ] }
58,009
BatchExchange
contracts/BatchExchange.sol
0x46f3f2f9662f66a6ddd6a8d1ddec3cd9ae5e87b5
Solidity
BatchExchange
contract BatchExchange is EpochTokenLocker { using SafeCast for uint256; using SafeMath for uint128; using BytesLib for bytes32; using BytesLib for bytes; using TokenConservation for int256[]; using TokenConservation for uint16[]; using IterableAppendOnlySet for IterableAppendOnlySet....
/** @title BatchExchange - A decentralized exchange for any ERC20 token as a multi-token batch * auction with uniform clearing prices. * For more information visit: <https://github.com/gnosis/dex-contracts> * @author @gnosis/dfusion-team <https://github.com/orgs/gnosis/teams/dfusion-team/members> */
NatSpecMultiLine
evaluateDisregardedUtility
function evaluateDisregardedUtility(Order memory order, address user) private view returns (uint256) { uint256 leftoverSellAmount = Math.min(getRemainingAmount(order), getBalance(user, tokenIdToAddressMap(order.sellToken))); uint256 limitTermLeft = currentPrices[order.sellToken].mul(order.priceDenominator); ...
/** @dev computes a measure of how much of an order was disregarded (only valid when limit price is respected) * @param order the sell order whose disregarded utility is being evaluated * @param user address of order's owner * @return disregardedUtility of the order (after it has been applied) * Note that: * ...
NatSpecMultiLine
v0.5.6+commit.b259423e
GNU GPLv3
bzzr://d75d8f06b335b5c4398c51039c6bbb9a0b7d2e34f3a8a69428935ad3326899cb
{ "func_code_index": [ 27582, 28320 ] }
58,010
BatchExchange
contracts/BatchExchange.sol
0x46f3f2f9662f66a6ddd6a8d1ddec3cd9ae5e87b5
Solidity
BatchExchange
contract BatchExchange is EpochTokenLocker { using SafeCast for uint256; using SafeMath for uint128; using BytesLib for bytes32; using BytesLib for bytes; using TokenConservation for int256[]; using TokenConservation for uint16[]; using IterableAppendOnlySet for IterableAppendOnlySet....
/** @title BatchExchange - A decentralized exchange for any ERC20 token as a multi-token batch * auction with uniform clearing prices. * For more information visit: <https://github.com/gnosis/dex-contracts> * @author @gnosis/dfusion-team <https://github.com/orgs/gnosis/teams/dfusion-team/members> */
NatSpecMultiLine
getExecutedSellAmount
function getExecutedSellAmount(uint128 executedBuyAmount, uint128 buyTokenPrice, uint128 sellTokenPrice) private view returns (uint128) { return uint256(executedBuyAmount) .mul(buyTokenPrice) .div(feeDenominator - 1) .mul(feeDenominator) ...
/** @dev Evaluates executedBuy amount based on prices and executedBuyAmout (fees included) * @param executedBuyAmount amount of buyToken executed for purchase in batch auction * @param buyTokenPrice uniform clearing price of buyToken * @param sellTokenPrice uniform clearing price of sellToken * @return executed...
NatSpecMultiLine
v0.5.6+commit.b259423e
GNU GPLv3
bzzr://d75d8f06b335b5c4398c51039c6bbb9a0b7d2e34f3a8a69428935ad3326899cb
{ "func_code_index": [ 29461, 29884 ] }
58,011
BatchExchange
contracts/BatchExchange.sol
0x46f3f2f9662f66a6ddd6a8d1ddec3cd9ae5e87b5
Solidity
BatchExchange
contract BatchExchange is EpochTokenLocker { using SafeCast for uint256; using SafeMath for uint128; using BytesLib for bytes32; using BytesLib for bytes; using TokenConservation for int256[]; using TokenConservation for uint16[]; using IterableAppendOnlySet for IterableAppendOnlySet....
/** @title BatchExchange - A decentralized exchange for any ERC20 token as a multi-token batch * auction with uniform clearing prices. * For more information visit: <https://github.com/gnosis/dex-contracts> * @author @gnosis/dfusion-team <https://github.com/orgs/gnosis/teams/dfusion-team/members> */
NatSpecMultiLine
currentBatchHasSolution
function currentBatchHasSolution() private view returns (bool) { return latestSolution.batchId == getCurrentBatchId() - 1; }
/** @dev used to determine if solution if first provided in current batch * @return true if `latestSolution` is storing a solution for current batch, else false */
NatSpecMultiLine
v0.5.6+commit.b259423e
GNU GPLv3
bzzr://d75d8f06b335b5c4398c51039c6bbb9a0b7d2e34f3a8a69428935ad3326899cb
{ "func_code_index": [ 30070, 30213 ] }
58,012
BatchExchange
contracts/BatchExchange.sol
0x46f3f2f9662f66a6ddd6a8d1ddec3cd9ae5e87b5
Solidity
BatchExchange
contract BatchExchange is EpochTokenLocker { using SafeCast for uint256; using SafeMath for uint128; using BytesLib for bytes32; using BytesLib for bytes; using TokenConservation for int256[]; using TokenConservation for uint16[]; using IterableAppendOnlySet for IterableAppendOnlySet....
/** @title BatchExchange - A decentralized exchange for any ERC20 token as a multi-token batch * auction with uniform clearing prices. * For more information visit: <https://github.com/gnosis/dex-contracts> * @author @gnosis/dfusion-team <https://github.com/orgs/gnosis/teams/dfusion-team/members> */
NatSpecMultiLine
getTradedAmounts
function getTradedAmounts(uint128 executedBuyAmount, Order memory order) private view returns (uint128, uint128) { uint128 executedSellAmount = getExecutedSellAmount( executedBuyAmount, currentPrices[order.buyToken], currentPrices[order.sellToken] ); return (executedBuyAmount, ...
/** @dev Compute trade execution based on executedBuyAmount and relevant token prices * @param executedBuyAmount executed buy amount * @param order contains relevant buy-sell token information * @return (executedBuyAmount, executedSellAmount) */
NatSpecMultiLine
v0.5.6+commit.b259423e
GNU GPLv3
bzzr://d75d8f06b335b5c4398c51039c6bbb9a0b7d2e34f3a8a69428935ad3326899cb
{ "func_code_index": [ 30516, 30892 ] }
58,013
BatchExchange
contracts/BatchExchange.sol
0x46f3f2f9662f66a6ddd6a8d1ddec3cd9ae5e87b5
Solidity
BatchExchange
contract BatchExchange is EpochTokenLocker { using SafeCast for uint256; using SafeMath for uint128; using BytesLib for bytes32; using BytesLib for bytes; using TokenConservation for int256[]; using TokenConservation for uint16[]; using IterableAppendOnlySet for IterableAppendOnlySet....
/** @title BatchExchange - A decentralized exchange for any ERC20 token as a multi-token batch * auction with uniform clearing prices. * For more information visit: <https://github.com/gnosis/dex-contracts> * @author @gnosis/dfusion-team <https://github.com/orgs/gnosis/teams/dfusion-team/members> */
NatSpecMultiLine
isObjectiveValueSufficientlyImproved
function isObjectiveValueSufficientlyImproved(uint256 objectiveValue) private view returns (bool) { return (objectiveValue.mul(IMPROVEMENT_DENOMINATOR) > getCurrentObjectiveValue().mul(IMPROVEMENT_DENOMINATOR + 1)); }
/** @dev Checks that the proposed objective value is a significant enough improvement on the latest one * @param objectiveValue the proposed objective value to check * @return true if the objectiveValue is a significant enough improvement, false otherwise */
NatSpecMultiLine
v0.5.6+commit.b259423e
GNU GPLv3
bzzr://d75d8f06b335b5c4398c51039c6bbb9a0b7d2e34f3a8a69428935ad3326899cb
{ "func_code_index": [ 31180, 31416 ] }
58,014
BatchExchange
contracts/BatchExchange.sol
0x46f3f2f9662f66a6ddd6a8d1ddec3cd9ae5e87b5
Solidity
BatchExchange
contract BatchExchange is EpochTokenLocker { using SafeCast for uint256; using SafeMath for uint128; using BytesLib for bytes32; using BytesLib for bytes; using TokenConservation for int256[]; using TokenConservation for uint16[]; using IterableAppendOnlySet for IterableAppendOnlySet....
/** @title BatchExchange - A decentralized exchange for any ERC20 token as a multi-token batch * auction with uniform clearing prices. * For more information visit: <https://github.com/gnosis/dex-contracts> * @author @gnosis/dfusion-team <https://github.com/orgs/gnosis/teams/dfusion-team/members> */
NatSpecMultiLine
checkOrderValidity
function checkOrderValidity(Order memory order, uint256 batchIndex) private pure returns (bool) { return order.validFrom <= batchIndex && order.validUntil >= batchIndex; }
/** @dev used to determine if an order is valid for specific auction/batch * @param order object whose validity is in question * @param batchIndex auction index of validity * @return true if order is valid in auction batchIndex else false */
NatSpecMultiLine
v0.5.6+commit.b259423e
GNU GPLv3
bzzr://d75d8f06b335b5c4398c51039c6bbb9a0b7d2e34f3a8a69428935ad3326899cb
{ "func_code_index": [ 31715, 31905 ] }
58,015
BatchExchange
contracts/BatchExchange.sol
0x46f3f2f9662f66a6ddd6a8d1ddec3cd9ae5e87b5
Solidity
BatchExchange
contract BatchExchange is EpochTokenLocker { using SafeCast for uint256; using SafeMath for uint128; using BytesLib for bytes32; using BytesLib for bytes; using TokenConservation for int256[]; using TokenConservation for uint16[]; using IterableAppendOnlySet for IterableAppendOnlySet....
/** @title BatchExchange - A decentralized exchange for any ERC20 token as a multi-token batch * auction with uniform clearing prices. * For more information visit: <https://github.com/gnosis/dex-contracts> * @author @gnosis/dfusion-team <https://github.com/orgs/gnosis/teams/dfusion-team/members> */
NatSpecMultiLine
getRemainingAmount
function getRemainingAmount(Order memory order) private pure returns (uint128) { return order.priceDenominator - order.usedAmount; }
/** @dev computes the remaining sell amount for a given order * @param order the order for which remaining amount should be calculated * @return the remaining sell amount */
NatSpecMultiLine
v0.5.6+commit.b259423e
GNU GPLv3
bzzr://d75d8f06b335b5c4398c51039c6bbb9a0b7d2e34f3a8a69428935ad3326899cb
{ "func_code_index": [ 32108, 32259 ] }
58,016
BatchExchange
contracts/BatchExchange.sol
0x46f3f2f9662f66a6ddd6a8d1ddec3cd9ae5e87b5
Solidity
BatchExchange
contract BatchExchange is EpochTokenLocker { using SafeCast for uint256; using SafeMath for uint128; using BytesLib for bytes32; using BytesLib for bytes; using TokenConservation for int256[]; using TokenConservation for uint16[]; using IterableAppendOnlySet for IterableAppendOnlySet....
/** @title BatchExchange - A decentralized exchange for any ERC20 token as a multi-token batch * auction with uniform clearing prices. * For more information visit: <https://github.com/gnosis/dex-contracts> * @author @gnosis/dfusion-team <https://github.com/orgs/gnosis/teams/dfusion-team/members> */
NatSpecMultiLine
encodeAuctionElement
function encodeAuctionElement(address user, uint256 sellTokenBalance, Order memory order) private pure returns (bytes memory element) { element = abi.encodePacked(user); element = element.concat(abi.encodePacked(sellTokenBalance)); element = element.concat(abi.encodePacked(order.buyToken)...
/** @dev called only by getEncodedOrders and used to pack auction info into bytes * @param user list of tokenIds * @param sellTokenBalance user's account balance of sell token * @param order a sell order * @return byte encoded, packed, concatenation of relevant order information */
NatSpecMultiLine
v0.5.6+commit.b259423e
GNU GPLv3
bzzr://d75d8f06b335b5c4398c51039c6bbb9a0b7d2e34f3a8a69428935ad3326899cb
{ "func_code_index": [ 32585, 33415 ] }
58,017
BatchExchange
contracts/BatchExchange.sol
0x46f3f2f9662f66a6ddd6a8d1ddec3cd9ae5e87b5
Solidity
BatchExchange
contract BatchExchange is EpochTokenLocker { using SafeCast for uint256; using SafeMath for uint128; using BytesLib for bytes32; using BytesLib for bytes; using TokenConservation for int256[]; using TokenConservation for uint16[]; using IterableAppendOnlySet for IterableAppendOnlySet....
/** @title BatchExchange - A decentralized exchange for any ERC20 token as a multi-token batch * auction with uniform clearing prices. * For more information visit: <https://github.com/gnosis/dex-contracts> * @author @gnosis/dfusion-team <https://github.com/orgs/gnosis/teams/dfusion-team/members> */
NatSpecMultiLine
verifyAmountThreshold
function verifyAmountThreshold(uint128[] memory amounts) private pure returns (bool) { for (uint256 i = 0; i < amounts.length; i++) { if (amounts[i] < AMOUNT_MINIMUM) { return false; } } return true; }
/** @dev determines if value is better than currently and updates if it is. * @param amounts array of values to be verified with AMOUNT_MINIMUM */
NatSpecMultiLine
v0.5.6+commit.b259423e
GNU GPLv3
bzzr://d75d8f06b335b5c4398c51039c6bbb9a0b7d2e34f3a8a69428935ad3326899cb
{ "func_code_index": [ 33584, 33865 ] }
58,018
BoyCoin
BoyCoin.sol
0x368e178bf686a2637a58d0f2ed319ccd24cf4484
Solidity
SafeMath
library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { // Gas optimization: this is cheaper than asserting 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://githu...
mul
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { // Gas optimization: this is cheaper than asserting 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { return 0; } c = a...
/** * @dev Multiplies two numbers, throws on overflow. */
NatSpecMultiLine
v0.4.23+commit.124ca40d
MIT
bzzr://1f6cbe41190aeb9442b4505fdebc619da85d57064e36d1b98a50d4cf00bd0c4b
{ "func_code_index": [ 89, 476 ] }
58,019
BoyCoin
BoyCoin.sol
0x368e178bf686a2637a58d0f2ed319ccd24cf4484
Solidity
SafeMath
library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { // Gas optimization: this is cheaper than asserting 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://githu...
div
function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return a / b; }
/** * @dev Integer division of two numbers, truncating the quotient. */
NatSpecMultiLine
v0.4.23+commit.124ca40d
MIT
bzzr://1f6cbe41190aeb9442b4505fdebc619da85d57064e36d1b98a50d4cf00bd0c4b
{ "func_code_index": [ 560, 840 ] }
58,020
BoyCoin
BoyCoin.sol
0x368e178bf686a2637a58d0f2ed319ccd24cf4484
Solidity
SafeMath
library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { // Gas optimization: this is cheaper than asserting 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://githu...
sub
function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; }
/** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */
NatSpecMultiLine
v0.4.23+commit.124ca40d
MIT
bzzr://1f6cbe41190aeb9442b4505fdebc619da85d57064e36d1b98a50d4cf00bd0c4b
{ "func_code_index": [ 954, 1070 ] }
58,021
BoyCoin
BoyCoin.sol
0x368e178bf686a2637a58d0f2ed319ccd24cf4484
Solidity
SafeMath
library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { // Gas optimization: this is cheaper than asserting 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://githu...
add
function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; assert(c >= a); return c; }
/** * @dev Adds two numbers, throws on overflow. */
NatSpecMultiLine
v0.4.23+commit.124ca40d
MIT
bzzr://1f6cbe41190aeb9442b4505fdebc619da85d57064e36d1b98a50d4cf00bd0c4b
{ "func_code_index": [ 1134, 1264 ] }
58,022
BoyCoin
BoyCoin.sol
0x368e178bf686a2637a58d0f2ed319ccd24cf4484
Solidity
Ownable
contract Ownable { address public owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * a...
/** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */
NatSpecMultiLine
renounceOwnership
function renounceOwnership() public onlyOwner { emit OwnershipRenounced(owner); owner = address(0); }
/** * @dev Allows the current owner to relinquish control of the contract. */
NatSpecMultiLine
v0.4.23+commit.124ca40d
MIT
bzzr://1f6cbe41190aeb9442b4505fdebc619da85d57064e36d1b98a50d4cf00bd0c4b
{ "func_code_index": [ 638, 755 ] }
58,023
BoyCoin
BoyCoin.sol
0x368e178bf686a2637a58d0f2ed319ccd24cf4484
Solidity
Ownable
contract Ownable { address public owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * a...
/** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */
NatSpecMultiLine
transferOwnership
function transferOwnership(address _newOwner) public onlyOwner { _transferOwnership(_newOwner); }
/** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */
NatSpecMultiLine
v0.4.23+commit.124ca40d
MIT
bzzr://1f6cbe41190aeb9442b4505fdebc619da85d57064e36d1b98a50d4cf00bd0c4b
{ "func_code_index": [ 920, 1028 ] }
58,024
BoyCoin
BoyCoin.sol
0x368e178bf686a2637a58d0f2ed319ccd24cf4484
Solidity
Ownable
contract Ownable { address public owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * a...
/** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */
NatSpecMultiLine
_transferOwnership
function _transferOwnership(address _newOwner) internal { require(_newOwner != address(0)); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; }
/** * @dev Transfers control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */
NatSpecMultiLine
v0.4.23+commit.124ca40d
MIT
bzzr://1f6cbe41190aeb9442b4505fdebc619da85d57064e36d1b98a50d4cf00bd0c4b
{ "func_code_index": [ 1166, 1344 ] }
58,025
BoyCoin
BoyCoin.sol
0x368e178bf686a2637a58d0f2ed319ccd24cf4484
Solidity
BasicToken
contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; uint256 totalSupply_; /** * @dev total number of tokens in existence */ function totalSupply() public view returns (uint256) { return totalSupply_; } /** * @dev transfer token...
/** * @title Basic token * @dev Basic version of StandardToken, with no allowances. */
NatSpecMultiLine
totalSupply
function totalSupply() public view returns (uint256) { return totalSupply_; }
/** * @dev total number of tokens in existence */
NatSpecMultiLine
v0.4.23+commit.124ca40d
MIT
bzzr://1f6cbe41190aeb9442b4505fdebc619da85d57064e36d1b98a50d4cf00bd0c4b
{ "func_code_index": [ 199, 287 ] }
58,026
BoyCoin
BoyCoin.sol
0x368e178bf686a2637a58d0f2ed319ccd24cf4484
Solidity
BasicToken
contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; uint256 totalSupply_; /** * @dev total number of tokens in existence */ function totalSupply() public view returns (uint256) { return totalSupply_; } /** * @dev transfer token...
/** * @title Basic token * @dev Basic version of StandardToken, with no allowances. */
NatSpecMultiLine
transfer
function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; }
/** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */
NatSpecMultiLine
v0.4.23+commit.124ca40d
MIT
bzzr://1f6cbe41190aeb9442b4505fdebc619da85d57064e36d1b98a50d4cf00bd0c4b
{ "func_code_index": [ 445, 777 ] }
58,027
BoyCoin
BoyCoin.sol
0x368e178bf686a2637a58d0f2ed319ccd24cf4484
Solidity
BasicToken
contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; uint256 totalSupply_; /** * @dev total number of tokens in existence */ function totalSupply() public view returns (uint256) { return totalSupply_; } /** * @dev transfer token...
/** * @title Basic token * @dev Basic version of StandardToken, with no allowances. */
NatSpecMultiLine
balanceOf
function balanceOf(address _owner) public view returns (uint256) { return balances[_owner]; }
/** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */
NatSpecMultiLine
v0.4.23+commit.124ca40d
MIT
bzzr://1f6cbe41190aeb9442b4505fdebc619da85d57064e36d1b98a50d4cf00bd0c4b
{ "func_code_index": [ 983, 1087 ] }
58,028
BoyCoin
BoyCoin.sol
0x368e178bf686a2637a58d0f2ed319ccd24cf4484
Solidity
BurnableToken
contract BurnableToken is BasicToken { event Burn(address indexed burner, uint256 value); /** * @dev Burns a specific amount of tokens. * @param _value The amount of token to be burned. */ function burn(uint256 _value) public { _burn(msg.sender, _value); } function _burn(address _w...
/** * @title Burnable Token * @dev Token that can be irreversibly burned (destroyed). */
NatSpecMultiLine
burn
function burn(uint256 _value) public { _burn(msg.sender, _value); }
/** * @dev Burns a specific amount of tokens. * @param _value The amount of token to be burned. */
NatSpecMultiLine
v0.4.23+commit.124ca40d
MIT
bzzr://1f6cbe41190aeb9442b4505fdebc619da85d57064e36d1b98a50d4cf00bd0c4b
{ "func_code_index": [ 212, 290 ] }
58,029
BoyCoin
BoyCoin.sol
0x368e178bf686a2637a58d0f2ed319ccd24cf4484
Solidity
StandardToken
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transf...
/** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * @dev https://github.com/ethereum/EIPs/issues/20 * @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */
NatSpecMultiLine
transferFrom
function transferFrom( address _from, address _to, uint256 _value ) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_v...
/** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */
NatSpecMultiLine
v0.4.23+commit.124ca40d
MIT
bzzr://1f6cbe41190aeb9442b4505fdebc619da85d57064e36d1b98a50d4cf00bd0c4b
{ "func_code_index": [ 401, 891 ] }
58,030
BoyCoin
BoyCoin.sol
0x368e178bf686a2637a58d0f2ed319ccd24cf4484
Solidity
StandardToken
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transf...
/** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * @dev https://github.com/ethereum/EIPs/issues/20 * @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */
NatSpecMultiLine
approve
function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; }
/** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * ...
NatSpecMultiLine
v0.4.23+commit.124ca40d
MIT
bzzr://1f6cbe41190aeb9442b4505fdebc619da85d57064e36d1b98a50d4cf00bd0c4b
{ "func_code_index": [ 1523, 1718 ] }
58,031
BoyCoin
BoyCoin.sol
0x368e178bf686a2637a58d0f2ed319ccd24cf4484
Solidity
StandardToken
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transf...
/** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * @dev https://github.com/ethereum/EIPs/issues/20 * @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */
NatSpecMultiLine
allowance
function allowance( address _owner, address _spender ) public view returns (uint256) { return allowed[_owner][_spender]; }
/** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */
NatSpecMultiLine
v0.4.23+commit.124ca40d
MIT
bzzr://1f6cbe41190aeb9442b4505fdebc619da85d57064e36d1b98a50d4cf00bd0c4b
{ "func_code_index": [ 2042, 2207 ] }
58,032
BoyCoin
BoyCoin.sol
0x368e178bf686a2637a58d0f2ed319ccd24cf4484
Solidity
StandardToken
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transf...
/** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * @dev https://github.com/ethereum/EIPs/issues/20 * @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */
NatSpecMultiLine
increaseApproval
function increaseApproval( address _spender, uint _addedValue ) public returns (bool) { allowed[msg.sender][_spender] = ( allowed[msg.sender][_spender].add(_addedValue)); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; }
/** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spend...
NatSpecMultiLine
v0.4.23+commit.124ca40d
MIT
bzzr://1f6cbe41190aeb9442b4505fdebc619da85d57064e36d1b98a50d4cf00bd0c4b
{ "func_code_index": [ 2673, 2980 ] }
58,033
BoyCoin
BoyCoin.sol
0x368e178bf686a2637a58d0f2ed319ccd24cf4484
Solidity
StandardToken
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transf...
/** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * @dev https://github.com/ethereum/EIPs/issues/20 * @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */
NatSpecMultiLine
decreaseApproval
function decreaseApproval( address _spender, uint _subtractedValue ) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); }...
/** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spend...
NatSpecMultiLine
v0.4.23+commit.124ca40d
MIT
bzzr://1f6cbe41190aeb9442b4505fdebc619da85d57064e36d1b98a50d4cf00bd0c4b
{ "func_code_index": [ 3451, 3894 ] }
58,034
BoyCoin
BoyCoin.sol
0x368e178bf686a2637a58d0f2ed319ccd24cf4484
Solidity
StandardBurnableToken
contract StandardBurnableToken is BurnableToken, StandardToken { /** * @dev Burns a specific amount of tokens from the target address and decrements allowance * @param _from address The address which you want to send tokens from * @param _value uint256 The amount of token to be burned */ functio...
/** * @title Standard Burnable Token * @dev Adds burnFrom method to ERC20 implementations */
NatSpecMultiLine
burnFrom
function burnFrom(address _from, uint256 _value) public { require(_value <= allowed[_from][msg.sender]); // Should https://github.com/OpenZeppelin/zeppelin-solidity/issues/707 be accepted, // this function needs to emit an event with the updated approval. allowed[_from][msg.sender] = allowed[_from][msg.send...
/** * @dev Burns a specific amount of tokens from the target address and decrements allowance * @param _from address The address which you want to send tokens from * @param _value uint256 The amount of token to be burned */
NatSpecMultiLine
v0.4.23+commit.124ca40d
MIT
bzzr://1f6cbe41190aeb9442b4505fdebc619da85d57064e36d1b98a50d4cf00bd0c4b
{ "func_code_index": [ 311, 690 ] }
58,035
BoyCoin
BoyCoin.sol
0x368e178bf686a2637a58d0f2ed319ccd24cf4484
Solidity
Pausable
contract Pausable is Ownable { event Pause(); event Unpause(); bool public paused = false; /** * @dev Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPaused() { require(!paused); _; } /** * @dev Modifier to make a function ...
/** * @title Pausable * @dev Base contract which allows children to implement an emergency stop mechanism. */
NatSpecMultiLine
pause
function pause() onlyOwner whenNotPaused public { paused = true; emit Pause(); }
/** * @dev called by the owner to pause, triggers stopped state */
NatSpecMultiLine
v0.4.23+commit.124ca40d
MIT
bzzr://1f6cbe41190aeb9442b4505fdebc619da85d57064e36d1b98a50d4cf00bd0c4b
{ "func_code_index": [ 513, 609 ] }
58,036
BoyCoin
BoyCoin.sol
0x368e178bf686a2637a58d0f2ed319ccd24cf4484
Solidity
Pausable
contract Pausable is Ownable { event Pause(); event Unpause(); bool public paused = false; /** * @dev Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPaused() { require(!paused); _; } /** * @dev Modifier to make a function ...
/** * @title Pausable * @dev Base contract which allows children to implement an emergency stop mechanism. */
NatSpecMultiLine
unpause
function unpause() onlyOwner whenPaused public { paused = false; emit Unpause(); }
/** * @dev called by the owner to unpause, returns to normal state */
NatSpecMultiLine
v0.4.23+commit.124ca40d
MIT
bzzr://1f6cbe41190aeb9442b4505fdebc619da85d57064e36d1b98a50d4cf00bd0c4b
{ "func_code_index": [ 693, 791 ] }
58,037
BoyCoin
BoyCoin.sol
0x368e178bf686a2637a58d0f2ed319ccd24cf4484
Solidity
BaseERC20Token
contract BaseERC20Token is StandardBurnableToken, PausableToken, DetailedERC20 { constructor( uint256 _initialAmount, uint8 _decimalUnits, string _tokenName, string _tokenSymbol ) DetailedERC20(_tokenName, _tokenSymbol, _decimalUnits) public { totalSupply_ = _initialAmount; balance...
/** * A base token for the BoyCoin (or any other coin with similar behavior). * Compatible with contracts and UIs expecting a ERC20 token. * Provides also a convenience method to burn tokens, permanently removing them from the pool; * the intent of this convenience method is for users who wish to burn tokens ...
NatSpecMultiLine
_burn
function _burn(address _from, uint256 _value) internal whenNotPaused { super._burn(_from, _value); }
// override the burnable token's "Burn" function: don't allow tokens to // be burned when paused
LineComment
v0.4.23+commit.124ca40d
MIT
bzzr://1f6cbe41190aeb9442b4505fdebc619da85d57064e36d1b98a50d4cf00bd0c4b
{ "func_code_index": [ 461, 572 ] }
58,038
CompoundProtocolAdapter
contracts/adapters/compound/CErc20Adapter.sol
0x7f77389b868718b5351433d8031d49921cd72ace
Solidity
CErc20Adapter
contract CErc20Adapter is AbstractErc20Adapter() { using MinimalSignedMath for uint256; using LowGasSafeMath for uint256; using TransferHelper for address; /* ========== Constants ========== */ IComptroller internal constant comptroller = IComptroller(0x3d9819210A31b4961b30EF54bE2aeD79B9c9Cd3B); address int...
_protocolName
function _protocolName() internal view virtual override returns (string memory) { return "Compound"; }
/* ========== Internal Queries ========== */
Comment
v0.7.6+commit.7338295f
MIT
{ "func_code_index": [ 513, 623 ] }
58,039
CompoundProtocolAdapter
contracts/adapters/compound/CErc20Adapter.sol
0x7f77389b868718b5351433d8031d49921cd72ace
Solidity
CErc20Adapter
contract CErc20Adapter is AbstractErc20Adapter() { using MinimalSignedMath for uint256; using LowGasSafeMath for uint256; using TransferHelper for address; /* ========== Constants ========== */ IComptroller internal constant comptroller = IComptroller(0x3d9819210A31b4961b30EF54bE2aeD79B9c9Cd3B); address int...
availableLiquidity
function availableLiquidity() public view override returns (uint256) { return IERC20(underlying).balanceOf(token); }
/* ========== Metadata ========== */
Comment
v0.7.6+commit.7338295f
MIT
{ "func_code_index": [ 663, 787 ] }
58,040
CompoundProtocolAdapter
contracts/adapters/compound/CErc20Adapter.sol
0x7f77389b868718b5351433d8031d49921cd72ace
Solidity
CErc20Adapter
contract CErc20Adapter is AbstractErc20Adapter() { using MinimalSignedMath for uint256; using LowGasSafeMath for uint256; using TransferHelper for address; /* ========== Constants ========== */ IComptroller internal constant comptroller = IComptroller(0x3d9819210A31b4961b30EF54bE2aeD79B9c9Cd3B); address int...
toUnderlyingAmount
function toUnderlyingAmount(uint256 tokenAmount) public view override returns (uint256) { return ( tokenAmount .mul(CTokenParams.currentExchangeRate(token)) / uint256(1e18) ); }
/* ========== Conversion Queries ========== */
Comment
v0.7.6+commit.7338295f
MIT
{ "func_code_index": [ 837, 1044 ] }
58,041
CompoundProtocolAdapter
contracts/adapters/compound/CErc20Adapter.sol
0x7f77389b868718b5351433d8031d49921cd72ace
Solidity
CErc20Adapter
contract CErc20Adapter is AbstractErc20Adapter() { using MinimalSignedMath for uint256; using LowGasSafeMath for uint256; using TransferHelper for address; /* ========== Constants ========== */ IComptroller internal constant comptroller = IComptroller(0x3d9819210A31b4961b30EF54bE2aeD79B9c9Cd3B); address int...
getRewardsAPR
function getRewardsAPR( ICToken cToken, uint256 _totalLiquidity ) internal view returns (uint256) { IPriceOracle oracle = comptroller.oracle(); uint256 compPrice = oracle.getUnderlyingPrice(cComp); uint256 tokenPrice = oracle.getUnderlyingPrice(address(cToken)); if (compPrice == 0 || tokenPrice == 0) return...
/* ========== Performance Queries ========== */
Comment
v0.7.6+commit.7338295f
MIT
{ "func_code_index": [ 1288, 1798 ] }
58,042
CompoundProtocolAdapter
contracts/adapters/compound/CErc20Adapter.sol
0x7f77389b868718b5351433d8031d49921cd72ace
Solidity
CErc20Adapter
contract CErc20Adapter is AbstractErc20Adapter() { using MinimalSignedMath for uint256; using LowGasSafeMath for uint256; using TransferHelper for address; /* ========== Constants ========== */ IComptroller internal constant comptroller = IComptroller(0x3d9819210A31b4961b30EF54bE2aeD79B9c9Cd3B); address int...
balanceUnderlying
function balanceUnderlying() external view virtual override returns (uint256) { return toUnderlyingAmount(ICToken(token).balanceOf(msg.sender)); }
/* ========== Caller Balance Queries ========== */
Comment
v0.7.6+commit.7338295f
MIT
{ "func_code_index": [ 4522, 4676 ] }
58,043
CompoundProtocolAdapter
contracts/adapters/compound/CErc20Adapter.sol
0x7f77389b868718b5351433d8031d49921cd72ace
Solidity
CErc20Adapter
contract CErc20Adapter is AbstractErc20Adapter() { using MinimalSignedMath for uint256; using LowGasSafeMath for uint256; using TransferHelper for address; /* ========== Constants ========== */ IComptroller internal constant comptroller = IComptroller(0x3d9819210A31b4961b30EF54bE2aeD79B9c9Cd3B); address int...
_claimRewardsIfAny
function _claimRewardsIfAny(address account) internal { address[] memory holders = new address[](1); address[] memory cTokens = new address[](1); holders[0] = account; cTokens[0] = token; comptroller.claimComp(holders, cTokens, false, true); }
/* ========== Internal Actions ========== */
Comment
v0.7.6+commit.7338295f
MIT
{ "func_code_index": [ 4724, 4991 ] }
58,044
CompoundProtocolAdapter
contracts/protocols/CompoundProtocolAdapter.sol
0x7f77389b868718b5351433d8031d49921cd72ace
Solidity
CompoundProtocolAdapter
contract CompoundProtocolAdapter is AbstractProtocolAdapter { using CloneLibrary for address; /* ========== Constants ========== */ IComptroller public constant comptroller = IComptroller(0x3d9819210A31b4961b30EF54bE2aeD79B9c9Cd3B); address public constant interestRateModelV1 = 0xBAE04CbF96391086dC643e842b51773...
deployAdapter
function deployAdapter(address cToken) internal virtual override returns (address adapter) { address underlying; // The call to underlying() will use all the gas sent if it fails, // so we specify a maximum of 25k gas. The contract will only use ~2k // but this protects against all likely changes to the gas sch...
/* ========== Internal Actions ========== */
Comment
v0.7.6+commit.7338295f
MIT
{ "func_code_index": [ 862, 1803 ] }
58,045
CompoundProtocolAdapter
contracts/protocols/CompoundProtocolAdapter.sol
0x7f77389b868718b5351433d8031d49921cd72ace
Solidity
CompoundProtocolAdapter
contract CompoundProtocolAdapter is AbstractProtocolAdapter { using CloneLibrary for address; /* ========== Constants ========== */ IComptroller public constant comptroller = IComptroller(0x3d9819210A31b4961b30EF54bE2aeD79B9c9Cd3B); address public constant interestRateModelV1 = 0xBAE04CbF96391086dC643e842b51773...
protocol
function protocol() external pure virtual override returns (string memory) { return "Compound"; }
/* ========== Public Queries ========== */
Comment
v0.7.6+commit.7338295f
MIT
{ "func_code_index": [ 1849, 1954 ] }
58,046
CompoundProtocolAdapter
contracts/protocols/CompoundProtocolAdapter.sol
0x7f77389b868718b5351433d8031d49921cd72ace
Solidity
CompoundProtocolAdapter
contract CompoundProtocolAdapter is AbstractProtocolAdapter { using CloneLibrary for address; /* ========== Constants ========== */ IComptroller public constant comptroller = IComptroller(0x3d9819210A31b4961b30EF54bE2aeD79B9c9Cd3B); address public constant interestRateModelV1 = 0xBAE04CbF96391086dC643e842b51773...
isAdapterMarketFrozen
function isAdapterMarketFrozen(address adapter) internal view virtual override returns (bool) { return isTokenMarketFrozen(IErc20Adapter(adapter).token()); }
/* ========== Internal Queries ========== */
Comment
v0.7.6+commit.7338295f
MIT
{ "func_code_index": [ 2563, 2728 ] }
58,047
locashToken
locashToken.sol
0x248a0316d862f6c7945067f8bd12c035bb4a12d5
Solidity
locashToken
contract locashToken is ERC20Interface, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // -------------------------------------...
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
totalSupply
function totalSupply() public view returns (uint) { return _totalSupply - balances[address(0)]; }
// ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------
LineComment
v0.5.0+commit.1d4f565a
GNU GPLv3
bzzr://fe03f09da0e82ec9bd31470ae8f46bf71efa12ab68481643cb7cf8d4437d900c
{ "func_code_index": [ 987, 1103 ] }
58,048
locashToken
locashToken.sol
0x248a0316d862f6c7945067f8bd12c035bb4a12d5
Solidity
locashToken
contract locashToken is ERC20Interface, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // -------------------------------------...
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
balanceOf
function balanceOf(address tokenOwner) public view returns (uint balance) { return balances[tokenOwner]; }
// ------------------------------------------------------------------------ // Get the token balance for account tokenOwner // ------------------------------------------------------------------------
LineComment
v0.5.0+commit.1d4f565a
GNU GPLv3
bzzr://fe03f09da0e82ec9bd31470ae8f46bf71efa12ab68481643cb7cf8d4437d900c
{ "func_code_index": [ 1323, 1448 ] }
58,049
locashToken
locashToken.sol
0x248a0316d862f6c7945067f8bd12c035bb4a12d5
Solidity
locashToken
contract locashToken is ERC20Interface, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // -------------------------------------...
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
transfer
function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(msg.sender, to, tokens); return true; }
// ------------------------------------------------------------------------ // Transfer the balance from token owner's account to to account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------
LineComment
v0.5.0+commit.1d4f565a
GNU GPLv3
bzzr://fe03f09da0e82ec9bd31470ae8f46bf71efa12ab68481643cb7cf8d4437d900c
{ "func_code_index": [ 1792, 2074 ] }
58,050
locashToken
locashToken.sol
0x248a0316d862f6c7945067f8bd12c035bb4a12d5
Solidity
locashToken
contract locashToken is ERC20Interface, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // -------------------------------------...
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
approve
function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; }
// ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account // // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // recommends that there are no checks for the approval double...
LineComment
v0.5.0+commit.1d4f565a
GNU GPLv3
bzzr://fe03f09da0e82ec9bd31470ae8f46bf71efa12ab68481643cb7cf8d4437d900c
{ "func_code_index": [ 2582, 2795 ] }
58,051
locashToken
locashToken.sol
0x248a0316d862f6c7945067f8bd12c035bb4a12d5
Solidity
locashToken
contract locashToken is ERC20Interface, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // -------------------------------------...
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
transferFrom
function transferFrom(address from, address to, uint tokens) public returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(from, to, tokens); r...
// ------------------------------------------------------------------------ // Transfer tokens from the from account to the to account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the from account and // - From account must have sufficient balance to transfer // - S...
LineComment
v0.5.0+commit.1d4f565a
GNU GPLv3
bzzr://fe03f09da0e82ec9bd31470ae8f46bf71efa12ab68481643cb7cf8d4437d900c
{ "func_code_index": [ 3326, 3689 ] }
58,052
locashToken
locashToken.sol
0x248a0316d862f6c7945067f8bd12c035bb4a12d5
Solidity
locashToken
contract locashToken is ERC20Interface, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // -------------------------------------...
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
allowance
function allowance(address tokenOwner, address spender) public view returns (uint remaining) { return allowed[tokenOwner][spender]; }
// ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------
LineComment
v0.5.0+commit.1d4f565a
GNU GPLv3
bzzr://fe03f09da0e82ec9bd31470ae8f46bf71efa12ab68481643cb7cf8d4437d900c
{ "func_code_index": [ 3972, 4124 ] }
58,053
locashToken
locashToken.sol
0x248a0316d862f6c7945067f8bd12c035bb4a12d5
Solidity
locashToken
contract locashToken is ERC20Interface, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // -------------------------------------...
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
approveAndCall
function approveAndCall(address spender, uint tokens, bytes memory data) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, address(this), data); return true; }
// ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account. The spender contract function // receiveApproval(...) is then executed // --------------------------------------------------------------------...
LineComment
v0.5.0+commit.1d4f565a
GNU GPLv3
bzzr://fe03f09da0e82ec9bd31470ae8f46bf71efa12ab68481643cb7cf8d4437d900c
{ "func_code_index": [ 4479, 4817 ] }
58,054
locashToken
locashToken.sol
0x248a0316d862f6c7945067f8bd12c035bb4a12d5
Solidity
locashToken
contract locashToken is ERC20Interface, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // -------------------------------------...
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
function () external payable { revert(); }
// ------------------------------------------------------------------------ // Don't accept ETH // ------------------------------------------------------------------------
LineComment
v0.5.0+commit.1d4f565a
GNU GPLv3
bzzr://fe03f09da0e82ec9bd31470ae8f46bf71efa12ab68481643cb7cf8d4437d900c
{ "func_code_index": [ 5009, 5070 ] }
58,055
locashToken
locashToken.sol
0x248a0316d862f6c7945067f8bd12c035bb4a12d5
Solidity
locashToken
contract locashToken is ERC20Interface, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // -------------------------------------...
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
transferAnyERC20Token
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, tokens); }
// ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------
LineComment
v0.5.0+commit.1d4f565a
GNU GPLv3
bzzr://fe03f09da0e82ec9bd31470ae8f46bf71efa12ab68481643cb7cf8d4437d900c
{ "func_code_index": [ 5303, 5492 ] }
58,056
ERC20Token
ERC20Token.sol
0x9611fd98881473d2adadbc49e6567df6192dec29
Solidity
SafeMath
library SafeMath { /** * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); uint256 c = a - b; ...
/** * @title SafeMath * @dev Unsigned math operations with safety checks that revert on error. */
NatSpecMultiLine
sub
function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); uint256 c = a - b; return c; }
/** * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend). */
NatSpecMultiLine
v0.5.10+commit.5a6ea5b1
OSL-3.0
bzzr://74a9a6e00aed31693f8140f1aedf6b445ae60c30769fcc70b6da4aaaf75f1daa
{ "func_code_index": [ 150, 339 ] }
58,057
ERC20Token
ERC20Token.sol
0x9611fd98881473d2adadbc49e6567df6192dec29
Solidity
SafeMath
library SafeMath { /** * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); uint256 c = a - b; ...
/** * @title SafeMath * @dev Unsigned math operations with safety checks that revert on error. */
NatSpecMultiLine
add
function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; }
/** * @dev Adds two unsigned integers, reverts on overflow. */
NatSpecMultiLine
v0.5.10+commit.5a6ea5b1
OSL-3.0
bzzr://74a9a6e00aed31693f8140f1aedf6b445ae60c30769fcc70b6da4aaaf75f1daa
{ "func_code_index": [ 422, 608 ] }
58,058
ERC20Token
ERC20Token.sol
0x9611fd98881473d2adadbc49e6567df6192dec29
Solidity
ERC20
contract ERC20 is IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; /** * @dev Total number of tokens in existence. */ function totalS...
/** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * https://eips.ethereum.org/EIPS/eip-20 * Originally based on code by FirstBlood: * https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol * * This implementation emits additional Approva...
NatSpecMultiLine
totalSupply
function totalSupply() public view returns (uint256) { return _totalSupply; }
/** * @dev Total number of tokens in existence. */
NatSpecMultiLine
v0.5.10+commit.5a6ea5b1
OSL-3.0
bzzr://74a9a6e00aed31693f8140f1aedf6b445ae60c30769fcc70b6da4aaaf75f1daa
{ "func_code_index": [ 301, 397 ] }
58,059
ERC20Token
ERC20Token.sol
0x9611fd98881473d2adadbc49e6567df6192dec29
Solidity
ERC20
contract ERC20 is IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; /** * @dev Total number of tokens in existence. */ function totalS...
/** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * https://eips.ethereum.org/EIPS/eip-20 * Originally based on code by FirstBlood: * https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol * * This implementation emits additional Approva...
NatSpecMultiLine
balanceOf
function balanceOf(address owner) public view returns (uint256) { return _balances[owner]; }
/** * @dev Gets the balance of the specified address. * @param owner The address to query the balance of. * @return A uint256 representing the amount owned by the passed address. */
NatSpecMultiLine
v0.5.10+commit.5a6ea5b1
OSL-3.0
bzzr://74a9a6e00aed31693f8140f1aedf6b445ae60c30769fcc70b6da4aaaf75f1daa
{ "func_code_index": [ 611, 722 ] }
58,060