GMX v2 - Trading (#7)

* Move PrivateKeys.cs

* Update gitignore

* Update gitignore

* updt

* Extract GmxServiceTests.cs

* Refact

* update todo

* Update code

* Fix hashdata

* Replace static token hashed datas

* Set allowance

* Add get orders

* Add get orders tests

* Add ignore

* add close orders

* revert

* Add get gas limit

* Start increasePosition. Todo: Finish GetExecutionFee and estimateGas

* little refact

* Update gitignore

* Fix namespaces and clean repo

* Add tests samples

* Add execution fee

* Add increase position

* Handle backtest on the frontend

* Add tests

* Update increase

* Test increase

* fix increase

* Fix size

* Start get position

* Update get positions

* Fix get position

* Update rpc and trade mappers

* Finish close position

* Fix leverage
This commit is contained in:
Oda
2025-01-30 23:06:22 +07:00
committed by GitHub
parent ecaa89c67b
commit 65bdb8e34f
156 changed files with 11253 additions and 4073 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,46 @@
using System.Numerics;
using Nethereum.ABI.FunctionEncoding.Attributes;
namespace Managing.ABI.GmxV2.ExchangeRouter.ContractDefinition
{
public partial class CreateDepositParams : CreateDepositParamsBase
{
}
public class CreateDepositParamsBase
{
[Parameter("address", "receiver", 1)] public virtual string Receiver { get; set; }
[Parameter("address", "callbackContract", 2)]
public virtual string CallbackContract { get; set; }
[Parameter("address", "uiFeeReceiver", 3)]
public virtual string UiFeeReceiver { get; set; }
[Parameter("address", "market", 4)] public virtual string Market { get; set; }
[Parameter("address", "initialLongToken", 5)]
public virtual string InitialLongToken { get; set; }
[Parameter("address", "initialShortToken", 6)]
public virtual string InitialShortToken { get; set; }
[Parameter("address[]", "longTokenSwapPath", 7)]
public virtual List<string> LongTokenSwapPath { get; set; }
[Parameter("address[]", "shortTokenSwapPath", 8)]
public virtual List<string> ShortTokenSwapPath { get; set; }
[Parameter("uint256", "minMarketTokens", 9)]
public virtual BigInteger MinMarketTokens { get; set; }
[Parameter("bool", "shouldUnwrapNativeToken", 10)]
public virtual bool ShouldUnwrapNativeToken { get; set; }
[Parameter("uint256", "executionFee", 11)]
public virtual BigInteger ExecutionFee { get; set; }
[Parameter("uint256", "callbackGasLimit", 12)]
public virtual BigInteger CallbackGasLimit { get; set; }
}
}

View File

@@ -0,0 +1,28 @@
using Nethereum.ABI.FunctionEncoding.Attributes;
namespace Managing.ABI.GmxV2.ExchangeRouter.ContractDefinition
{
public partial class CreateOrderParams : CreateOrderParamsBase
{
}
public class CreateOrderParamsBase
{
[Parameter("tuple", "addresses", 1)] public virtual CreateOrderParamsAddresses Addresses { get; set; }
[Parameter("tuple", "numbers", 2)] public virtual CreateOrderParamsNumbers Numbers { get; set; }
[Parameter("uint8", "orderType", 3)] public virtual byte OrderType { get; set; }
[Parameter("uint8", "decreasePositionSwapType", 4)]
public virtual byte DecreasePositionSwapType { get; set; }
[Parameter("bool", "isLong", 5)] public virtual bool IsLong { get; set; }
[Parameter("bool", "shouldUnwrapNativeToken", 6)]
public virtual bool ShouldUnwrapNativeToken { get; set; }
[Parameter("bool", "autoCancel", 7)] public virtual bool AutoCancel { get; set; }
[Parameter("bytes32", "referralCode", 8)]
public virtual byte[] ReferralCode { get; set; }
}
}

View File

@@ -0,0 +1,30 @@
using Nethereum.ABI.FunctionEncoding.Attributes;
namespace Managing.ABI.GmxV2.ExchangeRouter.ContractDefinition
{
public partial class CreateOrderParamsAddresses : CreateOrderParamsAddressesBase
{
}
public class CreateOrderParamsAddressesBase
{
[Parameter("address", "receiver", 1)] public virtual string Receiver { get; set; }
[Parameter("address", "cancellationReceiver", 2)]
public virtual string CancellationReceiver { get; set; }
[Parameter("address", "callbackContract", 3)]
public virtual string CallbackContract { get; set; }
[Parameter("address", "uiFeeReceiver", 4)]
public virtual string UiFeeReceiver { get; set; }
[Parameter("address", "market", 5)] public virtual string Market { get; set; }
[Parameter("address", "initialCollateralToken", 6)]
public virtual string InitialCollateralToken { get; set; }
[Parameter("address[]", "swapPath", 7)]
public virtual List<string> SwapPath { get; set; }
}
}

View File

@@ -0,0 +1,36 @@
using System.Numerics;
using Nethereum.ABI.FunctionEncoding.Attributes;
namespace Managing.ABI.GmxV2.ExchangeRouter.ContractDefinition
{
public partial class CreateOrderParamsNumbers : CreateOrderParamsNumbersBase
{
}
public class CreateOrderParamsNumbersBase
{
[Parameter("uint256", "sizeDeltaUsd", 1)]
public virtual BigInteger SizeDeltaUsd { get; set; }
[Parameter("uint256", "initialCollateralDeltaAmount", 2)]
public virtual BigInteger InitialCollateralDeltaAmount { get; set; }
[Parameter("uint256", "triggerPrice", 3)]
public virtual BigInteger TriggerPrice { get; set; }
[Parameter("uint256", "acceptablePrice", 4)]
public virtual BigInteger AcceptablePrice { get; set; }
[Parameter("uint256", "executionFee", 5)]
public virtual BigInteger ExecutionFee { get; set; }
[Parameter("uint256", "callbackGasLimit", 6)]
public virtual BigInteger CallbackGasLimit { get; set; }
[Parameter("uint256", "minOutputAmount", 7)]
public virtual BigInteger MinOutputAmount { get; set; }
[Parameter("uint256", "validFromTime", 8)]
public virtual BigInteger ValidFromTime { get; set; }
}
}

View File

@@ -0,0 +1,34 @@
using System.Numerics;
using Nethereum.ABI.FunctionEncoding.Attributes;
namespace Managing.ABI.GmxV2.ExchangeRouter.ContractDefinition
{
public partial class CreateShiftParams : CreateShiftParamsBase
{
}
public class CreateShiftParamsBase
{
[Parameter("address", "receiver", 1)] public virtual string Receiver { get; set; }
[Parameter("address", "callbackContract", 2)]
public virtual string CallbackContract { get; set; }
[Parameter("address", "uiFeeReceiver", 3)]
public virtual string UiFeeReceiver { get; set; }
[Parameter("address", "fromMarket", 4)]
public virtual string FromMarket { get; set; }
[Parameter("address", "toMarket", 5)] public virtual string ToMarket { get; set; }
[Parameter("uint256", "minMarketTokens", 6)]
public virtual BigInteger MinMarketTokens { get; set; }
[Parameter("uint256", "executionFee", 7)]
public virtual BigInteger ExecutionFee { get; set; }
[Parameter("uint256", "callbackGasLimit", 8)]
public virtual BigInteger CallbackGasLimit { get; set; }
}
}

View File

@@ -0,0 +1,43 @@
using System.Numerics;
using Nethereum.ABI.FunctionEncoding.Attributes;
namespace Managing.ABI.GmxV2.ExchangeRouter.ContractDefinition
{
public partial class CreateWithdrawalParams : CreateWithdrawalParamsBase
{
}
public class CreateWithdrawalParamsBase
{
[Parameter("address", "receiver", 1)] public virtual string Receiver { get; set; }
[Parameter("address", "callbackContract", 2)]
public virtual string CallbackContract { get; set; }
[Parameter("address", "uiFeeReceiver", 3)]
public virtual string UiFeeReceiver { get; set; }
[Parameter("address", "market", 4)] public virtual string Market { get; set; }
[Parameter("address[]", "longTokenSwapPath", 5)]
public virtual List<string> LongTokenSwapPath { get; set; }
[Parameter("address[]", "shortTokenSwapPath", 6)]
public virtual List<string> ShortTokenSwapPath { get; set; }
[Parameter("uint256", "minLongTokenAmount", 7)]
public virtual BigInteger MinLongTokenAmount { get; set; }
[Parameter("uint256", "minShortTokenAmount", 8)]
public virtual BigInteger MinShortTokenAmount { get; set; }
[Parameter("bool", "shouldUnwrapNativeToken", 9)]
public virtual bool ShouldUnwrapNativeToken { get; set; }
[Parameter("uint256", "executionFee", 10)]
public virtual BigInteger ExecutionFee { get; set; }
[Parameter("uint256", "callbackGasLimit", 11)]
public virtual BigInteger CallbackGasLimit { get; set; }
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,15 @@
using System.Numerics;
using Nethereum.ABI.FunctionEncoding.Attributes;
namespace Managing.ABI.GmxV2.ExchangeRouter.ContractDefinition
{
public partial class Props : PropsBase
{
}
public class PropsBase
{
[Parameter("uint256", "min", 1)] public virtual BigInteger Min { get; set; }
[Parameter("uint256", "max", 2)] public virtual BigInteger Max { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
using Nethereum.ABI.FunctionEncoding.Attributes;
namespace Managing.ABI.GmxV2.ExchangeRouter.ContractDefinition
{
public partial class SetPricesParams : SetPricesParamsBase
{
}
public class SetPricesParamsBase
{
[Parameter("address[]", "tokens", 1)] public virtual List<string> Tokens { get; set; }
[Parameter("address[]", "providers", 2)]
public virtual List<string> Providers { get; set; }
[Parameter("bytes[]", "data", 3)] public virtual List<byte[]> Data { get; set; }
}
}

View File

@@ -0,0 +1,24 @@
using System.Numerics;
using Nethereum.ABI.FunctionEncoding.Attributes;
namespace Managing.ABI.GmxV2.ExchangeRouter.ContractDefinition
{
public partial class SimulatePricesParams : SimulatePricesParamsBase
{
}
public class SimulatePricesParamsBase
{
[Parameter("address[]", "primaryTokens", 1)]
public virtual List<string> PrimaryTokens { get; set; }
[Parameter("tuple[]", "primaryPrices", 2)]
public virtual List<Props> PrimaryPrices { get; set; }
[Parameter("uint256", "minTimestamp", 3)]
public virtual BigInteger MinTimestamp { get; set; }
[Parameter("uint256", "maxTimestamp", 4)]
public virtual BigInteger MaxTimestamp { get; set; }
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -8,8 +8,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Nethereum.Contracts" Version="4.21.3"/>
<PackageReference Include="Nethereum.Web3" Version="4.21.2"/>
<PackageReference Include="Nethereum.Contracts" Version="4.28.0"/>
<PackageReference Include="Nethereum.Web3" Version="4.28.0"/>
</ItemGroup>
</Project>

View File

@@ -1,15 +0,0 @@
using Nethereum.ABI.FunctionEncoding.Attributes;
namespace Managing.ABI.GmxV2.Multicall3.ContractDefinition
{
public partial class Call3 : Call3Base
{
}
public class Call3Base
{
[Parameter("address", "target", 1)] public virtual string Target { get; set; }
[Parameter("bool", "allowFailure", 2)] public virtual bool AllowFailure { get; set; }
[Parameter("bytes", "callData", 3)] public virtual byte[] CallData { get; set; }
}
}

View File

@@ -1,17 +0,0 @@
using System.Numerics;
using Nethereum.ABI.FunctionEncoding.Attributes;
namespace Managing.ABI.GmxV2.Multicall3.ContractDefinition
{
public partial class Call3Value : Call3ValueBase
{
}
public class Call3ValueBase
{
[Parameter("address", "target", 1)] public virtual string Target { get; set; }
[Parameter("bool", "allowFailure", 2)] public virtual bool AllowFailure { get; set; }
[Parameter("uint256", "value", 3)] public virtual BigInteger Value { get; set; }
[Parameter("bytes", "callData", 4)] public virtual byte[] CallData { get; set; }
}
}

File diff suppressed because one or more lines are too long

View File

@@ -7,20 +7,19 @@ namespace Managing.ABI.GmxV2.Multicall3
{
public partial class Multicall3Service : ContractWeb3ServiceBase
{
public static Task<TransactionReceipt> DeployContractAndWaitForReceiptAsync(Nethereum.Web3.IWeb3 web3,
public static Task<TransactionReceipt> DeployContractAndWaitForReceiptAsync(IWeb3 web3,
Multicall3Deployment multicall3Deployment, CancellationTokenSource cancellationTokenSource = null)
{
return web3.Eth.GetContractDeploymentHandler<Multicall3Deployment>()
.SendRequestAndWaitForReceiptAsync(multicall3Deployment, cancellationTokenSource);
}
public static Task<string> DeployContractAsync(Nethereum.Web3.IWeb3 web3,
Multicall3Deployment multicall3Deployment)
public static Task<string> DeployContractAsync(IWeb3 web3, Multicall3Deployment multicall3Deployment)
{
return web3.Eth.GetContractDeploymentHandler<Multicall3Deployment>().SendRequestAsync(multicall3Deployment);
}
public static async Task<Multicall3Service> DeployContractAndGetServiceAsync(Nethereum.Web3.IWeb3 web3,
public static async Task<Multicall3Service> DeployContractAndGetServiceAsync(IWeb3 web3,
Multicall3Deployment multicall3Deployment, CancellationTokenSource cancellationTokenSource = null)
{
var receipt =
@@ -28,7 +27,7 @@ namespace Managing.ABI.GmxV2.Multicall3
return new Multicall3Service(web3, receipt.ContractAddress);
}
public Multicall3Service(Nethereum.Web3.IWeb3 web3, string contractAddress) : base(web3, contractAddress)
public Multicall3Service(IWeb3 web3, string contractAddress) : base(web3, contractAddress)
{
}
@@ -60,62 +59,6 @@ namespace Managing.ABI.GmxV2.Multicall3
return ContractHandler.SendRequestAndWaitForReceiptAsync(aggregateFunction, cancellationToken);
}
public Task<string> Aggregate3RequestAsync(Aggregate3Function aggregate3Function)
{
return ContractHandler.SendRequestAsync(aggregate3Function);
}
public Task<TransactionReceipt> Aggregate3RequestAndWaitForReceiptAsync(Aggregate3Function aggregate3Function,
CancellationTokenSource cancellationToken = null)
{
return ContractHandler.SendRequestAndWaitForReceiptAsync(aggregate3Function, cancellationToken);
}
public Task<string> Aggregate3RequestAsync(List<Call3> calls)
{
var aggregate3Function = new Aggregate3Function();
aggregate3Function.Calls = calls;
return ContractHandler.SendRequestAsync(aggregate3Function);
}
public Task<TransactionReceipt> Aggregate3RequestAndWaitForReceiptAsync(List<Call3> calls,
CancellationTokenSource cancellationToken = null)
{
var aggregate3Function = new Aggregate3Function();
aggregate3Function.Calls = calls;
return ContractHandler.SendRequestAndWaitForReceiptAsync(aggregate3Function, cancellationToken);
}
public Task<string> Aggregate3ValueRequestAsync(Aggregate3ValueFunction aggregate3ValueFunction)
{
return ContractHandler.SendRequestAsync(aggregate3ValueFunction);
}
public Task<TransactionReceipt> Aggregate3ValueRequestAndWaitForReceiptAsync(
Aggregate3ValueFunction aggregate3ValueFunction, CancellationTokenSource cancellationToken = null)
{
return ContractHandler.SendRequestAndWaitForReceiptAsync(aggregate3ValueFunction, cancellationToken);
}
public Task<string> Aggregate3ValueRequestAsync(List<Call3Value> calls)
{
var aggregate3ValueFunction = new Aggregate3ValueFunction();
aggregate3ValueFunction.Calls = calls;
return ContractHandler.SendRequestAsync(aggregate3ValueFunction);
}
public Task<TransactionReceipt> Aggregate3ValueRequestAndWaitForReceiptAsync(List<Call3Value> calls,
CancellationTokenSource cancellationToken = null)
{
var aggregate3ValueFunction = new Aggregate3ValueFunction();
aggregate3ValueFunction.Calls = calls;
return ContractHandler.SendRequestAndWaitForReceiptAsync(aggregate3ValueFunction, cancellationToken);
}
public Task<string> BlockAndAggregateRequestAsync(BlockAndAggregateFunction blockAndAggregateFunction)
{
return ContractHandler.SendRequestAsync(blockAndAggregateFunction);
@@ -144,18 +87,6 @@ namespace Managing.ABI.GmxV2.Multicall3
return ContractHandler.SendRequestAndWaitForReceiptAsync(blockAndAggregateFunction, cancellationToken);
}
public Task<BigInteger> GetBasefeeQueryAsync(GetBasefeeFunction getBasefeeFunction,
BlockParameter blockParameter = null)
{
return ContractHandler.QueryAsync<GetBasefeeFunction, BigInteger>(getBasefeeFunction, blockParameter);
}
public Task<BigInteger> GetBasefeeQueryAsync(BlockParameter blockParameter = null)
{
return ContractHandler.QueryAsync<GetBasefeeFunction, BigInteger>(null, blockParameter);
}
public Task<byte[]> GetBlockHashQueryAsync(GetBlockHashFunction getBlockHashFunction,
BlockParameter blockParameter = null)
{
@@ -184,18 +115,6 @@ namespace Managing.ABI.GmxV2.Multicall3
return ContractHandler.QueryAsync<GetBlockNumberFunction, BigInteger>(null, blockParameter);
}
public Task<BigInteger> GetChainIdQueryAsync(GetChainIdFunction getChainIdFunction,
BlockParameter blockParameter = null)
{
return ContractHandler.QueryAsync<GetChainIdFunction, BigInteger>(getChainIdFunction, blockParameter);
}
public Task<BigInteger> GetChainIdQueryAsync(BlockParameter blockParameter = null)
{
return ContractHandler.QueryAsync<GetChainIdFunction, BigInteger>(null, blockParameter);
}
public Task<string> GetCurrentBlockCoinbaseQueryAsync(
GetCurrentBlockCoinbaseFunction getCurrentBlockCoinbaseFunction, BlockParameter blockParameter = null)
{
@@ -209,6 +128,19 @@ namespace Managing.ABI.GmxV2.Multicall3
return ContractHandler.QueryAsync<GetCurrentBlockCoinbaseFunction, string>(null, blockParameter);
}
public Task<BigInteger> GetCurrentBlockDifficultyQueryAsync(
GetCurrentBlockDifficultyFunction getCurrentBlockDifficultyFunction, BlockParameter blockParameter = null)
{
return ContractHandler.QueryAsync<GetCurrentBlockDifficultyFunction, BigInteger>(
getCurrentBlockDifficultyFunction, blockParameter);
}
public Task<BigInteger> GetCurrentBlockDifficultyQueryAsync(BlockParameter blockParameter = null)
{
return ContractHandler.QueryAsync<GetCurrentBlockDifficultyFunction, BigInteger>(null, blockParameter);
}
public Task<BigInteger> GetCurrentBlockGasLimitQueryAsync(
GetCurrentBlockGasLimitFunction getCurrentBlockGasLimitFunction, BlockParameter blockParameter = null)
{
@@ -250,6 +182,19 @@ namespace Managing.ABI.GmxV2.Multicall3
return ContractHandler.QueryAsync<GetEthBalanceFunction, BigInteger>(getEthBalanceFunction, blockParameter);
}
public Task<BigInteger> GetL1BlockNumberQueryAsync(GetL1BlockNumberFunction getL1BlockNumberFunction,
BlockParameter blockParameter = null)
{
return ContractHandler.QueryAsync<GetL1BlockNumberFunction, BigInteger>(getL1BlockNumberFunction,
blockParameter);
}
public Task<BigInteger> GetL1BlockNumberQueryAsync(BlockParameter blockParameter = null)
{
return ContractHandler.QueryAsync<GetL1BlockNumberFunction, BigInteger>(null, blockParameter);
}
public Task<byte[]> GetLastBlockHashQueryAsync(GetLastBlockHashFunction getLastBlockHashFunction,
BlockParameter blockParameter = null)
{
@@ -328,17 +273,15 @@ namespace Managing.ABI.GmxV2.Multicall3
return new List<Type>
{
typeof(AggregateFunction),
typeof(Aggregate3Function),
typeof(Aggregate3ValueFunction),
typeof(BlockAndAggregateFunction),
typeof(GetBasefeeFunction),
typeof(GetBlockHashFunction),
typeof(GetBlockNumberFunction),
typeof(GetChainIdFunction),
typeof(GetCurrentBlockCoinbaseFunction),
typeof(GetCurrentBlockDifficultyFunction),
typeof(GetCurrentBlockGasLimitFunction),
typeof(GetCurrentBlockTimestampFunction),
typeof(GetEthBalanceFunction),
typeof(GetL1BlockNumberFunction),
typeof(GetLastBlockHashFunction),
typeof(TryAggregateFunction),
typeof(TryBlockAndAggregateFunction)

View File

@@ -0,0 +1,26 @@
using Nethereum.ABI.FunctionEncoding.Attributes;
namespace Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition
{
public partial class Addresses : AddressesBase { }
public class AddressesBase
{
[Parameter("address", "account", 1)]
public virtual string Account { get; set; }
[Parameter("address", "receiver", 2)]
public virtual string Receiver { get; set; }
[Parameter("address", "cancellationReceiver", 3)]
public virtual string CancellationReceiver { get; set; }
[Parameter("address", "callbackContract", 4)]
public virtual string CallbackContract { get; set; }
[Parameter("address", "uiFeeReceiver", 5)]
public virtual string UiFeeReceiver { get; set; }
[Parameter("address", "market", 6)]
public virtual string Market { get; set; }
[Parameter("address", "initialCollateralToken", 7)]
public virtual string InitialCollateralToken { get; set; }
[Parameter("address[]", "swapPath", 8)]
public virtual List<string> SwapPath { get; set; }
}
}

View File

@@ -0,0 +1,14 @@
using Nethereum.ABI.FunctionEncoding.Attributes;
namespace Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition
{
public partial class BaseFundingValues : BaseFundingValuesBase { }
public class BaseFundingValuesBase
{
[Parameter("tuple", "fundingFeeAmountPerSize", 1)]
public virtual PositionType FundingFeeAmountPerSize { get; set; }
[Parameter("tuple", "claimableFundingAmountPerSize", 2)]
public virtual PositionType ClaimableFundingAmountPerSize { get; set; }
}
}

View File

@@ -0,0 +1,15 @@
using System.Numerics;
using Nethereum.ABI.FunctionEncoding.Attributes;
namespace Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition
{
public partial class CollateralType : CollateralTypeBase { }
public class CollateralTypeBase
{
[Parameter("uint256", "longToken", 1)]
public virtual BigInteger LongToken { get; set; }
[Parameter("uint256", "shortToken", 2)]
public virtual BigInteger ShortToken { get; set; }
}
}

View File

@@ -0,0 +1,17 @@
using System.Numerics;
using Nethereum.ABI.FunctionEncoding.Attributes;
namespace Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition
{
public partial class ExecutionPriceResult : ExecutionPriceResultBase { }
public class ExecutionPriceResultBase
{
[Parameter("int256", "priceImpactUsd", 1)]
public virtual BigInteger PriceImpactUsd { get; set; }
[Parameter("uint256", "priceImpactDiffUsd", 2)]
public virtual BigInteger PriceImpactDiffUsd { get; set; }
[Parameter("uint256", "executionPrice", 3)]
public virtual BigInteger ExecutionPrice { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
using Nethereum.ABI.FunctionEncoding.Attributes;
namespace Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition
{
public partial class Flags : FlagsBase
{
}
public class FlagsBase
{
// [Parameter("bool", "isLong", 1)] public virtual bool IsLong { get; set; }
// [Parameter("bool", "shouldUnwrapNativeToken", 2)]
// public virtual bool ShouldUnwrapNativeToken { get; set; }
// [Parameter("bool", "isFrozen", 3)]
// public virtual bool IsFrozen { get; set; }
[Parameter("bool", "autoCancel", 4)] public virtual bool AutoCancel { get; set; }
}
}

View File

@@ -0,0 +1,21 @@
using System.Numerics;
using Nethereum.ABI.FunctionEncoding.Attributes;
namespace Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition
{
public partial class GetNextFundingAmountPerSizeResult : GetNextFundingAmountPerSizeResultBase { }
public class GetNextFundingAmountPerSizeResultBase
{
[Parameter("bool", "longsPayShorts", 1)]
public virtual bool LongsPayShorts { get; set; }
[Parameter("uint256", "fundingFactorPerSecond", 2)]
public virtual BigInteger FundingFactorPerSecond { get; set; }
[Parameter("int256", "nextSavedFundingFactorPerSecond", 3)]
public virtual BigInteger NextSavedFundingFactorPerSecond { get; set; }
[Parameter("tuple", "fundingFeeAmountPerSizeDelta", 4)]
public virtual PositionType FundingFeeAmountPerSizeDelta { get; set; }
[Parameter("tuple", "claimableFundingAmountPerSizeDelta", 5)]
public virtual PositionType ClaimableFundingAmountPerSizeDelta { get; set; }
}
}

View File

@@ -0,0 +1,17 @@
using System.Numerics;
using Nethereum.ABI.FunctionEncoding.Attributes;
namespace Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition
{
public partial class IsPositionLiquidatableInfo : IsPositionLiquidatableInfoBase { }
public class IsPositionLiquidatableInfoBase
{
[Parameter("int256", "remainingCollateralUsd", 1)]
public virtual BigInteger RemainingCollateralUsd { get; set; }
[Parameter("int256", "minCollateralUsd", 2)]
public virtual BigInteger MinCollateralUsd { get; set; }
[Parameter("int256", "minCollateralUsdForLeverage", 3)]
public virtual BigInteger MinCollateralUsdForLeverage { get; set; }
}
}

View File

@@ -0,0 +1,31 @@
using System.Numerics;
using Managing.ABI.GmxV2.Reader.ContractDefinition;
using Nethereum.ABI.FunctionEncoding.Attributes;
namespace Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition
{
public partial class MarketInfo : MarketInfoBase
{
}
public class MarketInfoBase
{
[Parameter("tuple", "market", 1)] public virtual MarketsProps Market { get; set; }
[Parameter("uint256", "borrowingFactorPerSecondForLongs", 2)]
public virtual BigInteger BorrowingFactorPerSecondForLongs { get; set; }
[Parameter("uint256", "borrowingFactorPerSecondForShorts", 3)]
public virtual BigInteger BorrowingFactorPerSecondForShorts { get; set; }
[Parameter("tuple", "baseFunding", 4)] public virtual BaseFundingValues BaseFunding { get; set; }
[Parameter("tuple", "nextFunding", 5)]
public virtual GetNextFundingAmountPerSizeResult NextFunding { get; set; }
[Parameter("tuple", "virtualInventory", 6)]
public virtual VirtualInventory VirtualInventory { get; set; }
[Parameter("bool", "isDisabled", 7)] public virtual bool IsDisabled { get; set; }
}
}

View File

@@ -0,0 +1,21 @@
using Managing.ABI.GmxV2.Reader.ContractDefinition;
using Nethereum.ABI.FunctionEncoding.Attributes;
namespace Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition
{
public partial class MarketPrices : MarketPricesBase
{
}
public class MarketPricesBase
{
[Parameter("tuple", "indexTokenPrice", 1)]
public virtual MarketPrice IndexTokenPrice { get; set; }
[Parameter("tuple", "longTokenPrice", 2)]
public virtual MarketPrice LongTokenPrice { get; set; }
[Parameter("tuple", "shortTokenPrice", 3)]
public virtual MarketPrice ShortTokenPrice { get; set; }
}
}

View File

@@ -0,0 +1,33 @@
using System.Numerics;
using Nethereum.ABI.FunctionEncoding.Attributes;
namespace Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition
{
public partial class Numbers : NumbersBase { }
public class NumbersBase
{
[Parameter("uint8", "orderType", 1)]
public virtual byte OrderType { get; set; }
[Parameter("uint8", "decreasePositionSwapType", 2)]
public virtual byte DecreasePositionSwapType { get; set; }
[Parameter("uint256", "sizeDeltaUsd", 3)]
public virtual BigInteger SizeDeltaUsd { get; set; }
[Parameter("uint256", "initialCollateralDeltaAmount", 4)]
public virtual BigInteger InitialCollateralDeltaAmount { get; set; }
[Parameter("uint256", "triggerPrice", 5)]
public virtual BigInteger TriggerPrice { get; set; }
[Parameter("uint256", "acceptablePrice", 6)]
public virtual BigInteger AcceptablePrice { get; set; }
[Parameter("uint256", "executionFee", 7)]
public virtual BigInteger ExecutionFee { get; set; }
[Parameter("uint256", "callbackGasLimit", 8)]
public virtual BigInteger CallbackGasLimit { get; set; }
[Parameter("uint256", "minOutputAmount", 9)]
public virtual BigInteger MinOutputAmount { get; set; }
[Parameter("uint256", "updatedAtTime", 10)]
public virtual BigInteger UpdatedAtTime { get; set; }
[Parameter("uint256", "validFromTime", 11)]
public virtual BigInteger ValidFromTime { get; set; }
}
}

View File

@@ -0,0 +1,19 @@
using System.Numerics;
using Nethereum.ABI.FunctionEncoding.Attributes;
namespace Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition
{
public partial class PositionBorrowingFees : PositionBorrowingFeesBase { }
public class PositionBorrowingFeesBase
{
[Parameter("uint256", "borrowingFeeUsd", 1)]
public virtual BigInteger BorrowingFeeUsd { get; set; }
[Parameter("uint256", "borrowingFeeAmount", 2)]
public virtual BigInteger BorrowingFeeAmount { get; set; }
[Parameter("uint256", "borrowingFeeReceiverFactor", 3)]
public virtual BigInteger BorrowingFeeReceiverFactor { get; set; }
[Parameter("uint256", "borrowingFeeAmountForFeeReceiver", 4)]
public virtual BigInteger BorrowingFeeAmountForFeeReceiver { get; set; }
}
}

View File

@@ -0,0 +1,53 @@
using System.Numerics;
using Managing.ABI.GmxV2.Reader.ContractDefinition;
using Nethereum.ABI.FunctionEncoding.Attributes;
namespace Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition
{
public partial class PositionFees : PositionFeesBase
{
}
public class PositionFeesBase
{
[Parameter("tuple", "referral", 1)] public virtual PositionReferralFees Referral { get; set; }
[Parameter("tuple", "pro", 2)] public virtual PositionProFees Pro { get; set; }
[Parameter("tuple", "funding", 3)] public virtual PositionFundingFees Funding { get; set; }
[Parameter("tuple", "borrowing", 4)] public virtual PositionBorrowingFees Borrowing { get; set; }
[Parameter("tuple", "ui", 5)] public virtual PositionUiFees Ui { get; set; }
[Parameter("tuple", "liquidation", 6)] public virtual PositionLiquidationFees Liquidation { get; set; }
[Parameter("tuple", "collateralTokenPrice", 7)]
public virtual MarketPrice CollateralTokenPrice { get; set; }
[Parameter("uint256", "positionFeeFactor", 8)]
public virtual BigInteger PositionFeeFactor { get; set; }
[Parameter("uint256", "protocolFeeAmount", 9)]
public virtual BigInteger ProtocolFeeAmount { get; set; }
[Parameter("uint256", "positionFeeReceiverFactor", 10)]
public virtual BigInteger PositionFeeReceiverFactor { get; set; }
[Parameter("uint256", "feeReceiverAmount", 11)]
public virtual BigInteger FeeReceiverAmount { get; set; }
[Parameter("uint256", "feeAmountForPool", 12)]
public virtual BigInteger FeeAmountForPool { get; set; }
[Parameter("uint256", "positionFeeAmountForPool", 13)]
public virtual BigInteger PositionFeeAmountForPool { get; set; }
[Parameter("uint256", "positionFeeAmount", 14)]
public virtual BigInteger PositionFeeAmount { get; set; }
[Parameter("uint256", "totalCostAmountExcludingFunding", 15)]
public virtual BigInteger TotalCostAmountExcludingFunding { get; set; }
[Parameter("uint256", "totalCostAmount", 16)]
public virtual BigInteger TotalCostAmount { get; set; }
[Parameter("uint256", "totalDiscountAmount", 17)]
public virtual BigInteger TotalDiscountAmount { get; set; }
}
}

View File

@@ -0,0 +1,23 @@
using System.Numerics;
using Nethereum.ABI.FunctionEncoding.Attributes;
namespace Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition
{
public partial class PositionFundingFees : PositionFundingFeesBase { }
public class PositionFundingFeesBase
{
[Parameter("uint256", "fundingFeeAmount", 1)]
public virtual BigInteger FundingFeeAmount { get; set; }
[Parameter("uint256", "claimableLongTokenAmount", 2)]
public virtual BigInteger ClaimableLongTokenAmount { get; set; }
[Parameter("uint256", "claimableShortTokenAmount", 3)]
public virtual BigInteger ClaimableShortTokenAmount { get; set; }
[Parameter("uint256", "latestFundingFeeAmountPerSize", 4)]
public virtual BigInteger LatestFundingFeeAmountPerSize { get; set; }
[Parameter("uint256", "latestLongTokenClaimableFundingAmountPerSize", 5)]
public virtual BigInteger LatestLongTokenClaimableFundingAmountPerSize { get; set; }
[Parameter("uint256", "latestShortTokenClaimableFundingAmountPerSize", 6)]
public virtual BigInteger LatestShortTokenClaimableFundingAmountPerSize { get; set; }
}
}

View File

@@ -0,0 +1,27 @@
using System.Numerics;
using Nethereum.ABI.FunctionEncoding.Attributes;
namespace Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition
{
public partial class PositionInfo : PositionInfoBase
{
}
public class PositionInfoBase
{
[Parameter("tuple", "position", 1)] public virtual PositionProps Position { get; set; }
[Parameter("tuple", "fees", 2)] public virtual PositionFees Fees { get; set; }
[Parameter("tuple", "executionPriceResult", 3)]
public virtual ExecutionPriceResult ExecutionPriceResult { get; set; }
[Parameter("int256", "basePnlUsd", 4)] public virtual BigInteger BasePnlUsd { get; set; }
[Parameter("int256", "uncappedBasePnlUsd", 5)]
public virtual BigInteger UncappedBasePnlUsd { get; set; }
[Parameter("int256", "pnlAfterPriceImpactUsd", 6)]
public virtual BigInteger PnlAfterPriceImpactUsd { get; set; }
}
}

View File

@@ -0,0 +1,19 @@
using System.Numerics;
using Nethereum.ABI.FunctionEncoding.Attributes;
namespace Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition
{
public partial class PositionLiquidationFees : PositionLiquidationFeesBase { }
public class PositionLiquidationFeesBase
{
[Parameter("uint256", "liquidationFeeUsd", 1)]
public virtual BigInteger LiquidationFeeUsd { get; set; }
[Parameter("uint256", "liquidationFeeAmount", 2)]
public virtual BigInteger LiquidationFeeAmount { get; set; }
[Parameter("uint256", "liquidationFeeReceiverFactor", 3)]
public virtual BigInteger LiquidationFeeReceiverFactor { get; set; }
[Parameter("uint256", "liquidationFeeAmountForFeeReceiver", 4)]
public virtual BigInteger LiquidationFeeAmountForFeeReceiver { get; set; }
}
}

View File

@@ -0,0 +1,17 @@
using System.Numerics;
using Nethereum.ABI.FunctionEncoding.Attributes;
namespace Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition
{
public partial class PositionProFees : PositionProFeesBase { }
public class PositionProFeesBase
{
[Parameter("uint256", "traderTier", 1)]
public virtual BigInteger TraderTier { get; set; }
[Parameter("uint256", "traderDiscountFactor", 2)]
public virtual BigInteger TraderDiscountFactor { get; set; }
[Parameter("uint256", "traderDiscountAmount", 3)]
public virtual BigInteger TraderDiscountAmount { get; set; }
}
}

View File

@@ -0,0 +1,60 @@
using System.Numerics;
using Nethereum.ABI.FunctionEncoding.Attributes;
namespace Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition
{
public partial class PositionProps : PositionPropsBase
{
}
public class PositionPropsBase
{
[Parameter("tuple", "addresses", 1)] public virtual PositionAddresses Addresses { get; set; }
[Parameter("tuple", "numbers", 2)] public virtual PositionNumbers Numbers { get; set; }
[Parameter("tuple", "flags", 3)] public virtual PositionFlags Flags { get; set; }
}
public class PositionFlags
{
[Parameter("bool", "isLong", 1)] public virtual bool IsLong { get; set; }
}
public class PositionAddresses
{
[Parameter("address", "account", 1)] public virtual string Account { get; set; }
[Parameter("address", "market", 2)] public virtual string Market { get; set; }
[Parameter("address", "collateralToken", 3)]
public virtual string CollateralToken { get; set; }
}
public class PositionNumbers
{
[Parameter("uint256", "sizeInUsd", 1)] public virtual BigInteger SizeInUsd { get; set; }
[Parameter("uint256", "sizeInTokens", 2)]
public virtual BigInteger SizeInTokens { get; set; }
[Parameter("uint256", "collateralAmount", 3)]
public virtual BigInteger CollateralAmount { get; set; }
[Parameter("uint256", "borrowingFactor", 4)]
public virtual BigInteger BorrowingFactor { get; set; }
[Parameter("uint256", "fundingFeeAmountPerSize", 5)]
public virtual BigInteger FundingFeeAmountPerSize { get; set; }
[Parameter("uint256", "longTokenClaimableFundingAmountPerSize", 6)]
public virtual BigInteger LongTokenClaimableFundingAmountPerSize { get; set; }
[Parameter("uint256", "shortTokenClaimableFundingAmountPerSize", 7)]
public virtual BigInteger ShortTokenClaimableFundingAmountPerSize { get; set; }
[Parameter("uint256", "increasedAtTime", 8)]
public virtual BigInteger IncreasedAtTime { get; set; }
[Parameter("uint256", "decreasedAtTime", 9)]
public virtual BigInteger DecreasedAtTime { get; set; }
}
}

View File

@@ -0,0 +1,31 @@
using System.Numerics;
using Nethereum.ABI.FunctionEncoding.Attributes;
namespace Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition
{
public partial class PositionReferralFees : PositionReferralFeesBase { }
public class PositionReferralFeesBase
{
[Parameter("bytes32", "referralCode", 1)]
public virtual byte[] ReferralCode { get; set; }
[Parameter("address", "affiliate", 2)]
public virtual string Affiliate { get; set; }
[Parameter("address", "trader", 3)]
public virtual string Trader { get; set; }
[Parameter("uint256", "totalRebateFactor", 4)]
public virtual BigInteger TotalRebateFactor { get; set; }
[Parameter("uint256", "affiliateRewardFactor", 5)]
public virtual BigInteger AffiliateRewardFactor { get; set; }
[Parameter("uint256", "adjustedAffiliateRewardFactor", 6)]
public virtual BigInteger AdjustedAffiliateRewardFactor { get; set; }
[Parameter("uint256", "traderDiscountFactor", 7)]
public virtual BigInteger TraderDiscountFactor { get; set; }
[Parameter("uint256", "totalRebateAmount", 8)]
public virtual BigInteger TotalRebateAmount { get; set; }
[Parameter("uint256", "traderDiscountAmount", 9)]
public virtual BigInteger TraderDiscountAmount { get; set; }
[Parameter("uint256", "affiliateRewardAmount", 10)]
public virtual BigInteger AffiliateRewardAmount { get; set; }
}
}

View File

@@ -0,0 +1,14 @@
using Nethereum.ABI.FunctionEncoding.Attributes;
namespace Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition
{
public partial class PositionType : PositionTypeBase { }
public class PositionTypeBase
{
[Parameter("tuple", "long", 1)]
public virtual CollateralType Long { get; set; }
[Parameter("tuple", "short", 2)]
public virtual CollateralType Short { get; set; }
}
}

View File

@@ -0,0 +1,17 @@
using System.Numerics;
using Nethereum.ABI.FunctionEncoding.Attributes;
namespace Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition
{
public partial class PositionUiFees : PositionUiFeesBase { }
public class PositionUiFeesBase
{
[Parameter("address", "uiFeeReceiver", 1)]
public virtual string UiFeeReceiver { get; set; }
[Parameter("uint256", "uiFeeReceiverFactor", 2)]
public virtual BigInteger UiFeeReceiverFactor { get; set; }
[Parameter("uint256", "uiFeeAmount", 3)]
public virtual BigInteger UiFeeAmount { get; set; }
}
}

View File

@@ -0,0 +1,23 @@
using System.Numerics;
using Nethereum.ABI.FunctionEncoding.Attributes;
namespace Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition
{
public partial class SwapFees : SwapFeesBase { }
public class SwapFeesBase
{
[Parameter("uint256", "feeReceiverAmount", 1)]
public virtual BigInteger FeeReceiverAmount { get; set; }
[Parameter("uint256", "feeAmountForPool", 2)]
public virtual BigInteger FeeAmountForPool { get; set; }
[Parameter("uint256", "amountAfterFees", 3)]
public virtual BigInteger AmountAfterFees { get; set; }
[Parameter("address", "uiFeeReceiver", 4)]
public virtual string UiFeeReceiver { get; set; }
[Parameter("uint256", "uiFeeReceiverFactor", 5)]
public virtual BigInteger UiFeeReceiverFactor { get; set; }
[Parameter("uint256", "uiFeeAmount", 6)]
public virtual BigInteger UiFeeAmount { get; set; }
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,17 @@
using System.Numerics;
using Nethereum.ABI.FunctionEncoding.Attributes;
namespace Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition
{
public partial class VirtualInventory : VirtualInventoryBase { }
public class VirtualInventoryBase
{
[Parameter("uint256", "virtualPoolAmountForLongToken", 1)]
public virtual BigInteger VirtualPoolAmountForLongToken { get; set; }
[Parameter("uint256", "virtualPoolAmountForShortToken", 2)]
public virtual BigInteger VirtualPoolAmountForShortToken { get; set; }
[Parameter("int256", "virtualInventoryForPositions", 3)]
public virtual BigInteger VirtualInventoryForPositions { get; set; }
}
}

View File

@@ -0,0 +1,748 @@
using System.Numerics;
using Managing.ABI.GmxV2.Reader.ContractDefinition;
using Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition;
using Nethereum.RPC.Eth.DTOs;
using Nethereum.Web3;
using GetAccountOrdersFunction = Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.GetAccountOrdersFunction;
using GetAccountOrdersOutputDTO = Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.GetAccountOrdersOutputDTO;
using GetAccountPositionInfoListFunction =
Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.GetAccountPositionInfoListFunction;
using GetAccountPositionInfoListOutputDTO =
Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.GetAccountPositionInfoListOutputDTO;
using GetAccountPositionsFunction = Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.GetAccountPositionsFunction;
using GetAccountPositionsOutputDTO =
Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.GetAccountPositionsOutputDTO;
using GetAdlStateFunction = Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.GetAdlStateFunction;
using GetAdlStateOutputDTO = Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.GetAdlStateOutputDTO;
using GetDepositAmountOutFunction = Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.GetDepositAmountOutFunction;
using GetDepositFunction = Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.GetDepositFunction;
using GetDepositOutputDTO = Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.GetDepositOutputDTO;
using GetExecutionPriceFunction = Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.GetExecutionPriceFunction;
using GetExecutionPriceOutputDTO = Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.GetExecutionPriceOutputDTO;
using GetMarketBySaltFunction = Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.GetMarketBySaltFunction;
using GetMarketBySaltOutputDTO = Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.GetMarketBySaltOutputDTO;
using GetMarketFunction = Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.GetMarketFunction;
using GetMarketInfoFunction = Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.GetMarketInfoFunction;
using GetMarketInfoListFunction = Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.GetMarketInfoListFunction;
using GetMarketInfoListOutputDTO = Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.GetMarketInfoListOutputDTO;
using GetMarketInfoOutputDTO = Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.GetMarketInfoOutputDTO;
using GetMarketOutputDTO = Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.GetMarketOutputDTO;
using GetMarketsFunction = Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.GetMarketsFunction;
using GetMarketsOutputDTO = Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.GetMarketsOutputDTO;
using GetMarketTokenPriceFunction = Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.GetMarketTokenPriceFunction;
using GetMarketTokenPriceOutputDTO =
Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.GetMarketTokenPriceOutputDTO;
using GetNetPnlFunction = Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.GetNetPnlFunction;
using GetOpenInterestWithPnlFunction =
Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.GetOpenInterestWithPnlFunction;
using GetOrderFunction = Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.GetOrderFunction;
using GetOrderOutputDTO = Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.GetOrderOutputDTO;
using GetPnlFunction = Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.GetPnlFunction;
using GetPnlToPoolFactorFunction = Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.GetPnlToPoolFactorFunction;
using GetPositionFunction = Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.GetPositionFunction;
using GetPositionInfoFunction = Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.GetPositionInfoFunction;
using GetPositionInfoOutputDTO = Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.GetPositionInfoOutputDTO;
using GetPositionOutputDTO = Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.GetPositionOutputDTO;
using GetPositionPnlUsdFunction = Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.GetPositionPnlUsdFunction;
using GetPositionPnlUsdOutputDTO = Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.GetPositionPnlUsdOutputDTO;
using GetShiftFunction = Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.GetShiftFunction;
using GetShiftOutputDTO = Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.GetShiftOutputDTO;
using GetSwapAmountOutFunction = Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.GetSwapAmountOutFunction;
using GetSwapAmountOutOutputDTO = Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.GetSwapAmountOutOutputDTO;
using GetSwapPriceImpactFunction = Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.GetSwapPriceImpactFunction;
using GetSwapPriceImpactOutputDTO = Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.GetSwapPriceImpactOutputDTO;
using GetWithdrawalAmountOutFunction =
Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.GetWithdrawalAmountOutFunction;
using GetWithdrawalAmountOutOutputDTO =
Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.GetWithdrawalAmountOutOutputDTO;
using GetWithdrawalFunction = Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.GetWithdrawalFunction;
using GetWithdrawalOutputDTO = Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.GetWithdrawalOutputDTO;
using MarketPrices = Managing.ABI.GmxV2.SyntheticsReader.ContractDefinition.MarketPrices;
namespace Managing.ABI.GmxV2.SyntheticsReader
{
public partial class SyntheticsReaderService : ContractWeb3ServiceBase
{
public static Task<TransactionReceipt> DeployContractAndWaitForReceiptAsync(IWeb3 web3,
SyntheticsReaderDeployment syntheticsReaderDeployment,
CancellationTokenSource cancellationTokenSource = null)
{
return web3.Eth.GetContractDeploymentHandler<SyntheticsReaderDeployment>()
.SendRequestAndWaitForReceiptAsync(syntheticsReaderDeployment, cancellationTokenSource);
}
public static Task<string> DeployContractAsync(IWeb3 web3,
SyntheticsReaderDeployment syntheticsReaderDeployment)
{
return web3.Eth.GetContractDeploymentHandler<SyntheticsReaderDeployment>()
.SendRequestAsync(syntheticsReaderDeployment);
}
public static async Task<SyntheticsReaderService> DeployContractAndGetServiceAsync(IWeb3 web3,
SyntheticsReaderDeployment syntheticsReaderDeployment,
CancellationTokenSource cancellationTokenSource = null)
{
var receipt =
await DeployContractAndWaitForReceiptAsync(web3, syntheticsReaderDeployment, cancellationTokenSource);
return new SyntheticsReaderService(web3, receipt.ContractAddress);
}
public SyntheticsReaderService(IWeb3 web3, string contractAddress) : base(web3, contractAddress)
{
}
public Task<GetAccountOrdersOutputDTO> GetAccountOrdersQueryAsync(
GetAccountOrdersFunction getAccountOrdersFunction, BlockParameter blockParameter = null)
{
return ContractHandler.QueryDeserializingToObjectAsync<GetAccountOrdersFunction, GetAccountOrdersOutputDTO>(
getAccountOrdersFunction, blockParameter);
}
public Task<GetAccountOrdersOutputDTO> GetAccountOrdersQueryAsync(string dataStore, string account,
BigInteger start, BigInteger end, BlockParameter blockParameter = null)
{
var getAccountOrdersFunction = new GetAccountOrdersFunction();
getAccountOrdersFunction.DataStore = dataStore;
getAccountOrdersFunction.Account = account;
getAccountOrdersFunction.Start = start;
getAccountOrdersFunction.End = end;
return ContractHandler.QueryDeserializingToObjectAsync<GetAccountOrdersFunction, GetAccountOrdersOutputDTO>(
getAccountOrdersFunction, blockParameter);
}
public Task<GetAccountPositionInfoListOutputDTO> GetAccountPositionInfoListQueryAsync(
GetAccountPositionInfoListFunction getAccountPositionInfoListFunction, BlockParameter blockParameter = null)
{
return ContractHandler
.QueryDeserializingToObjectAsync<GetAccountPositionInfoListFunction,
GetAccountPositionInfoListOutputDTO>(getAccountPositionInfoListFunction, blockParameter);
}
public Task<GetAccountPositionInfoListOutputDTO> GetAccountPositionInfoListQueryAsync(string dataStore,
string referralStorage, string account, List<string> markets, List<MarketPrices> marketPrices,
string uiFeeReceiver, BigInteger start, BigInteger end, BlockParameter blockParameter = null)
{
var getAccountPositionInfoListFunction = new GetAccountPositionInfoListFunction();
getAccountPositionInfoListFunction.DataStore = dataStore;
getAccountPositionInfoListFunction.ReferralStorage = referralStorage;
getAccountPositionInfoListFunction.Account = account;
getAccountPositionInfoListFunction.Markets = markets;
getAccountPositionInfoListFunction.MarketPrices = marketPrices;
getAccountPositionInfoListFunction.UiFeeReceiver = uiFeeReceiver;
getAccountPositionInfoListFunction.Start = start;
getAccountPositionInfoListFunction.End = end;
return ContractHandler
.QueryDeserializingToObjectAsync<GetAccountPositionInfoListFunction,
GetAccountPositionInfoListOutputDTO>(getAccountPositionInfoListFunction, blockParameter);
}
public Task<GetAccountPositionsOutputDTO> GetAccountPositionsQueryAsync(
GetAccountPositionsFunction getAccountPositionsFunction, BlockParameter blockParameter = null)
{
return ContractHandler
.QueryDeserializingToObjectAsync<GetAccountPositionsFunction, GetAccountPositionsOutputDTO>(
getAccountPositionsFunction, blockParameter);
}
public Task<GetAccountPositionsOutputDTO> GetAccountPositionsQueryAsync(string dataStore, string account,
BigInteger start, BigInteger end, BlockParameter blockParameter = null)
{
var getAccountPositionsFunction = new GetAccountPositionsFunction();
getAccountPositionsFunction.DataStore = dataStore;
getAccountPositionsFunction.Account = account;
getAccountPositionsFunction.Start = start;
getAccountPositionsFunction.End = end;
return ContractHandler
.QueryDeserializingToObjectAsync<GetAccountPositionsFunction, GetAccountPositionsOutputDTO>(
getAccountPositionsFunction, blockParameter);
}
public Task<GetAdlStateOutputDTO> GetAdlStateQueryAsync(GetAdlStateFunction getAdlStateFunction,
BlockParameter blockParameter = null)
{
return ContractHandler.QueryDeserializingToObjectAsync<GetAdlStateFunction, GetAdlStateOutputDTO>(
getAdlStateFunction, blockParameter);
}
public Task<GetAdlStateOutputDTO> GetAdlStateQueryAsync(string dataStore, string market, bool isLong,
MarketPrices prices, BlockParameter blockParameter = null)
{
var getAdlStateFunction = new GetAdlStateFunction();
getAdlStateFunction.DataStore = dataStore;
getAdlStateFunction.Market = market;
getAdlStateFunction.IsLong = isLong;
getAdlStateFunction.Prices = prices;
return ContractHandler.QueryDeserializingToObjectAsync<GetAdlStateFunction, GetAdlStateOutputDTO>(
getAdlStateFunction, blockParameter);
}
public Task<GetDepositOutputDTO> GetDepositQueryAsync(GetDepositFunction getDepositFunction,
BlockParameter blockParameter = null)
{
return ContractHandler.QueryDeserializingToObjectAsync<GetDepositFunction, GetDepositOutputDTO>(
getDepositFunction, blockParameter);
}
public Task<GetDepositOutputDTO> GetDepositQueryAsync(string dataStore, byte[] key,
BlockParameter blockParameter = null)
{
var getDepositFunction = new GetDepositFunction();
getDepositFunction.DataStore = dataStore;
getDepositFunction.Key = key;
return ContractHandler.QueryDeserializingToObjectAsync<GetDepositFunction, GetDepositOutputDTO>(
getDepositFunction, blockParameter);
}
public Task<BigInteger> GetDepositAmountOutQueryAsync(GetDepositAmountOutFunction getDepositAmountOutFunction,
BlockParameter blockParameter = null)
{
return ContractHandler.QueryAsync<GetDepositAmountOutFunction, BigInteger>(getDepositAmountOutFunction,
blockParameter);
}
public Task<BigInteger> GetDepositAmountOutQueryAsync(string dataStore, MarketsProps market,
MarketPrices prices, BigInteger longTokenAmount, BigInteger shortTokenAmount, string uiFeeReceiver,
byte swapPricingType, bool includeVirtualInventoryImpact, BlockParameter blockParameter = null)
{
var getDepositAmountOutFunction = new GetDepositAmountOutFunction();
getDepositAmountOutFunction.DataStore = dataStore;
getDepositAmountOutFunction.Market = market;
getDepositAmountOutFunction.Prices = prices;
getDepositAmountOutFunction.LongTokenAmount = longTokenAmount;
getDepositAmountOutFunction.ShortTokenAmount = shortTokenAmount;
getDepositAmountOutFunction.UiFeeReceiver = uiFeeReceiver;
getDepositAmountOutFunction.SwapPricingType = swapPricingType;
getDepositAmountOutFunction.IncludeVirtualInventoryImpact = includeVirtualInventoryImpact;
return ContractHandler.QueryAsync<GetDepositAmountOutFunction, BigInteger>(getDepositAmountOutFunction,
blockParameter);
}
public Task<GetExecutionPriceOutputDTO> GetExecutionPriceQueryAsync(
GetExecutionPriceFunction getExecutionPriceFunction, BlockParameter blockParameter = null)
{
return ContractHandler
.QueryDeserializingToObjectAsync<GetExecutionPriceFunction, GetExecutionPriceOutputDTO>(
getExecutionPriceFunction, blockParameter);
}
public Task<GetExecutionPriceOutputDTO> GetExecutionPriceQueryAsync(string dataStore, string marketKey,
Props indexTokenPrice, BigInteger positionSizeInUsd, BigInteger positionSizeInTokens,
BigInteger sizeDeltaUsd, bool isLong, BlockParameter blockParameter = null)
{
var getExecutionPriceFunction = new GetExecutionPriceFunction();
getExecutionPriceFunction.DataStore = dataStore;
getExecutionPriceFunction.MarketKey = marketKey;
getExecutionPriceFunction.IndexTokenPrice = indexTokenPrice;
getExecutionPriceFunction.PositionSizeInUsd = positionSizeInUsd;
getExecutionPriceFunction.PositionSizeInTokens = positionSizeInTokens;
getExecutionPriceFunction.SizeDeltaUsd = sizeDeltaUsd;
getExecutionPriceFunction.IsLong = isLong;
return ContractHandler
.QueryDeserializingToObjectAsync<GetExecutionPriceFunction, GetExecutionPriceOutputDTO>(
getExecutionPriceFunction, blockParameter);
}
public Task<GetMarketOutputDTO> GetMarketQueryAsync(GetMarketFunction getMarketFunction,
BlockParameter blockParameter = null)
{
return ContractHandler.QueryDeserializingToObjectAsync<GetMarketFunction, GetMarketOutputDTO>(
getMarketFunction, blockParameter);
}
public Task<GetMarketOutputDTO> GetMarketQueryAsync(string dataStore, string key,
BlockParameter blockParameter = null)
{
var getMarketFunction = new GetMarketFunction();
getMarketFunction.DataStore = dataStore;
getMarketFunction.Key = key;
return ContractHandler.QueryDeserializingToObjectAsync<GetMarketFunction, GetMarketOutputDTO>(
getMarketFunction, blockParameter);
}
public Task<GetMarketBySaltOutputDTO> GetMarketBySaltQueryAsync(GetMarketBySaltFunction getMarketBySaltFunction,
BlockParameter blockParameter = null)
{
return ContractHandler.QueryDeserializingToObjectAsync<GetMarketBySaltFunction, GetMarketBySaltOutputDTO>(
getMarketBySaltFunction, blockParameter);
}
public Task<GetMarketBySaltOutputDTO> GetMarketBySaltQueryAsync(string dataStore, byte[] salt,
BlockParameter blockParameter = null)
{
var getMarketBySaltFunction = new GetMarketBySaltFunction();
getMarketBySaltFunction.DataStore = dataStore;
getMarketBySaltFunction.Salt = salt;
return ContractHandler.QueryDeserializingToObjectAsync<GetMarketBySaltFunction, GetMarketBySaltOutputDTO>(
getMarketBySaltFunction, blockParameter);
}
public Task<GetMarketInfoOutputDTO> GetMarketInfoQueryAsync(GetMarketInfoFunction getMarketInfoFunction,
BlockParameter blockParameter = null)
{
return ContractHandler.QueryDeserializingToObjectAsync<GetMarketInfoFunction, GetMarketInfoOutputDTO>(
getMarketInfoFunction, blockParameter);
}
public Task<GetMarketInfoOutputDTO> GetMarketInfoQueryAsync(string dataStore, MarketPrices prices,
string marketKey, BlockParameter blockParameter = null)
{
var getMarketInfoFunction = new GetMarketInfoFunction();
getMarketInfoFunction.DataStore = dataStore;
getMarketInfoFunction.Prices = prices;
getMarketInfoFunction.MarketKey = marketKey;
return ContractHandler.QueryDeserializingToObjectAsync<GetMarketInfoFunction, GetMarketInfoOutputDTO>(
getMarketInfoFunction, blockParameter);
}
public Task<GetMarketInfoListOutputDTO> GetMarketInfoListQueryAsync(
GetMarketInfoListFunction getMarketInfoListFunction, BlockParameter blockParameter = null)
{
return ContractHandler
.QueryDeserializingToObjectAsync<GetMarketInfoListFunction, GetMarketInfoListOutputDTO>(
getMarketInfoListFunction, blockParameter);
}
public Task<GetMarketInfoListOutputDTO> GetMarketInfoListQueryAsync(string dataStore,
List<MarketPrices> marketPricesList, BigInteger start, BigInteger end, BlockParameter blockParameter = null)
{
var getMarketInfoListFunction = new GetMarketInfoListFunction();
getMarketInfoListFunction.DataStore = dataStore;
getMarketInfoListFunction.MarketPricesList = marketPricesList;
getMarketInfoListFunction.Start = start;
getMarketInfoListFunction.End = end;
return ContractHandler
.QueryDeserializingToObjectAsync<GetMarketInfoListFunction, GetMarketInfoListOutputDTO>(
getMarketInfoListFunction, blockParameter);
}
public Task<GetMarketTokenPriceOutputDTO> GetMarketTokenPriceQueryAsync(
GetMarketTokenPriceFunction getMarketTokenPriceFunction, BlockParameter blockParameter = null)
{
return ContractHandler
.QueryDeserializingToObjectAsync<GetMarketTokenPriceFunction, GetMarketTokenPriceOutputDTO>(
getMarketTokenPriceFunction, blockParameter);
}
public Task<GetMarketTokenPriceOutputDTO> GetMarketTokenPriceQueryAsync(string dataStore, Props market,
Props indexTokenPrice, Props longTokenPrice, Props shortTokenPrice, byte[] pnlFactorType, bool maximize,
BlockParameter blockParameter = null)
{
var getMarketTokenPriceFunction = new GetMarketTokenPriceFunction();
getMarketTokenPriceFunction.DataStore = dataStore;
getMarketTokenPriceFunction.Market = market;
getMarketTokenPriceFunction.IndexTokenPrice = indexTokenPrice;
getMarketTokenPriceFunction.LongTokenPrice = longTokenPrice;
getMarketTokenPriceFunction.ShortTokenPrice = shortTokenPrice;
getMarketTokenPriceFunction.PnlFactorType = pnlFactorType;
getMarketTokenPriceFunction.Maximize = maximize;
return ContractHandler
.QueryDeserializingToObjectAsync<GetMarketTokenPriceFunction, GetMarketTokenPriceOutputDTO>(
getMarketTokenPriceFunction, blockParameter);
}
public Task<GetMarketsOutputDTO> GetMarketsQueryAsync(GetMarketsFunction getMarketsFunction,
BlockParameter blockParameter = null)
{
return ContractHandler.QueryDeserializingToObjectAsync<GetMarketsFunction, GetMarketsOutputDTO>(
getMarketsFunction, blockParameter);
}
public Task<GetMarketsOutputDTO> GetMarketsQueryAsync(string dataStore, BigInteger start, BigInteger end,
BlockParameter blockParameter = null)
{
var getMarketsFunction = new GetMarketsFunction();
getMarketsFunction.DataStore = dataStore;
getMarketsFunction.Start = start;
getMarketsFunction.End = end;
return ContractHandler.QueryDeserializingToObjectAsync<GetMarketsFunction, GetMarketsOutputDTO>(
getMarketsFunction, blockParameter);
}
public Task<BigInteger> GetNetPnlQueryAsync(GetNetPnlFunction getNetPnlFunction,
BlockParameter blockParameter = null)
{
return ContractHandler.QueryAsync<GetNetPnlFunction, BigInteger>(getNetPnlFunction, blockParameter);
}
public Task<BigInteger> GetNetPnlQueryAsync(string dataStore, Props market, Props indexTokenPrice,
bool maximize, BlockParameter blockParameter = null)
{
var getNetPnlFunction = new GetNetPnlFunction();
getNetPnlFunction.DataStore = dataStore;
getNetPnlFunction.Market = market;
getNetPnlFunction.IndexTokenPrice = indexTokenPrice;
getNetPnlFunction.Maximize = maximize;
return ContractHandler.QueryAsync<GetNetPnlFunction, BigInteger>(getNetPnlFunction, blockParameter);
}
public Task<BigInteger> GetOpenInterestWithPnlQueryAsync(
GetOpenInterestWithPnlFunction getOpenInterestWithPnlFunction, BlockParameter blockParameter = null)
{
return ContractHandler.QueryAsync<GetOpenInterestWithPnlFunction, BigInteger>(
getOpenInterestWithPnlFunction, blockParameter);
}
public Task<BigInteger> GetOpenInterestWithPnlQueryAsync(string dataStore, Props market, Props indexTokenPrice,
bool isLong, bool maximize, BlockParameter blockParameter = null)
{
var getOpenInterestWithPnlFunction = new GetOpenInterestWithPnlFunction();
getOpenInterestWithPnlFunction.DataStore = dataStore;
getOpenInterestWithPnlFunction.Market = market;
getOpenInterestWithPnlFunction.IndexTokenPrice = indexTokenPrice;
getOpenInterestWithPnlFunction.IsLong = isLong;
getOpenInterestWithPnlFunction.Maximize = maximize;
return ContractHandler.QueryAsync<GetOpenInterestWithPnlFunction, BigInteger>(
getOpenInterestWithPnlFunction, blockParameter);
}
public Task<GetOrderOutputDTO> GetOrderQueryAsync(GetOrderFunction getOrderFunction,
BlockParameter blockParameter = null)
{
return ContractHandler.QueryDeserializingToObjectAsync<GetOrderFunction, GetOrderOutputDTO>(
getOrderFunction, blockParameter);
}
public Task<GetOrderOutputDTO> GetOrderQueryAsync(string dataStore, byte[] key,
BlockParameter blockParameter = null)
{
var getOrderFunction = new GetOrderFunction();
getOrderFunction.DataStore = dataStore;
getOrderFunction.Key = key;
return ContractHandler.QueryDeserializingToObjectAsync<GetOrderFunction, GetOrderOutputDTO>(
getOrderFunction, blockParameter);
}
public Task<BigInteger> GetPnlQueryAsync(GetPnlFunction getPnlFunction, BlockParameter blockParameter = null)
{
return ContractHandler.QueryAsync<GetPnlFunction, BigInteger>(getPnlFunction, blockParameter);
}
public Task<BigInteger> GetPnlQueryAsync(string dataStore, Props market, Props indexTokenPrice, bool isLong,
bool maximize, BlockParameter blockParameter = null)
{
var getPnlFunction = new GetPnlFunction();
getPnlFunction.DataStore = dataStore;
getPnlFunction.Market = market;
getPnlFunction.IndexTokenPrice = indexTokenPrice;
getPnlFunction.IsLong = isLong;
getPnlFunction.Maximize = maximize;
return ContractHandler.QueryAsync<GetPnlFunction, BigInteger>(getPnlFunction, blockParameter);
}
public Task<BigInteger> GetPnlToPoolFactorQueryAsync(GetPnlToPoolFactorFunction getPnlToPoolFactorFunction,
BlockParameter blockParameter = null)
{
return ContractHandler.QueryAsync<GetPnlToPoolFactorFunction, BigInteger>(getPnlToPoolFactorFunction,
blockParameter);
}
public Task<BigInteger> GetPnlToPoolFactorQueryAsync(string dataStore, string marketAddress,
MarketPrices prices, bool isLong, bool maximize, BlockParameter blockParameter = null)
{
var getPnlToPoolFactorFunction = new GetPnlToPoolFactorFunction();
getPnlToPoolFactorFunction.DataStore = dataStore;
getPnlToPoolFactorFunction.MarketAddress = marketAddress;
getPnlToPoolFactorFunction.Prices = prices;
getPnlToPoolFactorFunction.IsLong = isLong;
getPnlToPoolFactorFunction.Maximize = maximize;
return ContractHandler.QueryAsync<GetPnlToPoolFactorFunction, BigInteger>(getPnlToPoolFactorFunction,
blockParameter);
}
public Task<GetPositionOutputDTO> GetPositionQueryAsync(GetPositionFunction getPositionFunction,
BlockParameter blockParameter = null)
{
return ContractHandler.QueryDeserializingToObjectAsync<GetPositionFunction, GetPositionOutputDTO>(
getPositionFunction, blockParameter);
}
public Task<GetPositionOutputDTO> GetPositionQueryAsync(string dataStore, byte[] key,
BlockParameter blockParameter = null)
{
var getPositionFunction = new GetPositionFunction();
getPositionFunction.DataStore = dataStore;
getPositionFunction.Key = key;
return ContractHandler.QueryDeserializingToObjectAsync<GetPositionFunction, GetPositionOutputDTO>(
getPositionFunction, blockParameter);
}
public Task<GetPositionInfoOutputDTO> GetPositionInfoQueryAsync(GetPositionInfoFunction getPositionInfoFunction,
BlockParameter blockParameter = null)
{
return ContractHandler.QueryDeserializingToObjectAsync<GetPositionInfoFunction, GetPositionInfoOutputDTO>(
getPositionInfoFunction, blockParameter);
}
public Task<GetPositionInfoOutputDTO> GetPositionInfoQueryAsync(string dataStore, string referralStorage,
byte[] positionKey, MarketPrices prices, BigInteger sizeDeltaUsd, string uiFeeReceiver,
bool usePositionSizeAsSizeDeltaUsd, BlockParameter blockParameter = null)
{
var getPositionInfoFunction = new GetPositionInfoFunction();
getPositionInfoFunction.DataStore = dataStore;
getPositionInfoFunction.ReferralStorage = referralStorage;
getPositionInfoFunction.PositionKey = positionKey;
getPositionInfoFunction.Prices = prices;
getPositionInfoFunction.SizeDeltaUsd = sizeDeltaUsd;
getPositionInfoFunction.UiFeeReceiver = uiFeeReceiver;
getPositionInfoFunction.UsePositionSizeAsSizeDeltaUsd = usePositionSizeAsSizeDeltaUsd;
return ContractHandler.QueryDeserializingToObjectAsync<GetPositionInfoFunction, GetPositionInfoOutputDTO>(
getPositionInfoFunction, blockParameter);
}
public Task<GetPositionInfoListOutputDTO> GetPositionInfoListQueryAsync(
GetPositionInfoListFunction getPositionInfoListFunction, BlockParameter blockParameter = null)
{
return ContractHandler
.QueryDeserializingToObjectAsync<GetPositionInfoListFunction, GetPositionInfoListOutputDTO>(
getPositionInfoListFunction, blockParameter);
}
public Task<GetPositionInfoListOutputDTO> GetPositionInfoListQueryAsync(string dataStore,
string referralStorage, List<byte[]> positionKeys, List<MarketPrices> prices, string uiFeeReceiver,
BlockParameter blockParameter = null)
{
var getPositionInfoListFunction = new GetPositionInfoListFunction();
getPositionInfoListFunction.DataStore = dataStore;
getPositionInfoListFunction.ReferralStorage = referralStorage;
getPositionInfoListFunction.PositionKeys = positionKeys;
getPositionInfoListFunction.Prices = prices;
getPositionInfoListFunction.UiFeeReceiver = uiFeeReceiver;
return ContractHandler
.QueryDeserializingToObjectAsync<GetPositionInfoListFunction, GetPositionInfoListOutputDTO>(
getPositionInfoListFunction, blockParameter);
}
public Task<GetPositionPnlUsdOutputDTO> GetPositionPnlUsdQueryAsync(
GetPositionPnlUsdFunction getPositionPnlUsdFunction, BlockParameter blockParameter = null)
{
return ContractHandler
.QueryDeserializingToObjectAsync<GetPositionPnlUsdFunction, GetPositionPnlUsdOutputDTO>(
getPositionPnlUsdFunction, blockParameter);
}
public Task<GetPositionPnlUsdOutputDTO> GetPositionPnlUsdQueryAsync(string dataStore, Props market,
MarketPrices prices, byte[] positionKey, BigInteger sizeDeltaUsd, BlockParameter blockParameter = null)
{
var getPositionPnlUsdFunction = new GetPositionPnlUsdFunction();
getPositionPnlUsdFunction.DataStore = dataStore;
getPositionPnlUsdFunction.Market = market;
getPositionPnlUsdFunction.Prices = prices;
getPositionPnlUsdFunction.PositionKey = positionKey;
getPositionPnlUsdFunction.SizeDeltaUsd = sizeDeltaUsd;
return ContractHandler
.QueryDeserializingToObjectAsync<GetPositionPnlUsdFunction, GetPositionPnlUsdOutputDTO>(
getPositionPnlUsdFunction, blockParameter);
}
public Task<GetShiftOutputDTO> GetShiftQueryAsync(GetShiftFunction getShiftFunction,
BlockParameter blockParameter = null)
{
return ContractHandler.QueryDeserializingToObjectAsync<GetShiftFunction, GetShiftOutputDTO>(
getShiftFunction, blockParameter);
}
public Task<GetShiftOutputDTO> GetShiftQueryAsync(string dataStore, byte[] key,
BlockParameter blockParameter = null)
{
var getShiftFunction = new GetShiftFunction();
getShiftFunction.DataStore = dataStore;
getShiftFunction.Key = key;
return ContractHandler.QueryDeserializingToObjectAsync<GetShiftFunction, GetShiftOutputDTO>(
getShiftFunction, blockParameter);
}
public Task<GetSwapAmountOutOutputDTO> GetSwapAmountOutQueryAsync(
GetSwapAmountOutFunction getSwapAmountOutFunction, BlockParameter blockParameter = null)
{
return ContractHandler.QueryDeserializingToObjectAsync<GetSwapAmountOutFunction, GetSwapAmountOutOutputDTO>(
getSwapAmountOutFunction, blockParameter);
}
public Task<GetSwapAmountOutOutputDTO> GetSwapAmountOutQueryAsync(string dataStore, Props market,
MarketPrices prices, string tokenIn, BigInteger amountIn, string uiFeeReceiver,
BlockParameter blockParameter = null)
{
var getSwapAmountOutFunction = new GetSwapAmountOutFunction();
getSwapAmountOutFunction.DataStore = dataStore;
getSwapAmountOutFunction.Market = market;
getSwapAmountOutFunction.Prices = prices;
getSwapAmountOutFunction.TokenIn = tokenIn;
getSwapAmountOutFunction.AmountIn = amountIn;
getSwapAmountOutFunction.UiFeeReceiver = uiFeeReceiver;
return ContractHandler.QueryDeserializingToObjectAsync<GetSwapAmountOutFunction, GetSwapAmountOutOutputDTO>(
getSwapAmountOutFunction, blockParameter);
}
public Task<GetSwapPriceImpactOutputDTO> GetSwapPriceImpactQueryAsync(
GetSwapPriceImpactFunction getSwapPriceImpactFunction, BlockParameter blockParameter = null)
{
return ContractHandler
.QueryDeserializingToObjectAsync<GetSwapPriceImpactFunction, GetSwapPriceImpactOutputDTO>(
getSwapPriceImpactFunction, blockParameter);
}
public Task<GetSwapPriceImpactOutputDTO> GetSwapPriceImpactQueryAsync(string dataStore, string marketKey,
string tokenIn, string tokenOut, BigInteger amountIn, Props tokenInPrice, Props tokenOutPrice,
BlockParameter blockParameter = null)
{
var getSwapPriceImpactFunction = new GetSwapPriceImpactFunction();
getSwapPriceImpactFunction.DataStore = dataStore;
getSwapPriceImpactFunction.MarketKey = marketKey;
getSwapPriceImpactFunction.TokenIn = tokenIn;
getSwapPriceImpactFunction.TokenOut = tokenOut;
getSwapPriceImpactFunction.AmountIn = amountIn;
getSwapPriceImpactFunction.TokenInPrice = tokenInPrice;
getSwapPriceImpactFunction.TokenOutPrice = tokenOutPrice;
return ContractHandler
.QueryDeserializingToObjectAsync<GetSwapPriceImpactFunction, GetSwapPriceImpactOutputDTO>(
getSwapPriceImpactFunction, blockParameter);
}
public Task<GetWithdrawalOutputDTO> GetWithdrawalQueryAsync(GetWithdrawalFunction getWithdrawalFunction,
BlockParameter blockParameter = null)
{
return ContractHandler.QueryDeserializingToObjectAsync<GetWithdrawalFunction, GetWithdrawalOutputDTO>(
getWithdrawalFunction, blockParameter);
}
public Task<GetWithdrawalOutputDTO> GetWithdrawalQueryAsync(string dataStore, byte[] key,
BlockParameter blockParameter = null)
{
var getWithdrawalFunction = new GetWithdrawalFunction();
getWithdrawalFunction.DataStore = dataStore;
getWithdrawalFunction.Key = key;
return ContractHandler.QueryDeserializingToObjectAsync<GetWithdrawalFunction, GetWithdrawalOutputDTO>(
getWithdrawalFunction, blockParameter);
}
public Task<GetWithdrawalAmountOutOutputDTO> GetWithdrawalAmountOutQueryAsync(
GetWithdrawalAmountOutFunction getWithdrawalAmountOutFunction, BlockParameter blockParameter = null)
{
return ContractHandler
.QueryDeserializingToObjectAsync<GetWithdrawalAmountOutFunction, GetWithdrawalAmountOutOutputDTO>(
getWithdrawalAmountOutFunction, blockParameter);
}
public Task<GetWithdrawalAmountOutOutputDTO> GetWithdrawalAmountOutQueryAsync(string dataStore, Props market,
MarketPrices prices, BigInteger marketTokenAmount, string uiFeeReceiver, byte swapPricingType,
BlockParameter blockParameter = null)
{
var getWithdrawalAmountOutFunction = new GetWithdrawalAmountOutFunction();
getWithdrawalAmountOutFunction.DataStore = dataStore;
getWithdrawalAmountOutFunction.Market = market;
getWithdrawalAmountOutFunction.Prices = prices;
getWithdrawalAmountOutFunction.MarketTokenAmount = marketTokenAmount;
getWithdrawalAmountOutFunction.UiFeeReceiver = uiFeeReceiver;
getWithdrawalAmountOutFunction.SwapPricingType = swapPricingType;
return ContractHandler
.QueryDeserializingToObjectAsync<GetWithdrawalAmountOutFunction, GetWithdrawalAmountOutOutputDTO>(
getWithdrawalAmountOutFunction, blockParameter);
}
public Task<IsPositionLiquidatableOutputDTO> IsPositionLiquidatableQueryAsync(
IsPositionLiquidatableFunction isPositionLiquidatableFunction, BlockParameter blockParameter = null)
{
return ContractHandler
.QueryDeserializingToObjectAsync<IsPositionLiquidatableFunction, IsPositionLiquidatableOutputDTO>(
isPositionLiquidatableFunction, blockParameter);
}
public Task<IsPositionLiquidatableOutputDTO> IsPositionLiquidatableQueryAsync(string dataStore,
string referralStorage, byte[] positionKey, Props market, MarketPrices prices,
bool shouldValidateMinCollateralUsd, BlockParameter blockParameter = null)
{
var isPositionLiquidatableFunction = new IsPositionLiquidatableFunction();
isPositionLiquidatableFunction.DataStore = dataStore;
isPositionLiquidatableFunction.ReferralStorage = referralStorage;
isPositionLiquidatableFunction.PositionKey = positionKey;
isPositionLiquidatableFunction.Market = market;
isPositionLiquidatableFunction.Prices = prices;
isPositionLiquidatableFunction.ShouldValidateMinCollateralUsd = shouldValidateMinCollateralUsd;
return ContractHandler
.QueryDeserializingToObjectAsync<IsPositionLiquidatableFunction, IsPositionLiquidatableOutputDTO>(
isPositionLiquidatableFunction, blockParameter);
}
public override List<Type> GetAllFunctionTypes()
{
return new List<Type>
{
typeof(GetAccountOrdersFunction),
typeof(GetAccountPositionInfoListFunction),
typeof(GetAccountPositionsFunction),
typeof(GetAdlStateFunction),
typeof(GetDepositFunction),
typeof(GetDepositAmountOutFunction),
typeof(GetExecutionPriceFunction),
typeof(GetMarketFunction),
typeof(GetMarketBySaltFunction),
typeof(GetMarketInfoFunction),
typeof(GetMarketInfoListFunction),
typeof(GetMarketTokenPriceFunction),
typeof(GetMarketsFunction),
typeof(GetNetPnlFunction),
typeof(GetOpenInterestWithPnlFunction),
typeof(GetOrderFunction),
typeof(GetPnlFunction),
typeof(GetPnlToPoolFactorFunction),
typeof(GetPositionFunction),
typeof(GetPositionInfoFunction),
typeof(GetPositionInfoListFunction),
typeof(GetPositionPnlUsdFunction),
typeof(GetShiftFunction),
typeof(GetSwapAmountOutFunction),
typeof(GetSwapPriceImpactFunction),
typeof(GetWithdrawalFunction),
typeof(GetWithdrawalAmountOutFunction),
typeof(IsPositionLiquidatableFunction)
};
}
public override List<Type> GetAllEventTypes()
{
return new List<Type>
{
};
}
public override List<Type> GetAllErrorTypes()
{
return new List<Type>
{
};
}
}
}