Renamed LibMath to LibFeeMath
This commit is contained in:
parent
4d2ba9f1e6
commit
b36003896f
@ -19,6 +19,7 @@
|
||||
pragma solidity ^0.5.5;
|
||||
|
||||
import "../libs/LibSafeMath.sol";
|
||||
import "../libs/LibFeeMath.sol";
|
||||
import "../interfaces/IVault.sol";
|
||||
import "../immutable/MixinStorage.sol";
|
||||
import "../immutable/MixinConstants.sol";
|
||||
@ -29,7 +30,6 @@ import "./MixinPools.sol";
|
||||
import "./MixinExchange.sol";
|
||||
import "./MixinRewardVault.sol";
|
||||
import "../interfaces/IStructs.sol";
|
||||
import "../libs/LibMath.sol";
|
||||
|
||||
|
||||
contract MixinFees is
|
||||
@ -127,7 +127,7 @@ contract MixinFees is
|
||||
._div(100)
|
||||
);
|
||||
|
||||
uint256 reward = LibMath._cobbDouglasSuperSimplified(
|
||||
uint256 reward = LibFeeMath._cobbDouglasSuperSimplified(
|
||||
totalRewards,
|
||||
activePoolIds[i].feesCollected,
|
||||
totalFees,
|
||||
|
@ -22,7 +22,7 @@ pragma solidity ^0.5.5;
|
||||
|
||||
|
||||
|
||||
library LibMath {
|
||||
library LibFeeMath {
|
||||
|
||||
function _nthRoot(uint256 base, uint256 n) internal pure returns (uint256 root) {
|
||||
assembly {
|
@ -20,13 +20,13 @@
|
||||
|
||||
pragma solidity ^0.5.5;
|
||||
|
||||
import "../src/libs/LibMath.sol";
|
||||
import "../src/libs/LibFeeMath.sol";
|
||||
|
||||
|
||||
contract LibMathTest {
|
||||
contract LibFeeMathTest {
|
||||
|
||||
function nthRoot(uint256 base, uint256 n) public pure returns (uint256 root) {
|
||||
return LibMath._nthRoot(base, n);
|
||||
return LibFeeMath._nthRoot(base, n);
|
||||
}
|
||||
|
||||
function nthRootFixedPoint(
|
||||
@ -37,7 +37,7 @@ contract LibMathTest {
|
||||
pure
|
||||
returns (uint256 root)
|
||||
{
|
||||
return LibMath._nthRootFixedPoint(base, n);
|
||||
return LibFeeMath._nthRootFixedPoint(base, n);
|
||||
}
|
||||
|
||||
function cobbDouglas(
|
||||
@ -53,7 +53,7 @@ contract LibMathTest {
|
||||
pure
|
||||
returns (uint256)
|
||||
{
|
||||
return LibMath._cobbDouglas(
|
||||
return LibFeeMath._cobbDouglas(
|
||||
totalRewards,
|
||||
ownerFees,
|
||||
totalFees,
|
||||
@ -76,7 +76,7 @@ contract LibMathTest {
|
||||
pure
|
||||
returns (uint256)
|
||||
{
|
||||
return LibMath._cobbDouglasSimplified(
|
||||
return LibFeeMath._cobbDouglasSimplified(
|
||||
totalRewards,
|
||||
ownerFees,
|
||||
totalFees,
|
||||
@ -98,7 +98,7 @@ contract LibMathTest {
|
||||
// pure
|
||||
returns (uint256)
|
||||
{
|
||||
return LibMath._cobbDouglasSimplifiedInverse(
|
||||
return LibFeeMath._cobbDouglasSimplifiedInverse(
|
||||
totalRewards,
|
||||
ownerFees,
|
||||
totalFees,
|
@ -36,7 +36,7 @@
|
||||
"compile:truffle": "truffle compile"
|
||||
},
|
||||
"config": {
|
||||
"abis": "./generated-artifacts/@(LibMathTest|LibZrxToken|MixinStake|RewardVault|Staking|StakingProxy|ZrxVault).json",
|
||||
"abis": "./generated-artifacts/@(LibFeeMathTest|LibZrxToken|MixinStake|RewardVault|Staking|StakingProxy|ZrxVault).json",
|
||||
"abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually."
|
||||
},
|
||||
"repository": {
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
import { ContractArtifact } from 'ethereum-types';
|
||||
|
||||
import * as LibMathTest from '../generated-artifacts/LibMathTest.json';
|
||||
import * as LibFeeMathTest from '../generated-artifacts/LibFeeMathTest.json';
|
||||
import * as LibZrxToken from '../generated-artifacts/LibZrxToken.json';
|
||||
import * as MixinStake from '../generated-artifacts/MixinStake.json';
|
||||
import * as RewardVault from '../generated-artifacts/RewardVault.json';
|
||||
@ -19,5 +19,5 @@ export const artifacts = {
|
||||
LibZrxToken: LibZrxToken as ContractArtifact,
|
||||
RewardVault: RewardVault as ContractArtifact,
|
||||
ZrxVault: ZrxVault as ContractArtifact,
|
||||
LibMathTest: LibMathTest as ContractArtifact,
|
||||
LibFeeMathTest: LibFeeMathTest as ContractArtifact,
|
||||
};
|
||||
|
@ -3,7 +3,7 @@
|
||||
* Warning: This file is auto-generated by contracts-gen. Don't edit manually.
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
export * from '../generated-wrappers/lib_math_test';
|
||||
export * from '../generated-wrappers/lib_fee_math_test';
|
||||
export * from '../generated-wrappers/lib_zrx_token';
|
||||
export * from '../generated-wrappers/mixin_stake';
|
||||
export * from '../generated-wrappers/reward_vault';
|
||||
|
@ -9,7 +9,7 @@ import { artifacts as erc20Artifacts, DummyERC20TokenContract } from '@0x/contra
|
||||
import { ERC20ProxyContract } from '@0x/contracts-asset-proxy';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { artifacts, StakingContract, StakingProxyContract, ZrxVaultContract, RewardVaultContract, LibMathTestContract } from '../../src';
|
||||
import { artifacts, StakingContract, StakingProxyContract, ZrxVaultContract, RewardVaultContract, LibFeeMathTestContract } from '../../src';
|
||||
import { ApprovalFactory } from './ApprovalFactory';
|
||||
import { SignedStakingPoolApproval } from './types';
|
||||
import { constants } from './constants';
|
||||
@ -28,7 +28,7 @@ export class StakingWrapper {
|
||||
private _stakingProxyContractIfExists?: StakingProxyContract;
|
||||
private _zrxVaultContractIfExists?: ZrxVaultContract;
|
||||
private _rewardVaultContractIfExists?: RewardVaultContract;
|
||||
private _libMathTestContractIfExists?: LibMathTestContract;
|
||||
private _LibFeeMathTestContractIfExists?: LibFeeMathTestContract;
|
||||
|
||||
constructor(provider: Provider, ownerAddres: string, erc20ProxyContract: ERC20ProxyContract, zrxTokenContract: DummyERC20TokenContract, accounts: string[]) {
|
||||
this._web3Wrapper = new Web3Wrapper(provider);
|
||||
@ -56,9 +56,9 @@ export class StakingWrapper {
|
||||
this._validateDeployedOrThrow();
|
||||
return this._rewardVaultContractIfExists as RewardVaultContract;
|
||||
}
|
||||
public getLibMathTestContract(): LibMathTestContract {
|
||||
public getLibFeeMathTestContract(): LibFeeMathTestContract {
|
||||
this._validateDeployedOrThrow();
|
||||
return this._libMathTestContractIfExists as LibMathTestContract;
|
||||
return this._LibFeeMathTestContractIfExists as LibFeeMathTestContract;
|
||||
}
|
||||
public async deployAndConfigureContracts(): Promise<void> {
|
||||
// deploy zrx vault
|
||||
@ -117,8 +117,8 @@ export class StakingWrapper {
|
||||
await this._web3Wrapper.sendTransactionAsync(setRewardVaultTxData)
|
||||
);
|
||||
// deploy libmath test
|
||||
this._libMathTestContractIfExists = await LibMathTestContract.deployFrom0xArtifactAsync(
|
||||
artifacts.LibMathTest,
|
||||
this._LibFeeMathTestContractIfExists = await LibFeeMathTestContract.deployFrom0xArtifactAsync(
|
||||
artifacts.LibFeeMathTest,
|
||||
this._provider,
|
||||
txDefaults,
|
||||
);
|
||||
@ -521,12 +521,12 @@ export class StakingWrapper {
|
||||
}
|
||||
///// MATH /////
|
||||
public async nthRoot(value: BigNumber, n: BigNumber): Promise<BigNumber> {
|
||||
//const txReceipt = await this.getLibMathTestContract().nthRoot.await(value, n);
|
||||
const output = await this.getLibMathTestContract().nthRoot.callAsync(value, n);
|
||||
//const txReceipt = await this.getLibFeeMathTestContract().nthRoot.await(value, n);
|
||||
const output = await this.getLibFeeMathTestContract().nthRoot.callAsync(value, n);
|
||||
return output;
|
||||
}
|
||||
public async nthRootFixedPoint(value: BigNumber, n: BigNumber): Promise<BigNumber> {
|
||||
const output = await this.getLibMathTestContract().nthRootFixedPoint.callAsync(value, n);
|
||||
const output = await this.getLibFeeMathTestContract().nthRootFixedPoint.callAsync(value, n);
|
||||
return output;
|
||||
}
|
||||
public async cobbDouglasAsync(
|
||||
@ -538,7 +538,7 @@ export class StakingWrapper {
|
||||
alphaNumerator: BigNumber,
|
||||
alphaDenominator: BigNumber
|
||||
) {
|
||||
const output = await this.getLibMathTestContract().cobbDouglas.callAsync(
|
||||
const output = await this.getLibFeeMathTestContract().cobbDouglas.callAsync(
|
||||
totalRewards,
|
||||
ownerFees,
|
||||
totalFees,
|
||||
@ -557,7 +557,7 @@ export class StakingWrapper {
|
||||
totalStake: BigNumber,
|
||||
alphaDenominator: BigNumber
|
||||
) {
|
||||
const txReceipt = await this.getLibMathTestContract().cobbDouglasSimplifiedInverse.awaitTransactionSuccessAsync(
|
||||
const txReceipt = await this.getLibFeeMathTestContract().cobbDouglasSimplifiedInverse.awaitTransactionSuccessAsync(
|
||||
totalRewards,
|
||||
ownerFees,
|
||||
totalFees,
|
||||
@ -566,7 +566,7 @@ export class StakingWrapper {
|
||||
alphaDenominator
|
||||
);
|
||||
console.log(`Gas Used: ${txReceipt.gasUsed}`);
|
||||
const output = await this.getLibMathTestContract().cobbDouglasSimplified.callAsync(
|
||||
const output = await this.getLibFeeMathTestContract().cobbDouglasSimplified.callAsync(
|
||||
totalRewards,
|
||||
ownerFees,
|
||||
totalFees,
|
||||
@ -584,7 +584,7 @@ export class StakingWrapper {
|
||||
totalStake: BigNumber,
|
||||
alphaDenominator: BigNumber
|
||||
) {
|
||||
const txReceipt = await this.getLibMathTestContract().cobbDouglasSimplifiedInverse.awaitTransactionSuccessAsync(
|
||||
const txReceipt = await this.getLibFeeMathTestContract().cobbDouglasSimplifiedInverse.awaitTransactionSuccessAsync(
|
||||
totalRewards,
|
||||
ownerFees,
|
||||
totalFees,
|
||||
@ -593,7 +593,7 @@ export class StakingWrapper {
|
||||
alphaDenominator
|
||||
);
|
||||
|
||||
const output = await this.getLibMathTestContract().cobbDouglasSimplifiedInverse.callAsync(
|
||||
const output = await this.getLibFeeMathTestContract().cobbDouglasSimplifiedInverse.callAsync(
|
||||
totalRewards,
|
||||
ownerFees,
|
||||
totalFees,
|
||||
|
@ -3,7 +3,7 @@
|
||||
"compilerOptions": { "outDir": "lib", "rootDir": ".", "resolveJsonModule": true },
|
||||
"include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"],
|
||||
"files": [
|
||||
"generated-artifacts/LibMathTest.json",
|
||||
"generated-artifacts/LibFeeMathTest.json",
|
||||
"generated-artifacts/LibZrxToken.json",
|
||||
"generated-artifacts/MixinStake.json",
|
||||
"generated-artifacts/RewardVault.json",
|
||||
|
Loading…
x
Reference in New Issue
Block a user