• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript abi-decoder.addABI函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中abi-decoder.addABI函数的典型用法代码示例。如果您正苦于以下问题:TypeScript addABI函数的具体用法?TypeScript addABI怎么用?TypeScript addABI使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了addABI函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: before

    before(async () => {
        multiSig = await DharmaMultiSigWalletContract.deployed(web3, TX_DEFAULTS);
        debtRegistry = await DebtRegistryContract.deployed(web3, TX_DEFAULTS);
        debtToken = await DebtTokenContract.deployed(web3, TX_DEFAULTS);
        debtKernel = await DebtKernelContract.deployed(web3, TX_DEFAULTS);

        ABIDecoder.addABI(debtRegistryContract.abi);
        ABIDecoder.addABI(debtTokenContract.abi);
    });
开发者ID:TheRealest,项目名称:charta,代码行数:9,代码来源:debt_token.ts


示例2: before

    before(async () => {
        debtKernel = await DebtKernelContract.deployed(web3, TX_DEFAULTS);
        mockDebtRegistry = await MockDebtRegistryContract.deployed(web3, TX_DEFAULTS);
        mockTokenTransferProxy = await MockTokenTransferProxyContract.deployed(web3, TX_DEFAULTS);
        mockTokenRegistry = await MockTokenRegistryContract.deployed(web3, TX_DEFAULTS);
        mockDebtToken = await MockDebtTokenContract.deployed(web3, TX_DEFAULTS);
        repaymentRouter = await RepaymentRouterContract.deployed(web3, TX_DEFAULTS);
        collateralizer = await CollateralizerContract.deployed(web3, TX_DEFAULTS);

        const contractRegistryTruffle = await contractRegistryArtifact.new(
            collateralizer.address,
            debtKernel.address,
            mockDebtRegistry.address,
            mockDebtToken.address,
            repaymentRouter.address,
            mockTokenRegistry.address,
            mockTokenTransferProxy.address,
            { from: CONTRACT_OWNER },
        );

        const contractRegistryAsWeb3Contract = web3.eth
            .contract(contractRegistryArtifact.abi)
            .at(contractRegistryTruffle.address);

        contractRegistry = new ContractRegistryContract(
            contractRegistryAsWeb3Contract,
            TX_DEFAULTS,
        );

        ABIDecoder.addABI(contractRegistry.abi);
    });
开发者ID:TheRealest,项目名称:charta,代码行数:31,代码来源:contract_registry.ts


示例3: before

            before(async () => {
                await this.setupDebtOrder(scenario);

                dummyZRXToken = await this.setupDummyZRXToken();
                dummyREPToken = this.contracts.dummyREPToken;

                const {
                    CONTRACT_OWNER,
                    DEBTOR_1,
                } = this.accounts;

                const {
                    tokenTransferProxy,
                    simpleInterestTermsContract,
                } = this.contracts;

                // Fill a debt order, against which to test repayments.
                await this.fillDebtOrder();

                await dummyREPToken.setBalance.sendTransactionAsync(DEBTOR_1, scenario.repaymentAmount, {
                    from: CONTRACT_OWNER,
                });

                await dummyREPToken.approve.sendTransactionAsync(
                    tokenTransferProxy.address,
                    scenario.repaymentAmount,
                    { from: DEBTOR_1 },
                );

                repaidAmountBefore = await this.contracts.simpleInterestTermsContract
                    .getValueRepaidToDate.callAsync(this.agreementId);

                // Setup ABI decoder in order to decode logs
                ABIDecoder.addABI(simpleInterestTermsContract.abi);
            });
开发者ID:TheRealest,项目名称:charta,代码行数:35,代码来源:register_repayment.ts


示例4: submitMultiSigTransaction

export async function submitMultiSigTransaction(
    multiSig: DharmaMultiSigWalletContract,
    contract: BaseContract,
    methodName: string,
    args: any[],
    txData: TxData,
): Promise<BigNumber> {
    ABIDecoder.addABI(multiSig.abi);

    const encodedTransaction = await contract.web3ContractInstance[methodName].getData.apply(
        null,
        args,
    );

    const txHash = await multiSig.submitTransaction.sendTransactionAsync(
        contract.address,
        // Ether value - 0.
        new BigNumber(0),
        encodedTransaction,
        txData,
    );

    // Get the transaction ID from the logs.
    const receipt = await web3.eth.getTransactionReceipt(txHash);

    const submission = ABIDecoder.decodeLogs(receipt.logs)[0] as DecodedLog<
        MultiSigSubmissionEventArgs
    >;
    const transactionId = submission.events[0].value;

    ABIDecoder.removeABI(multiSig.abi);

    return transactionId;
}
开发者ID:TheRealest,项目名称:charta,代码行数:34,代码来源:multisig.ts


示例5: before

    before(async () => {
        const registryTruffleContract = await debtRegistryContract.new();

        // The typings we use ingest vanilla Web3 contracts, so we convert the
        // contract instance deployed by truffle into a Web3 contract instance
        const registryWeb3Contract = web3.eth
            .contract(debtRegistryContract.abi)
            .at(registryTruffleContract.address);

        registry = new DebtRegistryContract(registryWeb3Contract, TX_DEFAULTS);

        // The version of an entry is mapped to the address of
        // the current RepaymentRouter used in the debt agreement
        const repaymentRouter = await repaymentRouterContract.deployed();
        const VERSION = repaymentRouter.address;

        // DebtRegistryEntries are given a random salt on construction --
        // we use the following function to generate arbitrary
        // DebtRegistryEntries without hash collisions.
        generateEntryFn = (beneficiary: string = BENEFICIARY_1) => {
            return new DebtRegistryEntry({
                beneficiary,
                debtor: DEBTOR,
                termsContract: TERMS_CONTRACT_ADDRESS,
                termsContractParameters: ARBITRARY_TERMS_CONTRACT_PARAMS,
                underwriter: UNDERWRITER,
                underwriterRiskRating: Units.underwriterRiskRatingFixedPoint(5),
                version: VERSION,
            });
        };

        insertEntryFn = async (entry: DebtRegistryEntry, options?: TxDataPayable) => {
            return registry.insert.sendTransactionAsync(
                entry.getVersion(),
                entry.getBeneficiary(),
                entry.getDebtor(),
                entry.getUnderwriter(),
                entry.getUnderwriterRiskRating(),
                entry.getTermsContract(),
                entry.getTermsContractParameters(),
                entry.getSalt(),
                options,
            );
        };

        modifyEntryBeneficiaryFn = async (
            entry: DebtRegistryEntry,
            newBeneficiary: Address,
            options?: TxDataPayable,
        ) => {
            return registry.modifyBeneficiary.sendTransactionAsync(
                entry.getIssuanceHash(),
                newBeneficiary,
                options,
            );
        };

        // Initialize ABI Decoder for deciphering log receipts
        ABIDecoder.addABI(debtRegistryContract.abi);
    });
开发者ID:TheRealest,项目名称:charta,代码行数:60,代码来源:debt_registry.ts


示例6: before

            before(async () => {
                await this.setupDebtOrder(scenario);

                // Reset the collateralizer contract's balance for each example.
                await this.contracts.dummyZRXToken.setBalance.sendTransactionAsync(
                    this.contracts.collateralizerContract.address,
                    new BigNumber(0),
                    {
                        from: this.accounts.CONTRACT_OWNER,
                    },
                );

                await this.contracts.dummyZRXToken.setBalance.sendTransactionAsync(
                    this.accounts.DEBTOR_1,
                    scenario.collateralTokenBalance,
                    {
                        from: this.accounts.CONTRACT_OWNER,
                    },
                );

                await this.contracts.dummyZRXToken.approve.sendTransactionAsync(
                    this.contracts.tokenTransferProxy.address,
                    scenario.collateralTokenAllowance,
                    { from: this.accounts.DEBTOR_1 },
                );

                if (!scenario.permissionToCollateralize) {
                    await this.contracts.collateralizerContract.revokeCollateralizeAuthorization.sendTransactionAsync(
                        this.contracts.collateralizedSimpleInterestTermsContract.address,
                        { from: this.accounts.CONTRACT_OWNER },
                    );
                }

                if (scenario.invokedByDebtKernel && !scenario.reverts) {
                    const latestBlockTime = await this.web3Utils.getLatestBlockTime();

                    // Fill the debt order, thereby invoking registerTermsStart from the debt kernel.
                    txHash = await this.fillDebtOrder();
                }

                // Setup ABI decoder in order to decode logs.
                ABIDecoder.addABI(this.contracts.collateralizedSimpleInterestTermsContract.abi);
                ABIDecoder.addABI(this.contracts.collateralizerContract.abi);
            });
开发者ID:TheRealest,项目名称:charta,代码行数:44,代码来源:register_term_start.ts


示例7: before

            before(async () => {
                await this.setupDebtOrder(scenario);

                if (scenario.invokedByDebtKernel && !scenario.reverts) {
                    // Fill the debt order, thereby invoking registerTermsStart from the debt kernel.
                    txHash = await this.fillDebtOrder();
                }

                // Setup ABI decoder in order to decode logs
                ABIDecoder.addABI(this.contracts.simpleInterestTermsContract.abi);
            });
开发者ID:TheRealest,项目名称:charta,代码行数:11,代码来源:register_term_start.ts


示例8: before

            before(async () => {
                txHash = await multiSigExecuteAfterTimelock(
                    web3,
                    multiSig,
                    proxy,
                    "addAuthorizedTransferAgent",
                    ACCOUNTS,
                    [AGENT],
                );

                ABIDecoder.addABI(proxy.abi);
            });
开发者ID:TheRealest,项目名称:charta,代码行数:12,代码来源:token_transfer_proxy.ts


示例9: before

            before(async () => {
                ATTACKER = this.accounts.ATTACKER;
                COLLATERALIZER = this.accounts.COLLATERALIZER;
                MOCK_DEBT_KERNEL_ADDRESS = this.accounts.MOCK_DEBT_KERNEL_ADDRESS;
                MOCK_TERMS_CONTRACT_ADDRESS = this.accounts.MOCK_TERMS_CONTRACT_ADDRESS;

                collateralizer = this.contracts.collateralizer;
                mockDebtRegistry = this.contracts.mockDebtRegistry;
                mockCollateralToken = this.contracts.mockCollateralToken;
                mockTokenRegistry = this.contracts.mockTokenRegistry;
                mockTokenTransferProxy = this.contracts.mockTokenTransferProxy;

                await mockDebtRegistry.reset.sendTransactionAsync();
                await mockCollateralToken.reset.sendTransactionAsync();
                await mockTokenRegistry.reset.sendTransactionAsync();

                // Mock the collateral token's presence in the token registry at
                // the specified index
                await mockTokenRegistry.mockGetTokenAddressByIndex.sendTransactionAsync(
                    scenario.collateralTokenIndexInRegistry,
                    mockCollateralToken.address,
                );

                // Mock collateral token's balance for collateralizer
                await mockCollateralToken.mockBalanceOfFor.sendTransactionAsync(
                    COLLATERALIZER,
                    scenario.collateralTokenBalance,
                );

                // Mock `debtRegistry.getTerms` return value
                await mockDebtRegistry.mockGetTermsReturnValueFor.sendTransactionAsync(
                    scenario.agreementId,
                    scenario.termsContract(MOCK_TERMS_CONTRACT_ADDRESS, ATTACKER),
                    scenario.termsContractParameters,
                );

                // Mock the collateral token's presence in the token registry at
                // the specified index
                await mockTokenRegistry.mockGetTokenAddressByIndex.sendTransactionAsync(
                    scenario.collateralTokenIndexInRegistry,
                    this.contracts.mockCollateralToken.address,
                );

                // Mock collateral token's allowance for proxy.
                await mockCollateralToken.mockAllowanceFor.sendTransactionAsync(
                    COLLATERALIZER,
                    mockTokenTransferProxy.address,
                    scenario.collateralTokenAllowance,
                );

                ABIDecoder.addABI(collateralizer.abi);
            });
开发者ID:TheRealest,项目名称:charta,代码行数:52,代码来源:collateralize.ts


示例10: before

    before(async () => {
        mockRegistry = await MockDebtRegistryContract.deployed(web3, TX_DEFAULTS);
        mockToken = await MockERC20TokenContract.deployed(web3, TX_DEFAULTS);
        mockNonFungibleToken = await MockERC721TokenContract.deployed(web3, TX_DEFAULTS);
        mockTermsContract = await MockTermsContractContract.deployed(web3, TX_DEFAULTS);
        mockTokenTransferProxy = await MockTokenTransferProxyContract.deployed(web3, TX_DEFAULTS);

        const repaymentRouterTruffle = await repaymentRouterContract.new(
            mockRegistry.address,
            mockTokenTransferProxy.address,
        );

        // The typings we use ingest vanilla Web3 contracts, so we convert the
        // contract instance deployed by truffle into a Web3 contract instance
        const repaymentRouterWeb3Contract = web3.eth
            .contract(repaymentRouterTruffle.abi)
            .at(repaymentRouterTruffle.address);

        router = new RepaymentRouterContract(repaymentRouterWeb3Contract, TX_DEFAULTS);

        ABIDecoder.addABI(router.abi);
    });
开发者ID:TheRealest,项目名称:charta,代码行数:22,代码来源:repayment_router.ts



注:本文中的abi-decoder.addABI函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript abi-decoder.decodeLogs函数代码示例发布时间:2022-05-28
下一篇:
TypeScript abap-adt-api.ADTClient类代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap