-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
draft Mow w/ reward template, incomplete
- Loading branch information
1 parent
d187545
commit cc0580c
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |