Skip to content

Commit

Permalink
Move setting last time fee applied and period length init out of init…
Browse files Browse the repository at this point in the history
…ializer
  • Loading branch information
MiniRoman committed Jun 14, 2024
1 parent ea38600 commit 18bf4d4
Show file tree
Hide file tree
Showing 4 changed files with 348 additions and 89 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,24 +125,20 @@ contract BackedTokenImplementationWithMultiplierAndAutoFeeAccrual is
constructor() {
initialize(
"Backed Token Implementation",
"BTI",
block.timestamp,
24 * 3600
"BTI"
);
}

function initialize(
string memory name_,
string memory symbol_,
uint256 firstFeeAccrualTime_,
uint256 periodLength_
string memory symbol_
) public initializer {
__ERC20_init(name_, symbol_);
__Ownable_init();
_buildDomainSeparator();
_setTerms("https://www.backedassets.fi/legal-documentation"); // Default Terms
lastTimeFeeApplied = firstFeeAccrualTime_;
periodLength = periodLength_;
periodLength = 24 * 3600; // Set to 24h by default
lastTimeFeeApplied = block.timestamp;
}

/**
Expand Down Expand Up @@ -494,8 +490,26 @@ contract BackedTokenImplementationWithMultiplierAndAutoFeeAccrual is
* @param newTerms A string with the terms. Usually a web or IPFS link.
*/
function setTerms(string memory newTerms) external onlyOwner {
_setTerms(newTerms);
}
_setTerms(newTerms);
}

/**
* @dev Function to change the time of last fee accrual. Allowed only for owner
*
* @param newLastTimeFeeApplied A timestamp of last time fee was applied
*/
function setLastTimeFeeApplied(uint256 newLastTimeFeeApplied) external onlyOwner {
lastTimeFeeApplied = newLastTimeFeeApplied;
}

/**
* @dev Function to change period length. Allowed only for owner
*
* @param newPeriodLength Length of a single accrual period in seconds
*/
function setPeriodLength(uint256 newPeriodLength) external onlyOwner {
periodLength = newPeriodLength;
}

// Implement setTerms, to allow also to use from initializer:
function _setTerms(string memory newTerms) internal virtual {
Expand Down
Loading

0 comments on commit 18bf4d4

Please sign in to comment.