Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(RoninBridgeManager, MainchainBridgeManager): expose map tokens fu… #53

Merged
15 changes: 15 additions & 0 deletions src/mainchain/MainchainBridgeManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { CoreGovernance } from "../extensions/sequential-governance/CoreGovernan
import { GlobalCoreGovernance, GlobalGovernanceRelay } from "../extensions/sequential-governance/governance-relay/GlobalGovernanceRelay.sol";
import { GovernanceRelay } from "../extensions/sequential-governance/governance-relay/GovernanceRelay.sol";
import { ContractType, BridgeManager } from "../extensions/bridge-operator-governance/BridgeManager.sol";
import { IMainchainGatewayV3 } from "../interfaces/IMainchainGatewayV3.sol";
import { TokenStandard } from "../libraries/LibTokenInfo.sol";
import { Ballot } from "../libraries/Ballot.sol";
import { Proposal } from "../libraries/Proposal.sol";
import { GlobalProposal } from "../libraries/GlobalProposal.sol";
Expand All @@ -30,6 +32,19 @@ contract MainchainBridgeManager is BridgeManager, GovernanceRelay, GlobalGoverna
__BridgeManager_init(num, denom, roninChainId, bridgeContract, callbackRegisters, bridgeOperators, governors, voteWeights);
}

function expose_mapTokensAndThresholds(
address[] calldata mainchainTokens,
address[] calldata roninTokens,
TokenStandard[] calldata standards,
uint256[][4] calldata thresholds
) external onlyProxyAdmin {
GlobalProposal.TargetOption[] memory targetOptions = new GlobalProposal.TargetOption[](1);
targetOptions[0] = GlobalProposal.TargetOption.GatewayContract;
IMainchainGatewayV3 gateway = IMainchainGatewayV3(_resolveTargets({ targetOptions: targetOptions, strict: true })[0]);
TuDo1403 marked this conversation as resolved.
Show resolved Hide resolved

gateway.mapTokensAndThresholds({ _mainchainTokens: mainchainTokens, _roninTokens: roninTokens, _standards: standards, _thresholds: thresholds });
}

/**
* @dev See `GovernanceRelay-_relayProposal`.
*
Expand Down
18 changes: 18 additions & 0 deletions src/ronin/gateway/RoninBridgeManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,31 @@ import {
GlobalCoreGovernance,
GlobalGovernanceProposal
} from "../../extensions/sequential-governance/governance-proposal/GlobalGovernanceProposal.sol";
import { IRoninGatewayV3 } from "../../interfaces/IRoninGatewayV3.sol";
import { MinimumWithdrawal } from "../../extensions/MinimumWithdrawal.sol";
import { TokenStandard } from "../../libraries/LibTokenInfo.sol";
import { VoteStatusConsumer } from "../../interfaces/consumers/VoteStatusConsumer.sol";
import "../../utils/CommonErrors.sol";

contract RoninBridgeManager is BridgeManager, GovernanceProposal, GlobalGovernanceProposal {
using Proposal for Proposal.ProposalDetail;
using GlobalProposal for GlobalProposal.GlobalProposalDetail;

function expose_mapTokenAndSetMinimumThresholds(
address[] calldata mainchainTokens,
address[] calldata roninTokens,
uint256[] calldata chainIds,
TokenStandard[] calldata standards,
uint256[] calldata withdrawalThresholds
) external onlyProxyAdmin {
GlobalProposal.TargetOption[] memory targetOptions = new GlobalProposal.TargetOption[](1);
targetOptions[0] = GlobalProposal.TargetOption.GatewayContract;
address gw = _resolveTargets({ targetOptions: targetOptions, strict: true })[0];

IRoninGatewayV3(gw).mapTokens({ _roninTokens: roninTokens, _mainchainTokens: mainchainTokens, chainIds: chainIds, _standards: standards });
MinimumWithdrawal(gw).setMinimumThresholds({ _tokens: mainchainTokens, _thresholds: withdrawalThresholds });
}

/**
* CURRENT NETWORK
*/
Expand Down