Skip to content

Commit

Permalink
Diamond Service and web3.Eth.Standards. access
Browse files Browse the repository at this point in the history
  • Loading branch information
juanfranblanco committed Mar 27, 2024
1 parent 6d54bda commit a38ba44
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/Nethereum.Contracts/Services/EthApiContractService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using Nethereum.Contracts.Standards.ERC20;
using Nethereum.Contracts.Standards.ERC721;
using Nethereum.Contracts.Standards.ProofOfHumanity;
using Nethereum.Contracts.Standards.ERC2535Diamond;
using Nethereum.JsonRpc.Client;
using Nethereum.RPC;
using Nethereum.RPC.Eth.Transactions;
Expand All @@ -27,6 +28,7 @@ public EthApiContractService(IClient client) : base(client)
ERC20 = new ERC20Service(this);
ERC1155 = new ERC1155Service(this);
ERC1271 = new ERC1271Service(this);
ERC2535Diamond = new ERC2535DiamondService(this);
ProofOfHumanity = new ProofOfHumanityService(this);

#endif
Expand Down Expand Up @@ -133,6 +135,7 @@ public MultiQueryBatchRpcHandler GetMultiQueryBatchRpcHandler()
/// https://eips.ethereum.org/EIPS/eip-1271
/// </summary>
public ERC1271Service ERC1271 { get; private set; }
public ERC2535DiamondService ERC2535Diamond { get; private set; }

/// <summary>
/// Service to interact with the Proof of Humanity registry smart contract
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,22 @@
using Nethereum.Util;
using System.Runtime.CompilerServices;
using System;
using Nethereum.Contracts.Standards.ERC2535Diamond.DiamondLoupeFacet;

namespace Nethereum.Contracts.Standards.ERC2535Diamond.DiamondCutFacet
{

public enum FacetCutAction
{
Add = 0,
Replace = 1,
Remove = 2
}

public class DiamondCutFacetContractService: ContractServiceBase
public class ERC2535DiamondCutFacetContractService: ContractServiceBase
{

public DiamondCutFacetContractService(IEthApiContractService ethApiContractService, string contractAddress)
public ERC2535DiamondCutFacetContractService(IEthApiContractService ethApiContractService, string contractAddress)
{
#if !DOTNET35
ContractHandler = ethApiContractService.GetContractHandler(contractAddress);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

namespace Nethereum.Contracts.Standards.ERC2535Diamond.DiamondLoupeFacet
{
public partial class ERC2535DiamondLoupeFacetService : ContractServiceBase
public partial class ERC2535DiamondLoupeFacetContractService : ContractServiceBase
{

public ERC2535DiamondLoupeFacetService(IEthApiContractService ethApiContractService, string contractAddress)
public ERC2535DiamondLoupeFacetContractService(IEthApiContractService ethApiContractService, string contractAddress)
{
#if !DOTNET35
ContractHandler = ethApiContractService.GetContractHandler(contractAddress);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using Nethereum.Contracts.Services;
using Nethereum.Contracts.Standards.ERC2535Diamond.DiamondCutFacet;
using Nethereum.Contracts.Standards.ERC2535Diamond.DiamondLoupeFacet;

namespace Nethereum.Contracts.Standards.ERC2535Diamond
{
public class ERC2535DiamondService
{
private readonly IEthApiContractService _ethApiContractService;

public ERC2535DiamondService(IEthApiContractService ethApiContractService)
{
_ethApiContractService = ethApiContractService;
}

public ERC2535DiamondCutFacetContractService GetDiamondCutFacetContractService(string contractAddress)
{
return new ERC2535DiamondCutFacetContractService(_ethApiContractService, contractAddress);
}

public ERC2535DiamondLoupeFacetContractService GetDiamondLoupeFacetService(string contractAddress)
{
return new ERC2535DiamondLoupeFacetContractService(_ethApiContractService, contractAddress);
}
}
}

0 comments on commit a38ba44

Please sign in to comment.