當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript abi-decoder.addABI函數代碼示例

本文整理匯總了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;未經允許,請勿轉載。