OSDN Git Service

update the radio limits.
[bytom/Bytom-Dapp-Demo.git] / src / components / constants.js
1 import config from 'config';
2 import BigNumber from "bignumber.js/bignumber";
3
4 let depositProgram
5 let profitProgram
6 let assetDeposited
7 let assetBill
8 let totalAmountBill
9 let totalAmountCapital
10 let dueBlockHeight
11 let expireBlockHeight
12 let banker
13 let gas
14 let radio
15
16 const GetContractArgs = function() {
17   if(window.bytom && window.bytom.defaultAccount && window.bytom.defaultAccount.net){
18     let network = window.bytom.defaultAccount.net
19
20     const object = config[network]
21     if(object){
22       depositProgram = object.depositProgram
23       profitProgram = object.profitProgram
24       assetDeposited = object.assetDeposited
25       assetBill = object.assetBill
26       totalAmountBill = object.totalAmountBill
27       totalAmountCapital = object.totalAmountCapital
28       dueBlockHeight = object.dueBlockHeight
29       expireBlockHeight = object.expireBlockHeight
30       banker = object.banker
31       gas = object.gas
32       radio =BigNumber(object.totalAmountCapital).div(object.totalAmountBill).toNumber()
33     }
34   }
35
36   return {
37       depositProgram,
38       profitProgram,
39       assetDeposited,
40       assetBill,
41       totalAmountBill,
42       totalAmountCapital,
43       dueBlockHeight,
44       expireBlockHeight,
45       banker,
46       gas,
47       radio
48     };
49 }
50
51 export default GetContractArgs;