44 lines
1.4 KiB
C#
Raw Normal View History

2023-09-19 13:39:24 +02:00
using GethPlugin;
using Logging;
namespace CodexContractsPlugin
2023-09-19 10:24:43 +02:00
{
public interface ICodexContracts
{
string MarketplaceAddress { get; }
2023-09-19 13:39:24 +02:00
void MintTestTokens(IGethNode gethNode, IEthAddress ethAddress, TestToken testTokens);
TestToken GetTestTokenBalance(IGethNode gethNode, IEthAddress ethAddress);
2023-09-19 10:24:43 +02:00
}
public class CodexContractsAccess : ICodexContracts
{
2023-09-19 13:39:24 +02:00
private readonly ILog log;
public CodexContractsAccess(ILog log, string marketplaceAddress, string abi, string tokenAddress)
2023-09-19 10:24:43 +02:00
{
2023-09-19 13:39:24 +02:00
this.log = log;
2023-09-19 10:24:43 +02:00
MarketplaceAddress = marketplaceAddress;
Abi = abi;
TokenAddress = tokenAddress;
}
public string MarketplaceAddress { get; }
public string Abi { get; }
public string TokenAddress { get; }
2023-09-19 13:39:24 +02:00
public void MintTestTokens(IGethNode gethNode, IEthAddress ethAddress, TestToken testTokens)
{
var interaction = new ContractInteractions(log, gethNode);
interaction.MintTestTokens(ethAddress, testTokens.Amount, TokenAddress);
}
public TestToken GetTestTokenBalance(IGethNode gethNode, IEthAddress ethAddress)
{
var interaction = new ContractInteractions(log, gethNode);
var balance = interaction.GetBalance(TokenAddress, ethAddress.Address);
return balance.TestTokens();
}
2023-09-19 10:24:43 +02:00
}
}