Introduction
Market Maker Proxy is a market-based token repositories library, an Ethereum Smart Contract (MMProxy) written using Solidity. After joining the Tokenlon Ecology, the market maker should deposit the tokens for market making into the MMProxy contract. The market maker has the full ownership of the MMP contract as well as the token recharge, withdrawal and authorization processes.
API
Permissions
There are two permissions in the contract, owner
and operator
.
Owner
has the operation permission of the contract authority interface, and the operator
has the operation authority of the contract function interface.
transferOwnership
Transfer owner
permissions.
Owner
is the highest authority of the contract and has full management of the contract.
API
transferOwnership(address newOwner)
Parameters
- newOwner: New
Owner
address to be set
Note
-Only Owner has the interface operation permission -Use with caution, error in transferring the address may result in the contract asset not being able to withdraw!
setOperator
Sets the operator
.
The operator
has the operational rights of the contract function. Only the owner can specify the operator, and the operator can withdraw and authorize the contract.
API
setOperator(address newOperator)
Parameters
- newOperator: New Operator Address to be Set
Note
-Only Owner has the interface operation permission
Function
setSigner
Settings for Signer
.
The signer
is the order signature wallet address in MMSK. When the market maker accesses Tokenlon, the MMSK wallet address needs to be set to the MMProxy contract.
API
setSigner(address signer)
Parameters
signer
: newsigner
address to be set
Note
-Only Operator has the interface operation permission -signer Wallet has MMProxy contract ability to transfer Tokens
setAllowance Grants
The contract's specified token transfer rights to the sender.
Market makers need to license the supported tokens to the 0x ERC20Proxy contract (0x deployment address).
0x ERC20Proxy(mainnet): 0x95e6f48254609a6ee006f7d493c8e5fb97094cef
API
setAllowance(address[] memory token_addrs, address spender)
Parameters
- token_addrs: List of token addresses that need to be authorized
- spender: Authorize to the specified sender address
Note
-Only Operator has the interface operation permission
closeAllowanceCloses
the specified token transfer permission of the contract.
Tokens that are no longer supported by market makers can be turned off by themselves.
API
closeAllowance(address[] memory token_addrs, address spender)
Parameters
- token_addrs: needs the un-authorized token address list
- spender: turn off the authorization of the specified sender address
Note
-Only Operator has the interface operation permission
withdraw
Token specified in the withdrawal contract.
API
withdraw(address token, address to, uint256 amount)WithdrawWithdrawal amount
Parameters
- token: Address of the token to be withdrawn
- to be withdrawn to: Withdrawn to the specified address
- amount: Withdrawal amount
Note
-Only Operator has the interface operation permission -The withdrawal amount is bigInt, does not contain decimals
dapp
Note: dapp is in Beta stage. Use is at your own risk.
For the market maker to use the MMProxy contract, we provide the corresponding dapp tooling.
Project link: github(NOT READY)
dapp link: https://consenlabs.github.io/contract-admin/mmp.html?addr={mmProxyContractAddress}
{mmProxyContractAddress}
is your MMProxy contract address.
cold (offline) wallet settings: imToken 2.0 - How do I use cold wallet?
Security
To ensure the contract operations, it is recommended to use 3 separate wallets:
- owner wallet: MMProxy permission owner, used to set the contract operator permissions
- operator wallet: For MMProxy function settings and withdrawal
- signer wallet: For signing orders in MMSK
wallet requirements
- owner wallet: Use cold (offline) wallet or hardware wallet
- operator wallet: Hot wallet, one-time operation, abandon after use
- signer Wallet: Hot wallet, only signing, no need to store tokens. The signer wallet needs to ensure the security of the MMSK operating environment, avoid having the keystore or private key leaked.
Operation flow
- Prepare a new operator wallet, store a certain amount of ETH for operating the contract
- Set the operator with the owner wallet
- Use the operator wallet configure or withdraw the contract.
- Set the operator to 0x0000.. (empty address) using the owner wallet.