mirror of
https://github.com/Instadapp/dsa-connectors-old.git
synced 2024-07-29 22:47:46 +00:00
Added constructor in mapping gauge
This commit is contained in:
parent
acfa6d2d36
commit
ee5000da1b
|
@ -52,22 +52,11 @@ contract Helpers is BytesHelper {
|
|||
_;
|
||||
}
|
||||
|
||||
function addGaugeMappings(
|
||||
string[] memory gaugeNames,
|
||||
address[] memory gaugeAddresses,
|
||||
bool[] memory rewardTokens
|
||||
) public isChief {
|
||||
require(gaugeNames.length == gaugeAddresses.length && gaugeAddresses.length == rewardTokens.length, "length-not-match");
|
||||
for (uint32 i; i < gaugeNames.length; i++) {
|
||||
addGaugeMapping(gaugeNames[i], gaugeAddresses[i], rewardTokens[i]);
|
||||
}
|
||||
}
|
||||
|
||||
function addGaugeMapping(
|
||||
function _addGaugeMapping(
|
||||
string memory gaugeName,
|
||||
address gaugeAddress,
|
||||
bool rewardToken
|
||||
) public isChief {
|
||||
) internal {
|
||||
require(gaugeAddress != address(0), "gaugeAddress-not-vaild");
|
||||
require(bytes(gaugeName).length <= 32, "Length-exceeds");
|
||||
bytes32 gaugeType = stringToBytes32(gaugeName);
|
||||
|
@ -79,6 +68,17 @@ contract Helpers is BytesHelper {
|
|||
emit LogAddGaugeMapping(gaugeName, gaugeAddress, rewardToken);
|
||||
}
|
||||
|
||||
function addGaugeMappings(
|
||||
string[] memory gaugeNames,
|
||||
address[] memory gaugeAddresses,
|
||||
bool[] memory rewardTokens
|
||||
) public isChief {
|
||||
require(gaugeNames.length == gaugeAddresses.length && gaugeAddresses.length == rewardTokens.length, "length-not-match");
|
||||
for (uint32 i; i < gaugeNames.length; i++) {
|
||||
_addGaugeMapping(gaugeNames[i], gaugeAddresses[i], rewardTokens[i]);
|
||||
}
|
||||
}
|
||||
|
||||
function removeGaugeMapping(string memory gaugeName, address gaugeAddress) public isChief {
|
||||
require(gaugeAddress != address(0), "gaugeAddress-not-vaild");
|
||||
bytes32 gaugeType = stringToBytes32(gaugeName);
|
||||
|
@ -95,4 +95,15 @@ contract Helpers is BytesHelper {
|
|||
|
||||
contract CurveGaugeMapping is Helpers {
|
||||
string constant public name = "Curve-Gauge-Mapping-v1";
|
||||
|
||||
constructor (
|
||||
string[] memory gaugeNames,
|
||||
address[] memory gaugeAddresses,
|
||||
bool[] memory rewardTokens
|
||||
) public {
|
||||
require(gaugeNames.length == gaugeAddresses.length && gaugeAddresses.length == rewardTokens.length, "length-not-match");
|
||||
for (uint32 i; i < gaugeNames.length; i++) {
|
||||
_addGaugeMapping(gaugeNames[i], gaugeAddresses[i], rewardTokens[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user