Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export async function scenarioAsync(): Promise {
await runMigrationsOnceIfRequiredAsync();
let txHash;
PrintUtils.printScenario('Create Staking Pool');
// account information, balances, general contract logs
const web3Wrapper = new Web3Wrapper(providerEngine);
const [maker, otherMaker] = await web3Wrapper.getAvailableAddressesAsync();
const contractWrappers = new ContractWrappers(providerEngine, { chainId: NETWORK_CONFIGS.chainId });
const zrxTokenAddress = contractWrappers.contractAddresses.zrxToken;
const printUtils = new PrintUtils(web3Wrapper, contractWrappers, { maker }, { ZRX: zrxTokenAddress });
// Staking Proxy is a delegate contract. We initialize a Staking Contract (ABI) pointing to the delegate proxy
// at stakingProxyContractAddress
const stakingContract = new StakingContract(contractWrappers.contractAddresses.stakingProxy, providerEngine, {
from: maker,
});
// A small share is kept for the operator, note 1,000,000 represents all rebates
// going to the operator
const operatorSharePpm = new BigNumber(900000); // 90 %
const stakingPoolReceipt = await stakingContract
.createStakingPool(operatorSharePpm, true)
.awaitTransactionSuccessAsync({
from: maker,
});
const createStakingPoolLog = stakingPoolReceipt.logs[0];
const poolId = (createStakingPoolLog as any).args.poolId;
await printUtils.awaitTransactionMinedSpinnerAsync(`Create Pool ${poolId}`, stakingPoolReceipt.transactionHash);
// Approve the ZRX token for Staking using the ERC20Proxy