Skip to content

Commit

Permalink
Merge pull request #24 from noislabs/rename-allow-listed
Browse files Browse the repository at this point in the history
Rename is_allow_listed -> is_allowlisted
  • Loading branch information
webmaster128 committed Sep 3, 2023
2 parents e140b14 + d41127e commit f9eaa6d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
16 changes: 8 additions & 8 deletions drand_contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import { assert, CosmWasmClient, MsgExecuteContractEncodeObject, toUtf8 } from "

export function makeAddBeaconMessage(
senderAddress: string,
contractAddress: string,
drandAddress: string,
beacon: { round: number; signature: string },
): MsgExecuteContractEncodeObject {
return {
typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract",
value: MsgExecuteContract.fromPartial({
sender: senderAddress,
contract: contractAddress,
contract: drandAddress,
msg: toUtf8(JSON.stringify({
add_round: {
round: beacon.round,
Expand All @@ -23,24 +23,24 @@ export function makeAddBeaconMessage(
};
}

export async function queryIsAllowListed(
export async function queryIsAllowlisted(
client: CosmWasmClient,
contractAddress: string,
drandAddress: string,
botAddress: string,
): Promise<boolean> {
const { listed } = await client.queryContractSmart(contractAddress, {
is_allow_listed: { bot: botAddress },
const { listed } = await client.queryContractSmart(drandAddress, {
is_allowlisted: { bot: botAddress },
});
return listed;
}

export async function queryIsIncentivized(
client: CosmWasmClient,
contractAddress: string,
drandAddress: string,
round: number,
botAddress: string,
): Promise<boolean> {
const { incentivized } = await client.queryContractSmart(contractAddress, {
const { incentivized } = await client.queryContractSmart(drandAddress, {
is_incentivized: { rounds: [round], sender: botAddress },
});
// console.log(`#${rounds[0]} incentivized query returned at ${publishedSince(rounds[0])}ms`)
Expand Down
6 changes: 3 additions & 3 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
} from "./deps.ts";
import { JobsObserver } from "./jobs.ts";
import { Submitter } from "./submitter.ts";
import { queryIsAllowListed, queryIsIncentivized } from "./drand_contract.ts";
import { queryIsAllowlisted, queryIsIncentivized } from "./drand_contract.ts";
import { connectTendermint } from "./tendermint.ts";
import { Config } from "./config.ts";

Expand Down Expand Up @@ -122,8 +122,8 @@ if (import.meta.main) {
await Promise.all([
sleep(500), // the min waiting time
(async function () {
const listed = await queryIsAllowListed(client, drandAddress, botAddress);
console.info(`Bot allow listed for rewards: ${listed}`);
const listed = await queryIsAllowlisted(client, drandAddress, botAddress);
console.info(`Bot allowlisted for rewards: ${listed}`);
})(),
]);

Expand Down

0 comments on commit f9eaa6d

Please sign in to comment.