Gmx v2 - Funding rates (#6)
* Setup GMX v2 * Add get markets * Map token with service * Add get market info data * Add get markets * Add get market token prices * Get markets infos multicall * Try call datastore * Add some tests to figure out why datastore call dont work * Update funding rates * clean
This commit is contained in:
1
src/Managing.ABI.GmxV2/Contracts/DataStore.abi
Normal file
1
src/Managing.ABI.GmxV2/Contracts/DataStore.abi
Normal file
File diff suppressed because one or more lines are too long
1
src/Managing.ABI.GmxV2/Contracts/DataStore.bin
Normal file
1
src/Managing.ABI.GmxV2/Contracts/DataStore.bin
Normal file
File diff suppressed because one or more lines are too long
1
src/Managing.ABI.GmxV2/Contracts/Multicall3.abi
Normal file
1
src/Managing.ABI.GmxV2/Contracts/Multicall3.abi
Normal file
File diff suppressed because one or more lines are too long
1
src/Managing.ABI.GmxV2/Contracts/Multicall3.bin
Normal file
1
src/Managing.ABI.GmxV2/Contracts/Multicall3.bin
Normal file
File diff suppressed because one or more lines are too long
1
src/Managing.ABI.GmxV2/Contracts/Reader.abi
Normal file
1
src/Managing.ABI.GmxV2/Contracts/Reader.abi
Normal file
File diff suppressed because one or more lines are too long
1
src/Managing.ABI.GmxV2/Contracts/Reader.bin
Normal file
1
src/Managing.ABI.GmxV2/Contracts/Reader.bin
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1655
src/Managing.ABI.GmxV2/DataStore/DataStoreService.cs
Normal file
1655
src/Managing.ABI.GmxV2/DataStore/DataStoreService.cs
Normal file
File diff suppressed because it is too large
Load Diff
15
src/Managing.ABI.GmxV2/Managing.ABI.GmxV2.csproj
Normal file
15
src/Managing.ABI.GmxV2/Managing.ABI.GmxV2.csproj
Normal file
@@ -0,0 +1,15 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Nethereum.Contracts" Version="4.21.3"/>
|
||||
<PackageReference Include="Nethereum.Web3" Version="4.21.2"/>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
14
src/Managing.ABI.GmxV2/Multicall3/ContractDefinition/Call.cs
Normal file
14
src/Managing.ABI.GmxV2/Multicall3/ContractDefinition/Call.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using Nethereum.ABI.FunctionEncoding.Attributes;
|
||||
|
||||
namespace Managing.ABI.GmxV2.Multicall3.ContractDefinition
|
||||
{
|
||||
public partial class Call : CallBase
|
||||
{
|
||||
}
|
||||
|
||||
public class CallBase
|
||||
{
|
||||
[Parameter("address", "target", 1)] public virtual string Target { get; set; }
|
||||
[Parameter("bytes", "callData", 2)] public virtual byte[] CallData { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
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; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
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
@@ -0,0 +1,14 @@
|
||||
using Nethereum.ABI.FunctionEncoding.Attributes;
|
||||
|
||||
namespace Managing.ABI.GmxV2.Multicall3.ContractDefinition
|
||||
{
|
||||
public partial class Result : ResultBase
|
||||
{
|
||||
}
|
||||
|
||||
public class ResultBase
|
||||
{
|
||||
[Parameter("bool", "success", 1)] public virtual bool Success { get; set; }
|
||||
[Parameter("bytes", "returnData", 2)] public virtual byte[] ReturnData { get; set; }
|
||||
}
|
||||
}
|
||||
362
src/Managing.ABI.GmxV2/Multicall3/Multicall3Service.cs
Normal file
362
src/Managing.ABI.GmxV2/Multicall3/Multicall3Service.cs
Normal file
@@ -0,0 +1,362 @@
|
||||
using System.Numerics;
|
||||
using Managing.ABI.GmxV2.Multicall3.ContractDefinition;
|
||||
using Nethereum.RPC.Eth.DTOs;
|
||||
using Nethereum.Web3;
|
||||
|
||||
namespace Managing.ABI.GmxV2.Multicall3
|
||||
{
|
||||
public partial class Multicall3Service : ContractWeb3ServiceBase
|
||||
{
|
||||
public static Task<TransactionReceipt> DeployContractAndWaitForReceiptAsync(Nethereum.Web3.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)
|
||||
{
|
||||
return web3.Eth.GetContractDeploymentHandler<Multicall3Deployment>().SendRequestAsync(multicall3Deployment);
|
||||
}
|
||||
|
||||
public static async Task<Multicall3Service> DeployContractAndGetServiceAsync(Nethereum.Web3.IWeb3 web3,
|
||||
Multicall3Deployment multicall3Deployment, CancellationTokenSource cancellationTokenSource = null)
|
||||
{
|
||||
var receipt =
|
||||
await DeployContractAndWaitForReceiptAsync(web3, multicall3Deployment, cancellationTokenSource);
|
||||
return new Multicall3Service(web3, receipt.ContractAddress);
|
||||
}
|
||||
|
||||
public Multicall3Service(Nethereum.Web3.IWeb3 web3, string contractAddress) : base(web3, contractAddress)
|
||||
{
|
||||
}
|
||||
|
||||
public Task<string> AggregateRequestAsync(AggregateFunction aggregateFunction)
|
||||
{
|
||||
return ContractHandler.SendRequestAsync(aggregateFunction);
|
||||
}
|
||||
|
||||
public Task<TransactionReceipt> AggregateRequestAndWaitForReceiptAsync(AggregateFunction aggregateFunction,
|
||||
CancellationTokenSource cancellationToken = null)
|
||||
{
|
||||
return ContractHandler.SendRequestAndWaitForReceiptAsync(aggregateFunction, cancellationToken);
|
||||
}
|
||||
|
||||
public Task<string> AggregateRequestAsync(List<Call> calls)
|
||||
{
|
||||
var aggregateFunction = new AggregateFunction();
|
||||
aggregateFunction.Calls = calls;
|
||||
|
||||
return ContractHandler.SendRequestAsync(aggregateFunction);
|
||||
}
|
||||
|
||||
public Task<TransactionReceipt> AggregateRequestAndWaitForReceiptAsync(List<Call> calls,
|
||||
CancellationTokenSource cancellationToken = null)
|
||||
{
|
||||
var aggregateFunction = new AggregateFunction();
|
||||
aggregateFunction.Calls = calls;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
public Task<TransactionReceipt> BlockAndAggregateRequestAndWaitForReceiptAsync(
|
||||
BlockAndAggregateFunction blockAndAggregateFunction, CancellationTokenSource cancellationToken = null)
|
||||
{
|
||||
return ContractHandler.SendRequestAndWaitForReceiptAsync(blockAndAggregateFunction, cancellationToken);
|
||||
}
|
||||
|
||||
public Task<string> BlockAndAggregateRequestAsync(List<Call> calls)
|
||||
{
|
||||
var blockAndAggregateFunction = new BlockAndAggregateFunction();
|
||||
blockAndAggregateFunction.Calls = calls;
|
||||
|
||||
return ContractHandler.SendRequestAsync(blockAndAggregateFunction);
|
||||
}
|
||||
|
||||
public Task<TransactionReceipt> BlockAndAggregateRequestAndWaitForReceiptAsync(List<Call> calls,
|
||||
CancellationTokenSource cancellationToken = null)
|
||||
{
|
||||
var blockAndAggregateFunction = new BlockAndAggregateFunction();
|
||||
blockAndAggregateFunction.Calls = calls;
|
||||
|
||||
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)
|
||||
{
|
||||
return ContractHandler.QueryAsync<GetBlockHashFunction, byte[]>(getBlockHashFunction, blockParameter);
|
||||
}
|
||||
|
||||
|
||||
public Task<byte[]> GetBlockHashQueryAsync(BigInteger blockNumber, BlockParameter blockParameter = null)
|
||||
{
|
||||
var getBlockHashFunction = new GetBlockHashFunction();
|
||||
getBlockHashFunction.BlockNumber = blockNumber;
|
||||
|
||||
return ContractHandler.QueryAsync<GetBlockHashFunction, byte[]>(getBlockHashFunction, blockParameter);
|
||||
}
|
||||
|
||||
public Task<BigInteger> GetBlockNumberQueryAsync(GetBlockNumberFunction getBlockNumberFunction,
|
||||
BlockParameter blockParameter = null)
|
||||
{
|
||||
return ContractHandler.QueryAsync<GetBlockNumberFunction, BigInteger>(getBlockNumberFunction,
|
||||
blockParameter);
|
||||
}
|
||||
|
||||
|
||||
public Task<BigInteger> GetBlockNumberQueryAsync(BlockParameter blockParameter = null)
|
||||
{
|
||||
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)
|
||||
{
|
||||
return ContractHandler.QueryAsync<GetCurrentBlockCoinbaseFunction, string>(getCurrentBlockCoinbaseFunction,
|
||||
blockParameter);
|
||||
}
|
||||
|
||||
|
||||
public Task<string> GetCurrentBlockCoinbaseQueryAsync(BlockParameter blockParameter = null)
|
||||
{
|
||||
return ContractHandler.QueryAsync<GetCurrentBlockCoinbaseFunction, string>(null, blockParameter);
|
||||
}
|
||||
|
||||
public Task<BigInteger> GetCurrentBlockGasLimitQueryAsync(
|
||||
GetCurrentBlockGasLimitFunction getCurrentBlockGasLimitFunction, BlockParameter blockParameter = null)
|
||||
{
|
||||
return ContractHandler.QueryAsync<GetCurrentBlockGasLimitFunction, BigInteger>(
|
||||
getCurrentBlockGasLimitFunction, blockParameter);
|
||||
}
|
||||
|
||||
|
||||
public Task<BigInteger> GetCurrentBlockGasLimitQueryAsync(BlockParameter blockParameter = null)
|
||||
{
|
||||
return ContractHandler.QueryAsync<GetCurrentBlockGasLimitFunction, BigInteger>(null, blockParameter);
|
||||
}
|
||||
|
||||
public Task<BigInteger> GetCurrentBlockTimestampQueryAsync(
|
||||
GetCurrentBlockTimestampFunction getCurrentBlockTimestampFunction, BlockParameter blockParameter = null)
|
||||
{
|
||||
return ContractHandler.QueryAsync<GetCurrentBlockTimestampFunction, BigInteger>(
|
||||
getCurrentBlockTimestampFunction, blockParameter);
|
||||
}
|
||||
|
||||
|
||||
public Task<BigInteger> GetCurrentBlockTimestampQueryAsync(BlockParameter blockParameter = null)
|
||||
{
|
||||
return ContractHandler.QueryAsync<GetCurrentBlockTimestampFunction, BigInteger>(null, blockParameter);
|
||||
}
|
||||
|
||||
public Task<BigInteger> GetEthBalanceQueryAsync(GetEthBalanceFunction getEthBalanceFunction,
|
||||
BlockParameter blockParameter = null)
|
||||
{
|
||||
return ContractHandler.QueryAsync<GetEthBalanceFunction, BigInteger>(getEthBalanceFunction, blockParameter);
|
||||
}
|
||||
|
||||
|
||||
public Task<BigInteger> GetEthBalanceQueryAsync(string addr, BlockParameter blockParameter = null)
|
||||
{
|
||||
var getEthBalanceFunction = new GetEthBalanceFunction();
|
||||
getEthBalanceFunction.Addr = addr;
|
||||
|
||||
return ContractHandler.QueryAsync<GetEthBalanceFunction, BigInteger>(getEthBalanceFunction, blockParameter);
|
||||
}
|
||||
|
||||
public Task<byte[]> GetLastBlockHashQueryAsync(GetLastBlockHashFunction getLastBlockHashFunction,
|
||||
BlockParameter blockParameter = null)
|
||||
{
|
||||
return ContractHandler.QueryAsync<GetLastBlockHashFunction, byte[]>(getLastBlockHashFunction,
|
||||
blockParameter);
|
||||
}
|
||||
|
||||
|
||||
public Task<byte[]> GetLastBlockHashQueryAsync(BlockParameter blockParameter = null)
|
||||
{
|
||||
return ContractHandler.QueryAsync<GetLastBlockHashFunction, byte[]>(null, blockParameter);
|
||||
}
|
||||
|
||||
public Task<string> TryAggregateRequestAsync(TryAggregateFunction tryAggregateFunction)
|
||||
{
|
||||
return ContractHandler.SendRequestAsync(tryAggregateFunction);
|
||||
}
|
||||
|
||||
public Task<TransactionReceipt> TryAggregateRequestAndWaitForReceiptAsync(
|
||||
TryAggregateFunction tryAggregateFunction, CancellationTokenSource cancellationToken = null)
|
||||
{
|
||||
return ContractHandler.SendRequestAndWaitForReceiptAsync(tryAggregateFunction, cancellationToken);
|
||||
}
|
||||
|
||||
public Task<string> TryAggregateRequestAsync(bool requireSuccess, List<Call> calls)
|
||||
{
|
||||
var tryAggregateFunction = new TryAggregateFunction();
|
||||
tryAggregateFunction.RequireSuccess = requireSuccess;
|
||||
tryAggregateFunction.Calls = calls;
|
||||
|
||||
return ContractHandler.SendRequestAsync(tryAggregateFunction);
|
||||
}
|
||||
|
||||
public Task<TransactionReceipt> TryAggregateRequestAndWaitForReceiptAsync(bool requireSuccess, List<Call> calls,
|
||||
CancellationTokenSource cancellationToken = null)
|
||||
{
|
||||
var tryAggregateFunction = new TryAggregateFunction();
|
||||
tryAggregateFunction.RequireSuccess = requireSuccess;
|
||||
tryAggregateFunction.Calls = calls;
|
||||
|
||||
return ContractHandler.SendRequestAndWaitForReceiptAsync(tryAggregateFunction, cancellationToken);
|
||||
}
|
||||
|
||||
public Task<string> TryBlockAndAggregateRequestAsync(TryBlockAndAggregateFunction tryBlockAndAggregateFunction)
|
||||
{
|
||||
return ContractHandler.SendRequestAsync(tryBlockAndAggregateFunction);
|
||||
}
|
||||
|
||||
public Task<TransactionReceipt> TryBlockAndAggregateRequestAndWaitForReceiptAsync(
|
||||
TryBlockAndAggregateFunction tryBlockAndAggregateFunction, CancellationTokenSource cancellationToken = null)
|
||||
{
|
||||
return ContractHandler.SendRequestAndWaitForReceiptAsync(tryBlockAndAggregateFunction, cancellationToken);
|
||||
}
|
||||
|
||||
public Task<string> TryBlockAndAggregateRequestAsync(bool requireSuccess, List<Call> calls)
|
||||
{
|
||||
var tryBlockAndAggregateFunction = new TryBlockAndAggregateFunction();
|
||||
tryBlockAndAggregateFunction.RequireSuccess = requireSuccess;
|
||||
tryBlockAndAggregateFunction.Calls = calls;
|
||||
|
||||
return ContractHandler.SendRequestAsync(tryBlockAndAggregateFunction);
|
||||
}
|
||||
|
||||
public Task<TransactionReceipt> TryBlockAndAggregateRequestAndWaitForReceiptAsync(bool requireSuccess,
|
||||
List<Call> calls, CancellationTokenSource cancellationToken = null)
|
||||
{
|
||||
var tryBlockAndAggregateFunction = new TryBlockAndAggregateFunction();
|
||||
tryBlockAndAggregateFunction.RequireSuccess = requireSuccess;
|
||||
tryBlockAndAggregateFunction.Calls = calls;
|
||||
|
||||
return ContractHandler.SendRequestAndWaitForReceiptAsync(tryBlockAndAggregateFunction, cancellationToken);
|
||||
}
|
||||
|
||||
public override List<Type> GetAllFunctionTypes()
|
||||
{
|
||||
return new List<Type>
|
||||
{
|
||||
typeof(AggregateFunction),
|
||||
typeof(Aggregate3Function),
|
||||
typeof(Aggregate3ValueFunction),
|
||||
typeof(BlockAndAggregateFunction),
|
||||
typeof(GetBasefeeFunction),
|
||||
typeof(GetBlockHashFunction),
|
||||
typeof(GetBlockNumberFunction),
|
||||
typeof(GetChainIdFunction),
|
||||
typeof(GetCurrentBlockCoinbaseFunction),
|
||||
typeof(GetCurrentBlockGasLimitFunction),
|
||||
typeof(GetCurrentBlockTimestampFunction),
|
||||
typeof(GetEthBalanceFunction),
|
||||
typeof(GetLastBlockHashFunction),
|
||||
typeof(TryAggregateFunction),
|
||||
typeof(TryBlockAndAggregateFunction)
|
||||
};
|
||||
}
|
||||
|
||||
public override List<Type> GetAllEventTypes()
|
||||
{
|
||||
return new List<Type>
|
||||
{
|
||||
};
|
||||
}
|
||||
|
||||
public override List<Type> GetAllErrorTypes()
|
||||
{
|
||||
return new List<Type>
|
||||
{
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
3
src/Managing.ABI.GmxV2/Program.cs
Normal file
3
src/Managing.ABI.GmxV2/Program.cs
Normal file
@@ -0,0 +1,3 @@
|
||||
// See https://aka.ms/new-console-template for more information
|
||||
|
||||
Console.WriteLine("Hello, World!");
|
||||
@@ -0,0 +1,31 @@
|
||||
using Nethereum.ABI.FunctionEncoding.Attributes;
|
||||
|
||||
namespace Managing.ABI.GmxV2.Reader.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; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using Nethereum.ABI.FunctionEncoding.Attributes;
|
||||
|
||||
namespace Managing.ABI.GmxV2.Reader.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; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System.Numerics;
|
||||
using Nethereum.ABI.FunctionEncoding.Attributes;
|
||||
|
||||
namespace Managing.ABI.GmxV2.Reader.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; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System.Numerics;
|
||||
using Nethereum.ABI.FunctionEncoding.Attributes;
|
||||
|
||||
namespace Managing.ABI.GmxV2.Reader.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; }
|
||||
}
|
||||
}
|
||||
19
src/Managing.ABI.GmxV2/Reader/ContractDefinition/Flags.cs
Normal file
19
src/Managing.ABI.GmxV2/Reader/ContractDefinition/Flags.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using Nethereum.ABI.FunctionEncoding.Attributes;
|
||||
|
||||
namespace Managing.ABI.GmxV2.Reader.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; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System.Numerics;
|
||||
using Nethereum.ABI.FunctionEncoding.Attributes;
|
||||
|
||||
namespace Managing.ABI.GmxV2.Reader.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; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using System.Numerics;
|
||||
using Nethereum.ABI.FunctionEncoding.Attributes;
|
||||
|
||||
namespace Managing.ABI.GmxV2.Reader.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; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System.Numerics;
|
||||
using Nethereum.ABI.FunctionEncoding.Attributes;
|
||||
|
||||
namespace Managing.ABI.GmxV2.Reader.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; }
|
||||
}
|
||||
|
||||
public class MarketPrice
|
||||
{
|
||||
[Parameter("uint256", "min", 1)] public BigInteger Min { get; set; }
|
||||
[Parameter("uint256", "max", 2)] public BigInteger Max { get; set; }
|
||||
}
|
||||
}
|
||||
44
src/Managing.ABI.GmxV2/Reader/ContractDefinition/Numbers.cs
Normal file
44
src/Managing.ABI.GmxV2/Reader/ContractDefinition/Numbers.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using System.Numerics;
|
||||
using Nethereum.ABI.FunctionEncoding.Attributes;
|
||||
|
||||
namespace Managing.ABI.GmxV2.Reader.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", "updatedAtBlock", 10)]
|
||||
public virtual BigInteger UpdatedAtBlock { get; set; }
|
||||
|
||||
[Parameter("uint256", "updatedAtTime", 11)]
|
||||
public virtual BigInteger UpdatedAtTime { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using System.Numerics;
|
||||
using Nethereum.ABI.FunctionEncoding.Attributes;
|
||||
|
||||
namespace Managing.ABI.GmxV2.Reader.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; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
using System.Numerics;
|
||||
using Nethereum.ABI.FunctionEncoding.Attributes;
|
||||
|
||||
namespace Managing.ABI.GmxV2.Reader.ContractDefinition
|
||||
{
|
||||
public partial class PositionFees : PositionFeesBase
|
||||
{
|
||||
}
|
||||
|
||||
public class PositionFeesBase
|
||||
{
|
||||
[Parameter("tuple", "referral", 1)] public virtual PositionReferralFees Referral { get; set; }
|
||||
[Parameter("tuple", "funding", 2)] public virtual PositionFundingFees Funding { get; set; }
|
||||
[Parameter("tuple", "borrowing", 3)] public virtual PositionBorrowingFees Borrowing { get; set; }
|
||||
[Parameter("tuple", "ui", 4)] public virtual PositionUiFees Ui { get; set; }
|
||||
|
||||
[Parameter("tuple", "collateralTokenPrice", 5)]
|
||||
public virtual Props CollateralTokenPrice { get; set; }
|
||||
|
||||
[Parameter("uint256", "positionFeeFactor", 6)]
|
||||
public virtual BigInteger PositionFeeFactor { get; set; }
|
||||
|
||||
[Parameter("uint256", "protocolFeeAmount", 7)]
|
||||
public virtual BigInteger ProtocolFeeAmount { get; set; }
|
||||
|
||||
[Parameter("uint256", "positionFeeReceiverFactor", 8)]
|
||||
public virtual BigInteger PositionFeeReceiverFactor { get; set; }
|
||||
|
||||
[Parameter("uint256", "feeReceiverAmount", 9)]
|
||||
public virtual BigInteger FeeReceiverAmount { get; set; }
|
||||
|
||||
[Parameter("uint256", "feeAmountForPool", 10)]
|
||||
public virtual BigInteger FeeAmountForPool { get; set; }
|
||||
|
||||
[Parameter("uint256", "positionFeeAmountForPool", 11)]
|
||||
public virtual BigInteger PositionFeeAmountForPool { get; set; }
|
||||
|
||||
[Parameter("uint256", "positionFeeAmount", 12)]
|
||||
public virtual BigInteger PositionFeeAmount { get; set; }
|
||||
|
||||
[Parameter("uint256", "totalCostAmountExcludingFunding", 13)]
|
||||
public virtual BigInteger TotalCostAmountExcludingFunding { get; set; }
|
||||
|
||||
[Parameter("uint256", "totalCostAmount", 14)]
|
||||
public virtual BigInteger TotalCostAmount { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using System.Numerics;
|
||||
using Nethereum.ABI.FunctionEncoding.Attributes;
|
||||
|
||||
namespace Managing.ABI.GmxV2.Reader.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; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using System.Numerics;
|
||||
using Nethereum.ABI.FunctionEncoding.Attributes;
|
||||
|
||||
namespace Managing.ABI.GmxV2.Reader.ContractDefinition
|
||||
{
|
||||
public partial class PositionInfo : PositionInfoBase
|
||||
{
|
||||
}
|
||||
|
||||
public class PositionInfoBase
|
||||
{
|
||||
[Parameter("tuple", "position", 1)] public virtual Props 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; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using System.Numerics;
|
||||
using Nethereum.ABI.FunctionEncoding.Attributes;
|
||||
|
||||
namespace Managing.ABI.GmxV2.Reader.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", "traderDiscountFactor", 5)]
|
||||
public virtual BigInteger TraderDiscountFactor { get; set; }
|
||||
|
||||
[Parameter("uint256", "totalRebateAmount", 6)]
|
||||
public virtual BigInteger TotalRebateAmount { get; set; }
|
||||
|
||||
[Parameter("uint256", "traderDiscountAmount", 7)]
|
||||
public virtual BigInteger TraderDiscountAmount { get; set; }
|
||||
|
||||
[Parameter("uint256", "affiliateRewardAmount", 8)]
|
||||
public virtual BigInteger AffiliateRewardAmount { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using Nethereum.ABI.FunctionEncoding.Attributes;
|
||||
|
||||
namespace Managing.ABI.GmxV2.Reader.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; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System.Numerics;
|
||||
using Nethereum.ABI.FunctionEncoding.Attributes;
|
||||
|
||||
namespace Managing.ABI.GmxV2.Reader.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; }
|
||||
}
|
||||
}
|
||||
15
src/Managing.ABI.GmxV2/Reader/ContractDefinition/Props.cs
Normal file
15
src/Managing.ABI.GmxV2/Reader/ContractDefinition/Props.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using Nethereum.ABI.FunctionEncoding.Attributes;
|
||||
|
||||
namespace Managing.ABI.GmxV2.Reader.ContractDefinition
|
||||
{
|
||||
public partial class Props : PropsBase
|
||||
{
|
||||
}
|
||||
|
||||
public class PropsBase
|
||||
{
|
||||
[Parameter("tuple", "addresses", 1)] public virtual Addresses Addresses { get; set; }
|
||||
[Parameter("tuple", "numbers", 2)] public virtual Numbers Numbers { get; set; }
|
||||
[Parameter("tuple", "flags", 3)] public virtual Flags Flags { get; set; }
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
30
src/Managing.ABI.GmxV2/Reader/ContractDefinition/SwapFees.cs
Normal file
30
src/Managing.ABI.GmxV2/Reader/ContractDefinition/SwapFees.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System.Numerics;
|
||||
using Nethereum.ABI.FunctionEncoding.Attributes;
|
||||
|
||||
namespace Managing.ABI.GmxV2.Reader.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; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System.Numerics;
|
||||
using Nethereum.ABI.FunctionEncoding.Attributes;
|
||||
|
||||
namespace Managing.ABI.GmxV2.Reader.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; }
|
||||
}
|
||||
}
|
||||
636
src/Managing.ABI.GmxV2/Reader/ReaderService.cs
Normal file
636
src/Managing.ABI.GmxV2/Reader/ReaderService.cs
Normal file
@@ -0,0 +1,636 @@
|
||||
using System.Numerics;
|
||||
using Managing.ABI.GmxV2.Reader.ContractDefinition;
|
||||
using Nethereum.RPC.Eth.DTOs;
|
||||
using Nethereum.Web3;
|
||||
|
||||
namespace Managing.ABI.GmxV2.Reader
|
||||
{
|
||||
public partial class ReaderService : ContractWeb3ServiceBase
|
||||
{
|
||||
public static Task<TransactionReceipt> DeployContractAndWaitForReceiptAsync(Nethereum.Web3.IWeb3 web3,
|
||||
ReaderDeployment readerDeployment, CancellationTokenSource cancellationTokenSource = null)
|
||||
{
|
||||
return web3.Eth.GetContractDeploymentHandler<ReaderDeployment>()
|
||||
.SendRequestAndWaitForReceiptAsync(readerDeployment, cancellationTokenSource);
|
||||
}
|
||||
|
||||
public static Task<string> DeployContractAsync(Nethereum.Web3.IWeb3 web3, ReaderDeployment readerDeployment)
|
||||
{
|
||||
return web3.Eth.GetContractDeploymentHandler<ReaderDeployment>().SendRequestAsync(readerDeployment);
|
||||
}
|
||||
|
||||
public static async Task<ReaderService> DeployContractAndGetServiceAsync(Nethereum.Web3.IWeb3 web3,
|
||||
ReaderDeployment readerDeployment, CancellationTokenSource cancellationTokenSource = null)
|
||||
{
|
||||
var receipt = await DeployContractAndWaitForReceiptAsync(web3, readerDeployment, cancellationTokenSource);
|
||||
return new ReaderService(web3, receipt.ContractAddress);
|
||||
}
|
||||
|
||||
public ReaderService(Nethereum.Web3.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, List<byte[]> positionKeys, List<MarketPrices> prices, string uiFeeReceiver,
|
||||
BlockParameter blockParameter = null)
|
||||
{
|
||||
var getAccountPositionInfoListFunction = new GetAccountPositionInfoListFunction();
|
||||
getAccountPositionInfoListFunction.DataStore = dataStore;
|
||||
getAccountPositionInfoListFunction.ReferralStorage = referralStorage;
|
||||
getAccountPositionInfoListFunction.PositionKeys = positionKeys;
|
||||
getAccountPositionInfoListFunction.Prices = prices;
|
||||
getAccountPositionInfoListFunction.UiFeeReceiver = uiFeeReceiver;
|
||||
|
||||
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, Props 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, MarketsProps market,
|
||||
MarketPrice indexTokenPrice, MarketPrice longTokenPrice, MarketPrice 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<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 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(GetPositionPnlUsdFunction),
|
||||
typeof(GetShiftFunction),
|
||||
typeof(GetSwapAmountOutFunction),
|
||||
typeof(GetSwapPriceImpactFunction),
|
||||
typeof(GetWithdrawalFunction),
|
||||
typeof(GetWithdrawalAmountOutFunction)
|
||||
};
|
||||
}
|
||||
|
||||
public override List<Type> GetAllEventTypes()
|
||||
{
|
||||
return new List<Type>
|
||||
{
|
||||
};
|
||||
}
|
||||
|
||||
public override List<Type> GetAllErrorTypes()
|
||||
{
|
||||
return new List<Type>
|
||||
{
|
||||
typeof(DisabledMarketError),
|
||||
typeof(EmptyMarketError)
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user