decent cobb douglas implementation

This commit is contained in:
Greg Hysen
2019-05-23 14:48:52 -07:00
parent 3c4cfe8aee
commit 19f6a8dcfe
4 changed files with 145 additions and 1 deletions

View File

@@ -106,6 +106,26 @@ export class StakingWrapper {
const output = await this.getLibMathTestContract().nthRootFixedPoint.callAsync(value, n, decimals);
return output;
}
public async cobbDouglas(
totalRewards: BigNumber,
ownerFees: BigNumber,
totalFees: BigNumber,
ownerStake: BigNumber,
totalStake: BigNumber,
alphaNumerator: BigNumber,
alphaDenominator: BigNumber
) {
const output = await this.getLibMathTestContract().cobbDouglas.callAsync(
totalRewards,
ownerFees,
totalFees,
ownerStake,
totalStake,
alphaNumerator,
alphaDenominator
);
return output;
}
public toBaseUnitAmount(amount: BigNumber | number): BigNumber {
const decimals = 18;
const amountAsBigNumber = typeof(amount) === 'number' ? new BigNumber(amount) : amount;