-
Notifications
You must be signed in to change notification settings - Fork 0
/
Calyptus466.sol
30 lines (23 loc) · 1.1 KB
/
Calyptus466.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;
// https://x.com/calyptus_web3/status/1859514616834912704
// Tell us if this debt pool should be deployed on or not
contract DebtPool {
uint256 public aggregateDebt;
uint256 public previousInterestAccrual;
uint256 public tokenBalance;
constructor() {
aggregateDebt = 10000 * (10 ** 6); // Assume debt token is represented in 6 decimal places, Like USDC.
previousInterestAccrual = block.timestamp - 1;
tokenBalance = 500 * (10 ** 18); // Assuming token has 18 decimal places like Ether.
}
function calculateCurrentReward() public view returns (uint256 rewardAmount) {
// Calculating the time difference since last interest accrual
uint256 timeDifference = block.timestamp - previousInterestAccrual;
// In case no time has passed since the last accrual, the reward is o
if (timeDifference == 0) return 0;
// Compute the reward based on time difference
rewardAmount = (aggregateDebt * timeDifference) / (365 days * (10 ** 18));
return rewardAmount;
}
}