MIM

Abracadabra's stablecoin

Magic Internet Money

Magic Internet Money (MIM) is an ERC20 token with some additional functionality beyond the standard ERC20 behavior. The standard behavior of the token, such as transfers, allowances, and balance checks, are implemented as per the standard ERC20 protocol. Please refer to the ERC20 standard for more details on these functions.

The contract is implemented in Solidity version 0.6.12 and imports several utility libraries and contracts including BoringMath, ERC20, IBentoBoxV1, and BoringOwnable.

Contract Details

The MIM contract is BoringOwnable, meaning it has an owner who can only perform certain operations. The owner of the contract is the Big MIM Multisig. The contract uses the BoringMath library for mathematical operations, which provides some additional safety features like overflow checks.

The contract defines some constant variables including symbol, name, and decimals, which are common in ERC20 tokens:

  • symbol: The symbol of the token is "MIM".

  • name: The name of the token is "Magic Internet Money".

  • decimals: The number of decimal places the token can be divided into is 18.

The contract also overrides the totalSupply variable from the ERC20 standard to make it public and mutable.

Minting Mechanism

The contract has a unique minting mechanism that limits the amount that can be minted in a given period. The period duration restarts every time minting occurs. This mechanism is implemented in the mint function.

The minting mechanism is governed by the Minting struct which contains two properties:

  • time: The time when the last minting occurred.

  • amount: The amount that was minted.

Furthermore, there are some constant variables related to the minting mechanism:

  • MINTING_PERIOD: The minting period is set to 24 hours.

  • MINTING_INCREASE: The minting increase limit is set to 15000.

  • MINTING_PRECISION: The precision of the minting mechanism is set to 1e5.

This corresponds to a max minting of 15% of the totalSupply per day.

The mint function takes two arguments:

  • to: The address to which the new tokens will be minted.

  • amount: The amount of tokens to be minted.

The function requires that the to address is not the zero address and that the total supply of tokens after the minting will not exceed the limit defined by the minting mechanism. The minting mechanism ensures that the total amount minted in a given period does not exceed the total supply of tokens multiplied by the MINTING_INCREASE divided by the MINTING_PRECISION. If these conditions are met, the tokens are minted, added to the balance of the to address, and the total supply is updated accordingly. A Transfer event is emitted with the zero address as the sender and the to address as the recipient.

Minting to BentoBox

The contract also includes a mintToBentoBox function, which mints tokens and immediately deposits them into a BentoBox. This function takes three arguments:

  • clone: The address of the recipient used in the BentoBox deposit.

  • amount: The amount of tokens to be minted.

  • bentoBox: The BentoBox where the tokens will be deposited.

The function first mints the tokens to the BentoBox address and then deposits them into the BentoBox using the deposit function from the BentoBox interface. This effectively allows the contract owner to mint tokens directly into a BentoBox.

Burn Mechanism

Finally, the contract also includes a burn function which allows any address to burn (destroy) tokens from their own balance. This function takes a single argument:

  • amount: The amount of tokens to be burned.

The function requires that the amount to be burned is less than or equal to the balance of the sender. If this condition is met, the tokens are subtracted from the balance of the sender and the total supply of tokens. A Transfer event is emitted with the sender as the sender and the zero address as the recipient, signifying the destruction of the tokens.

Total (minted) Supply vs Circulating Supply

The total supply of Magic Internet Money (MIM) refers to all tokens that have been minted, regardless of their current status or location. This includes tokens that are not circulating but available to be borrowed by users. However, it's important to understand that not all minted MIM tokens are immediately put into active circulation.

When MIM tokens are minted, they are often directly deposited into Cauldrons, which are lending markets. Here, they are made available for users to borrow. It's only when a user decides to borrow these tokens that they truly enter circulation. This is because "circulating supply" refers to tokens that are borrowed and therefore free to move, not just tokens that exist.

This mechanism means that the circulating supply of MIM is typically smaller than the total supply. While the total supply counts all minted tokens, the circulating supply only counts those that are actively being borrowed and circulating. Therefore, when assessing the supply of MIM, it's crucial to distinguish between these two concepts to get a clear understanding of the supply.

Last updated