Merge branch 'master' into feature/bot-upgrade
This commit is contained in:
commit
fb57998aa8
28
.github/workflows/docker-discordbot.yml
vendored
Normal file
28
.github/workflows/docker-discordbot.yml
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
name: Docker - Discord Bot
|
||||
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
tags:
|
||||
- 'v*.*.*'
|
||||
paths:
|
||||
- 'Tools/BiblioTech/**'
|
||||
- '!Tools/BiblioTech/docker/docker-compose.yaml'
|
||||
- 'Framework/**'
|
||||
- 'ProjectPlugins/**'
|
||||
- .github/workflows/docker-discordbot.yml
|
||||
- .github/workflows/docker-reusable.yml
|
||||
workflow_dispatch:
|
||||
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
name: Build and Push
|
||||
uses: ./.github/workflows/docker-reusable.yml
|
||||
with:
|
||||
docker_file: Tools/BiblioTech/docker/Dockerfile
|
||||
docker_repo: codexstorage/codex-discordbot
|
||||
secrets: inherit
|
||||
|
@ -1,4 +1,4 @@
|
||||
name: Docker
|
||||
name: Docker - Runner
|
||||
|
||||
|
||||
on:
|
||||
@ -10,7 +10,7 @@ on:
|
||||
paths:
|
||||
- docker/Dockerfile
|
||||
- docker/docker-entrypoint.sh
|
||||
- .github/workflows/docker.yml
|
||||
- .github/workflows/docker-runner.yml
|
||||
- .github/workflows/docker-reusable.yml
|
||||
workflow_dispatch:
|
||||
|
6
.github/workflows/report-HoldMyBeerTest.yaml
vendored
6
.github/workflows/report-HoldMyBeerTest.yaml
vendored
@ -3,17 +3,17 @@ name: Report - HoldMyBeerTest
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '30 * */2 * *'
|
||||
- cron: '30 1 */2 * *'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
run_tests:
|
||||
name: Call runner
|
||||
uses: ./.github/workflows/continuous-tests.yaml
|
||||
uses: ./.github/workflows/run-continuous-tests.yaml
|
||||
with:
|
||||
source: ${{ format('{0}/{1}', github.server_url, github.repository) }}
|
||||
branch: master
|
||||
nameprefix: c-tests-report-holdmybeertest
|
||||
nameprefix: c-tests-report-holdmybeertest-48h
|
||||
tests_target_duration: 48h
|
||||
tests_filter: HoldMyBeerTest
|
||||
tests_cleanup: true
|
||||
|
6
.github/workflows/report-PeersTest.yaml
vendored
6
.github/workflows/report-PeersTest.yaml
vendored
@ -3,17 +3,17 @@ name: Report - PeersTest
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '30 * */2 * *'
|
||||
- cron: '30 1 */2 * *'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
run_tests:
|
||||
name: Call runner
|
||||
uses: ./.github/workflows/continuous-tests.yaml
|
||||
uses: ./.github/workflows/run-continuous-tests.yaml
|
||||
with:
|
||||
source: ${{ format('{0}/{1}', github.server_url, github.repository) }}
|
||||
branch: master
|
||||
nameprefix: c-tests-report-peerstest
|
||||
nameprefix: c-tests-report-peerstest-48h
|
||||
tests_target_duration: 48h
|
||||
tests_filter: PeersTest
|
||||
tests_cleanup: true
|
||||
|
@ -7,6 +7,7 @@ namespace CodexContractsPlugin
|
||||
{
|
||||
CodexContractsDeployment Deployment { get; }
|
||||
|
||||
bool IsDeployed();
|
||||
string MintTestTokens(IHasEthAddress owner, TestToken testTokens);
|
||||
string MintTestTokens(EthAddress ethAddress, TestToken testTokens);
|
||||
TestToken GetTestTokenBalance(IHasEthAddress owner);
|
||||
@ -27,6 +28,12 @@ namespace CodexContractsPlugin
|
||||
|
||||
public CodexContractsDeployment Deployment { get; }
|
||||
|
||||
public bool IsDeployed()
|
||||
{
|
||||
var interaction = new ContractInteractions(log, gethNode);
|
||||
return !string.IsNullOrEmpty(interaction.GetTokenName(Deployment.TokenAddress));
|
||||
}
|
||||
|
||||
public string MintTestTokens(IHasEthAddress owner, TestToken testTokens)
|
||||
{
|
||||
return MintTestTokens(owner.EthAddress, testTokens);
|
||||
|
@ -26,6 +26,22 @@ namespace CodexContractsPlugin
|
||||
return gethNode.Call<GetTokenFunction, string>(marketplaceAddress, function);
|
||||
}
|
||||
|
||||
public string GetTokenName(string tokenAddress)
|
||||
{
|
||||
try
|
||||
{
|
||||
log.Debug(tokenAddress);
|
||||
var function = new GetTokenNameFunction();
|
||||
|
||||
return gethNode.Call<GetTokenNameFunction, string>(tokenAddress, function);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
log.Log("Failed to get token name: " + ex);
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
public string MintTestTokens(EthAddress address, decimal amount, string tokenAddress)
|
||||
{
|
||||
log.Debug($"{amount} -> {address} (token: {tokenAddress})");
|
||||
@ -87,6 +103,11 @@ namespace CodexContractsPlugin
|
||||
{
|
||||
}
|
||||
|
||||
[Function("name", "string")]
|
||||
public class GetTokenNameFunction : FunctionMessage
|
||||
{
|
||||
}
|
||||
|
||||
[Function("mint")]
|
||||
public class MintTokensFunction : FunctionMessage
|
||||
{
|
||||
|
@ -59,12 +59,10 @@ namespace BiblioTech
|
||||
{
|
||||
protected override async Task Invoke(CommandContext context)
|
||||
{
|
||||
var log = new ConsoleLog();
|
||||
|
||||
if (!string.IsNullOrEmpty(GethInput.LoadError))
|
||||
{
|
||||
var msg = "Geth input incorrect: " + GethInput.LoadError;
|
||||
log.Error(msg);
|
||||
Program.Log.Error(msg);
|
||||
if (IsInAdminChannel(context.Command))
|
||||
{
|
||||
await context.Followup(msg);
|
||||
@ -82,8 +80,14 @@ namespace BiblioTech
|
||||
tokenAddress: GethInput.TokenAddress
|
||||
);
|
||||
|
||||
var gethNode = new CustomGethNode(log, GethInput.GethHost, GethInput.GethPort, GethInput.PrivateKey);
|
||||
var contracts = new CodexContractsAccess(log, gethNode, contractsDeployment);
|
||||
var gethNode = new CustomGethNode(Program.Log, GethInput.GethHost, GethInput.GethPort, GethInput.PrivateKey);
|
||||
var contracts = new CodexContractsAccess(Program.Log, gethNode, contractsDeployment);
|
||||
|
||||
if (!contracts.IsDeployed())
|
||||
{
|
||||
await context.Followup("I'm sorry, the Codex SmartContracts are not currently deployed.");
|
||||
return;
|
||||
}
|
||||
|
||||
await Execute(context, gethNode, contracts);
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ namespace BiblioTech.Commands
|
||||
private string FormatTransactionLink(string transaction)
|
||||
{
|
||||
var url = $"https://explorer.testnet.codex.storage/tx/{transaction}";
|
||||
return $"- [View on block explorer]({url}){Environment.NewLine}Transaction ID - `{transaction}`";
|
||||
return $"- [View on block explorer](<{url}>){Environment.NewLine}Transaction ID - `{transaction}`";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
public static string Get()
|
||||
{
|
||||
return "Hold on: " + messages[random.Next(messages.Length)];
|
||||
return "(⏳): " + messages[random.Next(messages.Length)];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,14 @@
|
||||
FROM mcr.microsoft.com/dotnet/sdk:7.0
|
||||
# Variables
|
||||
ARG IMAGE=mcr.microsoft.com/dotnet/sdk:7.0
|
||||
ARG APP_HOME=/app
|
||||
|
||||
WORKDIR app
|
||||
# Create
|
||||
FROM ${IMAGE}
|
||||
ARG APP_HOME
|
||||
|
||||
WORKDIR ${APP_HOME}
|
||||
COPY ./Tools/BiblioTech ./Tools/BiblioTech
|
||||
COPY ./Framework ./Framework
|
||||
COPY ./ProjectPlugins ./ProjectPlugins
|
||||
CMD ["dotnet", "run", "--project", "Tools/BiblioTech"]
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user