# How DeerLock works Smart Contract

The DeerLock contract is a smart contract that allows users to deposit the Deer token and earn interest in the form of interest tokens (InterestTokenDeer). Users can choose the duration of their deposit and earn interest based on the 15% APR annual interest rate established in the contract.

The contract uses an array of predefined lockout durations, represented in minutes. Users can choose one of these durations to lock up their Deer tokens and earn interest. Users' deposit is recorded in a data structure called Deposit, which contains information such as the amount deposited, the time it was deposited, and the time the deposit will expire.

The interest that users earn on their deposits is calculated using the calculateInterest() function in the contract. The function takes the amount deposited and the duration of the deposit and calculates the daily interest. Then, multiply the daily interest by the duration of the deposit in days to get the total interest that will be paid on the deposit. The total interest is stored in the Deposit data structure for later use.

When users withdraw their deposits after they have expired, the contract pays out the amount of Deer tokens deposited and the corresponding interest in interest tokens (InterestTokenDeer). The interest is withdrawn from the InterestTokenDeer contract and transferred to the user who made the deposit. The contract keeps a record of all deposits and withdrawals in data structures such as Claim and AllClaim, which contain information about the amount withdrawn, the duration of the deposit, and the time the withdrawal was made.

In short, the DeerLock contract allows users to deposit the Deer token and earn interest at a rate of 15% APR. Users can choose the duration of their deposit and interest is calculated daily using the calculateInterest() function. When deposits are due, users can withdraw their deposit and the corresponding interest in Deer tokens and interest tokens (InterestTokenDeer). The contract keeps a detailed record of all deposits and withdrawals made.

Smart Contract : <https://arbiscan.io/address/0x98808632936386bb58576dac118a1573bdb23aea#code>
