Skip to content

Commit

Permalink
draft Mow w/ reward template, incomplete
Browse files Browse the repository at this point in the history
  • Loading branch information
funderbrker committed Mar 1, 2024
1 parent d187545 commit cc0580c
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions projects/sdk/src/lib/tractor/examples.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// This test uses the Tractor SDK and core Tractor code. It represents how an end user would interact with Tractor.

import { ethers } from "ethers";
import {
AdvancedFarmCall,
Blueprint,
Draft,
OperatorPasteInstr,
encodeBlueprintData,
encodeOperatorPasteInstrs
} from "./types";
import { Drafter } from "./drafter";

// Create a Blueprint to Mow the publishers stalk.
// This function represents only one approach to implement a Mow Blueprint and is inherently biased.
function createBlueprint_mow(publisher: string) {
const blueprint: Blueprint = <Blueprint>{
publisher: publisher,
maxNonce: ethers.constants.MaxUint256,
startTime: ethers.BigNumber.from(Math.floor(Date.now() / 1000)),
endTime: ethers.constants.MaxUint256
};

let draft: Draft;

draft = Drafter.balanceOfStalkDraft(0);
draft = Drafter.concatDrafts(draft, Drafter.mowDraft(1));
draft = Drafter.concatDrafts(draft, Drafter.balanceOfStalkDraft(2));
draft = // need to use clipboard

Drafter.embedDraft(blueprint, encodeBlueprintData(blueprint, draft));
return blueprint;
}

0 comments on commit cc0580c

Please sign in to comment.