Skip to content

Commit

Permalink
Burger meister, meister burger
Browse files Browse the repository at this point in the history
  • Loading branch information
EndymionJkb committed Nov 9, 2023
1 parent 8494ce0 commit 87371c9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

pragma solidity >=0.7.0 <0.9.0;

library PhantomStablePoolUserData {
library StablePhantomPoolUserData {
enum JoinKind { INIT, COLLECT_PROTOCOL_FEES }
enum ExitKind { EXACT_BPT_IN_FOR_TOKENS_OUT }

Expand Down
14 changes: 7 additions & 7 deletions pkg/standalone-utils/contracts/relayer/VaultActions.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pragma experimental ABIEncoderV2;

import "@balancer-labs/v2-interfaces/contracts/vault/IVault.sol";
import "@balancer-labs/v2-interfaces/contracts/pool-weighted/WeightedPoolUserData.sol";
import "@balancer-labs/v2-interfaces/contracts/pool-stable/PhantomStablePoolUserData.sol";
import "@balancer-labs/v2-interfaces/contracts/pool-stable/StablePhantomPoolUserData.sol";
import "@balancer-labs/v2-interfaces/contracts/pool-stable/StablePoolUserData.sol";
import "@balancer-labs/v2-interfaces/contracts/pool-utils/BasePoolUserData.sol";

Expand Down Expand Up @@ -139,7 +139,7 @@ abstract contract VaultActions is IBaseRelayerLibrary {
}
}

enum PoolKind { WEIGHTED, LEGACY_STABLE, COMPOSABLE_STABLE, COMPOSABLE_STABLE_V2, PHANTOM_STABLE }
enum PoolKind { WEIGHTED, LEGACY_STABLE, COMPOSABLE_STABLE, COMPOSABLE_STABLE_V2, STABLE_PHANTOM }

function joinPool(
bytes32 poolId,
Expand Down Expand Up @@ -335,7 +335,7 @@ abstract contract VaultActions is IBaseRelayerLibrary {
return _doComposableStableExitChainedReferenceReplacements(userData);
} else if (kind == PoolKind.COMPOSABLE_STABLE_V2) {
return _doComposableStableV2ExitChainedReferenceReplacements(userData);
} else if (kind == PoolKind.PHANTOM_STABLE) {
} else if (kind == PoolKind.STABLE_PHANTOM) {
return _doStablePhantomExitChainedReferenceReplacements(userData);
} else {
revert("UNHANDLED_POOL_KIND");
Expand Down Expand Up @@ -402,11 +402,11 @@ abstract contract VaultActions is IBaseRelayerLibrary {
* value.
*
* For instance, BPT_IN_FOR_EXACT_TOKENS_OUT is 2 in legacy Stable Pools, but 1 in Composable Stable Pools.
* (See the reference comment and libraries below.) PhantomStable only has a "recovery" exit (it predates
* (See the reference comment and libraries below.) StablePhantom only has a "recovery" exit (it predates
* the standard recovery mode).
*
* Accordingly, the four do[PoolKind]ExitChainedReferenceReplacements functions below (for LegacyStable,
* ComposableStable, ComposableStableV2, and PhantomStable) extract the exitKind and pass it through to the
* ComposableStable, ComposableStableV2, and StablePhantom) extract the exitKind and pass it through to the
* shared recoding functions.
*/
function _doLegacyStableExitChainedReferenceReplacements(bytes memory userData) private returns (bytes memory) {
Expand Down Expand Up @@ -454,11 +454,11 @@ abstract contract VaultActions is IBaseRelayerLibrary {
}
}

// For PhantomStablePool
// For StablePhantomPool
function _doStablePhantomExitChainedReferenceReplacements(bytes memory userData) private returns (bytes memory) {
uint8 exitKind = uint8(StablePoolUserData.exitKind(userData));

if (exitKind == uint8(PhantomStablePoolUserData.ExitKind.EXACT_BPT_IN_FOR_TOKENS_OUT)) {
if (exitKind == uint8(StablePhantomPoolUserData.ExitKind.EXACT_BPT_IN_FOR_TOKENS_OUT)) {
return _doStableExactBptInForTokensOutReplacements(userData, exitKind);
} else {
return userData;
Expand Down
2 changes: 1 addition & 1 deletion pkg/standalone-utils/test/VaultActionsRelayer.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export enum PoolKind {
LEGACY_STABLE,
COMPOSABLE_STABLE,
COMPOSABLE_STABLE_V2,
PHANTOM_STABLE,
STABLE_PHANTOM,
}

export type OutputReference = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,7 @@ describe('Vault Actions - Stable Pools', () => {
});
});
describe('unhandled pool types', () => {
const INVALID_POOL_KIND = PoolKind.PHANTOM_STABLE + 1;
const INVALID_POOL_KIND = PoolKind.STABLE_PHANTOM + 1;
const sender = randomAddress();

context('on joins', () => {
Expand Down

0 comments on commit 87371c9

Please sign in to comment.