Skip to content

Commit

Permalink
feat: remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
reednaa committed Jan 18, 2024
1 parent e7cd23f commit 73b5bd0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 43 deletions.
10 changes: 5 additions & 5 deletions evm/script/config/config_contracts.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"contracts": {
"amplified_mathlib": "0xb94c66003aCbA88874E2160114a41994C1c5AdCB",
"amplified_template": "0x6Fd39FfA3D3973f2dE034497274ac2290a5cfaAB",
"factory": "0xb643b68D3502E30ba28E08Efd6766Fe3B772dE66",
"volatile_mathlib": "0x3673593a679d34ACeDC9940f57d1F10a8355d1e2",
"volatile_template": "0xDc4075AeD89088235A53a05B39218EbB5A92B8De"
"amplified_mathlib": "0xc9A497A21756834E6008dDD94AA3496b953a3C84",
"amplified_template": "0x0D7CBbc830b1618747cfc9DA1b2D1B95DE4B8D47",
"factory": "0x81533Ef9F1c0237c6688F051b3b113447f3AB478",
"volatile_mathlib": "0x0807A144Bcf48D433dBD84Fdaa3FB41Ef5548B4c",
"volatile_template": "0xd20b4731181F631D88321a7FB4adE1AA4A43e4E6"
},
"registry": {
"describer": "0xA9C609b79d62b9E27CDefA685CB795982f852d3c",
Expand Down
2 changes: 0 additions & 2 deletions evm/src/CatalystChainInterface.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ contract CatalystChainInterface is ICatalystChainInterface, Ownable, Bytes65 {
error InvalidContext(bytes1 context); // 9f769791
error InvalidAddress(); // e6c4247b
error InvalidSourceApplication(); // 003923e0
error SubcallOutOfGas(); // d271060e
error NotEnoughIncentives(uint256 expected, uint256 actual); // 6de78246
error ChainAlreadySetup(); // b8e35614

Expand All @@ -46,7 +45,6 @@ contract CatalystChainInterface is ICatalystChainInterface, Ownable, Bytes65 {
error MaxUnderwriteDurationTooLong(); // 3f6368aa
error MaxUnderwriteDurationTooShort(); // 6229dcd0
error NoVaultConnection(); // ea66ca6d
error MaliciousVault(); // 847ca49a
error SwapRecentlyUnderwritten(); // 695b3a94

//--- Events ---//
Expand Down
37 changes: 2 additions & 35 deletions evm/src/CatalystVaultCommon.sol
Original file line number Diff line number Diff line change
Expand Up @@ -414,20 +414,6 @@ abstract contract CatalystVaultCommon is
_escrowedVaultTokens += vaultTokens;
}

/// @notice Creates a token escrow for a swap.
function _setUnderwriteEscrow(
bytes32 underwriteIdentifier,
address fromAsset,
uint256 amount
) internal {
if (_escrowLookup[underwriteIdentifier] != address(0)) revert EscrowAlreadyExists();
_escrowLookup[underwriteIdentifier] = address(uint160(1));
unchecked {
// Must be less than than the vault balance.
_escrowedTokens[fromAsset] += amount;
}
}

/// @notice Returns the fallbackUser for the escrow and cleans up the escrow information.
/// @dev 'delete _escrowLookup[sendAssetHash]' ensures this function can only be called once.
function _releaseAssetEscrow(
Expand Down Expand Up @@ -467,26 +453,6 @@ abstract contract CatalystVaultCommon is
return fallbackUser;
}

/// @notice Returns the fallbackUser for the escrow and cleans up the escrow information.
/// @dev 'delete _escrowLookup[sendAssetHash]' ensures this function can only be called once.
function _releaseUnderwriteEscrow(
bytes32 sendAssetHash,
uint256 escrowAmount,
address escrowToken
) internal returns(address) {

address fallbackUser = _escrowLookup[sendAssetHash]; // Passing in an invalid swapHash returns address(0)
require(fallbackUser != address(0)); // dev: Invalid swapHash. Alt: Escrow doesn't exist.
delete _escrowLookup[sendAssetHash]; // Stops timeout and further acks from being called

unchecked {
// escrowAmount \subseteq _escrowedTokens => escrowAmount <= _escrowedTokens. Cannot be called twice since the 3 lines before ensure this can only be reached once.
_escrowedTokens[escrowToken] -= escrowAmount;
}

return fallbackUser;
}

/**
* @notice Implements basic ack logic: Deletes and releases tokens to the vault
* @dev Should never revert! For security limit adjustments, the implementation should be overwritten.
Expand Down Expand Up @@ -723,9 +689,10 @@ abstract contract CatalystVaultCommon is
ERC20(escrowToken).safeTransfer(refundTo, escrowAmount);
}

/// @dev The unsued parameter U is used for overwrites. (see CataulystVaultAmplified.sol)
function deleteUnderwriteAsset(
bytes32 identifier,
uint256 U,
uint256 /* U */,
uint256 escrowAmount,
address escrowToken
) onlyChainInterface virtual public {
Expand Down

0 comments on commit 73b5bd0

Please sign in to comment.