Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions contracts/addresses/1.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"debtInFrontHelper": "0x4bb5e28fdb12891369b560f2fab3c032600677c6",
"exchangeHelpers": "0x2f60bab0072abec7058017f48d7256ec288c8686",
"exchangeHelpersV2": "0xe453b864d3841469763bda2437e3dd0e38dca222",
"redemptionHelper": "0x0000000000000000000000000000000000000000",
"branches": [
{
"collSymbol": "WETH",
Expand Down
1 change: 1 addition & 0 deletions contracts/addresses/11155111.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"debtInFrontHelper": "0x99d799D62611849D4D1dA5FF770147164873Eb99",
"exchangeHelpers": "0x2b50462f3026446fa9f6e618f3f08a67aae96317",
"exchangeHelpersV2": "0x3fff2e6b2f7fb3121d966c1d67fa8f3ab5a99f3f",
"redemptionHelper": "0xf299f3c504904c5f0b67f0ea0caf745d8912dc45",
"branches": [
{
"collSymbol": "WETH",
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions contracts/script/DeployLiquity2.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import "src/GasPool.sol";
import "src/HintHelpers.sol";
import "src/MultiTroveGetter.sol";
import {DebtInFrontHelper, IDebtInFrontHelper} from "src/DebtInFrontHelper.sol";
import {RedemptionHelper, IRedemptionHelper} from "src/RedemptionHelper.sol";
import "src/SortedTroves.sol";
import "src/StabilityPool.sol";
import "src/PriceFeeds/WETHPriceFeed.sol";
Expand Down Expand Up @@ -227,6 +228,7 @@ contract DeployLiquity2Script is DeployGovernance, UniPriceConverter, StdCheats,
IDebtInFrontHelper debtInFrontHelper;
IExchangeHelpers exchangeHelpers;
IExchangeHelpersV2 exchangeHelpersV2;
IRedemptionHelper redemptionHelper;
}

function run() external {
Expand Down Expand Up @@ -655,6 +657,8 @@ contract DeployLiquity2Script is DeployGovernance, UniPriceConverter, StdCheats,
_feeWethColl: UNIV3_FEE_WETH_COLL,
_uniV3Quoter: uniV3Quoter
});

r.redemptionHelper = new RedemptionHelper(r.collateralRegistry, vars.addressesRegistries);
}

function _deployAddressesRegistry(TroveManagerParams memory _troveManagerParams)
Expand Down Expand Up @@ -1180,6 +1184,7 @@ contract DeployLiquity2Script is DeployGovernance, UniPriceConverter, StdCheats,
string.concat('"exchangeHelpersV2":"', address(deployed.exchangeHelpersV2).toHexString(), '",')
),
string.concat(
string.concat('"redemptionHelper":"', address(deployed.redemptionHelper).toHexString(), '",'),
string.concat('"branches":[', branches.join(","), "],"),
string.concat('"governance":', _governanceManifest, "") // no comma
),
Expand Down
32 changes: 32 additions & 0 deletions contracts/script/DeployRedemptionHelper.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.24;

import {console} from "forge-std/console.sol";
import {Script} from "forge-std/Script.sol";
import {Strings} from "openzeppelin-contracts/contracts/utils/Strings.sol";
import {IAddressesRegistry} from "../src/Interfaces/IAddressesRegistry.sol";
import {RedemptionHelper} from "../src/RedemptionHelper.sol";
import {UseDeployment} from "../test/Utils/UseDeployment.sol";

contract DeployRedemptionHelper is Script, UseDeployment {
using Strings for *;

function run() external {
if (block.chainid != 1 && block.chainid != 11155111) {
revert("Unsupported chain");
}

_loadDeploymentFromManifest(string.concat("addresses/", block.chainid.toString(), ".json"));

IAddressesRegistry[] memory addresses = new IAddressesRegistry[](branches.length);
for (uint256 i = 0; i < branches.length; ++i) {
addresses[i] = branches[i].addressesRegistry;
}

vm.startBroadcast();
RedemptionHelper redemptionHelper =
new RedemptionHelper({_collateralRegistry: collateralRegistry, _addresses: addresses});

console.log("redemptionHelper:", address(redemptionHelper));
}
}
2 changes: 2 additions & 0 deletions frontend/app/.env
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ NEXT_PUBLIC_CONTRACT_LQTY_STAKING=0x4f9fbb3f1e99b56e0fe2892e623ed36a76fc605d
NEXT_PUBLIC_CONTRACT_LQTY_TOKEN=0x6dea81c8171d0ba574754ef6f8b412f2ed88c54d
NEXT_PUBLIC_CONTRACT_LUSD_TOKEN=0x5f98805a4e8be255a32880fdec7f6728c6568ba0
NEXT_PUBLIC_CONTRACT_MULTI_TROVE_GETTER=0xfa61db085510c64b83056db3a7acf3b6f631d235
NEXT_PUBLIC_CONTRACT_REDEMPTION_HELPER=0x0000000000000000000000000000000000000000
NEXT_PUBLIC_CONTRACT_WETH=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2

###########
Expand Down Expand Up @@ -197,6 +198,7 @@ NEXT_PUBLIC_CONTRACT_WETH=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
# NEXT_PUBLIC_CONTRACT_LQTY_TOKEN=0x13e5b79dfa0408a2e93b531e5031e5f1a6b4d039
# NEXT_PUBLIC_CONTRACT_LUSD_TOKEN=0x8472e818fad7b22e009c45c6b35dbf582c39caca
# NEXT_PUBLIC_CONTRACT_MULTI_TROVE_GETTER=0x19303bc4d3518039d0780a55e9950b222b178467
# NEXT_PUBLIC_CONTRACT_REDEMPTION_HELPER=0xf299f3c504904c5f0b67f0ea0caf745d8912dc45
# NEXT_PUBLIC_CONTRACT_WETH=0x5a490cefab14d9479ca6a63cb9d8d17c8785fbcb

###########################
Expand Down
1 change: 1 addition & 0 deletions frontend/app/scripts/update-liquity-abis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const ABIS = [
["MultiTroveGetter"],
["DebtInFrontHelper"],
["IExchangeHelpersV2"],
["RedemptionHelper"],

// Governance (V2-gov lib)
["Governance"],
Expand Down
22 changes: 12 additions & 10 deletions frontend/app/src/abi/BribeInitiative.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,12 @@ export const BribeInitiative = [
"type": "uint256",
"internalType": "uint256",
}],
"outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }, {
"name": "",
"type": "uint256",
"internalType": "uint256",
}],
"outputs": [
{ "name": "", "type": "uint256", "internalType": "uint256" },
{ "name": "", "type": "uint256", "internalType": "uint256" },
{ "name": "", "type": "uint256", "internalType": "uint256" },
{ "name": "", "type": "uint256", "internalType": "uint256" },
],
"stateMutability": "view",
},
{
Expand Down Expand Up @@ -185,11 +186,12 @@ export const BribeInitiative = [
"type": "function",
"name": "totalLQTYAllocatedByEpoch",
"inputs": [{ "name": "_epoch", "type": "uint256", "internalType": "uint256" }],
"outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }, {
"name": "",
"type": "uint256",
"internalType": "uint256",
}],
"outputs": [
{ "name": "", "type": "uint256", "internalType": "uint256" },
{ "name": "", "type": "uint256", "internalType": "uint256" },
{ "name": "", "type": "uint256", "internalType": "uint256" },
{ "name": "", "type": "uint256", "internalType": "uint256" },
],
"stateMutability": "view",
},
{
Expand Down
93 changes: 93 additions & 0 deletions frontend/app/src/abi/RedemptionHelper.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
// this file was generated by scripts/update-liquity-abis.ts
// please do not edit it manually
export const RedemptionHelper = [{
"type": "constructor",
"inputs": [{ "name": "_collateralRegistry", "type": "address", "internalType": "contract ICollateralRegistry" }, {
"name": "_addresses",
"type": "address[]",
"internalType": "contract IAddressesRegistry[]",
}],
"stateMutability": "nonpayable",
}, {
"type": "function",
"name": "addresses",
"inputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }],
"outputs": [{ "name": "", "type": "address", "internalType": "contract IAddressesRegistry" }],
"stateMutability": "view",
}, {
"type": "function",
"name": "boldToken",
"inputs": [],
"outputs": [{ "name": "", "type": "address", "internalType": "contract IBoldToken" }],
"stateMutability": "view",
}, {
"type": "function",
"name": "collateralRegistry",
"inputs": [],
"outputs": [{ "name": "", "type": "address", "internalType": "contract ICollateralRegistry" }],
"stateMutability": "view",
}, {
"type": "function",
"name": "numBranches",
"inputs": [],
"outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }],
"stateMutability": "view",
}, {
"type": "function",
"name": "redeemCollateral",
"inputs": [
{ "name": "_bold", "type": "uint256", "internalType": "uint256" },
{ "name": "_maxIterationsPerCollateral", "type": "uint256", "internalType": "uint256" },
{ "name": "_maxFeePct", "type": "uint256", "internalType": "uint256" },
{ "name": "_minCollRedeemed", "type": "uint256[]", "internalType": "uint256[]" },
],
"outputs": [],
"stateMutability": "nonpayable",
}, {
"type": "function",
"name": "simulateRedemption",
"inputs": [{ "name": "_bold", "type": "uint256", "internalType": "uint256" }, {
"name": "_maxIterationsPerCollateral",
"type": "uint256",
"internalType": "uint256",
}],
"outputs": [{
"name": "branch",
"type": "tuple[]",
"internalType": "struct IRedemptionHelper.SimulationContext[]",
"components": [
{ "name": "troveManager", "type": "address", "internalType": "address" },
{ "name": "sortedTroves", "type": "address", "internalType": "address" },
{ "name": "redeemable", "type": "bool", "internalType": "bool" },
{ "name": "price", "type": "uint256", "internalType": "uint256" },
{ "name": "proportion", "type": "uint256", "internalType": "uint256" },
{ "name": "attemptedBold", "type": "uint256", "internalType": "uint256" },
{ "name": "redeemedBold", "type": "uint256", "internalType": "uint256" },
{ "name": "iterations", "type": "uint256", "internalType": "uint256" },
],
}, { "name": "totalProportions", "type": "uint256", "internalType": "uint256" }],
"stateMutability": "nonpayable",
}, {
"type": "function",
"name": "truncateRedemption",
"inputs": [{ "name": "_bold", "type": "uint256", "internalType": "uint256" }, {
"name": "_maxIterationsPerCollateral",
"type": "uint256",
"internalType": "uint256",
}],
"outputs": [{ "name": "truncatedBold", "type": "uint256", "internalType": "uint256" }, {
"name": "feePct",
"type": "uint256",
"internalType": "uint256",
}, {
"name": "redeemed",
"type": "tuple[]",
"internalType": "struct IRedemptionHelper.Redeemed[]",
"components": [{ "name": "bold", "type": "uint256", "internalType": "uint256" }, {
"name": "coll",
"type": "uint256",
"internalType": "uint256",
}],
}],
"stateMutability": "nonpayable",
}] as const;
7 changes: 7 additions & 0 deletions frontend/app/src/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { LqtyStaking } from "@/src/abi/LqtyStaking";
import { LqtyToken } from "@/src/abi/LqtyToken";
import { MultiTroveGetter } from "@/src/abi/MultiTroveGetter";
import { PriceFeed } from "@/src/abi/PriceFeed";
import { RedemptionHelper } from "@/src/abi/RedemptionHelper";
import { SortedTroves } from "@/src/abi/SortedTroves";
import { StabilityPool } from "@/src/abi/StabilityPool";
import { TroveManager } from "@/src/abi/TroveManager";
Expand All @@ -33,6 +34,7 @@ import {
CONTRACT_LQTY_TOKEN,
CONTRACT_LUSD_TOKEN,
CONTRACT_MULTI_TROVE_GETTER,
CONTRACT_REDEMPTION_HELPER,
CONTRACT_WETH,
ENV_BRANCHES,
} from "@/src/env";
Expand All @@ -50,6 +52,7 @@ const protocolAbis = {
LqtyToken,
LusdToken: erc20Abi,
MultiTroveGetter,
RedemptionHelper,
WETH: erc20Abi,
} as const;

Expand Down Expand Up @@ -141,6 +144,10 @@ export const CONTRACTS: Contracts = {
abi: abis.MultiTroveGetter,
address: CONTRACT_MULTI_TROVE_GETTER,
},
RedemptionHelper: {
abi: abis.RedemptionHelper,
address: CONTRACT_REDEMPTION_HELPER,
},
WETH: { abi: abis.WETH, address: CONTRACT_WETH },
branches: ENV_BRANCHES.map(({ branchId, symbol, contracts }) => ({
id: branchId,
Expand Down
3 changes: 3 additions & 0 deletions frontend/app/src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ export const EnvSchema = v.pipe(
CONTRACT_LQTY_TOKEN: vAddress(),
CONTRACT_LUSD_TOKEN: vAddress(),
CONTRACT_MULTI_TROVE_GETTER: vAddress(),
CONTRACT_REDEMPTION_HELPER: vAddress(),
CONTRACT_WETH: vAddress(),

...vBranchEnvVars(0).entries,
Expand Down Expand Up @@ -367,6 +368,7 @@ const parsedEnv = v.safeParse(EnvSchema, {
CONTRACT_LQTY_TOKEN: process.env.NEXT_PUBLIC_CONTRACT_LQTY_TOKEN,
CONTRACT_LUSD_TOKEN: process.env.NEXT_PUBLIC_CONTRACT_LUSD_TOKEN,
CONTRACT_MULTI_TROVE_GETTER: process.env.NEXT_PUBLIC_CONTRACT_MULTI_TROVE_GETTER,
CONTRACT_REDEMPTION_HELPER: process.env.NEXT_PUBLIC_CONTRACT_REDEMPTION_HELPER,
CONTRACT_WETH: process.env.NEXT_PUBLIC_CONTRACT_WETH,

COLL_0_TOKEN_ID: process.env.NEXT_PUBLIC_COLL_0_TOKEN_ID,
Expand Down Expand Up @@ -458,6 +460,7 @@ export const {
CONTRACT_LQTY_TOKEN,
CONTRACT_LUSD_TOKEN,
CONTRACT_MULTI_TROVE_GETTER,
CONTRACT_REDEMPTION_HELPER,
CONTRACT_WETH,
DEPLOYMENT_FLAVOR,
KNOWN_DELEGATES_URL,
Expand Down