Skip to content

Commit

Permalink
feat: support optional force minting
Browse files Browse the repository at this point in the history
  • Loading branch information
GitGuru7 committed Feb 20, 2024
1 parent 007ee95 commit 50eaa72
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,19 @@ import { IMultichainToken } from "./../interfaces/IMultichainToken.sol";
import { BaseTokenProxyOFT } from "./BaseTokenProxyOFT.sol";
import { ensureNonzeroAddress } from "@venusprotocol/solidity-utilities/contracts/validators.sol";


/**
* @title TokenProxyOFTDest
* @title TokenProxyOFT
* @author Venus
* @notice TokenProxyOFTDest contract builds upon the functionality of its parent contract, BaseTokenProxyOFT,
* and focuses on managing token transfers to the destination chain.
* @notice TokenProxyOFT contract builds upon the functionality of its parent contract, BaseTokenProxyOFT,
* and focuses on managing token transfers to the chain where token is mintable and burnable.
* It provides functions to check eligibility and perform the actual token transfers while maintaining strict access controls and pausing mechanisms.
*/

contract TokenProxyOFTDest is BaseTokenProxyOFT {
contract TokenProxyOFT is BaseTokenProxyOFT {
/**
* @notice Regulates the force minting; It should be true only if the token manage by this Bridge contract can be mintable on both source and destination chains.
*/
bool public immutable isForceMintActive;
/**
* @notice Emits when stored message dropped without successful retrying.
*/
Expand All @@ -28,8 +31,11 @@ contract TokenProxyOFTDest is BaseTokenProxyOFT {
address tokenAddress_,
uint8 sharedDecimals_,
address lzEndpoint_,
address oracle_
) BaseTokenProxyOFT(tokenAddress_, sharedDecimals_, lzEndpoint_, oracle_) {}
address oracle_,
bool isForceMintActive_
) BaseTokenProxyOFT(tokenAddress_, sharedDecimals_, lzEndpoint_, oracle_) {
isForceMintActive = isForceMintActive_;
}

/**
* @notice Clear failed messages from the storage.
Expand All @@ -54,6 +60,7 @@ contract TokenProxyOFTDest is BaseTokenProxyOFT {
* @custom:event Emits forceMint, once done with transfer.
*/
function forceMint(uint16 srcChainId_, address to_, uint256 amount_) external onlyOwner {
require(isForceMintActive, "ProxyOFT: Force mint of token is not allowed on this chain");
ensureNonzeroAddress(to_);
_creditTo(srcChainId_, to_, amount_);
emit ForceMint(srcChainId_, to_, amount_);
Expand Down
2 changes: 1 addition & 1 deletion contracts/Token/TokenControllerSrc.sol
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ contract TokenControllerSrc is TokenController {
_increaseMintLimit(msg.sender, amount_);
}

/**
/**
* @notice Hook that is called before any transfer of tokens. This includes
* minting and burning.
* @param from_ Address of account from which tokens are to be transferred.
Expand Down

0 comments on commit 50eaa72

Please sign in to comment.