Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fritzschoff committed Aug 16, 2023
1 parent 2fcff58 commit e943889
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 6 deletions.
14 changes: 11 additions & 3 deletions protocol/synthetix/storage.dump.sol
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@ contract IssueUSDModule {
bytes32 private constant _CONFIG_BURN_FEE_RATIO = "burnUsd_feeRatio";
bytes32 private constant _CONFIG_MINT_FEE_ADDRESS = "mintUsd_feeAddress";
bytes32 private constant _CONFIG_BURN_FEE_ADDRESS = "burnUsd_feeAddress";
bytes32 private constant _CONFIG_TIMEOUT_BURN = "burnUsd_toAccount";
}

// @custom:artifact contracts/modules/core/LiquidationModule.sol:LiquidationModule
Expand Down Expand Up @@ -545,8 +544,7 @@ library Pool {
uint64 __reserved1;
uint64 __reserved2;
uint64 __reserved3;
mapping(address => bool) collateralTypeDisabled;
mapping(address => uint256) issuanceRatioD18;
mapping(address => PoolCollateralConfiguration.Data) collateralConfigurations;
}
function load(uint128 id) internal pure returns (Data storage pool) {
bytes32 s = keccak256(abi.encode("io.synthetix.synthetix.Pool", id));
Expand All @@ -556,6 +554,16 @@ library Pool {
}
}

// @custom:artifact contracts/storage/PoolCollateralConfiguration.sol:PoolCollateralConfiguration
library PoolCollateralConfiguration {
bytes32 private constant _SLOT = keccak256(abi.encode("io.synthetix.synthetix.PoolCollateralConfiguration"));
struct Data {
uint256 maxDepositD18;
bool collateralTypeDisabled;
uint256 issuanceRatioD18;
}
}

// @custom:artifact contracts/storage/RewardDistribution.sol:RewardDistribution
library RewardDistribution {
struct Data {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import assertBn from '@synthetixio/core-utils/utils/assertions/assert-bignumber'
import assertRevert from '@synthetixio/core-utils/utils/assertions/assert-revert';
import assertEvent from '@synthetixio/core-utils/utils/assertions/assert-event';
import { snapshotCheckpoint } from '@synthetixio/core-utils/utils/mocha/snapshot';
import { BigNumber, ethers } from 'ethers';
import { BigNumber, constants, ethers } from 'ethers';
import hre from 'hardhat';
import { bn, bootstrapWithStakedPool } from '../../bootstrap';
import Permissions from '../../mixins/AccountRBACMixin.permissions';
import { verifyChecksCollateralEnabled, verifyUsesFeatureFlag } from '../../verifications';

const MARKET_FEATURE_FLAG = ethers.utils.formatBytes32String('registerMarket');

describe.only('IssueUSDModule', function () {
describe('IssueUSDModule', function () {
const { signers, systems, provider, accountId, poolId, depositAmount, collateralAddress } =
bootstrapWithStakedPool();

Expand Down Expand Up @@ -294,7 +294,21 @@ describe.only('IssueUSDModule', function () {

before('other account burn', async () => {
await systems()
.Core.connect(user1)
.Core.connect(owner)
.configureCollateral({
tokenAddress: await systems().Core.getUsdToken(),
oracleNodeId: ethers.utils.formatBytes32String(''),
issuanceRatioD18: 200,
liquidationRatioD18: 100,
liquidationRewardD18: 0,
minDelegationD18: 0,
depositingEnabled: true,
});
await systems()
.USD.connect(user2)
.approve(systems().Core.address, constants.MaxUint256.toString());
await systems()
.Core.connect(user2)
.deposit(accountId, await systems().Core.getUsdToken(), depositAmount.div(10));
await systems()
.Core.connect(user2)
Expand Down Expand Up @@ -326,6 +340,27 @@ describe.only('IssueUSDModule', function () {
});

before('account partial burn debt', async () => {
await systems()
.Core.connect(owner)
.configureCollateral({
tokenAddress: await systems().Core.getUsdToken(),
oracleNodeId: ethers.utils.formatBytes32String(''),
issuanceRatioD18: 200,
liquidationRatioD18: 100,
liquidationRewardD18: 0,
minDelegationD18: 0,
depositingEnabled: true,
});
await systems()
.USD.connect(user1)
.approve(systems().Core.address, constants.MaxUint256.toString());
await systems()
.Core.connect(user1)
.deposit(
accountId,
await systems().Core.getUsdToken(),
depositAmount.div(20).add(depositAmount.div(2000))
);
// in order to burn all with the fee we need a bit more
await systems()
.Core.connect(user1)
Expand Down

0 comments on commit e943889

Please sign in to comment.