Skip to content

Commit

Permalink
fdusd adapter for bnb
Browse files Browse the repository at this point in the history
  • Loading branch information
rustboyar committed Mar 6, 2024
1 parent 5071736 commit bce98df
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
19 changes: 17 additions & 2 deletions scripts/DeployBnb.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,29 @@ library CapAdaptersCodeBnb {
int256(1.04 * 1e8)
)
);
bytes public constant FDUSD_ADAPTER_CODE =
abi.encodePacked(
type(PriceCapAdapterStable).creationCode,
abi.encode(
AaveV3BNB.ACL_MANAGER,
AaveV3BNBAssets.FDUSD_ORACLE,
'Capped fdUSD/USD',
int256(1.04 * 1e8)
)
);
}

contract DeployBnbAdaptersAndPayload {
function _deploy() internal returns (address) {
AaveV3BnbPayload.Adapters memory adapters;

adapters.usdtAdapter = GovV3Helpers.deployDeterministic(CapAdaptersCodeBnb.USDT_ADAPTER_CODE);
adapters.usdcAdapter = GovV3Helpers.deployDeterministic(CapAdaptersCodeBnb.USDC_ADAPTER_CODE);
adapters.usdtAdapter = GovV3Helpers.predictDeterministicAddress(
CapAdaptersCodeBnb.USDT_ADAPTER_CODE
);
adapters.usdcAdapter = GovV3Helpers.predictDeterministicAddress(
CapAdaptersCodeBnb.USDC_ADAPTER_CODE
);
adapters.fdusdAdapter = GovV3Helpers.deployDeterministic(CapAdaptersCodeBnb.FDUSD_ADAPTER_CODE);

return
GovV3Helpers.deployDeterministic(
Expand Down
8 changes: 7 additions & 1 deletion src/contracts/payloads/AaveV3BnbPayload.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,30 @@ contract AaveV3BnbPayload is AaveV3PayloadBnb {
struct Adapters {
address usdtAdapter;
address usdcAdapter;
address fdusdAdapter;
}

address public immutable USDT_ADAPTER;
address public immutable USDC_ADAPTER;
address public immutable FDUSD_ADAPTER;

constructor(Adapters memory adapters) {
USDT_ADAPTER = adapters.usdtAdapter;
USDC_ADAPTER = adapters.usdcAdapter;
FDUSD_ADAPTER = adapters.fdusdAdapter;
}

function priceFeedsUpdates() public view override returns (IEngine.PriceFeedUpdate[] memory) {
IEngine.PriceFeedUpdate[] memory updates = new IEngine.PriceFeedUpdate[](2);
IEngine.PriceFeedUpdate[] memory updates = new IEngine.PriceFeedUpdate[](3);
updates[0].asset = AaveV3BNBAssets.USDT_UNDERLYING;
updates[0].priceFeed = USDT_ADAPTER;

updates[1].asset = AaveV3BNBAssets.USDC_UNDERLYING;
updates[1].priceFeed = USDC_ADAPTER;

updates[1].asset = AaveV3BNBAssets.FDUSD_UNDERLYING;
updates[1].priceFeed = FDUSD_ADAPTER;

return updates;
}
}

0 comments on commit bce98df

Please sign in to comment.