Documentation for MixinDelegatedStake

This commit is contained in:
Greg Hysen
2019-06-27 22:29:22 -07:00
parent 93844343de
commit 3e6cae0ca0
7 changed files with 127 additions and 62 deletions

View File

@@ -17,7 +17,7 @@ export class DelegatorActor extends StakerActor {
constructor(owner: string, stakingWrapper: StakingWrapper) {
super(owner, stakingWrapper);
}
public async depositAndDelegateAsync(
public async depositZrxAndDelegateToStakingPoolAsync(
poolId: string,
amount: BigNumber,
revertReason?: RevertReason,
@@ -26,7 +26,7 @@ export class DelegatorActor extends StakerActor {
const initZrxBalanceOfVault = await this._stakingWrapper.getZrxTokenBalanceOfZrxVaultAsync();
const initDelegatorBalances = await this.getBalancesAsync([poolId]);
// deposit stake
const txReceiptPromise = this._stakingWrapper.depositAndDelegateAsync(this._owner, poolId, amount);
const txReceiptPromise = this._stakingWrapper.depositZrxAndDelegateToStakingPoolAsync(this._owner, poolId, amount);
if (revertReason !== undefined) {
await expectTransactionFailedAsync(txReceiptPromise, revertReason);
return;

View File

@@ -95,7 +95,7 @@ describe('Staking & Delegating', () => {
const poolId = await stakingWrapper.createStakingPoolAsync(poolOperator, operatorShare);
// run test
const delegator = new DelegatorActor(stakers[0], stakingWrapper);
await delegator.depositAndDelegateAsync(poolId, amountToDelegate);
await delegator.depositZrxAndDelegateToStakingPoolAsync(poolId, amountToDelegate);
await delegator.deactivateAndTimelockDelegatedStakeAsync(poolId, amountToDeactivate);
// note - we cannot re-activate this timelocked stake until at least one full timelock period has passed.
// attempting to do so should revert.

View File

@@ -179,7 +179,7 @@ export class Simulation {
for (const j of _.range(numberOfDelegatorsInPool)) {
const delegator = this._delegators[delegatorIdx];
const amount = p.stakeByDelegator[delegatorIdx];
await delegator.depositAndDelegateAsync(poolId, amount);
await delegator.depositZrxAndDelegateToStakingPoolAsync(poolId, amount);
delegatorIdx += 1;
}
poolIdx += 1;

View File

@@ -190,12 +190,12 @@ export class StakingWrapper {
const txReceipt = await this._executeTransactionAsync(calldata, owner);
return txReceipt;
}
public async depositAndDelegateAsync(
public async depositZrxAndDelegateToStakingPoolAsync(
owner: string,
poolId: string,
amount: BigNumber,
): Promise<TransactionReceiptWithDecodedLogs> {
const calldata = this.getStakingContract().depositAndDelegate.getABIEncodedTransactionData(poolId, amount);
const calldata = this.getStakingContract().depositZrxAndDelegateToStakingPool.getABIEncodedTransactionData(poolId, amount);
const txReceipt = await this._executeTransactionAsync(calldata, owner, new BigNumber(0), true);
return txReceipt;
}