mirror of
https://github.com/logos-storage/logos-storage-nim-cs-dist-tests.git
synced 2026-01-09 17:03:08 +00:00
44 lines
1.4 KiB
C#
44 lines
1.4 KiB
C#
using GethPlugin;
|
|
using Logging;
|
|
|
|
namespace CodexContractsPlugin
|
|
{
|
|
public interface ICodexContracts
|
|
{
|
|
string MarketplaceAddress { get; }
|
|
|
|
void MintTestTokens(IGethNode gethNode, IEthAddress ethAddress, TestToken testTokens);
|
|
TestToken GetTestTokenBalance(IGethNode gethNode, IEthAddress ethAddress);
|
|
}
|
|
|
|
public class CodexContractsAccess : ICodexContracts
|
|
{
|
|
private readonly ILog log;
|
|
|
|
public CodexContractsAccess(ILog log, string marketplaceAddress, string abi, string tokenAddress)
|
|
{
|
|
this.log = log;
|
|
MarketplaceAddress = marketplaceAddress;
|
|
Abi = abi;
|
|
TokenAddress = tokenAddress;
|
|
}
|
|
|
|
public string MarketplaceAddress { get; }
|
|
public string Abi { get; }
|
|
public string TokenAddress { get; }
|
|
|
|
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();
|
|
}
|
|
}
|
|
}
|