Got staking contracts working after rebase

This commit is contained in:
Greg Hysen 2019-08-19 16:35:03 -07:00
parent de8b032df9
commit a765e47dca
7 changed files with 139 additions and 42 deletions

View File

@ -73,13 +73,13 @@ library LibEIP712Hash
pure
returns (bytes32 result)
{
bytes32 eip712StakingDomainHash = LibEIP712._hashEIP712Domain(
bytes32 eip712StakingDomainHash = LibEIP712.hashEIP712Domain(
EIP712_STAKING_DOMAIN_NAME,
EIP712_STAKING_DOMAIN_VERSION,
chainId,
verifierAddress
);
return LibEIP712._hashEIP712Message(eip712StakingDomainHash, hashStruct);
return LibEIP712.hashEIP712Message(eip712StakingDomainHash, hashStruct);
}
/// @dev Calculated the EIP712 hash of the StakingPool approval mesasage with no domain separator.

View File

@ -36,7 +36,7 @@
"compile:truffle": "truffle compile"
},
"config": {
"abis": "./generated-artifacts/@(LibFeeMathTest|Staking|StakingPoolRewardVault|StakingProxy|ZrxVault).json",
"abis": "./generated-artifacts/@(IAssetProxy|IStaking|IStakingEvents|IStakingPoolRewardVault|IStakingProxy|IStructs|IVaultCore|IWallet|IZrxVault|LibEIP712Hash|LibFeeMath|LibFeeMathTest|LibRewardMath|LibSafeMath|LibSafeMath64|LibSafeMath96|LibSignatureValidator|MixinConstants|MixinDelegatedStake|MixinDeploymentConstants|MixinExchangeFees|MixinExchangeManager|MixinOwnable|MixinScheduler|MixinStake|MixinStakeBalances|MixinStakingPool|MixinStakingPoolRewardVault|MixinStakingPoolRewards|MixinStorage|MixinTimelockedStake|MixinVaultCore|MixinZrxVault|Staking|StakingPoolRewardVault|StakingProxy|ZrxVault).json",
"abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually."
},
"repository": {
@ -49,7 +49,7 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/tokens/README.md",
"devDependencies": {
"@0x/abi-gen": "^2.0.9",
"@0x/abi-gen": "^4.1.0",
"@0x/contracts-gen": "^1.0.8",
"@0x/contracts-test-utils": "^3.1.2",
"@0x/dev-utils": "^2.2.1",
@ -73,8 +73,8 @@
},
"dependencies": {
"@0x/base-contract": "^5.1.0",
"@0x/contracts-utils": "3.1.6",
"@0x/contracts-asset-proxy": "^2.1.1",
"@0x/contracts-utils": "^3.2.1",
"@0x/contracts-asset-proxy": "^2.2.5",
"@0x/contracts-erc20": "^2.2.0",
"@0x/order-utils": "^8.1.0",
"@0x/types": "^2.2.2",

View File

@ -5,7 +5,39 @@
*/
import { ContractArtifact } from 'ethereum-types';
import * as IAssetProxy from '../generated-artifacts/IAssetProxy.json';
import * as IStaking from '../generated-artifacts/IStaking.json';
import * as IStakingEvents from '../generated-artifacts/IStakingEvents.json';
import * as IStakingPoolRewardVault from '../generated-artifacts/IStakingPoolRewardVault.json';
import * as IStakingProxy from '../generated-artifacts/IStakingProxy.json';
import * as IStructs from '../generated-artifacts/IStructs.json';
import * as IVaultCore from '../generated-artifacts/IVaultCore.json';
import * as IWallet from '../generated-artifacts/IWallet.json';
import * as IZrxVault from '../generated-artifacts/IZrxVault.json';
import * as LibEIP712Hash from '../generated-artifacts/LibEIP712Hash.json';
import * as LibFeeMath from '../generated-artifacts/LibFeeMath.json';
import * as LibFeeMathTest from '../generated-artifacts/LibFeeMathTest.json';
import * as LibRewardMath from '../generated-artifacts/LibRewardMath.json';
import * as LibSafeMath from '../generated-artifacts/LibSafeMath.json';
import * as LibSafeMath64 from '../generated-artifacts/LibSafeMath64.json';
import * as LibSafeMath96 from '../generated-artifacts/LibSafeMath96.json';
import * as LibSignatureValidator from '../generated-artifacts/LibSignatureValidator.json';
import * as MixinConstants from '../generated-artifacts/MixinConstants.json';
import * as MixinDelegatedStake from '../generated-artifacts/MixinDelegatedStake.json';
import * as MixinDeploymentConstants from '../generated-artifacts/MixinDeploymentConstants.json';
import * as MixinExchangeFees from '../generated-artifacts/MixinExchangeFees.json';
import * as MixinExchangeManager from '../generated-artifacts/MixinExchangeManager.json';
import * as MixinOwnable from '../generated-artifacts/MixinOwnable.json';
import * as MixinScheduler from '../generated-artifacts/MixinScheduler.json';
import * as MixinStake from '../generated-artifacts/MixinStake.json';
import * as MixinStakeBalances from '../generated-artifacts/MixinStakeBalances.json';
import * as MixinStakingPool from '../generated-artifacts/MixinStakingPool.json';
import * as MixinStakingPoolRewardVault from '../generated-artifacts/MixinStakingPoolRewardVault.json';
import * as MixinStakingPoolRewards from '../generated-artifacts/MixinStakingPoolRewards.json';
import * as MixinStorage from '../generated-artifacts/MixinStorage.json';
import * as MixinTimelockedStake from '../generated-artifacts/MixinTimelockedStake.json';
import * as MixinVaultCore from '../generated-artifacts/MixinVaultCore.json';
import * as MixinZrxVault from '../generated-artifacts/MixinZrxVault.json';
import * as Staking from '../generated-artifacts/Staking.json';
import * as StakingPoolRewardVault from '../generated-artifacts/StakingPoolRewardVault.json';
import * as StakingProxy from '../generated-artifacts/StakingProxy.json';
@ -13,6 +45,38 @@ import * as ZrxVault from '../generated-artifacts/ZrxVault.json';
export const artifacts = {
Staking: Staking as ContractArtifact,
StakingProxy: StakingProxy as ContractArtifact,
MixinExchangeFees: MixinExchangeFees as ContractArtifact,
MixinExchangeManager: MixinExchangeManager as ContractArtifact,
MixinConstants: MixinConstants as ContractArtifact,
MixinDeploymentConstants: MixinDeploymentConstants as ContractArtifact,
MixinStorage: MixinStorage as ContractArtifact,
IAssetProxy: IAssetProxy as ContractArtifact,
IStaking: IStaking as ContractArtifact,
IStakingEvents: IStakingEvents as ContractArtifact,
IStakingPoolRewardVault: IStakingPoolRewardVault as ContractArtifact,
IStakingProxy: IStakingProxy as ContractArtifact,
IStructs: IStructs as ContractArtifact,
IVaultCore: IVaultCore as ContractArtifact,
IWallet: IWallet as ContractArtifact,
IZrxVault: IZrxVault as ContractArtifact,
LibEIP712Hash: LibEIP712Hash as ContractArtifact,
LibFeeMath: LibFeeMath as ContractArtifact,
LibRewardMath: LibRewardMath as ContractArtifact,
LibSafeMath: LibSafeMath as ContractArtifact,
LibSafeMath64: LibSafeMath64 as ContractArtifact,
LibSafeMath96: LibSafeMath96 as ContractArtifact,
LibSignatureValidator: LibSignatureValidator as ContractArtifact,
MixinDelegatedStake: MixinDelegatedStake as ContractArtifact,
MixinStake: MixinStake as ContractArtifact,
MixinStakeBalances: MixinStakeBalances as ContractArtifact,
MixinTimelockedStake: MixinTimelockedStake as ContractArtifact,
MixinZrxVault: MixinZrxVault as ContractArtifact,
MixinStakingPool: MixinStakingPool as ContractArtifact,
MixinStakingPoolRewardVault: MixinStakingPoolRewardVault as ContractArtifact,
MixinStakingPoolRewards: MixinStakingPoolRewards as ContractArtifact,
MixinOwnable: MixinOwnable as ContractArtifact,
MixinScheduler: MixinScheduler as ContractArtifact,
MixinVaultCore: MixinVaultCore as ContractArtifact,
StakingPoolRewardVault: StakingPoolRewardVault as ContractArtifact,
ZrxVault: ZrxVault as ContractArtifact,
LibFeeMathTest: LibFeeMathTest as ContractArtifact,

View File

@ -3,7 +3,39 @@
* Warning: This file is auto-generated by contracts-gen. Don't edit manually.
* -----------------------------------------------------------------------------
*/
export * from '../generated-wrappers/i_asset_proxy';
export * from '../generated-wrappers/i_staking';
export * from '../generated-wrappers/i_staking_events';
export * from '../generated-wrappers/i_staking_pool_reward_vault';
export * from '../generated-wrappers/i_staking_proxy';
export * from '../generated-wrappers/i_structs';
export * from '../generated-wrappers/i_vault_core';
export * from '../generated-wrappers/i_wallet';
export * from '../generated-wrappers/i_zrx_vault';
export * from '../generated-wrappers/lib_e_i_p712_hash';
export * from '../generated-wrappers/lib_fee_math';
export * from '../generated-wrappers/lib_fee_math_test';
export * from '../generated-wrappers/lib_reward_math';
export * from '../generated-wrappers/lib_safe_math';
export * from '../generated-wrappers/lib_safe_math64';
export * from '../generated-wrappers/lib_safe_math96';
export * from '../generated-wrappers/lib_signature_validator';
export * from '../generated-wrappers/mixin_constants';
export * from '../generated-wrappers/mixin_delegated_stake';
export * from '../generated-wrappers/mixin_deployment_constants';
export * from '../generated-wrappers/mixin_exchange_fees';
export * from '../generated-wrappers/mixin_exchange_manager';
export * from '../generated-wrappers/mixin_ownable';
export * from '../generated-wrappers/mixin_scheduler';
export * from '../generated-wrappers/mixin_stake';
export * from '../generated-wrappers/mixin_stake_balances';
export * from '../generated-wrappers/mixin_staking_pool';
export * from '../generated-wrappers/mixin_staking_pool_reward_vault';
export * from '../generated-wrappers/mixin_staking_pool_rewards';
export * from '../generated-wrappers/mixin_storage';
export * from '../generated-wrappers/mixin_timelocked_stake';
export * from '../generated-wrappers/mixin_vault_core';
export * from '../generated-wrappers/mixin_zrx_vault';
export * from '../generated-wrappers/staking';
export * from '../generated-wrappers/staking_pool_reward_vault';
export * from '../generated-wrappers/staking_proxy';

View File

@ -105,6 +105,7 @@ export class StakingWrapper {
artifacts.ZrxVault,
this._provider,
txDefaults,
artifacts,
this._erc20ProxyContract.address,
this._zrxTokenContract.address,
zrxAssetData,
@ -114,6 +115,7 @@ export class StakingWrapper {
artifacts.StakingPoolRewardVault,
this._provider,
txDefaults,
artifacts,
);
// configure erc20 proxy to accept calls from zrx vault
await this._erc20ProxyContract.addAuthorizedAddress.awaitTransactionSuccessAsync(
@ -124,12 +126,14 @@ export class StakingWrapper {
artifacts.Staking,
this._provider,
txDefaults,
artifacts,
);
// deploy staking proxy
this._stakingProxyContractIfExists = await StakingProxyContract.deployFrom0xArtifactAsync(
artifacts.StakingProxy,
this._provider,
txDefaults,
artifacts,
this._stakingContractIfExists.address,
);
// set staking proxy contract in zrx vault
@ -169,6 +173,7 @@ export class StakingWrapper {
artifacts.LibFeeMathTest,
this._provider,
txDefaults,
artifacts,
);
}
public async getEthBalanceAsync(owner: string): Promise<BigNumber> {

View File

@ -3,7 +3,39 @@
"compilerOptions": { "outDir": "lib", "rootDir": ".", "resolveJsonModule": true },
"include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"],
"files": [
"generated-artifacts/IAssetProxy.json",
"generated-artifacts/IStaking.json",
"generated-artifacts/IStakingEvents.json",
"generated-artifacts/IStakingPoolRewardVault.json",
"generated-artifacts/IStakingProxy.json",
"generated-artifacts/IStructs.json",
"generated-artifacts/IVaultCore.json",
"generated-artifacts/IWallet.json",
"generated-artifacts/IZrxVault.json",
"generated-artifacts/LibEIP712Hash.json",
"generated-artifacts/LibFeeMath.json",
"generated-artifacts/LibFeeMathTest.json",
"generated-artifacts/LibRewardMath.json",
"generated-artifacts/LibSafeMath.json",
"generated-artifacts/LibSafeMath64.json",
"generated-artifacts/LibSafeMath96.json",
"generated-artifacts/LibSignatureValidator.json",
"generated-artifacts/MixinConstants.json",
"generated-artifacts/MixinDelegatedStake.json",
"generated-artifacts/MixinDeploymentConstants.json",
"generated-artifacts/MixinExchangeFees.json",
"generated-artifacts/MixinExchangeManager.json",
"generated-artifacts/MixinOwnable.json",
"generated-artifacts/MixinScheduler.json",
"generated-artifacts/MixinStake.json",
"generated-artifacts/MixinStakeBalances.json",
"generated-artifacts/MixinStakingPool.json",
"generated-artifacts/MixinStakingPoolRewardVault.json",
"generated-artifacts/MixinStakingPoolRewards.json",
"generated-artifacts/MixinStorage.json",
"generated-artifacts/MixinTimelockedStake.json",
"generated-artifacts/MixinVaultCore.json",
"generated-artifacts/MixinZrxVault.json",
"generated-artifacts/Staking.json",
"generated-artifacts/StakingPoolRewardVault.json",
"generated-artifacts/StakingProxy.json",

View File

@ -649,26 +649,6 @@
dependencies:
"@0x/base-contract" "^4.0.3"
"@0x/abi-gen@^2.0.9":
version "2.1.1"
resolved "https://registry.yarnpkg.com/@0x/abi-gen/-/abi-gen-2.1.1.tgz#2ca9072e64a2a46b6149aaea434f09d5dbf0866f"
integrity sha512-QLigDvQEGe248MjafJ58nWfwMbz+Va6KTlCsrADTuQd711XY10c95poDPevOfAXNHFZYpgS6rEzIau0WmY+Kbw==
dependencies:
"@0x/types" "^2.4.0"
"@0x/typescript-typings" "^4.2.3"
"@0x/utils" "^4.4.0"
chalk "^2.3.0"
change-case "^3.0.2"
cli-format "^3.0.9"
ethereum-types "^2.1.3"
glob "^7.1.2"
handlebars "^4.0.11"
lodash "^4.17.11"
mkdirp "^0.5.1"
tmp "^0.0.33"
to-snake-case "^1.0.0"
yargs "^10.0.3"
"@0x/asset-buyer@6.1.8":
version "6.1.8"
resolved "https://registry.yarnpkg.com/@0x/asset-buyer/-/asset-buyer-6.1.8.tgz#71f6abb366e89e62457c256644edb37e12113e94"
@ -746,22 +726,6 @@
ethereumjs-util "^5.1.1"
lodash "^4.17.5"
"@0x/contracts-utils@3.1.6":
version "3.1.6"
resolved "https://registry.yarnpkg.com/@0x/contracts-utils/-/contracts-utils-3.1.6.tgz#b415754931bb9d41ad2aa45cb54c8a14388cc061"
integrity sha512-HlG1ZNupShtBZX0mJqN6PSSZLPPc+7Bp1ZcccLVTyialZdWBEm91eFzgaymv2xNlRxM3H5bVtFi/YtRienOKGQ==
dependencies:
"@0x/base-contract" "^5.1.0"
"@0x/order-utils" "^8.1.1"
"@0x/types" "^2.2.2"
"@0x/typescript-typings" "^4.2.2"
"@0x/utils" "^4.3.3"
"@0x/web3-wrapper" "^6.0.6"
bn.js "^4.11.8"
ethereum-types "^2.1.2"
ethereumjs-util "^5.1.1"
lodash "^4.17.11"
"@0x/coordinator-server@^0.1.3":
version "0.1.3"
resolved "https://registry.yarnpkg.com/@0x/coordinator-server/-/coordinator-server-0.1.3.tgz#5fbb7c11bb641aa5386797769cab9a68a7d15b79"