Skip to content

Commit

Permalink
chore: remove unused SharedStructs library and institutions updates
Browse files Browse the repository at this point in the history
  • Loading branch information
OnahProsperity committed Jun 11, 2024
1 parent e42281e commit 3211801
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 544 deletions.
25 changes: 7 additions & 18 deletions contracts/Gateway.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import '@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol';

import {GatewaySettingManager} from './GatewaySettingManager.sol';
import {IGateway, IERC20} from './interfaces/IGateway.sol';
import {SharedStructs} from './libraries/SharedStructs.sol';

/**
* @title Gateway
Expand Down Expand Up @@ -67,15 +66,20 @@ contract Gateway is IGateway, GatewaySettingManager, PausableUpgradeable {
function createOrder(
address _token,
uint256 _amount,
bytes32 _institutionCode,
uint96 _rate,
address _senderFeeRecipient,
uint256 _senderFee,
address _refundAddress,
string calldata messageHash
) external whenNotPaused returns (bytes32 orderId) {
// checks that are required
_handler(_token, _amount, _refundAddress, _senderFeeRecipient, _senderFee);
_handler(
_token,
_amount,
_refundAddress,
_senderFeeRecipient,
_senderFee
);

// validate messageHash
require(bytes(messageHash).length != 0, 'InvalidMessageHash');
Expand Down Expand Up @@ -112,7 +116,6 @@ contract Gateway is IGateway, GatewaySettingManager, PausableUpgradeable {
_protocolFee,
orderId,
_rate,
_institutionCode,
messageHash
);
}
Expand Down Expand Up @@ -239,20 +242,6 @@ contract Gateway is IGateway, GatewaySettingManager, PausableUpgradeable {
return false;
}

/** @dev See {getSupportedInstitutionByCode-IGateway}. */
function getSupportedInstitutionByCode(
bytes32 _code
) external view returns (SharedStructs.InstitutionByCode memory) {
return supportedInstitutionsByCode[_code];
}

/** @dev See {getSupportedInstitutions-IGateway}. */
function getSupportedInstitutions(
bytes32 _currency
) external view returns (SharedStructs.Institution[] memory) {
return supportedInstitutions[_currency];
}

/** @dev See {getFeeDetails-IGateway}. */
function getFeeDetails() external view returns (uint64, uint256) {
return (protocolFeePercent, MAX_BPS);
Expand Down
34 changes: 1 addition & 33 deletions contracts/GatewaySettingManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,18 @@ pragma solidity ^0.8.18;

import '@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol';

import {SharedStructs} from './libraries/SharedStructs.sol';

contract GatewaySettingManager is Ownable2StepUpgradeable {
uint256 internal MAX_BPS;
uint64 internal protocolFeePercent;
address internal treasuryAddress;
address internal _aggregatorAddress;
mapping(address => uint256) internal _isTokenSupported;

// this should decrease if more slots are needed on this contract to avoid collisions with base contract
uint256[50] private __gap;

mapping(address => uint256) internal _isTokenSupported;

mapping(bytes32 => SharedStructs.Institution[]) internal supportedInstitutions;
mapping(bytes32 => SharedStructs.InstitutionByCode) internal supportedInstitutionsByCode;

event SettingManagerBool(bytes32 indexed what, address indexed value, uint256 status);
event SupportedInstitutionsUpdated(
bytes32 indexed currency,
SharedStructs.Institution[] institutions
);
event ProtocolFeeUpdated(uint64 protocolFee);
event ProtocolAddressUpdated(bytes32 indexed what, address indexed treasuryAddress);
event SetFeeRecipient(address indexed treasuryAddress);
Expand All @@ -54,29 +45,6 @@ contract GatewaySettingManager is Ownable2StepUpgradeable {
}
}

/**
* @dev Sets the supported institutions for a specific currency.
* @param currency The currency for which the institutions are being set.
* @param institutions The array of institutions to be set.
*/
function setSupportedInstitutions(
bytes32 currency,
SharedStructs.Institution[] memory institutions
) external onlyOwner {
delete supportedInstitutions[currency];
for (uint i; i < institutions.length; ) {
supportedInstitutions[currency].push(institutions[i]);
supportedInstitutionsByCode[institutions[i].code] = SharedStructs.InstitutionByCode({
name: institutions[i].name,
currency: currency
});
unchecked {
++i;
}
}
emit SupportedInstitutionsUpdated(currency, supportedInstitutions[currency]);
}

/**
* @dev Updates the protocol fee percentage.
* @param _protocolFeePercent The new protocol fee percentage to be set.
Expand Down
258 changes: 0 additions & 258 deletions contracts/GatewayV2.sol

This file was deleted.

Loading

0 comments on commit 3211801

Please sign in to comment.