Sitemap
4 min readFeb 25, 2022

--

DEFINER:

Press enter or click to view image in full size

DeFiner is a decentralized finance network that allows users to save, borrow, and pay in cryptocurrency. DeFiner is a blockchain-based platform that allows users to easily lend, borrow, and earn digital assets across a global network. DeFiner eliminates the friction and expenses associated with traditional financial services by allowing users to define their own rates and terms. DeFiner enables those who are embracing the new digital economy to get immediate value out of their assets.

Press enter or click to view image in full size

DeFiner Contract:

The DeFiner Protocol has four core contracts:

* SavingAccount,

* Accounts,

* Bank,

* TokenRegistry and

* GlobalConfig.

The Protocol’s essential business logic is included in the first three contracts, which are upgradeable. The SavingAccount, Accounts, and Bank contracts are all interconnected in our Protocol because it has a monolithic structure. To keep the code size under control, we split it into three contracts.

The naming scheme here is a tad strange. When we wish to deposit money in a bank, we usually go to the bank and open a savings account, then put money into it.

The SavingAccount contract operates as a bank in this case, and it is used to deposit or borrow money from DeFiner. The Bank contract keeps track of DeFiner’s protocol pool’s current state, including the total deposit, total borrow, and current rate. The Accounts contract maintains track of how much each user has deposited and borrowed.

Get Simon Eden’s stories in your inbox

Join Medium for free to get updates from this writer.

The path of a transaction to DeFiner is depicted in the diagram below. The user sends transactions by calling functions on the SavingAccount contract, which subsequently calls the Bank contract to construct a rate index checkpoint, which is used to compute all of the user’s accumulated interests. The Bank contract will then use the Account contract’s functionalities to calculate the balance change in the user account.

Press enter or click to view image in full size

TokenRegistry and GlobalConfig are used to save data that will be shared among the three primary contracts. As with all three contracts' addresses, they simply need to keep global config’s address in contract memory in these three contracts.

  1. SAVING ACCOUNT:
    This is the main interface contract that our users will interact with. Users will send transactions to this contract to conduct deposit, withdraw, borrow, payback, withdrawAll, and liquidation operations in order to engage with our protocol. The contract that receives and sends the tokens for each operation is this one. An event is produced when a transaction is provided to the SavingAccount contract in order to log the transaction.

2.BANK:
When there is an interaction with our SavingAccount contract, this contract is used to construct rate indexes. The borrow and deposit interests are calculated using rate indexes. We compute the user balances here using the various indices. This contract will fire an event whenever an index is generated.

3.ACCOUNT:
The token balances in each user’s account are tracked using this contract. This contract also features a BitMap, which allows users can know whether they have any deposits or borrowings for each token immediately while using less gas.

4 .GLOBAL CONFIG.:

Because this contract stores all of the contract’s addresses, all other contracts can only utilize GlobalConfig’s address to call other contracts' functions. It was also used to set the protocol’s reserve and communal fund ratios.

5.TOKEN REGISTRY
The meta-data for each token supported by the contract is kept in this contract. We may add new supported tokens using this contract.

For all Contracts UPGRADE Process is an essential feature.

* UPGRADABILITY

We are upgrading contracts utilizing OpenZeppelin proxies for SavingAccount, Accounts, and Bank contracts. So, in addition to the contracts, each of these three main contracts has an OpenZeppelin proxy contract. The proxy contract addresses will never change, but the underlying implementation’s contract may.

Press enter or click to view image in full size

We can deploy a new contract for the GlobalConfig and TokenRegistry contracts and call the setter function in three main contracts to point to the new contracts because they don’t save any transactional data.

For more information about DeFiner,

Visit our website
https://Definer.org

Channel: https://t.me/DeFiner

Twitter: DeFiner

--

--

Simon Eden
Simon Eden

Written by Simon Eden

Marketing Management || Community Management || Social Media Management || SEO Specialist || PR Management