These steps initialize Unicorn Power farming:
JavaScript
12345678910111213141516171819202122232425262728293031323334353637383940414243
const { ether, time } = require("@1inch/solidity-utils");
const { ethers } = require("hardhat");
// Setup environment
const inch = await ethers.getContractAt("IERC20", "0x111111111117dc0aa78b770fa6a738034120c302");
const st1inch = await ethers.getContractAt("IERC20", "0x9a0c8ff858d273f57072d714bca7411d717501d7");
const powerPod = await ethers.getContractAt("IERC20", "0xaccfac2339e16dc80c50d2fa81b5c2b049b4f947");
const whitelist = await ethers.getContractAt("WhitelistRegistry", "0xF55684BC536487394B423e70567413faB8e45E26");
const stakeAmount = ether("1000000");
const lockTime = time.duration.years("2");
const myShareToken = {
name: "MyShareTokenName",
symbol: "MST"
};
const worker = "..."; // Address of wallet which send transaction
const [resolver] = await ethers.getSigners();
// Ethers setup script
// approve 1inch staking
await await inch.connect(resolver).approve(st1inch.address, stakeAmount);
// stake 1inch token
await (await st1inch.connect(resolver).deposit(stakeAmount, lockTime)).wait();
// add delegation pod to
// 1. make it possible for any user to delegate staking power to
// the resolver's account
// 2. make it possible for a resolver to allocate its staking power for itself
await (await st1inch.connect(resolver).addPod(powerPod.address)).wait();
// register resolver's delegation token to count stakers' shares and rewards
await (
await powerPod.connect(resolver).functions["register(string,string)"](myShareToken.name, myShareToken.symbol)
).wait();
// Delegate staked power to self
await (await powerPod.connect(resolver).delegate(resolver.address)).wait();
// Whitelist resolver (there should be enough unicorn power to be in top 10)
await (await whitelist.connect(resolver).register()).wait();
// Add worker address from which order settlement will be executed
await (await whitelist.connect(resolver).promote(1, worker)).wait();