Skip to content

Commit

Permalink
feat: AUSD capo
Browse files Browse the repository at this point in the history
  • Loading branch information
ianflexa committed Nov 27, 2024
1 parent 9e8584b commit 39e2234
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ deploy-sdai-gnosis :; forge script scripts/DeployGnosis.s.sol:DeploySDaiGnosis -

deploy-rseth-mainnet :; forge script scripts/DeployEthereum.s.sol:DeployRsEthEthereum --rpc-url mainnet $(common-flags)

deploy-ausd-avalanche :; forge script scripts/DeployAvalanche.s.sol:DeployAUSDAvalanche --rpc-url avalanche $(common-flags)

# Utilities
download :; cast etherscan-source --chain ${chain} -d src/etherscan/${chain}_${address} ${address}
git-diff :
Expand Down
35 changes: 35 additions & 0 deletions scripts/DeployAvalanche.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;

import {GovV3Helpers} from 'aave-helpers/GovV3Helpers.sol';
import {AvalancheScript} from 'solidity-utils/contracts/utils/ScriptUtils.sol';
import {AaveV3Avalanche} from 'aave-address-book/AaveV3Avalanche.sol';

import {PriceCapAdapterStable} from '../src/contracts/PriceCapAdapterStable.sol';
import {IPriceCapAdapter, IChainlinkAggregator} from '../src/interfaces/IPriceCapAdapter.sol';
import {IPriceCapAdapterStable} from '../src/interfaces/IPriceCapAdapterStable.sol';

library CapAdaptersCodeAvalanche {
address public constant AUSD_PRICE_FEED = 0x5C2d58627Fbe746f5ea24Ef6D618f09f8e3f0122;

function AUSDAdapterCode() internal pure returns (bytes memory) {
return
abi.encodePacked(
type(PriceCapAdapterStable).creationCode,
abi.encode(
IPriceCapAdapterStable.CapAdapterStableParams({
aclManager: AaveV3Avalanche.ACL_MANAGER,
assetToUsdAggregator: IChainlinkAggregator(AUSD_PRICE_FEED),
adapterDescription: 'Capped AUSD / USD',
priceCap: int256(1.04 * 1e8)
})
)
);
}
}

contract DeployAUSDAvalanche is AvalancheScript {
function run() external broadcast {
GovV3Helpers.deployDeterministic(CapAdaptersCodeAvalanche.AUSDAdapterCode());
}
}
16 changes: 16 additions & 0 deletions tests/avalanche/AUSDPriceCapAdapterTest.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;

import '../BaseStableTest.sol';
import {PriceCapAdapterStable} from '../../src/contracts/PriceCapAdapterStable.sol';
import {CapAdaptersCodeAvalanche} from '../../scripts/DeployAvalanche.s.sol';

contract AUSDPriceCapAdapterTest is BaseStableTest {
constructor()
BaseStableTest(
CapAdaptersCodeAvalanche.AUSDAdapterCode(),
10,
ForkParams({network: 'avalanche', blockNumber: 53614500})
)
{}
}

0 comments on commit 39e2234

Please sign in to comment.