Skip to content

Commit

Permalink
Merge pull request #502 from liquity/unipool-reward-rate
Browse files Browse the repository at this point in the history
feat: add `liquidityMiningLQTYRewardRate` to `EthersLiquityConnection`
  • Loading branch information
danielattilasimon authored Apr 7, 2021
2 parents 4916d42 + 0818b46 commit 337f8d1
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@liquity/lib-ethers](./lib-ethers.md) &gt; [EthersLiquityConnection](./lib-ethers.ethersliquityconnection.md) &gt; [liquidityMiningLQTYRewardRate](./lib-ethers.ethersliquityconnection.liquiditymininglqtyrewardrate.md)

## EthersLiquityConnection.liquidityMiningLQTYRewardRate property

Amount of LQTY collectively rewarded to stakers of the liquidity mining pool per second.

<b>Signature:</b>

```typescript
readonly liquidityMiningLQTYRewardRate: Decimal;
```
1 change: 1 addition & 0 deletions docs/sdk/lib-ethers.ethersliquityconnection.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Exposed through [ReadableEthersLiquity.connection](./lib-ethers.readableethersli
| [bootstrapPeriod](./lib-ethers.ethersliquityconnection.bootstrapperiod.md) | number | Time period (in seconds) after <code>deploymentDate</code> during which redemptions are disabled. |
| [chainId](./lib-ethers.ethersliquityconnection.chainid.md) | number | Chain ID of the connected network. |
| [deploymentDate](./lib-ethers.ethersliquityconnection.deploymentdate.md) | Date | Date when the Liquity contracts were deployed. |
| [liquidityMiningLQTYRewardRate](./lib-ethers.ethersliquityconnection.liquiditymininglqtyrewardrate.md) | [Decimal](./lib-base.decimal.md) | Amount of LQTY collectively rewarded to stakers of the liquidity mining pool per second. |
| [provider](./lib-ethers.ethersliquityconnection.provider.md) | [EthersProvider](./lib-ethers.ethersprovider.md) | Ethers <code>Provider</code> used for connecting to the network. |
| [signer?](./lib-ethers.ethersliquityconnection.signer.md) | [EthersSigner](./lib-ethers.etherssigner.md) | <i>(Optional)</i> Ethers <code>Signer</code> used for sending transactions. |
| [totalStabilityPoolLQTYReward](./lib-ethers.ethersliquityconnection.totalstabilitypoollqtyreward.md) | [Decimal](./lib-base.decimal.md) | Total amount of LQTY allocated for rewarding stability depositors. |
Expand Down
3 changes: 2 additions & 1 deletion packages/lib-ethers/deployments/default/goerli.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"deploymentDate": 1617356502000,
"bootstrapPeriod": 1209600,
"totalStabilityPoolLQTYReward": "32000000",
"liquidityMiningLQTYRewardRate": "0.257201646090534979",
"_priceFeedIsTestnet": true,
"_uniTokenIsMock": false,
"_isDev": false,
Expand All @@ -27,4 +28,4 @@
"multiTroveGetter": "0x251ce26Bc4604Cd2471f7D7F7bDedd2973211d17",
"uniToken": "0xc693D2CC6e5f9251594F132Ba6CA9DB106eF845b"
}
}
}
3 changes: 2 additions & 1 deletion packages/lib-ethers/deployments/default/kovan.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"deploymentDate": 1617374516000,
"bootstrapPeriod": 1209600,
"totalStabilityPoolLQTYReward": "32000000",
"liquidityMiningLQTYRewardRate": "0.257201646090534979",
"_priceFeedIsTestnet": false,
"_uniTokenIsMock": false,
"_isDev": false,
Expand All @@ -27,4 +28,4 @@
"multiTroveGetter": "0x9c5977268592E964784EFF50043BFFC035B6b0C7",
"uniToken": "0x6E14b68E16e4211C06bcc8527D6b92A43AA47806"
}
}
}
1 change: 1 addition & 0 deletions packages/lib-ethers/deployments/default/mainnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"deploymentDate": 1617611590000,
"bootstrapPeriod": 1209600,
"totalStabilityPoolLQTYReward": "32000000",
"liquidityMiningLQTYRewardRate": "0.367430922986478542",
"_priceFeedIsTestnet": false,
"_uniTokenIsMock": false,
"_isDev": false,
Expand Down
3 changes: 2 additions & 1 deletion packages/lib-ethers/deployments/default/rinkeby.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"deploymentDate": 1617355618000,
"bootstrapPeriod": 1209600,
"totalStabilityPoolLQTYReward": "32000000",
"liquidityMiningLQTYRewardRate": "0.257201646090534979",
"_priceFeedIsTestnet": false,
"_uniTokenIsMock": false,
"_isDev": false,
Expand All @@ -27,4 +28,4 @@
"multiTroveGetter": "0x1bE036A6A82b4b774757a48a1bb79653f89eD9fD",
"uniToken": "0x36A5ec67B9C25D765186FBAd2735f1746bd894D8"
}
}
}
3 changes: 2 additions & 1 deletion packages/lib-ethers/deployments/default/ropsten.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"deploymentDate": 1617356113000,
"bootstrapPeriod": 1209600,
"totalStabilityPoolLQTYReward": "32000000",
"liquidityMiningLQTYRewardRate": "0.257201646090534979",
"_priceFeedIsTestnet": true,
"_uniTokenIsMock": false,
"_isDev": false,
Expand All @@ -27,4 +28,4 @@
"multiTroveGetter": "0xDA7Aa96fC750B456a63af90D894063009e26f6ba",
"uniToken": "0x14E87Db22A5a402a0A1461FAE94fade1976AAaF7"
}
}
}
1 change: 1 addition & 0 deletions packages/lib-ethers/etc/lib-ethers.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ export interface EthersLiquityConnection extends EthersLiquityConnectionOptional
readonly deploymentDate: Date;
// @internal (undocumented)
readonly _isDev: boolean;
readonly liquidityMiningLQTYRewardRate: Decimal;
// @internal (undocumented)
readonly _priceFeedIsTestnet: boolean;
readonly provider: EthersProvider;
Expand Down
11 changes: 10 additions & 1 deletion packages/lib-ethers/src/EthersLiquityConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ export interface EthersLiquityConnection extends EthersLiquityConnectionOptional
/** Total amount of LQTY allocated for rewarding stability depositors. */
readonly totalStabilityPoolLQTYReward: Decimal;

/** Amount of LQTY collectively rewarded to stakers of the liquidity mining pool per second. */
readonly liquidityMiningLQTYRewardRate: Decimal;

/** A mapping of Liquity contracts' names to their addresses. */
readonly addresses: Record<string, string>;

Expand All @@ -97,7 +100,12 @@ const connectionFrom = (
signer: EthersSigner | undefined,
_contracts: _LiquityContracts,
_multicall: _Multicall | undefined,
{ deploymentDate, totalStabilityPoolLQTYReward, ...deployment }: _LiquityDeploymentJSON,
{
deploymentDate,
totalStabilityPoolLQTYReward,
liquidityMiningLQTYRewardRate,
...deployment
}: _LiquityDeploymentJSON,
optionalParams?: EthersLiquityConnectionOptionalParams
): _InternalEthersLiquityConnection => {
if (
Expand All @@ -115,6 +123,7 @@ const connectionFrom = (
_multicall,
deploymentDate: new Date(deploymentDate),
totalStabilityPoolLQTYReward: Decimal.from(totalStabilityPoolLQTYReward),
liquidityMiningLQTYRewardRate: Decimal.from(liquidityMiningLQTYRewardRate),
...deployment,
...optionalParams
});
Expand Down
1 change: 1 addition & 0 deletions packages/lib-ethers/src/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ export interface _LiquityDeploymentJSON {
readonly deploymentDate: number;
readonly bootstrapPeriod: number;
readonly totalStabilityPoolLQTYReward: string;
readonly liquidityMiningLQTYRewardRate: string;
readonly _priceFeedIsTestnet: boolean;
readonly _uniTokenIsMock: boolean;
readonly _isDev: boolean;
Expand Down
13 changes: 9 additions & 4 deletions packages/lib-ethers/utils/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ export const deployAndSetupContracts = async (
deploymentDate: new Date().getTime(),
bootstrapPeriod: 0,
totalStabilityPoolLQTYReward: "0",
liquidityMiningLQTYRewardRate: "0",
_priceFeedIsTestnet,
_uniTokenIsMock: !wethAddress,
_isDev,
Expand All @@ -338,20 +339,24 @@ export const deployAndSetupContracts = async (
};

const contracts = _connectToContracts(deployer, deployment);
const lqtyTokenDeploymentTime = await contracts.lqtyToken.getDeploymentStartTime();
const bootstrapPeriod = await contracts.troveManager.BOOTSTRAP_PERIOD();
const totalStabilityPoolLQTYReward = await contracts.communityIssuance.LQTYSupplyCap();

log("Connecting contracts...");

await connectContracts(contracts, deployer, overrides);

const lqtyTokenDeploymentTime = await contracts.lqtyToken.getDeploymentStartTime();
const bootstrapPeriod = await contracts.troveManager.BOOTSTRAP_PERIOD();
const totalStabilityPoolLQTYReward = await contracts.communityIssuance.LQTYSupplyCap();
const liquidityMiningLQTYRewardRate = await contracts.unipool.rewardRate();

return {
...deployment,
deploymentDate: lqtyTokenDeploymentTime.toNumber() * 1000,
bootstrapPeriod: bootstrapPeriod.toNumber(),
totalStabilityPoolLQTYReward: `${Decimal.fromBigNumberString(
totalStabilityPoolLQTYReward.toHexString()
)}`,
liquidityMiningLQTYRewardRate: `${Decimal.fromBigNumberString(
liquidityMiningLQTYRewardRate.toHexString()
)}`
};
};

0 comments on commit 337f8d1

Please sign in to comment.