Taxes
Last updated
Last updated
Bill contracts can be used to do people's taxes. Suppose we want to process taxes for user A who is a merchant on CanCan.
Let's setup our Bill contract to process taxes for User A at the end of each month.
The first step is to deploy a Bill contract (with the Is Payable parameter set to No since we are not going to be paying the user) like we did on this page
Bill contracts enable you to account for all credits/debits to an account.
You can also add a credit factor that multiplies all the credits and a debit factor that multiplies all the debits in an equation that gives an end value which in our case will be the monthly tax.
All taxes can be written in this format: debit_factor * debit - credit_factor * credit = tax
To setup the credit and debit factors of your bill, go your Bill contract and click on the Details button to reveal its panel.
Click on the Control Panel button to reveal its menu and select the Update Migration Point option
We are setting our factors to be 100% so our monthly taxes due on an account could just be computed as all credits - all debits.
We will just need to update each account on all credits/debits to an account each month. That way the account owner will know at the end of each month, how much taxes he/she needs to pay.
The next step will be for account owners to pay their taxes through the Bill contract and for the Bill admin to withdraw the paid taxes and send the funds to the IRS or whichever branch of the government is in charge of taxes in your country.
The next step is to create your user's accounts. Let's create User A's account then Click on the Details button of your Bill contract to reveal the panel
Since User A is paid in USD, let's select the USD tFIAT token. Click on the Select a currency button to reveal the token wizard like in the image below. Click on the Manage Tokens button to reveal the form on the right, activate the PaySwap Onramp tokens then go back to the previous form
Search for and select the USD tFIAT token
You should now have the USD selected in the drop down field on top of your Control Panel button. Click on the Control Panel button to show the control panel's menu
Click the Create/Update Account button; fill in the form on the right image below. Make sure you read the description for each parameter in order to provide the correct value
We set the Period Receivable to the duration of a month in a minutes since we will be doing User A's taxes every month
We also set the Start of the account to October 20th, 2023 which is when the contract start counting the Period Receivable from
Lastly, we set the Description of our account and validate the transaction
Reload the page and tick the Mine Only button to only show your Bill contracts (this should enable you to find your Bill contract faster)
Click on the Details button to reveal the panel of your Bill contract. You should be able to see at the bottom left of the panel, your account's ID. Click on the ID to display the parameters of the account like we did by clicking on our account's ID in the image below (our account ID is 1)
Other details like the amount of tax the account owner needs to pay (which is computed with the formula: debit_factor * debits - credit_factor * credits) are available in the parameter section of the Bill contract once you select the right account. In our case, the tax amount is the Due Payable
Got to your Bill contract's panel and select the account to notify by its ID available at the bottom left of your panel
Go to your control panel's menu and select the Notify Credit button and fill in the Credit Address parameter with your own wallet address since you are the one notifying the contract. In case you are not the admin of the Bill, you should input in here the address of a contract approved to notify your Bill contract of Credit & Bill operations. Also enter the amount of the credit; this is in the currency of the account being notified.
Validate and confirm the operation. You should see the update reflected in the parameter section of your Bill contract once you select your account's ID
Got to your Bill contract's panel and select the account to notify by its ID available at the bottom left of your panel
Go to your control panel's menu and select the Notify Debit button and fill in the Debit Address parameter with your own wallet address since you are the one notifying the contract. In case you are not the admin of the Bill, you should input in here the address of a contract approved to notify your Bill contract of Credit & Bill operations. Also enter the amount of the debit; this is in the currency of the account being notified.
Validate and confirm the operation. You should see the update reflected in the parameter section of your Bill contract once you select your account's ID