Skip to content

Commit 05268d9

Browse files
committed
refactor(FAssetsRedeem): simplify redemption process and enhance asset manager settings retrieval
1 parent 36cbfbe commit 05268d9

File tree

1 file changed

+7
-18
lines changed

1 file changed

+7
-18
lines changed

examples/developer-hub-solidity/FAssetsRedeem.sol

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,7 @@ import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
88
import {RedemptionRequestInfo} from "flare-periphery-contracts-fassets-test/coston2/data/RedemptionRequestInfo.sol";
99

1010
contract FAssetsRedeem {
11-
// 1. Use the AssetManager contract
12-
IAssetManager public immutable assetManager;
13-
IERC20 public immutable underlyingToken;
14-
15-
address public immutable fAssetToken;
16-
17-
constructor(address _assetManager, address _fAssetToken) {
18-
assetManager = IAssetManager(_assetManager);
19-
fAssetToken = _fAssetToken;
20-
}
21-
22-
// 2. Approve FAssets for redemption
23-
function approveFAssets(uint256 _amount) public returns (bool) {
24-
return IERC20(fAssetToken).approve(address(this), _amount);
25-
}
26-
27-
// 3. Redeem FAssets (requires prior approval)
11+
// 1. Redeem FAssets
2812
function redeem(
2913
uint256 _lots,
3014
string memory _redeemerUnderlyingAddressString
@@ -47,7 +31,12 @@ contract FAssetsRedeem {
4731
return redeemedAmountUBA;
4832
}
4933

50-
// 4. Get the AssetManager settings
34+
function getFXRPAddress() public view returns (address) {
35+
IAssetManager assetManager = ContractRegistry.getAssetManagerFXRP();
36+
return address(assetManager.fAsset());
37+
}
38+
39+
// 2. Get the AssetManager settings
5140
function getSettings()
5241
public
5342
view

0 commit comments

Comments
 (0)