All tests are passing again. Minor fixes after messing around with different code

This commit is contained in:
Greg Hysen
2019-06-10 20:04:16 -07:00
parent 316ef69074
commit 55238b9669
7 changed files with 26 additions and 35 deletions

View File

@@ -550,7 +550,7 @@ describe('Staking Core', () => {
);
});
it.only('Reward Vault', async () => {
it.skip('Reward Vault', async () => {
/*
// 1 setup test parameters
const poolOperator = stakers[1];
@@ -576,12 +576,6 @@ describe('Staking Core', () => {
*/
});
it.only('Staking Contract / Reward Vault Integration', async () => {
//
//const poolId = await stakingWrapper.createPoolAsync();
//await stakingWrapper.depositForAsync()
});
it('Protocol Fees', async () => {
///// 0 DEPLOY EXCHANGE /////
await stakingWrapper.addExchangeAddressAsync(exchange);
@@ -678,13 +672,12 @@ describe('Staking Core', () => {
});
it('nth root #3 with fixed point', async () => {
const decimals = 6;
const decimals = 18;
const base = stakingWrapper.toFixedPoint(4.234, decimals);
const n = new BigNumber(2);
const decimalsAsBn = new BigNumber(decimals);
const root = await stakingWrapper.nthRootFixedPoint(base, n, decimalsAsBn);
const root = await stakingWrapper.nthRootFixedPoint(base, n);
const rootAsFloatingPoint = stakingWrapper.toFloatingPoint(root, decimals);
const expectedResult = new BigNumber(2.057);
const expectedResult = new BigNumber(2.057668584);
expect(rootAsFloatingPoint).to.be.bignumber.equal(expectedResult);
});
@@ -693,8 +686,7 @@ describe('Staking Core', () => {
const base = stakingWrapper.toFixedPoint(5429503678976, decimals);
console.log(base);
const n = new BigNumber(9);
const decimalsAsBn = new BigNumber(decimals);
const root = await stakingWrapper.nthRootFixedPoint(base, n, decimalsAsBn);
const root = await stakingWrapper.nthRootFixedPoint(base, n);
const rootAsFloatingPoint = stakingWrapper.toFloatingPoint(root, decimals);
const expectedResult = new BigNumber(26);
expect(rootAsFloatingPoint).to.be.bignumber.equal(expectedResult);
@@ -705,8 +697,7 @@ describe('Staking Core', () => {
const base = stakingWrapper.toFixedPoint(new BigNumber('5429503678976.295036789761543678', 10), decimals);
console.log(base);
const n = new BigNumber(9);
const decimalsAsBn = new BigNumber(decimals);
const root = await stakingWrapper.nthRootFixedPoint(base, n, decimalsAsBn);
const root = await stakingWrapper.nthRootFixedPoint(base, n);
console.log(`root - ${root}`);
const rootAsFloatingPoint = stakingWrapper.toFloatingPoint(root, decimals);
const expectedResult = new BigNumber(26);

View File

@@ -97,6 +97,8 @@ export class StakingWrapper {
await this._web3Wrapper.awaitTransactionSuccessAsync(
await this._web3Wrapper.sendTransactionAsync(setZrxVaultTxData)
);
// set staking proxy contract in reward vault
await (this._rewardVaultContractIfExists as RewardVaultContract).setStakingContractAddrsess.awaitTransactionSuccessAsync((this._stakingProxyContractIfExists as StakingProxyContract).address);
// set reward vault in staking contract
const setRewardVaultCalldata = await (this._stakingContractIfExists as StakingContract).setRewardVault.getABIEncodedTransactionData((this._rewardVaultContractIfExists as RewardVaultContract).address);
const setRewardVaultTxData = {
@@ -448,11 +450,11 @@ export class StakingWrapper {
return balance;
}
public async getZrxTokenBalance(holder: string): Promise<BigNumber> {
const balance = await this.getZrxVaultContract().balanceOf.callAsync(holder);
const balance = await this._zrxTokenContract.balanceOf.callAsync(holder);
return balance;
}
public async getZrxTokenBalanceOfZrxVault(): Promise<BigNumber> {
const balance = await this.getZrxVaultContract().balanceOf.callAsync(this.getZrxVaultContract().address);
const balance = await this._zrxTokenContract.balanceOf.callAsync(this.getZrxVaultContract().address);
return balance;
}
///// MATH /////
@@ -461,8 +463,8 @@ export class StakingWrapper {
const output = await this.getLibMathTestContract().nthRoot.callAsync(value, n);
return output;
}
public async nthRootFixedPoint(value: BigNumber, n: BigNumber, decimals: BigNumber): Promise<BigNumber> {
const output = await this.getLibMathTestContract().nthRootFixedPoint.callAsync(value, n, decimals);
public async nthRootFixedPoint(value: BigNumber, n: BigNumber): Promise<BigNumber> {
const output = await this.getLibMathTestContract().nthRootFixedPoint.callAsync(value, n);
return output;
}
public async cobbDouglas(