# Star Gateway
```
contract ERC20Gateway is MasterCopyNonUpgradable, MessageBus
{
// Stoage
function setup(
address _erc20Cogateway,
uint256 _maxStorageRoots,
uint8 _outboxStorageIndex
) external
{
}
function depositBase(
uint256 _amount, // can be removed
address _beneficiary,
uint256 _feeGasPrice,
uint256 _feeGasLimit
)
payable
external
returns(bytes32 messageHash_)
{
}
function depositToken(
ERC20I _valueToken,
uint256 _amount,
address _beneficiary,
uint256 _feeGasPrice,
uint256 _feeGasLimit
) external
{
}
}
```
```
contract ERC20Cogatway is MasterCopyNonUpgradable, MessageBus
{
mapping(address /*Value token */ => address /* Utility Token */) utilityTokens;
address utBase;
function setup(
address _erc20Gateway
)
{
}
function confirmDepositBase(
uint256 _amount,
address _beneficiary,
address _feeGasPrice,
address _feeGasLimit,
address _sender,
uint256 _blockHeight,
uint256 _storageProof
)
{
}
function confirmDepositToken(
address _valueTokenAddress,
uint256 _amount,
address _beneficiary,
address _feeGasPrice,
address _feeGasLimit,
address _sender,
uint256 _blockHeight,
uint256 _storageProof
)
{
if(utilityToken[_valueTokenAddress] == address(0)){
// deploy utiltity token proxy
address utilityToken = new Proxy(utilityTokenMasterCopy);
utilityTokens[_valueTokenAddress] = utilityToken;
}
// minting
}
}
```
### Gateway contract:
There are two approaches for implementing deposit of ERC20Token/ base(coin). There are two approaches for implementing it.
1. deposit() payable : One method to handle depositing of Eth and ERC20 token. Value token address will be a constant.e.g.`0x0` when depositing Eth and non-zero for and erc20 token. We would validate if `msg.value` and valuetoken address is 0 when depositing ERCToken.
2. There will be 2-methods for each depositing base and erc20 token.
a. depositBase() payable : It will deposit base amount.
b. depositToken() : It will deposit an erc20 token.
This approach simplifies checks whether base or token is to be deposited.
At gateway layer, we intend to maintain `utilityTokens(valuetoken => utilityToken)` mapping. For eth, what will be the value for `valuetoken` ?
## Using existing chain with mosaic-1
1. Reuse UtBase
2. Reuse Anchor