本文整理汇总了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);
});
示例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);
});
示例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);
});
示例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;
}
示例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);
});
示例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);
});
示例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);
});
示例8: before
before(async () => {
txHash = await multiSigExecuteAfterTimelock(
web3,
multiSig,
proxy,
"addAuthorizedTransferAgent",
ACCOUNTS,
[AGENT],
);
ABIDecoder.addABI(proxy.abi);
});
示例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);
});
示例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);
});