Skip to content

Instantly share code, notes, and snippets.

@keefertaylor
Last active December 1, 2020 03:16
Show Gist options
  • Save keefertaylor/9a9e1eae1ed3aa0845fe11e6ecff3126 to your computer and use it in GitHub Desktop.
Save keefertaylor/9a9e1eae1ed3aa0845fe11e6ecff3126 to your computer and use it in GitHub Desktop.
import fetch from 'node-fetch'
import { getLogger } from 'loglevel'
import { WrappedTezosHelper, registerFetch, registerLogger } from 'conseiljs'
import { Utils } from '@tacoinfra/harbinger-lib'
import { TezosNodeReader } from '../../../conseiljs/dist'
const TOKEN_ADDR = "KT1JYf7xjCJAqFDfNpuump9woSMaapy1WcMY"
const BIG_MAP_ID = 14566
const OVEN_LIST_BIG_MAP_ID = 14569
const OVEN_ADDR = "KT1N6R5hn15yQoJWXJwiAADkkYQJNdgGyUqD"
const CORE_ADDR = "KT1S98ELFTo6mdMBqhAVbGgKAVgLbdPP3AX8"
const KEEFERS_ACCOUNT = "tz1fzHtv2UqtXzFUBHuBPh2xXVv5Pv5MTh5Z"
const DEST_ACCOUNT = "tz1PnUd6R31MnjEE8VhfZhZdbGc1hrWQvjnK"
const TEZOS_NODE_URL = "https://rpczero.tzbeta.net"
const TOKEN_CONTRACT_SCRIPT = ""
const OVEN_CONTRACT_SCRIPT = ""
const CORE_CONTRACT_SCRIPT = ""
const PRIV_KEY = "<REDACTED>"
const CONSEIL_URL = "https://conseil-dev.cryptonomic-infra.tech:443"
const CONSEIL_KEY = "<REDACTED>"
async function main() {
// Configure Conseil
const logger = getLogger('conseiljs')
logger.setLevel('info', false)
registerLogger(logger)
registerFetch(fetch)
const keystore = await Utils.keyStoreFromPrivateKey(PRIV_KEY)
const signer = await Utils.signerFromKeyStore(keystore)
console.log('========================================')
console.log('SANITY CHECKS')
console.log('========================================')
// Verify contracts
const contractMatched = await WrappedTezosHelper.verifyDestination(TEZOS_NODE_URL, TOKEN_ADDR, OVEN_ADDR, CORE_ADDR)
console.log("Contract matched: " + contractMatched)
console.log("")
console.log('========================================')
console.log('CORE CONTRACT')
console.log('========================================')
const serverInfo = {
url: CONSEIL_URL,
apiKey: CONSEIL_KEY,
network: 'delphinet'
}
const ovenWithoutBakerResult = await WrappedTezosHelper.deployOven(
TEZOS_NODE_URL,
signer,
keystore,
10_000_000,
CORE_ADDR,
)
console.log("Opened a vault in hash: " + ovenWithoutBakerResult.operationHash)
console.log("New address: " + ovenWithoutBakerResult.ovenAddress)
console.log("sleeping for tx to be included...")
await Utils.sleep(120)
console.log("good morning!\n")
const ovenWithBakerResult = await WrappedTezosHelper.deployOven(
TEZOS_NODE_URL,
signer,
keystore,
10_000_000,
CORE_ADDR,
'tz1RomaiWJV3NFDZWTMVR2aEeHknsn3iF5Gi'
)
console.log("Opened a vault in hash: " + ovenWithBakerResult.operationHash)
console.log("New address: " + ovenWithBakerResult.ovenAddress)
}
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment