Skip to content

Commit

Permalink
chore: docs
Browse files Browse the repository at this point in the history
  • Loading branch information
addiaddiaddi committed Nov 26, 2024
1 parent 5bc05bb commit 4257131
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/Lock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,9 @@ contract Lock is Initializable, OwnableUpgradeable {
function setFreeze(bool status) public onlyOwner {
frozen = status;
}


function setMoveBridge(address bridge_) public onlyOwner {
movementBridge = NativeBridge(bridge_);
}
}
26 changes: 23 additions & 3 deletions src/token/fstMOVE.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ contract fstMOVE is IERC20, IERC20Metadata, IERC20Errors, AccessControlDefaultAd
uint256 public nextShareRate;
uint256 public updateEnd;

uint256 public maxAprThreshold;

uint256 private _totalSupply;

string private _name;
Expand All @@ -45,6 +47,7 @@ contract fstMOVE is IERC20, IERC20Metadata, IERC20Errors, AccessControlDefaultAd
error ApprovalsNotSupported();
error NegativeRebaseNotAllowed();
error UpdateMustBeInFuture();
error AprTooHigh();

/**
* @dev Sets the values for {name} and {symbol}.
Expand All @@ -68,11 +71,12 @@ contract fstMOVE is IERC20, IERC20Metadata, IERC20Errors, AccessControlDefaultAd
BASE = 10 ** 8;
lastShareRate = BASE;
nextShareRate = BASE;

maxAprThreshold = 35*10**6;
}

/**
* @dev Returns the current share rate based on the nextShareRate and the current progress of reaching updateEnd
*
*/
function shareRate() public view returns (uint256) {
uint256 updateEnd_ = updateEnd;
Expand Down Expand Up @@ -233,7 +237,7 @@ contract fstMOVE is IERC20, IERC20Metadata, IERC20Errors, AccessControlDefaultAd
event Rebase(uint256 shareRate, uint256 updateTime);

/**
* @dev Update next share rate
* @dev Update share rate by static share rate
*/
function rebaseByShareRate(uint256 nextShareRate_, uint256 updateEnd_) external onlyRole(DEFAULT_ADMIN_ROLE) {
if (nextShareRate_ < lastShareRate) revert NegativeRebaseNotAllowed();
Expand All @@ -248,8 +252,12 @@ contract fstMOVE is IERC20, IERC20Metadata, IERC20Errors, AccessControlDefaultAd
emit Rebase(nextShareRate_, updateEnd_);
}

/**
* @dev Increase share rate by APR
*/
function rebaseByApr(uint256 apr, uint256 updateEnd_) external onlyRole(DEFAULT_ADMIN_ROLE) {
if (updateEnd_ < block.timestamp) revert UpdateMustBeInFuture();
if (apr > maxAprThreshold) revert AprTooHigh();

uint256 shareRateIncrease = apr * (updateEnd_ - block.timestamp) / 365 days;
uint256 currentShareRate_ = shareRate();
Expand All @@ -272,20 +280,32 @@ contract fstMOVE is IERC20, IERC20Metadata, IERC20Errors, AccessControlDefaultAd

/**
* Fulfill IERC20 interface
*
* Token not transferable
*/
function transferFrom(address, address, uint256) public virtual returns (bool) {
revert TransferFromNotSupported();
}

/**
* Fulfill IERC20 interface
* Token not transferable
*/
function transfer(address, uint256) public virtual returns (bool) {
revert TransferNotSupported();
}

/**
* Fulfill IERC20 interface
* Token not transferable
*/
function allowance(address, address) public view virtual returns (uint256) {
return 0;
}

/**
* Fulfill IERC20 interface
* Token not transferable
*/
function approve(address, uint256) public virtual returns (bool) {
revert ApprovalsNotSupported();
}
Expand Down

0 comments on commit 4257131

Please sign in to comment.