@@ -8,11 +8,13 @@ const REDEEM_AMOUNT_UBA = 5000000n;
88// 2. Redeemer underlying (XRPL) address that will receive the redeemed XRP.
99const REDEEMER_UNDERLYING_ADDRESS_STRING = "rSHYuiEvsYsKR8uUHhBTuGP5zjRcGt4nm" ;
1010// 3. Executor (not used here, so the zero address).
11- const EXECUTOR_ZERO_ADDRESS : Address = "0x0000000000000000000000000000000000000000" ;
11+ const EXECUTOR_ZERO_ADDRESS : Address =
12+ "0x0000000000000000000000000000000000000000" ;
1213
1314async function main ( ) {
1415 // 4. Resolve the AssetManagerFXRP address from the Flare Contract Registry.
15- const assetManagerAddress = await getContractAddressByName ( "AssetManagerFXRP" ) ;
16+ const assetManagerAddress =
17+ await getContractAddressByName ( "AssetManagerFXRP" ) ;
1618 console . log ( "AssetManagerFXRP address:" , assetManagerAddress , "\n" ) ;
1719
1820 // 5. Read the protocol-wide minimum redemption amount and assert that the
@@ -22,12 +24,20 @@ async function main() {
2224 abi : coston2 . iAssetManagerAbi ,
2325 functionName : "minimumRedeemAmountUBA" ,
2426 } ) ;
25- console . log ( "minimumRedeemAmountUBA:" , minimumRedeemAmountUBA . toString ( ) , "\n" ) ;
26- console . log ( "Requested redeem amount UBA:" , REDEEM_AMOUNT_UBA . toString ( ) , "\n" ) ;
27+ console . log (
28+ "minimumRedeemAmountUBA:" ,
29+ minimumRedeemAmountUBA . toString ( ) ,
30+ "\n" ,
31+ ) ;
32+ console . log (
33+ "Requested redeem amount UBA:" ,
34+ REDEEM_AMOUNT_UBA . toString ( ) ,
35+ "\n" ,
36+ ) ;
2737
2838 if ( REDEEM_AMOUNT_UBA < minimumRedeemAmountUBA ) {
2939 throw new Error (
30- `Redeem amount (${ REDEEM_AMOUNT_UBA . toString ( ) } ) must be greater than minimumRedeemAmountUBA (${ minimumRedeemAmountUBA . toString ( ) } ).`
40+ `Redeem amount (${ REDEEM_AMOUNT_UBA . toString ( ) } ) must be greater than minimumRedeemAmountUBA (${ minimumRedeemAmountUBA . toString ( ) } ).` ,
3141 ) ;
3242 }
3343
@@ -38,15 +48,21 @@ async function main() {
3848 address : assetManagerAddress ,
3949 abi : coston2 . iAssetManagerAbi ,
4050 functionName : "redeemAmount" ,
41- args : [ REDEEM_AMOUNT_UBA , REDEEMER_UNDERLYING_ADDRESS_STRING , EXECUTOR_ZERO_ADDRESS ] ,
51+ args : [
52+ REDEEM_AMOUNT_UBA ,
53+ REDEEMER_UNDERLYING_ADDRESS_STRING ,
54+ EXECUTOR_ZERO_ADDRESS ,
55+ ] ,
4256 } ) ;
4357
4458 // 7. Submit the redemption request transaction on Flare.
4559 const txHash = await walletClient . writeContract ( request ) ;
4660 console . log ( "redeemAmount tx hash:" , txHash , "\n" ) ;
4761
4862 // 8. Wait for the transaction receipt.
49- const receipt = await publicClient . waitForTransactionReceipt ( { hash : txHash } ) ;
63+ const receipt = await publicClient . waitForTransactionReceipt ( {
64+ hash : txHash ,
65+ } ) ;
5066 console . log ( "redeemAmount status:" , receipt . status , "\n" ) ;
5167
5268 // 9. Decode RedemptionRequested events from the receipt logs and pick the
@@ -62,7 +78,9 @@ async function main() {
6278 ) ;
6379
6480 if ( ! redemptionEvent ) {
65- throw new Error ( "RedemptionRequested event not found for this transaction and redeemer" ) ;
81+ throw new Error (
82+ "RedemptionRequested event not found for this transaction and redeemer" ,
83+ ) ;
6684 }
6785
6886 console . log ( "RedemptionRequested event:" , redemptionEvent , "\n" ) ;
0 commit comments