ulysses-actions-sdk
Version:
An sdk for interacting with contracts using Ulysses Protocol
2,606 lines • 138 kB
JavaScript
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var maiaCoreSdk = require('maia-core-sdk');
var JSBI = _interopDefault(require('jsbi'));
var ulyssesSdk = require('ulysses-sdk');
var hermesV2Sdk = require('hermes-v2-sdk');
var talosSdk = require('talos-sdk');
var invariant = _interopDefault(require('tiny-invariant'));
var maiaV2Sdk = require('maia-v2-sdk');
var solidity = require('@ethersproject/solidity');
/**
* @title GenericAction class
* @notice Provides a set of function to store encoded calldata inside a generic action for use in ActionBuilders.
* @author MaiaDAO
*/
var GenericAction = /*#__PURE__*/function () {
/**
* Constructor for the GenericAction class.
* @param params object instance of IActionResult containing the tx data to wrap inside action.
* @returns a new instance of GenericAction.
* @notice the constructor is used to set the calldata to wrap inside action in bHermesGauges.
* @dev IActionResult.target the target contract to send the calldata to.
* @dev IActionResult.calldata the encoded calldata to send to the target contract.
* @dev IActionResult.value the message value to send with the calldata.
*/
function GenericAction(params) {
this.params = params;
}
/**
* Encodes the contract interaction calldata to decrement a gauge in bHermesGauges.
* @param params the calldata to wrap inside action in bHermesGauges.
* @returns the target contract, encoded calldata and message value to send calldata to wrap inside action.
*/
var _proto = GenericAction.prototype;
_proto.encode = function encode(params) {
return {
target: params.target,
params: params.params
};
};
return GenericAction;
}();
function _arrayLikeToArray(r, a) {
(null == a || a > r.length) && (a = r.length);
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
return n;
}
function _createForOfIteratorHelperLoose(r, e) {
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
if (t) return (t = t.call(r)).next.bind(t);
if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
t && (r = t);
var o = 0;
return function () {
return o >= r.length ? {
done: !0
} : {
done: !1,
value: r[o++]
};
};
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _extends() {
return _extends = Object.assign ? Object.assign.bind() : function (n) {
for (var e = 1; e < arguments.length; e++) {
var t = arguments[e];
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
}
return n;
}, _extends.apply(null, arguments);
}
function _unsupportedIterableToArray(r, a) {
if (r) {
if ("string" == typeof r) return _arrayLikeToArray(r, a);
var t = {}.toString.call(r).slice(8, -1);
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
}
}
/**
* @title ActionBuilder.
* @notice A builder class for creating a batch of actions to be executed onchain.
* @author MaiaDAO
*/
var ActionBuilder = /*#__PURE__*/function () {
function ActionBuilder(context) {
this.actions = [];
this.context = context;
}
var _proto = ActionBuilder.prototype;
_proto.addAction = function addAction(action) {
this.actions.push(action);
return this;
};
_proto.build = function build() {
// eslint-disable-next-line prefer-const
var results = [];
for (var _iterator = _createForOfIteratorHelperLoose(this.actions), _step; !(_step = _iterator()).done;) {
var action = _step.value;
// Perform any necessary pre-checks or adjustments
this.beforeEncode();
// Encode action with context
var result = this.context.encodeAction(action, action.params);
// Store result for further processing
results.push(result);
// Optionally, adjust context or the results array for subsequent actions
this.afterEncode();
}
return {
results: results,
encodedResults: this.context.wrapCalldata(results)
};
};
_proto.beforeEncode = function beforeEncode() {
// Implement checks such as invariant validations here
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
;
_proto.afterEncode = function afterEncode() {
// Adjust the context based on previous action's result if necessary
};
return ActionBuilder;
}();
var ContextHandler = /*#__PURE__*/function () {
// This is the constructor for the context handler
function ContextHandler(params) {
this.chainId = params.chainId;
this.useVirtualAccount = params.useVirtualAccount;
this.userAccount = params.userAccount;
this.value = params.value;
this.gasParams = params.gasParams;
this.inputTokens = params.inputTokens;
this.outputTokens = params.outputTokens;
}
var _proto = ContextHandler.prototype;
_proto.encodeAction = function encodeAction(action, params) {
return action.encode(params);
};
_proto.wrapCalldata = function wrapCalldata(results) {
// Prepare the calldata
var calldata = '';
var rootChainId = ulyssesSdk.EVM_CHAIN_ID_TO_ROOT_CHAIN_ID[this.chainId];
//---Wrap or adjust calldata for root chain virtual account usage
if (this.chainId === rootChainId && this.useVirtualAccount) {
// Root Action with no settlement creation
if (!this.gasParams && !this.outputTokens) {
var _this$userAccount;
// Wrap encode a Payable interaction via Virtual Account
if (this.isPayableContext()) {
// Encode the array of results into an array of IPayableCall type
var calls = results.map(function (result) {
return {
target: result.target,
callData: result.params.calldata,
value: result.params.value
};
});
// Wrap the array of IPayableCall into a single calldata for direct Virtual Account usage
calldata = ulyssesSdk.VirtualAccount.encodePayableCall(calls);
// Wrap encode a standard Multicall interaction via Virtual Account
} else {
// Encode the array of results into an array of IMulticallCall type
var _calls = results.map(function (result) {
return {
target: result.target,
callData: result.params.calldata
};
});
// Wrap the array of IMulticallCall into a single calldata for direct Virtual Account usage
calldata = ulyssesSdk.VirtualAccount.encodeMulticall(_calls);
}
// Return the call information for direct Virtual Account usage
return {
target: (_this$userAccount = this.userAccount) != null ? _this$userAccount : maiaCoreSdk.ZERO_ADDRESS,
params: {
calldata: calldata,
value: this.value
}
}; // This would be the modified calldata based on the context
// Root Action with settlement or multiple settlement creation
} else {
var _Ulysses$this$chainId, _Ulysses$this$chainId2, _this$value, _this$userAccount2;
// Encode the array of results into an array of IPayableCall type
var _calls2 = results.map(function (result) {
return {
target: result.target,
callData: result.params.calldata,
value: result.params.value
};
});
// Wrap calldata inside Root Router Params
var settlementCalldata = '';
// Adjust encode for an interaction with single token output
if (this.isOutputTokenParams(this.outputTokens)) {
settlementCalldata = ulyssesSdk.RootRouter.encodeCallOutAndBridgeCalldata(_extends({
settlementOwnerAndGasRefundee: this.outputTokens.settlementOwner
}, this.outputTokens));
// Adjust encode for a multiple token output interaction
} else if (this.isOutputMultipleTokenParams(this.outputTokens)) {
settlementCalldata = ulyssesSdk.RootRouter.encodeCallOutAndBridgeMultipleCalldata(_extends({
settlementOwnerAndGasRefundee: this.outputTokens.settlementOwner
}, this.outputTokens));
}
// Add the settlement calldata to the calls array
_calls2.push({
target: (_Ulysses$this$chainId = (_Ulysses$this$chainId2 = maiaCoreSdk.Ulysses[this.chainId]) == null ? void 0 : _Ulysses$this$chainId2.MulticallRootRouterLibZip) != null ? _Ulysses$this$chainId : maiaCoreSdk.ZERO_ADDRESS,
callData: settlementCalldata,
value: (_this$value = this.value) != null ? _this$value : '0'
});
return {
target: (_this$userAccount2 = this.userAccount) != null ? _this$userAccount2 : maiaCoreSdk.ZERO_ADDRESS,
params: {
calldata: ulyssesSdk.VirtualAccount.encodePayableCall(_calls2),
value: '0'
}
};
}
//---Wrap or adjust calldata for branch chain usage of Branch Bridge Agent
} else {
var _Ulysses$this$chainId3, _Ulysses$this$chainId4;
// Encode the array of results into an array of IMulticallCall type
var _calls3 = results.map(function (result) {
return {
target: result.target,
callData: result.params.calldata
};
});
// Wrap calldata inside Root Router Params
// Adjust encode for an interaction that doesn't require a token output
if (!this.outputTokens) {
calldata = ulyssesSdk.RootRouter.encodeRemoteMulticallNoOutput(_calls3);
// Adjust encode for a single token output interaction
} else if (this.isOutputTokenParams(this.outputTokens)) {
calldata = ulyssesSdk.RootRouter.encodeRemoteMulticallWithOutput(_calls3, this.outputTokens);
// Adjust encode for a multiple token output interaction
} else if (this.isOutputMultipleTokenParams(this.outputTokens)) {
calldata = ulyssesSdk.RootRouter.encodeRemoteMulticallWithMultipleOutput(_calls3, this.outputTokens);
}
// Prepare the calldata for the Branch Bridge Agent
var result = {
calldata: '',
value: '0'
};
// Wrap calldata inside Branch Bridge Agent Params
// Adjust encode for an interaction that doesn't require a token
if (!this.inputTokens) {
var _this$gasParams;
result = ulyssesSdk.BranchBridgeAgent.encodeCallOutSignedLibZipCalldata(calldata, (_this$gasParams = this.gasParams) != null ? _this$gasParams : {
gasLimit: maiaCoreSdk.ZERO.toString(),
remoteBranchExecutionGas: maiaCoreSdk.ZERO.toString()
});
// Adjust encode for a single deposit interaction
} else if (this.isSingleDepositParams(this.inputTokens)) {
var _this$gasParams2;
result = ulyssesSdk.BranchBridgeAgent.encodeCallOutSignedAndBridgeLibZipCalldata(calldata, this.inputTokens, (_this$gasParams2 = this.gasParams) != null ? _this$gasParams2 : {
gasLimit: maiaCoreSdk.ZERO.toString(),
remoteBranchExecutionGas: maiaCoreSdk.ZERO.toString()
});
// Adjust encode for a multiple deposit interaction
} else if (this.isMultipleDepositParams(this.inputTokens)) {
var _this$gasParams3;
result = ulyssesSdk.BranchBridgeAgent.encodeCallOutSignedAndBridgeMultipleLibZipCalldata(calldata, this.inputTokens, (_this$gasParams3 = this.gasParams) != null ? _this$gasParams3 : {
gasLimit: maiaCoreSdk.ZERO.toString(),
remoteBranchExecutionGas: maiaCoreSdk.ZERO.toString()
});
}
return {
target: (_Ulysses$this$chainId3 = (_Ulysses$this$chainId4 = maiaCoreSdk.Ulysses[this.chainId]) == null ? void 0 : _Ulysses$this$chainId4.MulticallBranchBridgeAgentLibZip) != null ? _Ulysses$this$chainId3 : maiaCoreSdk.ZERO_ADDRESS,
params: {
calldata: result.calldata,
value: result.value
}
};
}
};
_proto.isPayableContext = function isPayableContext() {
return this.value !== undefined && JSBI.greaterThan(JSBI.BigInt(this.value), JSBI.BigInt('0'));
};
_proto.isOutputTokenParams = function isOutputTokenParams(params) {
return params && 'settlementOwner' in params && typeof params.settlementOwner === 'string' && 'recipient' in params && typeof params.recipient === 'string' && 'outputToken' in params && typeof params.outputToken === 'string' && 'amountOut' in params && typeof params.amountOut === 'string' && 'depositOut' in params && typeof params.depositOut === 'string' && 'dstChainId' in params && typeof params.dstChainId === 'number' && 'gasParams' in params && typeof params.gasParams === 'object' && typeof params.gasParams.gasLimit === 'string' && typeof params.gasParams.remoteBranchExecutionGas === 'string';
};
_proto.isOutputMultipleTokenParams = function isOutputMultipleTokenParams(params) {
return params && 'settlementOwner' in params && typeof params.settlementOwner === 'string' && 'recipient' in params && typeof params.recipient === 'string' && 'outputTokens' in params && Array.isArray(params.outputTokens) && 'amountsOut' in params && Array.isArray(params.amountsOut) && 'depositsOut' in params && Array.isArray(params.depositsOut) && 'dstChainId' in params && typeof params.dstChainId === 'number' && 'gasParams' in params && typeof params.gasParams === 'object' && typeof params.gasParams.gasLimit === 'string' && typeof params.gasParams.remoteBranchExecutionGas === 'string';
};
_proto.isSingleDepositParams = function isSingleDepositParams(params) {
return params && 'hToken' in params && typeof params.hToken === 'string' && 'token' in params && typeof params.token === 'string' && 'amount' in params && typeof params.amount === 'string' && 'deposit' in params && typeof params.deposit === 'string';
};
_proto.isMultipleDepositParams = function isMultipleDepositParams(params) {
return params && 'hTokens' in params && Array.isArray(params.hTokens) && 'tokens' in params && Array.isArray(params.tokens) && 'amounts' in params && Array.isArray(params.amounts) && 'deposits' in params && Array.isArray(params.deposits);
};
return ContextHandler;
}();
/**
* @title BurnHermesAction class
* @notice Provides a set of function to encode calldata for the burn action in bHermes contract.
* @author MaiaDAO
*/
var BurnHermesAction = /*#__PURE__*/function () {
/**
* Constructor for the BurnHermesAction class.
* @param params the parameters for the burn action in bHermes.
* @returns a new instance of BurnHermesAction.
* @notice the constructor is used to set the parameters for the burn action in bHermes.
*/
function BurnHermesAction(params, chainId) {
this.params = params;
this.chainId = chainId;
}
/**
* Encodes the contract interaction calldata to burn $Hermes in exchange for $bHermes.
* @param params the parameters for the burn action in bHermes.
* @returns the target contract, encoded calldata and message value to send to Branch Router for the burn action.
*/
var _proto = BurnHermesAction.prototype;
_proto.encode = function encode(params) {
var _HermesAddresses$bHer, _HermesAddresses, _this$chainId;
return {
target: (_HermesAddresses$bHer = (_HermesAddresses = maiaCoreSdk.HermesAddresses[(_this$chainId = this.chainId) != null ? _this$chainId : maiaCoreSdk.ROOT_CHAIN_ID]) == null ? void 0 : _HermesAddresses.bHermes) != null ? _HermesAddresses$bHer : maiaCoreSdk.ZERO_ADDRESS,
params: {
calldata: hermesV2Sdk.BHermes.encodeBurnCalldata(params),
value: '0'
}
};
};
return BurnHermesAction;
}();
/**
* @title DecrementAllGaugesAllBoostAction class
* @notice Provides a set of function to encode calldata for the decrement all gauge all boost action in bHermesBoost contract.
* @author MaiaDAO
*/
var DecrementAllGaugesAllBoostAction = /*#__PURE__*/function () {
/**
* Constructor for the DecrementAllGaugesAllBoostAction class.
* @returns a new instance of DecrementAllGaugesAllBoostAction.
* @notice the constructor is used to set the parameters for the decrement all gauge all boost action in bHermesBoost.
*/
function DecrementAllGaugesAllBoostAction(params, chainId) {
this.params = params;
this.chainId = chainId;
}
/**
* Encodes the contract interaction calldata to decrement all boost from all attached gauges in bHermesBoost.
* @param _params no parameters required, input is ignored.
* @returns the target contract, encoded calldata and message value to send onchain for the decrement all gauge all boost action.
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
var _proto = DecrementAllGaugesAllBoostAction.prototype;
_proto.encode = function encode(_params) {
var _HermesAddresses$bHer, _HermesAddresses, _this$chainId;
return {
target: (_HermesAddresses$bHer = (_HermesAddresses = maiaCoreSdk.HermesAddresses[(_this$chainId = this.chainId) != null ? _this$chainId : maiaCoreSdk.ROOT_CHAIN_ID]) == null ? void 0 : _HermesAddresses.bHermesBoost) != null ? _HermesAddresses$bHer : maiaCoreSdk.ZERO_ADDRESS,
params: {
calldata: hermesV2Sdk.BHermesBoost.encodeDecrementAllGaugesAllBoostCalldata(),
value: '0'
}
};
};
return DecrementAllGaugesAllBoostAction;
}();
/**
* @title DecrementAllGaugesBoostAction class
* @notice Provides a set of function to encode calldata for the decrement all gauges boost action in bHermesBoost contract.
* @author MaiaDAO
*/
var DecrementAllGaugesBoostAction = /*#__PURE__*/function () {
/**
* Constructor for the DecrementAllGaugesBoostAction class.
* @param params the parameters for the decrement all gauges boost action in bHermesBoost.
* @returns a new instance of DecrementAllGaugesBoostAction.
* @notice the constructor is used to set the parameters for the decrement all gauges boost action in bHermesBoost.
*/
function DecrementAllGaugesBoostAction(params, chainId) {
this.params = params;
this.chainId = chainId;
}
/**
* Encodes the contract interaction calldata to decrement an amount of boost from all attached gauges in bHermesBoost.
* @param params the parameters for the decrement all gauges boost action in bHermesBoost.
* @returns the target contract, encoded calldata and message value to send onchain for the decrement all gauges boost action.
*/
var _proto = DecrementAllGaugesBoostAction.prototype;
_proto.encode = function encode(params) {
var _HermesAddresses$bHer, _HermesAddresses, _this$chainId;
return {
target: (_HermesAddresses$bHer = (_HermesAddresses = maiaCoreSdk.HermesAddresses[(_this$chainId = this.chainId) != null ? _this$chainId : maiaCoreSdk.ROOT_CHAIN_ID]) == null ? void 0 : _HermesAddresses.bHermesBoost) != null ? _HermesAddresses$bHer : maiaCoreSdk.ZERO_ADDRESS,
params: {
calldata: hermesV2Sdk.BHermesBoost.encodeDecrementAllGaugesBoostCalldata(params),
value: '0'
}
};
};
return DecrementAllGaugesBoostAction;
}();
/**
* @title DecrementGaugeAllBoostAction class
* @notice Provides a set of function to encode calldata for the decrement gauge all boost action in bHermesBoost contract.
* @author MaiaDAO
*/
var DecrementGaugeAllBoostAction = /*#__PURE__*/function () {
/**
* Constructor for the DecrementGaugeAllBoostAction class.
* @param params the parameters for the decrement gauge all boost action in bHermesBoost.
* @returns a new instance of DecrementGaugeAllBoostAction.
* @notice the constructor is used to set the parameters for the decrement gauge all boost action in bHermesBoost.
*/
function DecrementGaugeAllBoostAction(params, chainId) {
this.params = params;
this.chainId = chainId;
}
/**
* Encodes the contract interaction calldata to decrement all of a gauge's boost in bHermesBoost.
* @param params the parameters for the decrement gauge all boost action in bHermesBoost.
* @returns the target contract, encoded calldata and message value to send onchain for the decrement gauge all boost action.
*/
var _proto = DecrementGaugeAllBoostAction.prototype;
_proto.encode = function encode(params) {
var _HermesAddresses$bHer, _HermesAddresses, _this$chainId;
return {
target: (_HermesAddresses$bHer = (_HermesAddresses = maiaCoreSdk.HermesAddresses[(_this$chainId = this.chainId) != null ? _this$chainId : maiaCoreSdk.ROOT_CHAIN_ID]) == null ? void 0 : _HermesAddresses.bHermesBoost) != null ? _HermesAddresses$bHer : maiaCoreSdk.ZERO_ADDRESS,
params: {
calldata: hermesV2Sdk.BHermesBoost.encodeDecrementGaugeAllBoostCalldata(params),
value: '0'
}
};
};
return DecrementGaugeAllBoostAction;
}();
/**
* @title DecrementGaugeBoostAction class
* @notice Provides a set of function to encode calldata for the decrement gauge boost action in bHermesBoost contract.
* @author MaiaDAO
*/
var DecrementGaugeBoostAction = /*#__PURE__*/function () {
/**
* Constructor for the DecrementGaugeBoostAction class.
* @param params the parameters for the decrement gauge boost action in bHermesBoost.
* @returns a new instance of DecrementGaugeBoostAction.
* @notice the constructor is used to set the parameters for the decrement gauge boost action in bHermesBoost.
*/
function DecrementGaugeBoostAction(params, chainId) {
this.params = params;
this.chainId = chainId;
}
/**
* Encodes the contract interaction calldata to decrement a gauge's boost in bHermesBoost.
* @param params the parameters for the decrement gauge boost action in bHermesBoost.
* @returns the target contract, encoded calldata and message value to send onchain for the decrement gauge boost action.
*/
var _proto = DecrementGaugeBoostAction.prototype;
_proto.encode = function encode(params) {
var _HermesAddresses$bHer, _HermesAddresses, _this$chainId;
return {
target: (_HermesAddresses$bHer = (_HermesAddresses = maiaCoreSdk.HermesAddresses[(_this$chainId = this.chainId) != null ? _this$chainId : maiaCoreSdk.ROOT_CHAIN_ID]) == null ? void 0 : _HermesAddresses.bHermesBoost) != null ? _HermesAddresses$bHer : maiaCoreSdk.ZERO_ADDRESS,
params: {
calldata: hermesV2Sdk.BHermesBoost.encodeDecrementGaugeBoostCalldata(params),
value: '0'
}
};
};
return DecrementGaugeBoostAction;
}();
/**
* @title DecrementGaugesBoostIndexedAction class
* @notice Provides a set of function to encode calldata for the decrement gauges boost indexed action in bHermesBoost contract.
* @author MaiaDAO
*/
var DecrementGaugesBoostIndexedAction = /*#__PURE__*/function () {
/**
* Constructor for the DecrementGaugesBoostIndexedAction class.
* @param params the parameters for the decrement gauges boost indexed action in bHermesBoost.
* @returns a new instance of DecrementGaugesBoostIndexedAction.
* @notice the constructor is used to set the parameters for the decrement gauges boost indexed action in bHermesBoost.
*/
function DecrementGaugesBoostIndexedAction(params, chainId) {
this.params = params;
this.chainId = chainId;
}
/**
* Encodes the contract interaction calldata to decrement an amount of boost from all attached gauges in bHermesBoost.
* @param params the parameters for the decrement gauges boost indexed action in bHermesBoost.
* @returns the target contract, encoded calldata and message value to send onchain for the decrement gauges boost indexed action.
*/
var _proto = DecrementGaugesBoostIndexedAction.prototype;
_proto.encode = function encode(params) {
var _HermesAddresses$bHer, _HermesAddresses, _this$chainId;
return {
target: (_HermesAddresses$bHer = (_HermesAddresses = maiaCoreSdk.HermesAddresses[(_this$chainId = this.chainId) != null ? _this$chainId : maiaCoreSdk.ROOT_CHAIN_ID]) == null ? void 0 : _HermesAddresses.bHermesBoost) != null ? _HermesAddresses$bHer : maiaCoreSdk.ZERO_ADDRESS,
params: {
calldata: hermesV2Sdk.BHermesBoost.encodeDecrementGaugesBoostIndexedCalldata(params),
value: '0'
}
};
};
return DecrementGaugesBoostIndexedAction;
}();
/**
* @title DecrementGaugeAction class
* @notice Provides a set of function to encode calldata for the decrement gauge action in bHermesGauges contract.
* @author MaiaDAO
*/
var DecrementGaugeAction = /*#__PURE__*/function () {
/**
* Constructor for the DecrementGaugeAction class.
* @param params the parameters for the decrement gauge action in bHermesGauges.
* @returns a new instance of DecrementGaugeAction.
* @notice the constructor is used to set the parameters for the decrement gauge action in bHermesGauges.
*/
function DecrementGaugeAction(params, chainId) {
this.params = params;
this.chainId = chainId;
}
/**
* Encodes the contract interaction calldata to decrement a gauge in bHermesGauges.
* @param params the parameters for the decrement gauge action in bHermesGauges.
* @returns the target contract, encoded calldata and message value to send onchain for the decrement gauge action.
*/
var _proto = DecrementGaugeAction.prototype;
_proto.encode = function encode(params) {
var _HermesAddresses$bHer, _HermesAddresses, _this$chainId;
return {
target: (_HermesAddresses$bHer = (_HermesAddresses = maiaCoreSdk.HermesAddresses[(_this$chainId = this.chainId) != null ? _this$chainId : maiaCoreSdk.ROOT_CHAIN_ID]) == null ? void 0 : _HermesAddresses.bHermesGauges) != null ? _HermesAddresses$bHer : maiaCoreSdk.ZERO_ADDRESS,
params: {
calldata: hermesV2Sdk.BHermesGauges.encodeDecrementGaugeCalldata(params),
value: '0'
}
};
};
return DecrementGaugeAction;
}();
/**
* @title DecrementGaugesAction class
* @notice Provides a set of function to encode calldata for the decrement gauges action in bHermesGauges contract.
* @author MaiaDAO
*/
var DecrementGaugesAction = /*#__PURE__*/function () {
/**
* Constructor for the DecrementGaugesAction class.
* @param params the parameters for the decrement gauges action in bHermesGauges.
* @returns a new instance of DecrementGaugesAction.
* @notice the constructor is used to set the parameters for the decrement gauges action in bHermesGauges.
*/
function DecrementGaugesAction(params, chainId) {
this.params = params;
this.chainId = chainId;
}
/**
* Encodes the contract interaction calldata to decrement multiple gauges in bHermesGauges.
* @param params the parameters for the decrement gauges action in bHermesGauges.
* @returns the target contract, encoded calldata and message value to send onchain for the decrement gauges action.
*/
var _proto = DecrementGaugesAction.prototype;
_proto.encode = function encode(params) {
var _HermesAddresses$bHer, _HermesAddresses, _this$chainId;
return {
target: (_HermesAddresses$bHer = (_HermesAddresses = maiaCoreSdk.HermesAddresses[(_this$chainId = this.chainId) != null ? _this$chainId : maiaCoreSdk.ROOT_CHAIN_ID]) == null ? void 0 : _HermesAddresses.bHermesGauges) != null ? _HermesAddresses$bHer : maiaCoreSdk.ZERO_ADDRESS,
params: {
calldata: hermesV2Sdk.BHermesGauges.encodeDecrementGaugesCalldata(params),
value: '0'
}
};
};
return DecrementGaugesAction;
}();
/**
* @title DelegateAction class
* @notice Provides a set of function to encode calldata for the delegate action in bHermesGauges contract.
* @author MaiaDAO
*/
var DelegateGaugeAction = /*#__PURE__*/function () {
/**
* Constructor for the DelegateAction class.
* @param params the parameters for the delegate action in bHermesGauges.
* @returns a new instance of DelegateAction.
* @notice the constructor is used to set the parameters for the delegate action in bHermesGauges.
*/
function DelegateGaugeAction(params, chainId) {
this.params = params;
this.chainId = chainId;
}
/**
* Encodes the contract interaction calldata to delegate bHermesGauges.
* @param params the parameters for the delegate action in bHermesGauges.
* @returns the target contract, encoded calldata and message value to send onchain for the delegate action.
*/
var _proto = DelegateGaugeAction.prototype;
_proto.encode = function encode(params) {
var _HermesAddresses$bHer, _HermesAddresses, _this$chainId;
return {
target: (_HermesAddresses$bHer = (_HermesAddresses = maiaCoreSdk.HermesAddresses[(_this$chainId = this.chainId) != null ? _this$chainId : maiaCoreSdk.ROOT_CHAIN_ID]) == null ? void 0 : _HermesAddresses.bHermesGauges) != null ? _HermesAddresses$bHer : maiaCoreSdk.ZERO_ADDRESS,
params: {
calldata: hermesV2Sdk.BHermesGauges.encodeDelegateCalldata(params),
value: '0'
}
};
};
return DelegateGaugeAction;
}();
/**
* @title IncrementGaugeAction class
* @notice Provides a set of function to encode calldata for the increment gauge action in bHermesGauges contract.
* @author MaiaDAO
*/
var IncrementGaugeAction = /*#__PURE__*/function () {
/**
* Constructor for the IncrementGaugeAction class.
* @param params the parameters for the increment gauge action in bHermesGauges.
* @returns a new instance of IncrementGaugeAction.
* @notice the constructor is used to set the parameters for the increment gauge action in bHermesGauges.
*/
function IncrementGaugeAction(params, chainId) {
this.params = params;
this.chainId = chainId;
}
/**
* Encodes the contract interaction calldata to increment a gauge in bHermesGauges.
* @param params the parameters for the increment gauge action in bHermesGauges.
* @returns the target contract, encoded calldata and message value to send onchain for the increment gauge action.
*/
var _proto = IncrementGaugeAction.prototype;
_proto.encode = function encode(params) {
var _HermesAddresses$bHer, _HermesAddresses, _this$chainId;
return {
target: (_HermesAddresses$bHer = (_HermesAddresses = maiaCoreSdk.HermesAddresses[(_this$chainId = this.chainId) != null ? _this$chainId : maiaCoreSdk.ROOT_CHAIN_ID]) == null ? void 0 : _HermesAddresses.bHermesGauges) != null ? _HermesAddresses$bHer : maiaCoreSdk.ZERO_ADDRESS,
params: {
calldata: hermesV2Sdk.BHermesGauges.encodeIncrementGaugeCalldata(params),
value: '0'
}
};
};
return IncrementGaugeAction;
}();
/**
* @title IncrementGaugesAction class
* @notice Provides a set of function to encode calldata for the increment gauges action in bHermesGauges contract.
* @author MaiaDAO
*/
var IncrementGaugesAction = /*#__PURE__*/function () {
/**
* Constructor for the IncrementGaugesAction class.
* @param params the parameters for the increment gauges action in bHermesGauges.
* @returns a new instance of IncrementGaugesAction.
* @notice the constructor is used to set the parameters for the increment gauges action in bHermesGauges.
*/
function IncrementGaugesAction(params, chainId) {
this.params = params;
this.chainId = chainId;
}
/**
* Encodes the contract interaction calldata to increment multiple gauges in bHermesGauges.
* @param params the parameters for the increment gauges action in bHermesGauges.
* @returns the target contract, encoded calldata and message value to send onchain for the increment gauges action.
*/
var _proto = IncrementGaugesAction.prototype;
_proto.encode = function encode(params) {
var _HermesAddresses$bHer, _HermesAddresses, _this$chainId;
return {
target: (_HermesAddresses$bHer = (_HermesAddresses = maiaCoreSdk.HermesAddresses[(_this$chainId = this.chainId) != null ? _this$chainId : maiaCoreSdk.ROOT_CHAIN_ID]) == null ? void 0 : _HermesAddresses.bHermesGauges) != null ? _HermesAddresses$bHer : maiaCoreSdk.ZERO_ADDRESS,
params: {
calldata: hermesV2Sdk.BHermesGauges.encodeIncrementGaugesCalldata(params),
value: '0'
}
};
};
return IncrementGaugesAction;
}();
/**
* @title UndelegateAction class
* @notice Provides a set of function to encode calldata for the undelegate action in bHermesGauges contract.
* @author MaiaDAO
*/
var UndelegateGaugeAction = /*#__PURE__*/function () {
/**
* Constructor for the UndelegateAction class.
* @param params the parameters for the undelegate action in bHermesGauges.
* @returns a new instance of UndelegateAction.
* @notice the constructor is used to set the parameters for the undelegate action in bHermesGauges.
*/
function UndelegateGaugeAction(params, chainId) {
this.params = params;
this.chainId = chainId;
}
/**
* Encodes the contract interaction calldata to undelegate bHermesGauges.
* @param params the parameters for the undelegate action in bHermesGauges.
* @returns the target contract, encoded calldata and message value to send onchain for the undelegate action.
*/
var _proto = UndelegateGaugeAction.prototype;
_proto.encode = function encode(params) {
var _HermesAddresses$bHer, _HermesAddresses, _this$chainId;
return {
target: (_HermesAddresses$bHer = (_HermesAddresses = maiaCoreSdk.HermesAddresses[(_this$chainId = this.chainId) != null ? _this$chainId : maiaCoreSdk.ROOT_CHAIN_ID]) == null ? void 0 : _HermesAddresses.bHermesGauges) != null ? _HermesAddresses$bHer : maiaCoreSdk.ZERO_ADDRESS,
params: {
calldata: hermesV2Sdk.BHermesGauges.encodeUndelegateCalldata(params),
value: '0'
}
};
};
return UndelegateGaugeAction;
}();
/**
* @title DelegateAction class
* @notice Provides a set of function to encode calldata for the delegate action in bHermesVotes contract.
* @author MaiaDAO
*/
var DelegateVotesAction = /*#__PURE__*/function () {
/**
* Constructor for the DelegateAction class.
* @param params the parameters for the delegate action in bHermesVotes.
* @returns a new instance of DelegateAction.
* @notice the constructor is used to set the parameters for the delegate action in bHermesVotes.
*/
function DelegateVotesAction(params, chainId) {
this.params = params;
this.chainId = chainId;
}
/**
* Encodes the contract interaction calldata to delegate bHermesVotes.
* @param params the parameters for the delegate action in bHermesVotes.
* @returns the target contract, encoded calldata and message value to send onchain for the delegate action.
*/
var _proto = DelegateVotesAction.prototype;
_proto.encode = function encode(params) {
var _HermesAddresses$bHer, _HermesAddresses, _this$chainId;
return {
target: (_HermesAddresses$bHer = (_HermesAddresses = maiaCoreSdk.HermesAddresses[(_this$chainId = this.chainId) != null ? _this$chainId : maiaCoreSdk.ROOT_CHAIN_ID]) == null ? void 0 : _HermesAddresses.bHermesVotes) != null ? _HermesAddresses$bHer : maiaCoreSdk.ZERO_ADDRESS,
params: {
calldata: hermesV2Sdk.BHermesVotes.encodeDelegateCalldata(params),
value: '0'
}
};
};
return DelegateVotesAction;
}();
/**
* @title UndelegateAction class
* @notice Provides a set of function to encode calldata for the undelegate action in bHermesVotes contract.
* @author MaiaDAO
*/
var UndelegateVotesAction = /*#__PURE__*/function () {
/**
* Constructor for the UndelegateAction class.
* @param params the parameters for the undelegate action in bHermesVotes.
* @returns a new instance of UndelegateAction.
* @notice the constructor is used to set the parameters for the undelegate action in bHermesVotes.
*/
function UndelegateVotesAction(params, chainId) {
this.params = params;
this.chainId = chainId;
}
/**
* Encodes the contract interaction calldata to undelegate bHermesVotes.
* @param params the parameters for the undelegate action in bHermesVotes.
* @returns the target contract, encoded calldata and message value to send onchain for the undelegate action.
*/
var _proto = UndelegateVotesAction.prototype;
_proto.encode = function encode(params) {
var _HermesAddresses$bHer, _HermesAddresses, _this$chainId;
return {
target: (_HermesAddresses$bHer = (_HermesAddresses = maiaCoreSdk.HermesAddresses[(_this$chainId = this.chainId) != null ? _this$chainId : maiaCoreSdk.ROOT_CHAIN_ID]) == null ? void 0 : _HermesAddresses.bHermesVotes) != null ? _HermesAddresses$bHer : maiaCoreSdk.ZERO_ADDRESS,
params: {
calldata: hermesV2Sdk.BHermesVotes.encodeUndelegateCalldata(params),
value: '0'
}
};
};
return UndelegateVotesAction;
}();
/**
* @title ClaimRewardAction class
* @notice Provides a set of function to encode calldata for the claim reward action from a Flywheel contract.
* @author MaiaDAO
*/
var ClaimRewardsAction = /*#__PURE__*/function () {
/**
* Constructor for the ClaimRewardsAction class.
* @param flywheel the address of the flywheel contract.
* @param recipient the recipient for the claim rewards.
* @returns a new instance of ClaimRewardsAction.
* @notice the constructor is used to set the parameters for the claim rewards action in the flywheel.
*/
function ClaimRewardsAction(flywheel, recipient) {
this.target = flywheel;
this.params = recipient;
}
/**
* Encodes the contract interaction calldata to claim rewards from a flywheel contract.
* @param recipient the recipient for the claim rewards action.
* @returns the target contract, encoded calldata and message value to send onchain for the claim rewards action.
*/
var _proto = ClaimRewardsAction.prototype;
_proto.encode = function encode(recipient) {
var _this$target;
return {
target: (_this$target = this.target) != null ? _this$target : maiaCoreSdk.ZERO_ADDRESS,
params: {
calldata: hermesV2Sdk.Flywheel.encodeClaimRewardsCalldata(recipient),
value: '0'
}
};
};
return ClaimRewardsAction;
}();
/**
* @title StrategyDepositAction class
* @notice Provides a set of function to encode calldata to deposit into Talos Strategy contract.
* @author MaiaDAO
*/
var StrategyDepositAction = /*#__PURE__*/function () {
/**
* Constructor for the StrategyDepositAction class.
* @param strategy the address of the strategy to deposit into.
* @param params the parameters for the strategy deposit action in Talos Strategy.
* @returns a new instance of StrategyDepositAction.
* @notice the constructor is used to set the parameters for the strategy deposit action in Talos Strategy.
*/
function StrategyDepositAction(strategy, params) {
this.target = strategy;
this.params = params;
}
/**
* Encodes the contract interaction calldata to deposit into Talos Strategy.
* @param params the parameters for the strategy deposit action in Talos Strategy.
* @returns the target contract, encoded calldata and message value to send onchain for the strategy deposit action.
*/
var _proto = StrategyDepositAction.prototype;
_proto.encode = function encode(params) {
return {
target: this.target,
params: {
calldata: talosSdk.TalosBaseStrategy.encodeStrategyDepositParams(params),
value: '0'
}
};
};
return StrategyDepositAction;
}();
/**
* @title StrategyRedeemAction class
* @notice Provides a set of function to encode calldata to redeem from Talos Strategy contract.
* @author MaiaDAO
*/
var StrategyRedeemAction = /*#__PURE__*/function () {
/**
* Constructor for the StrategyRedeemAction class.
* @param strategy the address of the strategy to redeem from.
* @param params the parameters for the strategy redeem action in Talos Strategy.
* @returns a new instance of StrategyRedeemAction.
* @notice the constructor is used to set the parameters for the strategy redeem action in Talos Strategy.
*/
function StrategyRedeemAction(strategy, params) {
this.target = strategy;
this.params = params;
}
/**
* Encodes the contract interaction calldata to redeem into Talos Strategy.
* @param params the parameters for the strategy redeem action in Talos Strategy.
* @returns the target contract, encoded calldata and message value to send onchain for the strategy redeem action.
*/
var _proto = StrategyRedeemAction.prototype;
_proto.encode = function encode(params) {
return {
target: this.target,
params: {
calldata: talosSdk.TalosBaseStrategy.encodeStrategyRedeemParams(params),
value: '0'
}
};
};
return StrategyRedeemAction;
}();
/**
* @title CreateTalosManagerAction class
* @notice Provides a set of function to encode calldata to create a Talos Manager using Talos Manager Factory contract.
* @author MaiaDAO
*/
var CreateTalosManagerAction = /*#__PURE__*/function () {
/**
* Constructor for the CreateTalosManager class.
* @param params the parameters for the create Talos Manager action in Talos Strategy.
* @returns a new instance of CreateTalosManager.
* @notice the constructor is used to set the parameters for the create Talos Manager action in Talos Strategy.
*/
function CreateTalosManagerAction(params) {
this.params = params;
}
/**
* Encodes the contract interaction calldata to create a Talos manager.
* @param params the parameters for the create Talos Manager action in Talos Strategy.
* @returns the target contract, encoded calldata and message value to send onchain for the create Talos Manager action.
*/
var _proto = CreateTalosManagerAction.prototype;
_proto.encode = function encode(params) {
var _TalosAddresses$ROOT_, _TalosAddresses$ROOT_2;
return {
target: (_TalosAddresses$ROOT_ = (_TalosAddresses$ROOT_2 = maiaCoreSdk.TalosAddresses[maiaCoreSdk.ROOT_CHAIN_ID]) == null ? void 0 : _TalosAddresses$ROOT_2.talosManagerFactory) != null ? _TalosAddresses$ROOT_ : maiaCoreSdk.ZERO_ADDRESS,
params: {
calldata: talosSdk.TalosManagerFactory.encodeCreateTalosManagerParams(params),
value: '0'
}
};
};
return CreateTalosManagerAction;
}();
/**
* @title CreateTalosOptimizerAction class
* @notice Provides a set of function to encode calldata to create a Talos Optimizer using Talos Optimizer Factory contract.
* @author MaiaDAO
*/
var CreateTalosOptimizerAction = /*#__PURE__*/function () {
/**
* Constructor for the CreateTalosOptimizer class.
* @param params the parameters for the create Talos Manager action in Talos Strategy.
* @returns a new instance of CreateTalosOptimizer.
* @notice the constructor is used to set the parameters for the create Talos Manager action in Talos Strategy.
*/
function CreateTalosOptimizerAction(params) {
this.params = params;
}
/**
* Encodes the contract interaction calldata to create a Talos manager.
* @param params the parameters for the create Talos Manager action in Talos Strategy.
* @returns the target contract, encoded calldata and message value to send onchain for the create Talos Manager action.
*/
var _proto = CreateTalosOptimizerAction.prototype;
_proto.encode = function encode(params) {
var _TalosAddresses$ROOT_, _TalosAddresses$ROOT_2;
return {
target: (_TalosAddresses$ROOT_ = (_TalosAddresses$ROOT_2 = maiaCoreSdk.TalosAddresses[maiaCoreSdk.ROOT_CHAIN_ID]) == null ? void 0 : _TalosAddresses$ROOT_2.talosOptimizerFactory) != null ? _TalosAddresses$ROOT_ : maiaCoreSdk.ZERO_ADDRESS,
params: {
calldata: talosSdk.TalosOptimizerFactory.encodeCreateTalosOptimizerParams(params),
value: '0'
}
};
};
return CreateTalosOptimizerAction;
}();
/**
* @title CreateTalosStrategyStakedAction class
* @notice Provides a set of function to encode calldata to create a Talos Staked Strategy using Talos Strategy Staked Factory contract.
* @author MaiaDAO
*/
var CreateTalosStrategyStakedAction = /*#__PURE__*/function () {
/**
* Constructor for the CreateTalosStrategyStaked class.
* @param params the parameters for the create Talos Strategy Staked action in Talos Strategy.
* @returns a new instance of CreateTalosStrategyStakedAction.
* @notice the constructor is used to set the parameters for the create Talos Strategy Staked action.
*/
function CreateTalosStrategyStakedAction(params) {
this.params = params;
}
/**
* Encodes the contract interaction calldata to create a Talos manager.
* @param params the parameters for the create Talos Strategy Staked action in Talos Strategy.
* @returns the target contract, encoded calldata and message value to send onchain for the create Talos Strategy Staked action.
*/
var _proto = CreateTalosStrategyStakedAction.prototype;
_proto.encode = function encode(params) {
var _TalosAddresses$ROOT_, _TalosAddresses$ROOT_2;
return {
target: (_TalosAddresses$ROOT_ = (_TalosAddresses$ROOT_2 = maiaCoreSdk.TalosAddresses[maiaCoreSdk.ROOT_CHAIN_ID]) == null ? void 0 : _TalosAddresses$ROOT_2.talosOptimizerFactory) != null ? _TalosAddresses$ROOT_ : maiaCoreSdk.ZERO_ADDRESS,
params: {
calldata: talosSdk.TalosStrategyStakedFactory.encodeCreateTalosBaseStrategyParams(params),
value: '0'
}
};
};
return CreateTalosStrategyStakedAction;
}();
/**
* @title CreateTalosStrategyVanillaAction class
* @notice Provides a set of function to encode calldata to create a Talos Vanilla Strategy using Talos Strategy Vanilla Factory contract.
* @author MaiaDAO
*/
var CreateTalosStrategyVanillaAction = /*#__PURE__*/function () {
/**
* Constructor for the CreateTalosVanillaStakedAction class.
* @param params the parameters for the create Talos Strategy Vanilla action.
* @returns a new instance of CreateTalosStrategyVanillaAction.
* @notice the constructor is used to set the parameters for the create Talos Strategy Vanilla action.
*/
function CreateTalosStrategyVanillaAction(params) {
this.params = params;
}
/**
* Encodes the contract interaction calldata to create a Talos Strategy Vanilla.
* @param params the parameters for the create Talos Strategy Vanilla action.
* @returns the target contract, encoded calldata and message value to send onchain for the create Talos Strategy Vanilla action.
*/
var _proto = CreateTalosStrategyVanillaAction.prototype;
_proto.encode = function encode(params) {
var _TalosAddresses$ROOT_, _TalosAddresses$ROOT_2;
return {
target: (_TalosAddresses$ROOT_ = (_TalosAddresses$ROOT_2 = maiaCoreSdk.TalosAddresses[maiaCoreSdk.ROOT_CHAIN_ID]) == null ? void 0 : _TalosAddresses$ROOT_2.talosOptimizerFactory) != null ? _TalosAddresses$ROOT_ : maiaCoreSdk.ZERO_ADDRESS,
params: {
calldata: talosSdk.TalosStrategyVanillaFactory.encodeCreateTalosBaseStrategyParams(params),
value: '0'
}
};
};
return CreateTalosStrategyVanillaAction;
}();
/**
* @title ClaimRewardAction class
* @notice Provides a set of function to encode calldata for the claim all rewards action in UniswapV3Staker contract.
* @author MaiaDAO
*/
var ClaimAllRewardsAction = /*#__PURE__*/function () {
/**
* Constructor for the ClaimRewardAction class.
* @param params the parameters for the claim all rewards action in UniswapV3Staker.
* @returns a new instance of ClaimRewardAction.
* @notice the constructor is used to set the parameters for the claim all rewards action in UniswapV3Staker.
*/
function ClaimAllRewardsAction(params, chainId) {
this.params = params;
this.chainId = chainId;
}
/**
* Encodes the contract interaction calldata to increment a gauge in UniswapV3Staker.
* @param params the parameters for the claim all rewards action in UniswapV3Staker.
* @returns the target contract, encoded calldata and message value to send onchain for the claim all rewards action.
*/
var _proto = ClaimAllRewardsAction.prototype;
_proto.encode = function encode(params) {
var _HermesAddresses$Unis, _HermesAddresses, _this$chainId;
return {
target: (_HermesAddresses$Unis = (_HermesAddresses = maiaCoreSdk.HermesAddresses[(_this$chainId = this.chainId) != null ? _this$chainId : maiaCoreSdk.ROOT_CHAIN_ID]) == null ? void 0 : _HermesAddresses.UniswapV3Staker) != null ? _HermesAddresses$Unis : maiaCoreSdk.ZERO_ADDRESS,
params: {
calldata: hermesV2Sdk.UniswapV3Staker.encodeClaimAllRewardsCalldata(params),
value: '0'
}
};
};
return ClaimAllRewardsAction;
}();
/**
* @title ClaimRewardAction class
* @notice Provides a set of function to encode calldata for the claim reward action in UniswapV3Staker contract.
* @author MaiaDAO
*/
var ClaimRewardAction = /*#__PURE__*/function () {
/**
* Constructor for the ClaimRewardAction class.
* @param params the parameters for the claim reward action in UniswapV3Staker.
* @returns a new instance of ClaimRewardAction.
* @notice the constructor is used to set the parameters for the claim reward action in UniswapV3Staker.
*/
function ClaimRewardAction(params, chainId) {
this.params = params;
this.chainId = chainId;
}
/**
* Encodes the contract interaction calldata to increment a gauge in UniswapV3Staker.
* @param params the parameters for the claim reward action in UniswapV3Staker.
* @returns the target contract, encoded calldata and message value to send onchain for the claim reward action.
*/
var _proto = ClaimRewardAction.prototype;
_proto.encode = function encode(params) {
var _HermesAddresses$Unis, _HermesAddresses, _this$chainId;
return {
target: (_HermesAddresses$Unis = (_HermesAddresses = maiaCoreSdk.HermesAddresses[(_this$chainId = this.chainId) != null ? _this$chainId : maiaCoreSdk.ROOT_CHAIN_ID]) == null ? void 0 : _HermesAddresses.UniswapV3Staker) != null ? _HermesAddresses$Unis : maiaCoreSdk.ZERO_ADDRESS,
params: {
calldata: hermesV2Sdk.UniswapV3Staker.encodeClaimRewardCalldata(params),
value: '0'
}
};
};
return ClaimRewardAction;
}();
/**
* @title CreateIncentiveAction class
* @notice Provides a set of function to encode calldata for the create incentive action in UniswapV3Staker contract.
* @author MaiaDAO
*/
var CreateIncentiveAction = /*#__PURE__*/function () {
/**
* Constructor for the CreateIncentiveAction class.
* @param params the parameters for the create incentive action in UniswapV3Staker.
* @returns a new instance of CreateIncentiveAction.
* @notice the constructor is used to set the parameters for the create incentive action in UniswapV3Staker.
*/
function CreateIncentiveAction(params, chainId) {
this.params = params;
this.chainId = chainId;
}
/**
* Encodes the contract interaction calldata to increment a gauge in UniswapV3Staker.
* @param params the parameters for the create incentive action in UniswapV3Staker.
* @returns the target contract, encoded calldata and message value to send onchain for the create incentive action.
*/
var _proto = CreateIncentiveAction.prototype;
_proto.encode = function encode(params) {
var _HermesAddresses$Unis, _HermesAddresses, _this$chainId;
return {
target: (_HermesAddresses$Unis = (_HermesAddresses = maiaCoreSdk.HermesAddresses[(_this$chainId = this.chainId) != null ? _this$chainId : maiaCoreSdk.ROOT_CHAIN_ID]) == null ? void 0 : _HermesAddresses.UniswapV3Staker) != null ? _HermesAddresses$Unis : maiaCoreSdk.ZERO_ADDRESS,
params: {
calldata: hermesV2Sdk.UniswapV3Staker.encodeCreateIncentiveCalldata(params),
value: '0'
}
};
};
return CreateIncentiveAction;
}();
/**
* @title stakeTokenAction class
* @notice Provides a set of function to encode calldata for the stake token action in UniswapV3Staker contract.
* @author MaiaDAO
*/
var StakeTokenAction = /*#__PURE__*/function () {
/**
* Constructor for the stakeTokenAction class.
* @param params the parameters for the stake token action in UniswapV3Staker.
* @returns a new instance of stakeTokenAction.
* @notice the constructor is used to set the parameters for the stake token action in UniswapV3Staker.
*/
function StakeTokenAction(params, chainId) {
!params.tokenId ? invariant(false, 'Invalid tokenId') : void 0;
this.params = params;
this.chainId = chainId;
}
/**
* Encodes the contract interaction calldata to increment a gauge in UniswapV3Staker.
* @param params the parameters for the stake token action in UniswapV3Staker.
* @returns the target contract, encoded calldata and message value to send onchain for the stake token action.
*/
var _proto = StakeTokenAction.prototype;
_proto.encode = function encode(params) {
var _HermesAddresses$Unis, _HermesAddresses, _this$chainId;
return {
target: (_HermesAddresses$Unis = (_HermesAddresses = maiaCoreSdk.HermesAddresses[(_this$chainId = this.chainId) != null ? _this$chainId : maiaCoreSdk.ROOT_CHAIN_ID]) == null ? void 0 : _HermesAddresses.UniswapV3Staker) != null ? _HermesAddresses$Unis : maiaCoreSdk.ZERO_ADDRESS,
params: {
calldata: hermesV2Sdk.UniswapV3Staker.encodeStakeTokenCalldata(params),
value: '0'
}
};
};
return StakeTokenAction;
}();
/**
* @title UnstakeTokenAction class
* @notice Provides a set of function to encode calldata for the unstake token action in UniswapV3Staker contract.
* @author MaiaDAO
*/
var UnstakeTokenAction = /*#__PURE__*/function () {
/**
* Constructor for the UnstakeTokenAction class.
* @param params the parameters for the unstake token action in UniswapV3Staker.
* @returns a new instance of UnstakeTokenAction.
* @notice the constructor is used to set the parameters for the unstake token action in UniswapV3Staker.
*/
function UnstakeTokenAction(params, chainId) {
!params.tokenId ? invariant(false, 'Invalid tokenId') : void 0;
this.params = params;
this.chainId = chainId;
}
/**
* Encodes the contract interaction calldata to increment a gauge in UniswapV3Staker.
* @param params the parameters for the unstake token action in UniswapV3Staker.
* @returns the target contract, encoded calldata and message value to send onchain for the unstake token action.
*/
var _proto = UnstakeTokenAction.prototype;
_proto.encode = function encode(params) {
var _HermesAddresses$Unis, _HermesAddresses, _this$chainId;
return {
target: (_HermesAddresses$Unis = (_HermesAddresses = maiaCoreSdk.HermesAddresses[(_this$chainId = this.chainId) != null ? _this$chainId : maiaCoreSdk.ROOT_CHAIN_ID]) == null ? void 0 : _HermesAddresses.UniswapV3Staker) != null ? _HermesAddresses$Unis : maiaCoreSdk.ZERO_ADDRESS,
params: {
calldata: hermesV2Sdk.UniswapV3Staker.encodeUnstakeTokenCalldata(params),
value: '0'
}
};
};
return UnstakeTokenAction;
}();
/**
* @title ClaimGovernanceAction class
* @notice Provides a set of functions to encode calldata to Claim an amount of Governance utility tokens back into the VoteMaia contract.
* @author MaiaDAO
*/
var ClaimGovernanceAction = /*#__PURE__*/function () {
/**
* Constructor for the ClaimGovernanceAction class.
* @param params the parameters for the Claim Governance action in the VoteMaia contract.
* @returns a new instance of ClaimGovernanceAction.
* @notice the constructor is used to set the parameters for the Claim Governance action.
*/
function ClaimGovernanceAction(params, chainId) {
this.params = params;
this.chainId = chainId;
}
/**
* Encodes the contract interaction calldata to Claim Governance utility tokens into the VoteMaia contract.
* @param params the parameters for the Claim Governance action.
* @returns the target contract, encoded calldata and message value to send onchain for the Claim Governance action.
*/
var _proto = ClaimGovernanceAction.prototype;
_proto.encode = function encode(params) {
var _MaiaAddresses$vMaia, _MaiaAddresses, _this$chainId;
return {
target: (_MaiaAddresses$vMaia = (_MaiaAddresses = maiaCoreSdk.MaiaAddresses[(_this$chainId = this.chainId) != null ? _this$chainId : maiaCoreSdk.ROOT_CHAIN_ID]) == null ? void 0 : _MaiaAddresses.vMaia) != null ? _MaiaAddresses$vMaia : maiaCoreSdk.ZERO_ADDRESS,
params: {
calldata: maiaV2Sdk.VMaia.encodeClaimGovernanceCalldata(params),
value: '0'
}
};
};
return ClaimGovernanceAction;
}();
/**
* @title ClaimMultipleAction class
* @notice Provides a set of functions to encode calldata to Claim an amount of utility tokens back into the VoteMaia contract.
* @author MaiaDAO
*/
var ClaimMultipleAction = /*#__PURE__*/function () {
/**
* Constructor for the ClaimMultipleAction class.
* @param params the parameters for the Claim multiple action in the VoteMaia contract.
* @returns a new instance of ClaimMultipleAction.
* @notice the constructor is used to set the parameters for the Claim multiple action.
*/
function ClaimMultipleAction(params, chainId) {
this.params = params;
this.chainId = chainId;
}
/**
* Encodes the contract interaction calldata to Claim an amount of multiple of utility tokens into the VoteMaia contract.
* @param params the parameters for the Claim multiple action.
* @returns the target contract, encoded calldata and message value to send onchain for the Claim multiple action.
*/
var _proto = ClaimMultipleAction.prototype;
_proto.encode = function encode(params) {
var _MaiaAddresses$vMaia, _MaiaAddresses, _this$chainId;
return {
target: (_MaiaAddresses$vMaia = (_MaiaAddresses = maiaCoreSdk.MaiaAddresses[(_this$chainId = this.chainId) != null ? _this$chainId : maiaCoreSdk.ROOT_CHAIN_ID]) == null ? void 0 : _MaiaAddresses.vMaia) != null ? _MaiaAddresses$vMaia : maiaCoreSdk.ZERO_ADDRESS,
params: {
calldata: maiaV2Sdk.VMaia.encodeClaimMultipleCalldata(params),
value: '0'
}
};
};
return ClaimMultipleAction;
}();
/**
* @title ClaimMultipleAmountsAction class
* @notice Provides a set of functions to encode calldata to Claim specific amounts of utility tokens back into the VoteMaia contract.
* @author MaiaDAO
*/
var ClaimMultipleAmountsAction = /*#__PURE__*/function () {
/**
* Constructor for the ClaimMultipleAmountsAction class.
* @param params the parameters for the Claim multiple amounts action in the VoteMaia contract.
* @returns a new instance of ClaimMultipleAmountsAction.
* @notice the constructor is used to set the parameters for the Claim multiple amounts action.
*/
function ClaimMultipleAmountsAction(params, chainId) {
this.params = params;
this.chainId = chainId;
}
/**
* Encodes the contract interaction calldata to Claim multiple amouts of utiliuty tokens into the VoteMaia contract.
* @param params the parameters for the Claim multiple amounts action.
* @returns the target contract, encoded calldata and message value to send onchain for the Claim multiple amounts action.
*/
var _proto = ClaimMultipleAmountsAction.prototype;
_proto.encode = function encode(params) {
var _MaiaAddresses$vMaia, _MaiaAddresses, _this$chainId;
return {
target: (_MaiaAddresses$vMaia = (_MaiaAddresses = maiaCoreSdk.MaiaAddresses[(_this$chainId = this.chainId) != null ? _this$chainId : maiaCoreSdk.ROOT_CHAIN_ID]) == null ? void 0 : _MaiaAddresses.vMaia) != null ? _MaiaAddresses$vMaia : maiaCoreSdk.ZERO_ADDRESS,
params: {
calldata: maiaV2Sdk.VMaia.encodeClaimMultipleAmountsCalldata(params),
value: '0'
}
};
};
return ClaimMultipleAmountsAction;
}();
/**
* @title ClaimPartnerGovernanceAction class
* @notice Provides a set of functions to encode calldata to Claim an amount of Maia Governance utility tokens back into the VoteMaia contract.
* @author MaiaDAO
*/
var ClaimPartnerGovernanceAction = /*#__PURE__*/function () {
/**
* Constructor for the ClaimPartnerGovernanceAction class.
* @param params the parameters for the Claim Maia Governance action in the VoteMaia contract.
* @returns a new instance of ClaimPartnerGovernanceAction.
* @notice the constructor is used to set the parameters for the Claim PartnerGovernance action.
*/
function ClaimPartnerGovernanceAction(params, chainId) {
this.params = params;
this.chainId = chainId;
}
/**
* Encodes the contract interaction calldata to Claim Maia Governance utility tokens into the VoteMaia contract.
* @param params the parameters for the Claim Maia action.
* @returns the target contract, encoded calldata and message value to send onchain for the Claim Maia Governance action.
*/
var _proto = ClaimPartnerGovernanceAction.prototype;
_proto.encode = function encode(params) {
var _MaiaAddresses$vMaia, _MaiaAddresses, _this$chainId;
return {
target: (_MaiaAddresses$vMaia = (_MaiaAddresses = maiaCoreSdk.MaiaAddresses[(_this$chainId = this.chainId) != null ? _this$chainId : maiaCoreSdk.ROOT_CHAIN_ID]) == null ? void 0 : _MaiaAddresses.vMaia) != null ? _MaiaAddresses$vMaia : maiaCoreSdk.ZERO_ADDRESS,
params: {
calldata: maiaV2Sdk.VMaia.encodeClaimPartnerGovernanceCalldata(params),
value: '0'
}
};
};
return ClaimPartnerGovernanceAction;
}();
/**
* @title ClaimWeightAction class
* @notice Provides a set of functions to encode calldata to Claim an amount of weight utility tokens back into the VoteMaia contract.
* @author MaiaDAO
*/
var ClaimWeightAction = /*#__PURE__*/function () {
/**
* Constructor for the ClaimWeightAction class.
* @param params the parameters for the Claim weight action in the VoteMaia contract.
* @returns a new instance of ClaimWeightAction.
* @notice the constructor is used to set the parameters for the Claim weight action.
*/
function ClaimWeightAction(params, chainId) {
this.params = params;
this.chainId = chainId;
}
/**
* Encodes the contract interaction calldata to Claim weight utility tokens into the VoteMaia contract.
* @param params the parameters for the Claim weight action.
* @returns the target contract, encoded calldata and message value to send onchain for the Claim weight action.
*/
var _proto = ClaimWeightAction.prototype;
_proto.encode = function encode(params) {
var _MaiaAddresses$vMaia, _MaiaAddresses, _this$chainId;
return {
target: (_MaiaAddresses$vMaia = (_MaiaAddresses = maiaCoreSdk.MaiaAddresses[(_this$chainId = this.chainId) != null ? _this$chainId : maiaCoreSdk.ROOT_CHAIN_ID]) == null ? void 0 : _MaiaAddresses.vMaia) != null ? _MaiaAddresses$vMaia : maiaCoreSdk.ZERO_ADDRESS,
params: {
calldata: maiaV2Sdk.VMaia.encodeClaimWeightCalldata(params),
value: '0'
}
};
};
return ClaimWeightAction;
}();
/**
* @title DepositAction class
* @notice Provides a set of functions to encode calldata to deposit $Maia for $vMaia using VoteMaia contract.
* @author MaiaDAO
*/
var DepositAction = /*#__PURE__*/function () {
/**
* Constructor for the DepositAction class.
* @param params the parameters for the deposit action in the VoteMaia contract.
* @returns a new instance of DepositAction.
* @notice the constructor is used to set the parameters for the deposit Maia action.
*/
function DepositAction(params, chainId) {
this.params = params;
this.chainId = chainId;
}
/**
* Encodes the contract interaction calldata to deposit $Maia in exchange for $vMaia.
* @param params the parameters for the deposit Maia action.
* @returns the target contract, encoded calldata and message value to send onchain for the deposit Maia action.
*/
var _proto = DepositAction.prototype;
_proto.encode = function encode(params) {
var _MaiaAddresses$vMaia, _MaiaAddresses, _this$chainId;
return {
target: (_MaiaAddresses$vMaia = (_MaiaAddresses = maiaCoreSdk.MaiaAddresses[(_this$chainId = this.chainId) != null ? _this$chainId : maiaCoreSdk.ROOT_CHAIN_ID]) == null ? void 0 : _MaiaAddresses.vMaia) != null ? _MaiaAddresses$vMaia : maiaCoreSdk.ZERO_ADDRESS,
params: {
calldata: maiaV2Sdk.VMaia.encodeDepositCalldata(params),
value: '0'
}
};
};
return DepositAction;
}();
/**
* @title ForfeitGovernanceAction class
* @notice Provides a set of functions to encode calldata to forfeit an amount of Governance utility tokens back into the VoteMaia contract.
* @author MaiaDAO
*/
var ForfeitGovernanceAction = /*#__PURE__*/function () {
/**
* Constructor for the ForfeitGovernanceAction class.
* @param params the parameters for the forfeit Governance action in the VoteMaia contract.
* @returns a new instance of ForfeitGovernanceAction.
* @notice the constructor is used to set the parameters for the forfeit Governance action.
*/
function ForfeitGovernanceAction(params, chainId) {
this.params = params;
this.chainId = chainId;
}
/**
* Encodes the contract interaction calldata to forfeit Governance utility tokens into the VoteMaia contract.
* @param params the parameters for the forfeit Governance action.
* @returns the target contract, encoded calldata and message value to send onchain for the forfeit Governance action.
*/
var _proto = ForfeitGovernanceAction.prototype;
_proto.encode = function encode(params) {
var _MaiaAddresses$vMaia, _MaiaAddresses, _this$chainId;
return {
target: (_MaiaAddresses$vMaia = (_MaiaAddresses = maiaCoreSdk.MaiaAddresses[(_this$chainId = this.chainId) != null ? _this$chainId : maiaCoreSdk.ROOT_CHAIN_ID]) == null ? void 0 : _MaiaAddresses.vMaia) != null ? _MaiaAddresses$vMaia : maiaCoreSdk.ZERO_ADDRESS,
params: {
calldata: maiaV2Sdk.VMaia.encodeForfeitGovernanceCalldata(params),
value: '0'
}
};
};
return ForfeitGovernanceAction;
}();
/**
* @title ForfeitMultipleAction class
* @notice Provides a set of functions to encode calldata to forfeit an amount of utility tokens back into the VoteMaia contract.
* @author MaiaDAO
*/
var ForfeitMultipleAction = /*#__PURE__*/function () {
/**
* Constructor for the ForfeitMultipleAction class.
* @param params the parameters for the forfeit multiple action in the VoteMaia contract.
* @returns a new instance of ForfeitMultipleAction.
* @notice the constructor is used to set the parameters for the forfeit multiple action.
*/
function ForfeitMultipleAction(params, chainId) {
this.params = params;
this.chainId = chainId;
}
/**
* Encodes the contract interaction calldata to forfeit an amount of multiple of utility tokens into the VoteMaia contract.
* @param params the parameters for the forfeit multiple action.
* @returns the target contract, encoded calldata and message value to send onchain for the forfeit multiple action.
*/
var _proto = ForfeitMultipleAction.prototype;
_proto.encode = function encode(params) {
var _MaiaAddresses$vMaia, _MaiaAddresses, _this$chainId;
return {
target: (_MaiaAddresses$vMaia = (_MaiaAddresses = maiaCoreSdk.MaiaAddresses[(_this$chainId = this.chainId) != null ? _this$chainId : maiaCoreSdk.ROOT_CHAIN_ID]) == null ? void 0 : _MaiaAddresses.vMaia) != null ? _MaiaAddresses$vMaia : maiaCoreSdk.ZERO_ADDRESS,
params: {
calldata: maiaV2Sdk.VMaia.encodeForfeitMultipleCalldata(params),
value: '0'
}
};
};
return ForfeitMultipleAction;
}();
/**
* @title ForfeitMultipleAmountsAction class
* @notice Provides a set of functions to encode calldata to forfeit specific amounts of utility tokens back into the VoteMaia contract.
* @author MaiaDAO
*/
var ForfeitMultipleAmountsAction = /*#__PURE__*/function () {
/**
* Constructor for the ForfeitMultipleAmountsAction class.
* @param params the parameters for the forfeit multiple amounts action in the VoteMaia contract.
* @returns a new instance of ForfeitMultipleAmountsAction.
* @notice the constructor is used to set the parameters for the forfeit multiple amounts action.
*/
function ForfeitMultipleAmountsAction(params, chainId) {
this.params = params;
this.chainId = chainId;
}
/**
* Encodes the contract interaction calldata to forfeit multiple amouts of utiliuty tokens into the VoteMaia contract.
* @param params the parameters for the forfeit multiple amounts action.
* @returns the target contract, encoded calldata and message value to send onchain for the forfeit multiple amounts action.
*/
var _proto = ForfeitMultipleAmountsAction.prototype;
_proto.encode = function encode(params) {
var _MaiaAddresses$vMaia, _MaiaAddresses, _this$chainId;
return {
target: (_MaiaAddresses$vMaia = (_MaiaAddresses = maiaCoreSdk.MaiaAddresses[(_this$chainId = this.chainId) != null ? _this$chainId : maiaCoreSdk.ROOT_CHAIN_ID]) == null ? void 0 : _MaiaAddresses.vMaia) != null ? _MaiaAddresses$vMaia : maiaCoreSdk.ZERO_ADDRESS,
params: {
calldata: maiaV2Sdk.VMaia.encodeForfeitMultipleAmountsCalldata(params),
value: '0'
}
};
};
return ForfeitMultipleAmountsAction;
}();
/**
* @title ForfeitPartnerGovernanceAction class
* @notice Provides a set of functions to encode calldata to forfeit an amount of Maia Governance utility tokens back into the VoteMaia contract.
* @author MaiaDAO
*/
var ForfeitPartnerGovernanceAction = /*#__PURE__*/function () {
/**
* Constructor for the ForfeitPartnerGovernanceAction class.
* @param params the parameters for the forfeit Maia Governance action in the VoteMaia contract.
* @returns a new instance of ForfeitPartnerGovernanceAction.
* @notice the constructor is used to set the parameters for the forfeit PartnerGovernance action.
*/
function ForfeitPartnerGovernanceAction(params, chainId) {
this.params = params;
this.chainId = chainId;
}
/**
* Encodes the contract interaction calldata to forfeit Maia Governance utility tokens into the VoteMaia contract.
* @param params the parameters for the forfeit Maia action.
* @returns the target contract, encoded calldata and message value to send onchain for the forfeit Maia Governance action.
*/
var _proto = ForfeitPartnerGovernanceAction.prototype;
_proto.encode = function encode(params) {
var _MaiaAddresses$vMaia, _MaiaAddresses, _this$chainId;
return {
target: (_MaiaAddresses$vMaia = (_MaiaAddresses = maiaCoreSdk.MaiaAddresses[(_this$chainId = this.chainId) != null ? _this$chainId : maiaCoreSdk.ROOT_CHAIN_ID]) == null ? void 0 : _MaiaAddresses.vMaia) != null ? _MaiaAddresses$vMaia : maiaCoreSdk.ZERO_ADDRESS,
params: {
calldata: maiaV2Sdk.VMaia.encodeForfeitPartnerGovernanceCalldata(params),
value: '0'
}
};
};
return ForfeitPartnerGovernanceAction;
}();
/**
* @title ForfeitWeightAction class
* @notice Provides a set of functions to encode calldata to forfeit an amount of weight utility tokens back into the VoteMaia contract.
* @author MaiaDAO
*/
var ForfeitWeightAction = /*#__PURE__*/function () {
/**
* Constructor for the ForfeitWeightAction class.
* @param params the parameters for the forfeit weight action in the VoteMaia contract.
* @returns a new instance of ForfeitWeightAction.
* @notice the constructor is used to set the parameters for the forfeit weight action.
*/
function ForfeitWeightAction(params, chainId) {
this.params = params;
this.chainId = chainId;
}
/**
* Encodes the contract interaction calldata to forfeit weight utility tokens into the VoteMaia contract.
* @param params the parameters for the forfeit weight action.
* @returns the target contract, encoded calldata and message value to send onchain for the forfeit weight action.
*/
var _proto = ForfeitWeightAction.prototype;
_proto.encode = function encode(params) {
var _MaiaAddresses$vMaia, _MaiaAddresses, _this$chainId;
return {
target: (_MaiaAddresses$vMaia = (_MaiaAddresses = maiaCoreSdk.MaiaAddresses[(_this$chainId = this.chainId) != null ? _this$chainId : maiaCoreSdk.ROOT_CHAIN_ID]) == null ? void 0 : _MaiaAddresses.vMaia) != null ? _MaiaAddresses$vMaia : maiaCoreSdk.ZERO_ADDRESS,
params: {
calldata: maiaV2Sdk.VMaia.encodeForfeitWeightCalldata(params),
value: '0'
}
};
};
return ForfeitWeightAction;
}();
/**
* @title MintAction class
* @notice Provides a set of functions to encode calldata to mint $vMaia for $Maia using VoteMaia contract.
* @author MaiaDAO
*/
var MintAction = /*#__PURE__*/function () {
/**
* Constructor for the MintAction class.
* @param params the parameters for the mint action in the VoteMaia contract.
* @returns a new instance of MintAction.
* @notice the constructor is used to set the parameters for the mint Maia action.
*/
function MintAction(params, chainId) {
this.params = params;
this.chainId = chainId;
}
/**
* Encodes the contract interaction calldata to mint $Maia in exchange for $vMaia.
* @param params the parameters for the mint Maia action.
* @returns the target contract, encoded calldata and message value to send onchain for the mint Maia action.
*/
var _proto = MintAction.prototype;
_proto.encode = function encode(params) {
var _MaiaAddresses$vMaia, _MaiaAddresses, _this$chainId;
return {
target: (_MaiaAddresses$vMaia = (_MaiaAddresses = maiaCoreSdk.MaiaAddresses[(_this$chainId = this.chainId) != null ? _this$chainId : maiaCoreSdk.ROOT_CHAIN_ID]) == null ? void 0 : _MaiaAddresses.vMaia) != null ? _MaiaAddresses$vMaia : maiaCoreSdk.ZERO_ADDRESS,
params: {
calldata: maiaV2Sdk.VMaia.encodeMintCalldata(params),
value: '0'
}
};
};
return MintAction;
}();
/**
* @title RedeemAction class
* @notice Provides a set of functions to encode calldata to redeem $Maia for $vMaia using VoteMaia contract.
* @author MaiaDAO
*/
var RedeemAction = /*#__PURE__*/function () {
/**
* Constructor for the RedeemAction class.
* @param params the parameters for the redeem action in the VoteMaia contract.
* @returns a new instance of RedeemAction.
* @notice the constructor is used to set the parameters for the redeem $vMaia action.
*/
function RedeemAction(params, chainId) {
this.params = params;
this.chainId = chainId;
}
/**
* Encodes the contract interaction calldata to redeem $vMaia in exchange $Maia.
* @param params the parameters for the redeem vMaia action.
* @returns the target contract, encoded calldata and message value to send onchain for the redeem vMaia action.
*/
var _proto = RedeemAction.prototype;
_proto.encode = function encode(params) {
var _MaiaAddresses$vMaia, _MaiaAddresses, _this$chainId;
return {
target: (_MaiaAddresses$vMaia = (_MaiaAddresses = maiaCoreSdk.MaiaAddresses[(_this$chainId = this.chainId) != null ? _this$chainId : maiaCoreSdk.ROOT_CHAIN_ID]) == null ? void 0 : _MaiaAddresses.vMaia) != null ? _MaiaAddresses$vMaia : maiaCoreSdk.ZERO_ADDRESS,
params: {
calldata: maiaV2Sdk.VMaia.encodeMintCalldata(params),
value: '0'
}
};
};
return RedeemAction;
}();
/**
* @title WithdrawAction class
* @notice Provides a set of functions to encode calldata to withdraw $Maia for $vMaia using VoteMaia contract.
* @author MaiaDAO
*/
var WithdrawAction = /*#__PURE__*/function () {
/**
* Constructor for the WithdrawAction class.
* @param params the parameters for the withdraw action in the VoteMaia contract.
* @returns a new instance of WithdrawAction.
* @notice the constructor is used to set the parameters for the withdraw Maia action.
*/
function WithdrawAction(params, chainId) {
this.params = params;
this.chainId = chainId;
}
/**
* Encodes the contract interaction calldata to withdraw $Maia in exchange for $vMaia.
* @param params the parameters for the withdraw Maia action.
* @returns the target contract, encoded calldata and message value to send onchain for the withdraw Maia action.
*/
var _proto = WithdrawAction.prototype;
_proto.encode = function encode(params) {
var _MaiaAddresses$vMaia, _MaiaAddresses, _this$chainId;
return {
target: (_MaiaAddresses$vMaia = (_MaiaAddresses = maiaCoreSdk.MaiaAddresses[(_this$chainId = this.chainId) != null ? _this$chainId : maiaCoreSdk.ROOT_CHAIN_ID]) == null ? void 0 : _MaiaAddresses.vMaia) != null ? _MaiaAddresses$vMaia : maiaCoreSdk.ZERO_ADDRESS,
params: {
calldata: maiaV2Sdk.VMaia.encodeWithdrawCalldata(params),
value: '0'
}
};
};
return WithdrawAction;
}();
/**
* Holds the functions that create the parameters for the actions that can be made by a user in Hermes
*/
var UlyssesActions = /*#__PURE__*/function () {
function UlyssesActions() {}
/**
* Creates the necessary transaction parameters for a simple contract interaction.
* @param action the action to be executed
* @param context the context parameters for the action
* @returns the target contract, encoded calldata and message value to send onchain for the action.
*/
UlyssesActions.buildSimpleAction = function buildSimpleAction(action, context) {
// Create the transaction builder
var transactionBuilder = new ActionBuilder(new ContextHandler(context));
// Add the action to the transaction
transactionBuilder.addAction(action);
// Build the transaction
var _transactionBuilder$b = transactionBuilder.build(),
encodedResults = _transactionBuilder$b.encodedResults;
// Return the results
return encodedResults != null ? encodedResults : {
target: maiaCoreSdk.ZERO_ADDRESS,
params: {
calldata: '',
value: '0'
}
};
}
/**
* Creates the necessary transaction parameters for a complex contract interaction.
* @param actions set of actions to be executed
* @param context the context parameters for the actions
* @returns the target contract, encoded calldata and message value to send onchain for the actions.
*/;
UlyssesActions.buildComplexAction = function buildComplexAction(actions, context) {
// Create the transaction builder
var transactionBuilder = new ActionBuilder(new ContextHandler(context));
// Add the actions to the transaction
actions.forEach(function (act) {
return transactionBuilder.addAction(act);
});
// Build the transaction
var _transactionBuilder$b2 = transactionBuilder.build(),
encodedResults = _transactionBuilder$b2.encodedResults;
// Return the results
return encodedResults != null ? encodedResults : {
target: maiaCoreSdk.ZERO_ADDRESS,
params: {
calldata: '',
value: '0'
}
};
}
// Make me an helper function for this logic const actions = []
// if (preActions) actions.push(...preActions)
// actions.push(new BurnHermesAction(params))
// if (postActions) actions.push(...postActions)
;
UlyssesActions.buildComplexActionWithPreAndPostActions = function buildComplexActionWithPreAndPostActions(actions, context, preActions, postActions) {
// Append actions into array if the are pre or post actions
var allActions = [];
if (preActions) allActions.push.apply(allActions, preActions);
allActions.push.apply(allActions, actions);
if (postActions) allActions.push.apply(allActions, postActions);
// Build complex action
return this.buildComplexAction(allActions, context);
}
/**
* Creates the necessary execution params for the burning of hermes tokens for bHermes.
* @param params the parameters for the burn action in bHermes.
* @param context the context parameters for the burn action.
* @param preActions the pre actions to be executed right before the burn action.
* @param postActions the post actions to be executed right after the burn action.
* @returns the target contract, encoded calldata and message value to send to Branch Router for the burn action.
*/;
UlyssesActions.burnHermesParameters = function burnHermesParameters(params, context, preActions, postActions) {
return this.buildComplexActionWithPreAndPostActions([new BurnHermesAction(params)], context, preActions, postActions);
}
/**
* Creates the necessary execution params for the increment of a gauge in bHermesGauges.
* @param params the parameters for the increment gauge action in bHermesGauges.
* @param context the context parameters for the increment gauge action.
* @param preActions the pre actions to be executed right before the increment gauge action.
* @param postActions the post actions to be executed right after the increment gauge action.
* @returns the target contract, encoded calldata and message value to send onchain for the increment gauge action.
*/;
UlyssesActions.incrementGaugeParameters = function incrementGaugeParameters(params, context, preActions, postActions) {
return this.buildComplexActionWithPreAndPostActions([new IncrementGaugeAction(params)], context, preActions, postActions);
}
/**
* Creates the necessary execution params for the increment multiple gauges in bHermesGauges.
* @param params the parameters for the increment gauges action in bHermesGauges.
* @param context the context parameters for the increment gauges action.
* @param preActions the pre actions to be executed right before the increment gauges action.
* @param postActions the post actions to be executed right after the increment gauges action.
* @returns the target contract, encoded calldata and message value to send onchain for the increment gauges action.
*/;
UlyssesActions.incrementGaugesParameters = function incrementGaugesParameters(params, context, preActions, postActions) {
return this.buildComplexActionWithPreAndPostActions([new IncrementGaugesAction(params)], context, preActions, postActions);
}
/**
* Creates the necessary execution params for the decrement of a gauge in bHermesGauges.
* @param params the parameters for the decrement gauge action in bHermesGauges.
* @param context the context parameters for the decrement gauge action.
* @param preActions the pre actions to be executed right before the decrement gauge action.
* @param postActions the post actions to be executed right after the decrement gauge action.
* @returns the target contract, encoded calldata and message value to send onchain for the decrement gauge action.
*/;
UlyssesActions.decrementGaugeParameters = function decrementGaugeParameters(params, context, preActions, postActions) {
return this.buildComplexActionWithPreAndPostActions([new DecrementGaugeAction(params)], context, preActions, postActions);
}
/**
* Creates the necessary execution params for the decrement of multiple gauges in bHermesGauges.
* @param params the parameters for the decrement gauges action in bHermesGauges.
* @param context the context parameters for the decrement gauges action.
* @param preActions the pre actions to be executed right before the decrement gauges action.
* @param postActions the post actions to be executed right after the decrement gauges action.
* @returns the target contract, encoded calldata and message value to send onchain for the decrement gauges action.
*/;
UlyssesActions.decrementGaugesParameters = function decrementGaugesParameters(params, context, preActions, postActions) {
return this.buildComplexActionWithPreAndPostActions([new DecrementGaugesAction(params)], context, preActions, postActions);
}
/**
* Creates the necessary execution params for the delegation of a gauge in bHermesGauges.
* @param params the parameters for the delegate action in bHermesGauges.
* @param context the context parameters for the delegate action.
* @param preActions the pre actions to be executed right before the delegate action.
* @param postActions the post actions to be executed right after the delegate action.
* @returns the target contract, encoded calldata and message value to send onchain for the delegate action.
*/;
UlyssesActions.delegateGaugeParameters = function delegateGaugeParameters(params, context, preActions, postActions) {
return this.buildComplexActionWithPreAndPostActions([new DelegateGaugeAction(params)], context, preActions, postActions);
}
/**
* Creates the necessary execution params for the undelegation of a gauge in bHermesGauges.
* @param params the parameters for the undelegate action in bHermesGauges.
* @param context the context parameters for the undelegate action.
* @param preActions the pre actions to be executed right before the undelegate action.
* @param postActions the post actions to be executed right after the undelegate action.
* @returns the target contract, encoded calldata and message value to send onchain for the undelegate action.
*/;
UlyssesActions.undelegateGaugeParameters = function undelegateGaugeParameters(params, context, preActions, postActions) {
return this.buildComplexActionWithPreAndPostActions([new UndelegateGaugeAction(params)], context, preActions, postActions);
}
/**
* Creates the necessary execution params for the decrement gauge boost action in bHermesBoost.
* @param params the parameters for the decrement gauge boost action in bHermesBoost.
* @param context the context parameters for the decrement gauge boost action.
* @param preActions the pre actions to be executed right before the decrement gauge boost action.
* @param postActions the post actions to be executed right after the decrement gauge boost action.
* @returns the target contract, encoded calldata and message value to send onchain for the decrement gauge boost action.
*/;
UlyssesActions.decrementGaugeBoostParameters = function decrementGaugeBoostParameters(params, context, preActions, postActions) {
return this.buildComplexActionWithPreAndPostActions([new DecrementGaugeBoostAction(params)], context, preActions, postActions);
}
/**
* Creates the necessary execution params for the decrement gauges all boost action in bHermesBoost.
* @param params the parameters for the decrement gauges all boost action in bHermesBoost.
* @param context the context parameters for the decrement gauges all boost action.
* @param preActions the pre actions to be executed right before the decrement gauges all boost action.
* @param postActions the post actions to be executed right after the decrement gauges all boost action.
* @returns the target contract, encoded calldata and message value to send onchain for the decrement gauges all boost action.
*/;
UlyssesActions.decrementGaugeAllBoostParameters = function decrementGaugeAllBoostParameters(params, context, preActions, postActions) {
return this.buildComplexActionWithPreAndPostActions([new DecrementGaugeAllBoostAction(params)], context, preActions, postActions);
}
/**
* Creates the necessary execution params for the decrement certain boost from all gauges in bHermesBoost.
* @param params the parameters for the decrement all gauges boost action in bHermesBoost.
* @param context the context parameters for the decrement boost all gauges action.
* @param preActions the pre actions to be executed right before the decrement all gauges boost action.
* @param postActions the post actions to be executed right after the decrement all gauges boost action.
* @returns the target contract, encoded calldata and message value to send onchain for the decrement boost all gauges action.
*/;
UlyssesActions.decrementAllGaugesBoostParameters = function decrementAllGaugesBoostParameters(params, context, preActions, postActions) {
return this.buildComplexActionWithPreAndPostActions([new DecrementAllGaugesBoostAction(params)], context, preActions, postActions);
}
/**
* Creates the necessary execution params for the decrement gauges boost indexed action in bHermesBoost.
* @param params the parameters for the decrement gauges boost indexed action in bHermesBoost.
* @param context the context parameters for the decrement gauges boost indexed action.
* @param preActions the pre actions to be executed right before the decrement gauges boost indexed action.
* @param postActions the post actions to be executed right after the decrement gauges boost indexed action.
* @returns the target contract, encoded calldata and message value to send onchain for the decrement gauges boost indexed action.
*/;
UlyssesActions.decrementGaugesBoostIndexedParameters = function decrementGaugesBoostIndexedParameters(params, context, preActions, postActions) {
return this.buildComplexActionWithPreAndPostActions([new DecrementGaugesBoostIndexedAction(params)], context, preActions, postActions);
}
/**
* Creates the necessary execution params for the decrement all gauges all boost action in bHermesBoost.
* @param params the parameters for the decrement all gauges all boost action in bHermesBoost.
* @param context the context parameters for the decrement all gauges all boost action.
* @param preActions the pre actions to be executed right before the decrement all gauges all boost action.
* @param postActions the post actions to be executed right after the decrement all gauges all boost action.
* @returns the target contract, encoded calldata and message value to send onchain for the decrement all gauges all boost action.
*/;
UlyssesActions.decrementAllGaugesAllBoostParameters = function decrementAllGaugesAllBoostParameters(params, context, preActions, postActions) {
return this.buildComplexActionWithPreAndPostActions([new DecrementAllGaugesAllBoostAction(params)], context, preActions, postActions);
}
/**
* Creates the necessary execution params for the delegation of governance power in bHermesVotes.
* @param params the parameters for the delegate action in bHermesVotes.
* @param context the context parameters for the delegate action.
* @param preActions the pre actions to be executed right before the delegate action.
* @param postActions the post actions to be executed right after the delegate action.
* @returns the target contract, encoded calldata and message value to send onchain for the delegate action.
*/;
UlyssesActions.delegateVotesParameters = function delegateVotesParameters(params, context, preActions, postActions) {
return this.buildComplexActionWithPreAndPostActions([new DelegateVotesAction(params)], context, preActions, postActions);
}
/**
* Creates the necessary execution params for the undelegation of governance power in bHermesVotes.
* @param params the parameters for the undelegate action in bHermesVotes.
* @param context the context parameters for the undelegate action.
* @param preActions the pre actions to be executed right before the undelegate action.
* @param postActions the post actions to be executed right after the undelegate action.
* @returns the target contract, encoded calldata and message value to send onchain for the undelegate action.
*/;
UlyssesActions.undelegateVotesParameters = function undelegateVotesParameters(params, context, preActions, postActions) {
return this.buildComplexActionWithPreAndPostActions([new UndelegateVotesAction(params)], context, preActions, postActions);
}
/**
* Creates the necessary execution params to claim rewards from a flywheel contract.
* @param flywheel the address of the flywheel contract.
* @param recipient the recipient for the claim rewards.
* @param context the context parameters for the claim rewards action.
* @param preActions the pre actions to be executed right before the claim rewards action.
* @param postActions the post actions to be executed right after the claim rewards action.
* @returns the target contract, encoded calldata and message value to send onchain for the claim rewards action.
*/;
UlyssesActions.claimRewardsParameters = function claimRewardsParameters(flywheel, recipient, context, preActions, postActions) {
return this.buildComplexActionWithPreAndPostActions([new ClaimRewardsAction(flywheel, recipient)], context, preActions, postActions);
}
/**
* Creates the necessary execution params for the deposit into a Talos Strategy contract.
* @param strategy the address of the strategy to deposit into.
* @param params the parameters for the strategy deposit action in Talos Strategy.
* @param context the context parameters for the strategy deposit action.
* @param preActions the pre actions to be executed right before the strategy deposit action.
* @param postActions the post actions to be executed right after the strategy deposit action.
* @returns the target contract, encoded calldata and message value to send onchain for the strategy deposit action.
*/;
UlyssesActions.strategyDepositParameters = function strategyDepositParameters(strategy, params, context, preActions, postActions) {
return this.buildComplexActionWithPreAndPostActions([new StrategyDepositAction(strategy, params)], context, preActions, postActions);
}
/**
* Creates the necessary execution params for the redeem from a Talos Strategy contract.
* @param strategy the address of the strategy to redeem from.
* @param params the parameters for the strategy redeem action in Talos Strategy.
* @param context the context parameters for the strategy redeem action.
* @param preActions the pre actions to be executed right before the strategy redeem action.
* @param postActions the post actions to be executed right after the strategy redeem action.
* @returns the target contract, encoded calldata and message value to send onchain for the strategy redeem action.
*/;
UlyssesActions.strategyRedeemParameters = function strategyRedeemParameters(strategy, params, context, preActions, postActions) {
return this.buildComplexActionWithPreAndPostActions([new StrategyRedeemAction(strategy, params)], context, preActions, postActions);
}
/**
* Creates the necessary execution params for the creation of a Talos Manager.
* @param params the parameters for the create Talos Manager action in Talos Manager Factory.
* @param context the context parameters for the create Talos Manager action.
* @param preActions the pre actions to be executed right before the create Talos Manager action.
* @param postActions the post actions to be executed right after the create Talos Manager action.
* @returns the target contract, encoded calldata and message value to send onchain for the create Talos Manager action.
*/;
UlyssesActions.createTalosManagerParameters = function createTalosManagerParameters(params, context, preActions, postActions) {
return this.buildComplexActionWithPreAndPostActions([new CreateTalosManagerAction(params)], context, preActions, postActions);
}
/**
* Creates the necessary execution params for the creation of a Talos Optimizer.
* @param params the parameters for the create Talos Optimizer action in Talos Optimizer Factory.
* @param context the context parameters for the create Talos Optimizer action.
* @param preActions the pre actions to be executed right before the create Talos Optimizer action.
* @param postActions the post actions to be executed right after the create Talos Optimizer action.
* @returns the target contract, encoded calldata and message value to send onchain for the create Talos Optimizer action.
*/;
UlyssesActions.createTalosOptimizerParameters = function createTalosOptimizerParameters(params, context, preActions, postActions) {
return this.buildComplexActionWithPreAndPostActions([new CreateTalosOptimizerAction(params)], context, preActions, postActions);
}
/**
* Creates the necessary execution params for the creation of a Talos Strategy Staked.
* @param params the parameters for the create Talos Strategy Staked action in Talos Strategy Staked Factory.
* @param context the context parameters for the create Talos Strategy Staked action.
* @param preActions the pre actions to be executed right before the create Talos Strategy Staked action.
* @param postActions the post actions to be executed right after the create Talos Strategy Staked action.
* @returns the target contract, encoded calldata and message value to send onchain for the create Talos Strategy Staked action.
*/;
UlyssesActions.createTalosStrategyStakedParameters = function createTalosStrategyStakedParameters(params, context, preActions, postActions) {
return this.buildComplexActionWithPreAndPostActions([new CreateTalosStrategyStakedAction(params)], context, preActions, postActions);
}
/**
* Creates the necessary execution params for the creation of a Talos Strategy Vanilla.
* @param params the parameters for the create Talos Strategy Vanilla action in Talos Strategy Vanilla Factory.
* @param context the context parameters for the create Talos Strategy Vanilla action.
* @param preActions the pre actions to be executed right before the create Talos Strategy Vanilla action.
* @param postActions the post actions to be executed right after the create Talos Strategy Vanilla action.
* @returns the target contract, encoded calldata and message value to send onchain for the create Talos Strategy Vanilla action.
*/;
UlyssesActions.createTalosStrategyVanillaParameters = function createTalosStrategyVanillaParameters(params, context, preActions, postActions) {
return this.buildComplexActionWithPreAndPostActions([new CreateTalosStrategyVanillaAction(params)], context, preActions, postActions);
}
/**
* Creates the necessary execution params for incentivizing a univ3 pool via our UniswapV3Stakers contract.
* @param params the parameters for the create incentive action in UniswapV3Staker.
* @param context the context parameters for the create incentive action.
* @param preActions the pre actions to be executed right before the create incentive action.
* @param postActions the post actions to be executed right after the create incentive action.
* @returns the target contract, encoded calldata and message value to send onchain for the create incentive action.
*/;
UlyssesActions.createIncentiveParameters = function createIncentiveParameters(params, context, preActions, postActions) {
return this.buildComplexActionWithPreAndPostActions([new CreateIncentiveAction(params)], context, preActions, postActions);
}
/**
* Creates the necessary execution params for claiming the rewards from a single univ3 position staked in the gauge.
* @param params the parameters for the claim reward action in UniswapV3Staker.
* @param context the context parameters for the claim reward action.
* @param preActions the pre actions to be executed right before the claim reward action.
* @param postActions the post actions to be executed right after the claim reward action.
* @returns the target contract, encoded calldata and message value to send onchain for the claim reward action.
*/;
UlyssesActions.claimRewardParameters = function claimRewardParameters(params, context, preActions, postActions) {
return this.buildComplexActionWithPreAndPostActions([new ClaimRewardAction(params)], context, preActions, postActions);
}
/**
* Creates the necessary execution params for claiming the rewards from multiple univ3 positions staked in the gauge.
* @param params the parameters for the claim all rewards action in UniswapV3Staker.
* @param context the context parameters for the claim all rewards action.
* @param preActions the pre actions to be executed right before the claim all rewards action.
* @param postActions the post actions to be executed right after the claim all rewards action.
* @returns the target contract, encoded calldata and message value to send onchain for the claim all rewards action.
*/;
UlyssesActions.claimAllRewardsParameters = function claimAllRewardsParameters(params, context, preActions, postActions) {
return this.buildComplexActionWithPreAndPostActions([new ClaimAllRewardsAction(params)], context, preActions, postActions);
}
/**
* Creates the necessary execution params for staking a univ3 position in the gauge.
* @param params the parameters for the stake token action in UniswapV3Staker.
* @param context the context parameters for the stake token action.
* @param preActions the pre actions to be executed right before the stake token action.
* @param postActions the post actions to be executed right after the stake token action.
* @returns the target contract, encoded calldata and message value to send onchain for the stake token action.
*/;
UlyssesActions.stakeTokenParameters = function stakeTokenParameters(params, context, preActions, postActions) {
return this.buildComplexActionWithPreAndPostActions([new StakeTokenAction(params)], context, preActions, postActions);
}
/**
* Creates the necessary execution params for unstaking a univ3 position in the gauge.
* @param params the parameters for the unstake token action in UniswapV3Staker.
* @param context the context parameters for the unstake token action.
* @param preActions the pre actions to be executed right before the unstake token action.
* @param postActions the post actions to be executed right after the unstake token action.
* @returns the target contract, encoded calldata and message value to send onchain for the unstake token action.
*/;
UlyssesActions.unstakeTokenParameters = function unstakeTokenParameters(params, context, preActions, postActions) {
return this.buildComplexActionWithPreAndPostActions([new UnstakeTokenAction(params)], context, preActions, postActions);
}
/**
* Creates the necessary execution params for depositing $Maia in exchange for $vMaia in the Vote Maia contract.
* @param params the parameters for the deposit action in Vote Maia.
* @param context the context parameters for the deposit action.
* @param preActions the pre actions to be executed right before the deposit action.
* @param postActions the post actions to be executed right after the deposit action.
* @returns the target contract, encoded calldata and message value to send onchain for the deposit action.
*/;
UlyssesActions.depositMaiaParameters = function depositMaiaParameters(params, context, preActions, postActions) {
return this.buildComplexActionWithPreAndPostActions([new DepositAction(params)], context, preActions, postActions);
}
/**
* Creates the necessary execution params for minting $vMaia in exchange for $Maia in the Vote Maia contract.
* @param params the parameters for the Mint action in Vote Maia.
* @param context the context parameters for the Mint action.
* @param preActions the pre actions to be executed right before the Mint action.
* @param postActions the post actions to be executed right after the Mint action.
* @returns the target contract, encoded calldata and message value to send onchain for the Mint action.
*/;
UlyssesActions.MintMaiaParameters = function MintMaiaParameters(params, context, preActions, postActions) {
return this.buildComplexActionWithPreAndPostActions([new MintAction(params)], context, preActions, postActions);
}
/**
* Creates the necessary execution params for withdrawing $Maia in exchange for $vMaia in the Vote Maia contract.
* @param params the parameters for the Withdraw action in Vote Maia.
* @param context the context parameters for the Withdraw action.
* @param preActions the pre actions to be executed right before the Withdraw action.
* @param postActions the post actions to be executed right after the Withdraw action.
* @returns the target contract, encoded calldata and message value to send onchain for the Withdraw action.
*/;
UlyssesActions.WithdrawMaiaParameters = function WithdrawMaiaParameters(params, context, preActions, postActions) {
return this.buildComplexActionWithPreAndPostActions([new WithdrawAction(params)], context, preActions, postActions);
}
/**
* Creates the necessary execution params for redeeming $vMaia in exchange for $Maia in the Vote Maia contract.
* @param params the parameters for the Redeem action in Vote Maia.
* @param context the context parameters for the Redeem action.
* @param preActions the pre actions to be executed right before the Redeem action.
* @param postActions the post actions to be executed right after the Redeem action.
* @returns the target contract, encoded calldata and message value to send onchain for the Redeem action.
*/;
UlyssesActions.RedeemMaiaParameters = function RedeemMaiaParameters(params, context, preActions, postActions) {
return this.buildComplexActionWithPreAndPostActions([new RedeemAction(params)], context, preActions, postActions);
}
/**
* Creates the necessary execution params for the claim of governance utility tokens from the Vote Maia contract.
* @param params the parameters for the claim governance utility tokens action in Vote Maia.
* @param context the context parameters for the claim governance utility tokens action.
* @param preActions the pre actions to be executed right before the claim governance utility tokens action.
* @param postActions the post actions to be executed right after the claim governance utility tokens action.
* @returns the target contract, encoded calldata and message value to send onchain for the claim governance utility tokens action.
*/;
UlyssesActions.claimGovernanceParameters = function claimGovernanceParameters(params, context, preActions, postActions) {
return this.buildComplexActionWithPreAndPostActions([new ClaimGovernanceAction(params)], context, preActions, postActions);
}
/**
* Creates the necessary execution params for the claim of Weight utility tokens from the Vote Maia contract.
* @param params the parameters for the claim Weight utility tokens action in Vote Maia.
* @param context the context parameters for the claim Weight utility tokens action.
* @param preActions the pre actions to be executed right before the claim Weight utility tokens action.
* @param postActions the post actions to be executed right after the claim Weight utility tokens action.
* @returns the target contract, encoded calldata and message value to send onchain for the claim Weight utility tokens action.
*/;
UlyssesActions.claimWeightParameters = function claimWeightParameters(params, context, preActions, postActions) {
return this.buildComplexActionWithPreAndPostActions([new ClaimWeightAction(params)], context, preActions, postActions);
}
/**
* Creates the necessary execution params for the claim of Maia Governance utility tokens from the Vote Maia contract.
* @param params the parameters for the claim Maia Governance utility tokens action in Vote Maia.
* @param context the context parameters for the claim Maia Governance utility tokens action.
* @param preActions the pre actions to be executed right before the claim Maia Governance utility tokens action.
* @param postActions the post actions to be executed right after the claim Maia Governance utility tokens action.
* @returns the target contract, encoded calldata and message value to send onchain for the claim Maia Governance utility tokens action.
*/;
UlyssesActions.claimPartnerGovernanceParameters = function claimPartnerGovernanceParameters(params, context, preActions, postActions) {
return this.buildComplexActionWithPreAndPostActions([new ClaimPartnerGovernanceAction(params)], context, preActions, postActions);
}
/**
* Creates the necessary execution params for the claim of of multiple utility tokens from the Vote Maia contract.
* @param params the parameters for the claim of multiple utility tokens action in Vote Maia.
* @param context the context parameters for the claim of multiple utility tokens action.
* @param preActions the pre actions to be executed right before the claim of multiple utility tokens action.
* @param postActions the post actions to be executed right after the claim of multiple utility tokens action.
* @returns the target contract, encoded calldata and message value to send onchain for the claim of multiple utility tokens action.
*/;
UlyssesActions.claimMultipleParameters = function claimMultipleParameters(params, context, preActions, postActions) {
return this.buildComplexActionWithPreAndPostActions([new ClaimMultipleAction(params)], context, preActions, postActions);
}
/**
* Creates the necessary execution params for the claim of of multiple utility tokens from the Vote Maia contract.
* @param params the parameters for the claim of multiple utility tokens action in Vote Maia.
* @param context the context parameters for the claim of multiple utility tokens action.
* @param preActions the pre actions to be executed right before the claim of multiple utility tokens action.
* @param postActions the post actions to be executed right after the claim of multiple utility tokens action.
* @returns the target contract, encoded calldata and message value to send onchain for the claim of multiple utility tokens action.
*/;
UlyssesActions.claimMultipleAmountsParameters = function claimMultipleAmountsParameters(params, context, preActions, postActions) {
return this.buildComplexActionWithPreAndPostActions([new ClaimMultipleAmountsAction(params)], context, preActions, postActions);
}
/**
* Creates the necessary execution params for the Forfeit of governance utility tokens from the Vote Maia contract.
* @param params the parameters for the Forfeit governance utility tokens action in Vote Maia.
* @param context the context parameters for the Forfeit governance utility tokens action.
* @param preActions the pre actions to be executed right before the Forfeit governance utility tokens action.
* @param postActions the post actions to be executed right after the Forfeit governance utility tokens action.
* @returns the target contract, encoded calldata and message value to send onchain for the Forfeit governance utility tokens action.
*/;
UlyssesActions.forfeitGovernanceParameters = function forfeitGovernanceParameters(params, context, preActions, postActions) {
return this.buildComplexActionWithPreAndPostActions([new ForfeitGovernanceAction(params)], context, preActions, postActions);
}
/**
* Creates the necessary execution params for the Forfeit of Weight utility tokens from the Vote Maia contract.
* @param params the parameters for the Forfeit Weight utility tokens action in Vote Maia.
* @param context the context parameters for the Forfeit Weight utility tokens action.
* @param preActions the pre actions to be executed right before the Forfeit Weight utility tokens action.
* @param postActions the post actions to be executed right after the Forfeit Weight utility tokens action.
* @returns the target contract, encoded calldata and message value to send onchain for the Forfeit Weight utility tokens action.
*/;
UlyssesActions.forfeitWeightParameters = function forfeitWeightParameters(params, context, preActions, postActions) {
return this.buildComplexActionWithPreAndPostActions([new ForfeitWeightAction(params)], context, preActions, postActions);
}
/**
* Creates the necessary execution params for the Forfeit of Maia Governance utility tokens from the Vote Maia contract.
* @param params the parameters for the Forfeit Maia Governance utility tokens action in Vote Maia.
* @param context the context parameters for the Forfeit Maia Governance utility tokens action.
* @param preActions the pre actions to be executed right before the Forfeit Maia Governance utility tokens action.
* @param postActions the post actions to be executed right after the Forfeit Maia Governance utility tokens action.
* @returns the target contract, encoded calldata and message value to send onchain for the Forfeit Maia Governance utility tokens action.
*/;
UlyssesActions.forfeitPartnerGovernanceParameters = function forfeitPartnerGovernanceParameters(params, context, preActions, postActions) {
return this.buildComplexActionWithPreAndPostActions([new ForfeitPartnerGovernanceAction(params)], context, preActions, postActions);
}
/**
* Creates the necessary execution params for the Forfeit of of multiple utility tokens from the Vote Maia contract.
* @param params the parameters for the Forfeit of multiple utility tokens action in Vote Maia.
* @param context the context parameters for the Forfeit of multiple utility tokens action.
* @param preActions the pre actions to be executed right before the Forfeit of multiple utility tokens action.
* @param postActions the post actions to be executed right after the Forfeit of multiple utility tokens action.
* @returns the target contract, encoded calldata and message value to send onchain for the Forfeit of multiple utility tokens action.
*/;
UlyssesActions.forfeitMultipleParameters = function forfeitMultipleParameters(params, context, preActions, postActions) {
return this.buildComplexActionWithPreAndPostActions([new ForfeitMultipleAction(params)], context, preActions, postActions);
}
/**
* Creates the necessary execution params for the Forfeit of of multiple utility tokens from the Vote Maia contract.
* @param params the parameters for the Forfeit of multiple utility tokens action in Vote Maia.
* @param context the context parameters for the Forfeit of multiple utility tokens action.
* @param preActions the pre actions to be executed right before the Forfeit of multiple utility tokens action.
* @param postActions the post actions to be executed right after the Forfeit of multiple utility tokens action.
* @returns the target contract, encoded calldata and message value to send onchain for the Forfeit of multiple utility tokens action.
*/;
UlyssesActions.forfeitMultipleAmountsParameters = function forfeitMultipleAmountsParameters(params, context, preActions, postActions) {
return this.buildComplexActionWithPreAndPostActions([new ForfeitMultipleAmountsAction(params)], context, preActions, postActions);
};
return UlyssesActions;
}();
/**
* Returns the action context
* @param chainId chain id
* @param useVirtualAccount flag to use virtual account
* @param userAccount user account
* @param value message value
* @param gasParams cross-chain gas parameters
* @returns the action context for use in transaction builder
*/
function getActionContext(chainId, useVirtualAccount, userAccount, value, gasParams, inputTokens, outputTokens) {
return {
chainId: chainId,
useVirtualAccount: useVirtualAccount,
userAccount: userAccount,
value: value,
gasParams: gasParams,
inputTokens: inputTokens,
outputTokens: outputTokens
};
}
/**
* Creates the token input parameters
* @param hTokens the hTokens
* @param tokens the tokens
* @param amounts the amounts
* @param deposits the deposits
* @returns the token input parameters
*/
function createTokenInputParams(hTokens, tokens, amounts, deposits) {
if (hTokens.length > 1) {
return {
hTokens: hTokens,
tokens: tokens,
amounts: amounts.map(function (amount) {
return amount.toString();
}),
deposits: deposits.map(function (deposit) {
return deposit.toString();
})
};
} else {
return {
hToken: hTokens[0],
token: tokens[0],
amount: amounts[0].toString(),
deposit: deposits[0].toString()
};
}
}
/**
* Creates the token output parameters
* @param settlementOwner the settlement owner
* @param recipient the recipient in the destination chain
* @param dstChainId the destination chain id
* @param gasParams the gas parameters
* @param outputTokens the output tokens
* @param amountsOut the amounts out
* @param depositsOut the deposits out
* @returns
*/
function createTokenOutputParams(settlementOwner, recipient, dstChainId, gasParams, outputTokens, amountsOut, depositsOut) {
if ((outputTokens == null ? void 0 : outputTokens.length) > 1) {
return {
settlementOwner: settlementOwner,
recipient: recipient,
outputTokens: outputTokens,
amountsOut: amountsOut.map(function (amount) {
return amount.toString();
}),
depositsOut: depositsOut.map(function (deposit) {
return deposit.toString();
}),
dstChainId: dstChainId,
gasParams: gasParams
};
} else {
var _outputTokens$;
return {
settlementOwner: settlementOwner,
recipient: recipient,
outputToken: (_outputTokens$ = outputTokens[0]) != null ? _outputTokens$ : '',
amountOut: amountsOut[0].toString() || maiaCoreSdk.ZERO.toString(),
depositOut: depositsOut[0].toString() || maiaCoreSdk.ZERO.toString(),
dstChainId: dstChainId,
gasParams: gasParams
};
}
}
/**
* Generates the approvals calldata - e.g. useful to get calldata to send for Virtual Account execution.
* @param params the approval parameters
* @returns the approvals calldata
*/
function generateTransferOrApproveCalldata(params) {
var approvalFlags = params.approvalFlags,
tokensToSpend = params.tokensToSpend,
amountsToSpend = params.amountsToSpend,
spenders = params.spenders;
return tokensToSpend.map(function (token, index) {
return {
target: token,
params: {
calldata: approvalFlags[index] ? ulyssesSdk.ERC20Token.encodeApproveToken(amountsToSpend[index], spenders[index]) : ulyssesSdk.ERC20Token.encodeTransfer(amountsToSpend[index], spenders[index]),
value: maiaCoreSdk.toHex('0')
}
};
});
}
function returnDefaultParams(targets, calldatas, values) {
return targets.map(function (target, index) {
return {
target: target,
params: {
calldata: calldatas[index],
value: values != null && values[index] ? values[index] : maiaCoreSdk.toHex('0')
}
};
});
}
/**
* Encodes the calldata for a Layer Zero endpoint.
*/
var LayerZeroEndpointCalldataEncoder = /*#__PURE__*/function () {
function LayerZeroEndpointCalldataEncoder(useVirtualAccount, useFallback, useRootAsOrigin, rootChainId, originChainId, dstChainId, branchBridgeAgentAddress, rootBridgeAgentAddress, destinationBridgeAgentAddress, branchBridgeAgentNonce, rootBridgeAgentNonce, destinationBridgeAgentNonce, rootRouterParams, destinationRouterParams, depositTokens, settlementTokens, settlementOverrideAmounts, account, settlementRecipient, settlementOwnerAndRefundee) {
this.useVirtualAccount = useVirtualAccount;
this.useFallback = useFallback;
this.useRootAsOrigin = useRootAsOrigin;
this.rootChainId = rootChainId;
this.originChainId = originChainId;
this.dstChainId = dstChainId;
this.branchBridgeAgentAddress = branchBridgeAgentAddress;
this.rootBridgeAgentAddress = rootBridgeAgentAddress;
this.destinationBridgeAgentAddress = destinationBridgeAgentAddress;
this.branchBridgeAgentNonce = branchBridgeAgentNonce;
this.rootBridgeAgentNonce = rootBridgeAgentNonce;
this.destinationBridgeAgentNonce = destinationBridgeAgentNonce;
this.rootRouterParams = rootRouterParams;
this.destinationRouterParams = destinationRouterParams;
this.depositTokens = depositTokens;
this.settlementTokens = settlementTokens;
this.settlementOverrideAmounts = settlementOverrideAmounts;
this.account = account;
this.settlementRecipient = settlementRecipient;
this.settlementOwnerAndRefundee = settlementOwnerAndRefundee;
this.rootChainIdLz = maiaCoreSdk.LZ_CHAIN_ID_FROM_EVM_CHAIN_ID[rootChainId];
this.originChainIdLz = maiaCoreSdk.LZ_CHAIN_ID_FROM_EVM_CHAIN_ID[originChainId];
this.dstChainIdLz = dstChainId ? maiaCoreSdk.LZ_CHAIN_ID_FROM_EVM_CHAIN_ID[dstChainId] : undefined;
this.validateParameters();
}
var _proto = LayerZeroEndpointCalldataEncoder.prototype;
_proto.validateParameters = function validateParameters() {
if (this.useVirtualAccount === undefined) {
throw new Error('Use virtual account parameter is required');
}
if (this.useFallback === undefined) {
throw new Error('Use fallback parameter is required');
}
if (this.useRootAsOrigin === undefined) {
throw new Error('Use root as origin parameter is required');
}
if (this.rootChainId === undefined || this.rootChainId <= 0) {
throw new Error('Invalid root chain ID');
}
if (this.originChainId === undefined || this.originChainId <= 0) {
throw new Error('Invalid origin chain ID');
}
if (this.dstChainId !== undefined && this.dstChainId <= 0) {
throw new Error('Invalid destination chain ID');
}
if (this.rootBridgeAgentAddress === undefined) {
throw new Error('Root bridge agent address is required');
}
if (this.branchBridgeAgentAddress === undefined && this.destinationBridgeAgentAddress === undefined) {
throw new Error('Destination branch bridge agent address is required');
}
if (this.rootBridgeAgentNonce === undefined) {
throw new Error('Root bridge agent nonce is required');
}
if (this.branchBridgeAgentNonce === undefined && this.destinationBridgeAgentNonce === undefined) {
throw new Error('Destination branch bridge agent nonce is required');
}
if (this.useVirtualAccount && this.account === undefined) {
throw new Error('User account is required for virtual account usage');
}
if (this.settlementTokens && (this.settlementRecipient === undefined || this.settlementOwnerAndRefundee === undefined)) {
throw new Error('Settlement recipient and owner/refundee are required for settlement tokens');
}
};
_proto.encode = function encode() {
var entryBridgeAgentAddress;
var entryChainId;
var steps = [];
// Step 1: Origin Chain is Root Chain
if (this.useRootAsOrigin) {
var _this$rootBridgeAgent, _this$settlementOwner, _this$rootBridgeAgent2, _this$destinationBrid, _this$rootBridgeAgent3;
// Set entry bridge agent address and entry chain id
entryBridgeAgentAddress = (_this$rootBridgeAgent = this.rootBridgeAgentAddress) != null ? _this$rootBridgeAgent : '';
entryChainId = this.rootChainId;
// Perform input checks
if (!this.settlementRecipient || !this.useFallback || !this.destinationBridgeAgentNonce || !this.destinationBridgeAgentAddress || !this.rootBridgeAgentAddress || !this.dstChainId || !this.dstChainIdLz) {
return steps;
}
// Encode calldata for destination branch chain
var dstCalldata = this.encodeCalldataForBranchChain(this.settlementRecipient, (_this$settlementOwner = this.settlementOwnerAndRefundee) != null ? _this$settlementOwner : maiaCoreSdk.ZERO_ADDRESS, this.useFallback, (_this$rootBridgeAgent2 = this.rootBridgeAgentNonce) != null ? _this$rootBridgeAgent2 : 0, (_this$destinationBrid = this.destinationBridgeAgentAddress) != null ? _this$destinationBrid : '', (_this$rootBridgeAgent3 = this.rootBridgeAgentAddress) != null ? _this$rootBridgeAgent3 : '', this.dstChainId, this.dstChainIdLz, this.destinationRouterParams, this.settlementTokens, this.settlementOverrideAmounts);
// Add destination branch chain calldata to steps
steps.push.apply(steps, dstCalldata);
// Step 1: Origin Chain is a Branch Chain
} else {
var _this$branchBridgeAge, _this$branchBridgeAge2;
// Set entry bridge agent address and entry chain id
entryBridgeAgentAddress = (_this$branchBridgeAge = this.branchBridgeAgentAddress) != null ? _this$branchBridgeAge : '';
entryChainId = this.originChainId;
// Perform input checks
if (!this.useVirtualAccount || !this.account || !this.useFallback || !this.rootBridgeAgentNonce || !this.rootBridgeAgentAddress || !this.branchBridgeAgentAddress || !this.originChainId || !this.originChainIdLz) {
return steps;
}
// Encode calldata for root chain
var rootCalldata = this.encodeCalldataForRootChain(this.useVirtualAccount, this.account, this.useFallback, (_this$branchBridgeAge2 = this.branchBridgeAgentNonce) != null ? _this$branchBridgeAge2 : 0, this.branchBridgeAgentAddress, this.rootBridgeAgentAddress, this.originChainId, this.originChainIdLz, this.rootRouterParams, this.depositTokens);
// Add root chain calldata to steps
steps.push.apply(steps, rootCalldata);
}
// Step 2: Root Chain -> Destination Chain (if destination chain exists)
if (!this.useRootAsOrigin && this.dstChainId && this.dstChainId !== this.rootChainId) {
var _this$settlementRecip, _this$settlementOwner2, _this$rootBridgeAgent4, _this$destinationBrid2, _this$rootBridgeAgent5;
// Encode calldata for execution after second hop/step to destination branch chain
var _dstCalldata = this.encodeCalldataForBranchChain((_this$settlementRecip = this.settlementRecipient) != null ? _this$settlementRecip : maiaCoreSdk.ZERO_ADDRESS, (_this$settlementOwner2 = this.settlementOwnerAndRefundee) != null ? _this$settlementOwner2 : maiaCoreSdk.ZERO_ADDRESS, this.useFallback, (_this$rootBridgeAgent4 = this.rootBridgeAgentNonce) != null ? _this$rootBridgeAgent4 : 0, (_this$destinationBrid2 = this.destinationBridgeAgentAddress) != null ? _this$destinationBrid2 : '', (_this$rootBridgeAgent5 = this.rootBridgeAgentAddress) != null ? _this$rootBridgeAgent5 : '', this.dstChainId, this.dstChainIdLz, this.destinationRouterParams, this.settlementTokens, this.settlementOverrideAmounts);
// Add destination branch chain calldata to steps
steps.push.apply(steps, _dstCalldata);
// Step 2: Origin Chain -> Root Chain (if origin chain is root chain and destination chain exists)
} else if (this.useRootAsOrigin && this.dstChainId && this.dstChainId === this.rootChainId && this.account) {
var _this$destinationBrid3, _this$destinationBrid4, _this$rootBridgeAgent6;
// Encode calldata for execution after second hop/step to root chain
var _rootCalldata = this.encodeCalldataForRootChain(this.useVirtualAccount, this.account, this.useFallback, (_this$destinationBrid3 = this.destinationBridgeAgentNonce) != null ? _this$destinationBrid3 : 0, (_this$destinationBrid4 = this.destinationBridgeAgentAddress) != null ? _this$destinationBrid4 : '', (_this$rootBridgeAgent6 = this.rootBridgeAgentAddress) != null ? _this$rootBridgeAgent6 : '', this.originChainId, this.originChainIdLz, this.rootRouterParams, this.depositTokens);
steps.push.apply(steps, _rootCalldata);
}
return [{
to: entryBridgeAgentAddress,
calldata: '',
baseGas: maiaCoreSdk.ZERO.toString(),
chainId: entryChainId
}].concat(steps);
};
_proto.encodeCalldataForRootChain = function encodeCalldataForRootChain(useVirtualAccount, account, useFallback, branchBridgeAgentNonce, branchBridgeAgentAddress, rootBridgeAgentAddress, _originChainId, originChainIdLz, rootRouterParams, depositTokens) {
var calldata = '';
var baseGas = maiaCoreSdk.ZERO.toString();
// Logic to encode calldata for root chain execution
// Step 1: If there are no deposit tokens, then encode calldata for createCallOutLzEndpointCalldata
if (!depositTokens) {
if (!useVirtualAccount) {
calldata = ulyssesSdk.LzEndpoint.createCallOutLzEndpointCalldata(originChainIdLz, solidity.pack(['address', 'address'], [branchBridgeAgentAddress, rootBridgeAgentAddress]), branchBridgeAgentNonce, rootRouterParams != null ? rootRouterParams : '0x');
baseGas = ulyssesSdk.ROOT_BRIDGE_AGENT_ACTION_BASE_GAS.NO_ASSET_DEPOSIT.toString();
} else {
calldata = ulyssesSdk.LzEndpoint.createBranchCallOutSignedLzEndpointCalldata(originChainIdLz, solidity.pack(['address', 'address'], [branchBridgeAgentAddress, rootBridgeAgentAddress]), branchBridgeAgentNonce, account, rootRouterParams != null ? rootRouterParams : '0x');
baseGas = ulyssesSdk.ROOT_BRIDGE_AGENT_ACTION_BASE_GAS.SIGNED_NO_ASSET_DEPOSIT.toString();
}
} else if (this.isSingleDepositParams(depositTokens)) {
if (!useVirtualAccount) {
calldata = ulyssesSdk.LzEndpoint.createCallOutAndBridgeLzEndpointCalldata(originChainIdLz, solidity.pack(['address', 'address'], [branchBridgeAgentAddress, rootBridgeAgentAddress]), branchBridgeAgentNonce, {
params: rootRouterParams != null ? rootRouterParams : '0x',
depositParams: depositTokens,
gasParams: {
gasLimit: '',
remoteBranchExecutionGas: ''
}
});
baseGas = ulyssesSdk.ROOT_BRIDGE_AGENT_ACTION_BASE_GAS.SINGLE_ASSET_DEPOSIT.toString();
} else {
calldata = ulyssesSdk.LzEndpoint.createBranchCallOutSignedAndBridgeLzEndpointCalldata(originChainIdLz, solidity.pack(['address', 'address'], [branchBridgeAgentAddress, rootBridgeAgentAddress]), branchBridgeAgentNonce, account, {
params: rootRouterParams != null ? rootRouterParams : '0x',
depositParams: depositTokens,
gasParams: {
gasLimit: '',
remoteBranchExecutionGas: ''
},
hasFallbackToggled: useFallback
});
baseGas = ulyssesSdk.ROOT_BRIDGE_AGENT_ACTION_BASE_GAS.SIGNED_SINGLE_ASSET_DEPOSIT_WITH_FALLBACK.toString();
}
} else if (this.isMultipleDepositParams(depositTokens)) {
if (!useVirtualAccount) {
calldata = ulyssesSdk.LzEndpoint.createBranchCallOutAndBridgeMultipleLzEndpointCalldata(originChainIdLz, solidity.pack(['address', 'address'], [branchBridgeAgentAddress, rootBridgeAgentAddress]), branchBridgeAgentNonce, {
params: rootRouterParams != null ? rootRouterParams : '0x',
depositParams: depositTokens,
gasParams: {
gasLimit: '',
remoteBranchExecutionGas: ''
}
});
baseGas = ulyssesSdk.ROOT_BRIDGE_AGENT_ACTION_BASE_GAS.MULTIPLE_ASSET_DEPOSIT.toString();
} else {
calldata = ulyssesSdk.LzEndpoint.createBranchCallOutSignedAndBridgeMultipleLzEndpointCalldata(originChainIdLz, solidity.pack(['address', 'address'], [branchBridgeAgentAddress, rootBridgeAgentAddress]), branchBridgeAgentNonce, account, {
params: rootRouterParams != null ? rootRouterParams : '0x',
depositParams: depositTokens,
gasParams: {
gasLimit: '',
remoteBranchExecutionGas: ''
},
hasFallbackToggled: useFallback
});
baseGas = ulyssesSdk.ROOT_BRIDGE_AGENT_ACTION_BASE_GAS.SIGNED_MULTIPLE_ASSET_DEPOSIT_WITH_FALLBACK.toString();
}
}
return [{
to: rootBridgeAgentAddress,
calldata: calldata,
baseGas: baseGas,
chainId: this.rootChainId
}];
};
_proto.encodeCalldataForBranchChain = function encodeCalldataForBranchChain(recipient, settlementOwnerAndGasRefundee, useFallback, rootBridgeAgentNonce, branchBridgeAgentAddress, rootBridgeAgentAddress, dstChainId, dstChainIdLz, destinationRouterParams, settlementTokens, settlementOverrideAmounts) {
var calldata = '';
var baseGas = maiaCoreSdk.ZERO.toString();
// Logic to encode calldata for branch chain execution
// Step 1: If there are no settlement tokens, then encode calldata for createCallOutLzEndpointCalldata
if (!settlementTokens) {
calldata = ulyssesSdk.LzEndpoint.createRootCallOutLzEndpointCalldata(this.rootChainIdLz, solidity.pack(['address', 'address'], [rootBridgeAgentAddress, branchBridgeAgentAddress]), rootBridgeAgentNonce, recipient, destinationRouterParams != null ? destinationRouterParams : '0x');
baseGas = ulyssesSdk.BRANCH_BRIDGE_AGENT_ACTION_BASE_GAS.NO_ASSET_DEPOSIT.toString();
} else if (this.isSingleSettlementParams(settlementTokens)) {
var _settlementOverrideAm, _settlementOverrideAm2;
calldata = ulyssesSdk.LzEndpoint.createRootCallOutAndBridgeLzEndpointCalldata(this.rootChainIdLz, solidity.pack(['address', 'address'], [rootBridgeAgentAddress, branchBridgeAgentAddress]), rootBridgeAgentNonce, {
settlementOwnerAndGasRefundee: settlementOwnerAndGasRefundee,
recipient: recipient,
params: destinationRouterParams != null ? destinationRouterParams : '0x',
settlementParams: {
hToken: settlementTokens.hToken,
token: settlementTokens.token,
amount: (_settlementOverrideAm = settlementOverrideAmounts == null ? void 0 : settlementOverrideAmounts[0]) != null ? _settlementOverrideAm : settlementTokens.amount,
deposit: (_settlementOverrideAm2 = settlementOverrideAmounts == null ? void 0 : settlementOverrideAmounts[0]) != null ? _settlementOverrideAm2 : settlementTokens.deposit
},
gasParams: {
gasLimit: ulyssesSdk.DEFAULT_GAS_PARAMS[dstChainId != null ? dstChainId : 0].gasLimit,
remoteBranchExecutionGas: ulyssesSdk.DEFAULT_GAS_PARAMS[dstChainId != null ? dstChainId : 0].remoteBranchExecutionGas
},
hasFallbackToggled: useFallback,
dstChainId: dstChainIdLz != null ? dstChainIdLz : 0
});
baseGas = ulyssesSdk.BRANCH_BRIDGE_AGENT_ACTION_BASE_GAS.SINGLE_ASSET_DEPOSIT.toString();
} else if (this.isMultipleSettlementParams(settlementTokens)) {
calldata = ulyssesSdk.LzEndpoint.createRootCallOutAndBridgeMultipleLzEndpointCalldata(this.rootChainIdLz, solidity.pack(['address', 'address'], [rootBridgeAgentAddress, branchBridgeAgentAddress]), rootBridgeAgentNonce, {
settlementOwnerAndGasRefundee: settlementOwnerAndGasRefundee,
recipient: recipient,
params: destinationRouterParams != null ? destinationRouterParams : '0x',
settlementParams: {
hTokens: settlementTokens.hTokens,
tokens: settlementTokens.tokens,
amounts: settlementOverrideAmounts != null ? settlementOverrideAmounts : settlementTokens.amounts,
deposits: settlementOverrideAmounts != null ? settlementOverrideAmounts : settlementTokens.deposits
},
gasParams: {
gasLimit: ulyssesSdk.DEFAULT_GAS_PARAMS[dstChainId != null ? dstChainId : 0].gasLimit,
remoteBranchExecutionGas: ulyssesSdk.DEFAULT_GAS_PARAMS[dstChainId != null ? dstChainId : 0].remoteBranchExecutionGas
},
hasFallbackToggled: useFallback,
dstChainId: dstChainIdLz != null ? dstChainIdLz : 0
});
baseGas = ulyssesSdk.BRANCH_BRIDGE_AGENT_ACTION_BASE_GAS.MULTIPLE_ASSET_DEPOSIT.toString();
}
return [{
to: branchBridgeAgentAddress,
calldata: calldata,
baseGas: baseGas,
chainId: dstChainId != null ? dstChainId : 0
}];
};
_proto.isSingleSettlementParams = function isSingleSettlementParams(params) {
return params && 'hToken' in params && typeof params.hToken === 'string' && 'token' in params && typeof params.token === 'string' && 'amount' in params && typeof params.amount === 'string' && 'deposit' in params && typeof params.deposit === 'string';
};
_proto.isMultipleSettlementParams = function isMultipleSettlementParams(params) {
return params && 'hTokens' in params && Array.isArray(params.hTokens) && 'tokens' in params && Array.isArray(params.tokens) && 'amounts' in params && Array.isArray(params.amounts) && 'deposits' in params && Array.isArray(params.deposits);
};
_proto.isSingleDepositParams = function isSingleDepositParams(params) {
return params && 'hToken' in params && typeof params.hToken === 'string' && 'token' in params && typeof params.token === 'string' && 'amount' in params && typeof params.amount === 'string' && 'deposit' in params && typeof params.deposit === 'string';
};
_proto.isMultipleDepositParams = function isMultipleDepositParams(params) {
return params && 'hTokens' in params && Array.isArray(params.hTokens) && 'tokens' in params && Array.isArray(params.tokens) && 'amounts' in params && Array.isArray(params.amounts) && 'deposits' in params && Array.isArray(params.deposits);
};
return LayerZeroEndpointCalldataEncoder;
}();
exports.ActionBuilder = ActionBuilder;
exports.ContextHandler = ContextHandler;
exports.GenericAction = GenericAction;
exports.LayerZeroEndpointCalldataEncoder = LayerZeroEndpointCalldataEncoder;
exports.UlyssesActions = UlyssesActions;
exports.createTokenInputParams = createTokenInputParams;
exports.createTokenOutputParams = createTokenOutputParams;
exports.generateTransferOrApproveCalldata = generateTransferOrApproveCalldata;
exports.getActionContext = getActionContext;
exports.returnDefaultParams = returnDefaultParams;
//# sourceMappingURL=ulysses-actions-sdk.cjs.development.js.map