Spending Funds & Allowance

Similar to how access control in Mezzanine is hierarchical, the spending and allowances of assets are also hierarchal. An allowance is the amount that another address can spend of an ERC20 on behalf of another address. For example, if Alice gives Bob an allowance of 100 USDC, Bob can spend up to 100 of Alice's USDC on her behalf.

ERC20 allowances are used in Mezzanine to enable departments and their descendants to spend funds directly from the Treasury. Take the following example of Mezzanine company, Foo:

In the above example, Foo's Treasury contains 1,000 USD, and its Finance Department has an allowance of 1,000 USD. The Finance Department can spend this at its discretion. Notably, the Treasury can also set allowances higher than its current balance. In the above example, the Billing Department has an allowance of 2,000 USD of Foo's Treasury even though the treasury only contains 1,000 USD. When the allowance is greater than the funds available, the child can only spend up to the amount available to the ancestor.

Setting an extremely high allowance may be useful when a department needs a highly variable amount of funds as working capital. However, setting a high allowance should be used with caution, and the signers of the department should be trusted to use those funds wisely.

Under the Finance Department is a Sales Department, which can spend up to 500 USD at its discretion. Spending funds transfers funds down the organization, decreasing the allowances of its ancestors by the amount. Let's assume that Foo's Sales Department spends all 500 of its USD allowance:

The Sales Department's spending of 500 USD decreases the Treasury Contract's balance by 500. Notably, the allowances of both the Finance Department and Sales Department decreased by 500. All modules and departments in Mezzanine have access to this hierarchic spending.

Last updated