How to use @0x/contracts-utils - 4 common examples

To help you get started, we’ve selected a few @0x/contracts-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github 0xProject / 0x-monorepo / packages / migrations / src / utils / timelocks.ts View on Github external
export async function getTimelockRegistrationsAsync(provider: SupportedProvider): Promise {
    const web3Wrapper = new Web3Wrapper(provider);
    const chainId = await web3Wrapper.getChainIdAsync();
    const deployedAddresses = getContractAddressesForChainOrThrow(chainId);

    const authorizableInterface = new IAuthorizableContract(constants.NULL_ADDRESS, provider);
    const ownableInterface = new IOwnableContract(constants.NULL_ADDRESS, provider);
    const zrxVault = new ZrxVaultContract(constants.NULL_ADDRESS, provider);
    const stakingProxy = new StakingProxyContract(constants.NULL_ADDRESS, provider);
    const exchange = new ExchangeContract(constants.NULL_ADDRESS, provider);
    const stakingLogic = new StakingContract(constants.NULL_ADDRESS, provider);

    const noTimelockRegistrations = [
        // AssetProxy timelocks
        {
            destination: deployedAddresses.erc20Proxy,
            functionSelector: authorizableInterface.getSelector('removeAuthorizedAddress'),
            secondsTimeLocked: constants.ZERO_AMOUNT,
        },
        {
            destination: deployedAddresses.erc20Proxy,
            functionSelector: authorizableInterface.getSelector('removeAuthorizedAddressAtIndex'),
github 0xProject / 0x-monorepo / packages / migrations / src / utils / timelocks.ts View on Github external
export async function getTimelockRegistrationsAsync(provider: SupportedProvider): Promise {
    const web3Wrapper = new Web3Wrapper(provider);
    const chainId = await web3Wrapper.getChainIdAsync();
    const deployedAddresses = getContractAddressesForChainOrThrow(chainId);

    const authorizableInterface = new IAuthorizableContract(constants.NULL_ADDRESS, provider);
    const ownableInterface = new IOwnableContract(constants.NULL_ADDRESS, provider);
    const zrxVault = new ZrxVaultContract(constants.NULL_ADDRESS, provider);
    const stakingProxy = new StakingProxyContract(constants.NULL_ADDRESS, provider);
    const exchange = new ExchangeContract(constants.NULL_ADDRESS, provider);
    const stakingLogic = new StakingContract(constants.NULL_ADDRESS, provider);

    const noTimelockRegistrations = [
        // AssetProxy timelocks
        {
            destination: deployedAddresses.erc20Proxy,
            functionSelector: authorizableInterface.getSelector('removeAuthorizedAddress'),
            secondsTimeLocked: constants.ZERO_AMOUNT,
        },
        {
            destination: deployedAddresses.erc20Proxy,
            functionSelector: authorizableInterface.getSelector('removeAuthorizedAddressAtIndex'),
            secondsTimeLocked: constants.ZERO_AMOUNT,
github 0xProject / 0x-monorepo / packages / migrations / src / testnet_migrations.ts View on Github external
await UniswapBridgeContract.deployFrom0xArtifactAsync(
        assetProxyArtifacts.UniswapBridge,
        provider,
        txDefaults,
        assetProxyArtifacts,
    );

    await Eth2DaiBridgeContract.deployFrom0xArtifactAsync(
        assetProxyArtifacts.Eth2DaiBridge,
        provider,
        txDefaults,
        assetProxyArtifacts,
    );

    const authorizableInterface = new IAuthorizableContract(constants.NULL_ADDRESS, provider, txDefaults);
    const ownableInterface = new IOwnableContract(constants.NULL_ADDRESS, provider, txDefaults);

    const customTimeLocks = getTimelockRegistrationsByChainId(chainId.toNumber());

    const governor = await ZeroExGovernorContract.deployFrom0xArtifactAsync(
        multisigArtifacts.ZeroExGovernor,
        provider,
        txDefaults,
        multisigArtifacts,
        customTimeLocks.map(timeLockInfo => timeLockInfo.functionSelector),
        customTimeLocks.map(timeLockInfo => timeLockInfo.destination),
        customTimeLocks.map(timeLockInfo => timeLockInfo.secondsTimeLocked),
        configs.zeroExGovernor.owners,
        configs.zeroExGovernor.required,
        configs.zeroExGovernor.secondsTimeLocked,
    );
github 0xProject / 0x-monorepo / packages / migrations / src / testnet_migrations.ts View on Github external
await UniswapBridgeContract.deployFrom0xArtifactAsync(
        assetProxyArtifacts.UniswapBridge,
        provider,
        txDefaults,
        assetProxyArtifacts,
    );

    await Eth2DaiBridgeContract.deployFrom0xArtifactAsync(
        assetProxyArtifacts.Eth2DaiBridge,
        provider,
        txDefaults,
        assetProxyArtifacts,
    );

    const authorizableInterface = new IAuthorizableContract(constants.NULL_ADDRESS, provider, txDefaults);
    const ownableInterface = new IOwnableContract(constants.NULL_ADDRESS, provider, txDefaults);

    const customTimeLocks = getTimelockRegistrationsByChainId(chainId.toNumber());

    const governor = await ZeroExGovernorContract.deployFrom0xArtifactAsync(
        multisigArtifacts.ZeroExGovernor,
        provider,
        txDefaults,
        multisigArtifacts,
        customTimeLocks.map(timeLockInfo => timeLockInfo.functionSelector),
        customTimeLocks.map(timeLockInfo => timeLockInfo.destination),
        customTimeLocks.map(timeLockInfo => timeLockInfo.secondsTimeLocked),
        configs.zeroExGovernor.owners,
        configs.zeroExGovernor.required,
        configs.zeroExGovernor.secondsTimeLocked,
    );

@0x/contracts-utils

Smart contract utils of 0x protocol

Apache-2.0
Latest version published 3 months ago

Package Health Score

76 / 100
Full package analysis

Similar packages