Documentation for MixinDelegatedStake
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user