@dolomite-exchange/dolomite-margin
Version:
Ethereum Smart Contracts and TypeScript library used for the DolomiteMargin trading protocol
44 lines • 4.34 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.BorrowPositionProxyV2 = void 0;
const BorrowPositionProxyV1_1 = require("./BorrowPositionProxyV1");
class BorrowPositionProxyV2 extends BorrowPositionProxyV1_1.BorrowPositionProxyV1 {
constructor(contracts) {
super(contracts);
}
async dolomiteMargin() {
return this.contracts.callConstantContractFunction(this.contracts.borrowPositionProxyV2.methods.DOLOMITE_MARGIN());
}
async setIsCallerAuthorized(caller, isAuthorized, options = {}) {
return this.contracts.callContractFunction(this.contracts.borrowPositionProxyV2.methods.setIsCallerAuthorized(caller, isAuthorized), options);
}
async isCallerAuthorized(caller, options = {}) {
return this.contracts.callConstantContractFunction(this.contracts.borrowPositionProxyV2.methods.isCallerAuthorized(caller), options);
}
async openBorrowPosition(fromAccountNumber, toAccountNumber, marketId, amountWei, balanceCheckFlag, options = {}) {
return this.contracts.callContractFunction(this.contracts.borrowPositionProxyV2.methods.openBorrowPosition(fromAccountNumber.toFixed(), toAccountNumber.toFixed(), marketId.toFixed(), amountWei.toFixed(), balanceCheckFlag), options);
}
async closeBorrowPosition(borrowAccountNumber, toAccountNumber, marketIds, options = {}) {
return this.contracts.callContractFunction(this.contracts.borrowPositionProxyV2.methods.closeBorrowPosition(borrowAccountNumber.toFixed(), toAccountNumber.toFixed(), marketIds.map(marketId => marketId.toFixed())), options);
}
async transferBetweenAccounts(fromAccountNumber, toAccountNumber, marketId, amountWei, balanceCheckFlag, options = {}) {
return this.contracts.callContractFunction(this.contracts.borrowPositionProxyV2.methods.transferBetweenAccounts(fromAccountNumber.toFixed(), toAccountNumber.toFixed(), marketId.toFixed(), amountWei.toFixed(), balanceCheckFlag), options);
}
async repayAllForBorrowPosition(fromAccountNumber, borrowAccountNumber, marketId, balanceCheckFlag, options = {}) {
return this.contracts.callContractFunction(this.contracts.borrowPositionProxyV2.methods.repayAllForBorrowPosition(fromAccountNumber.toFixed(), borrowAccountNumber.toFixed(), marketId.toFixed(), balanceCheckFlag), options);
}
async openBorrowPositionWithDifferentAccounts(fromAccountOwner, fromAccountNumber, toAccountOwner, toAccountNumber, marketId, amountWei, balanceCheckFlag, options = {}) {
return this.contracts.callContractFunction(this.contracts.borrowPositionProxyV2.methods.openBorrowPositionWithDifferentAccounts(fromAccountOwner, fromAccountNumber.toFixed(), toAccountOwner, toAccountNumber.toFixed(), marketId.toFixed(), amountWei.toFixed(), balanceCheckFlag), options);
}
async closeBorrowPositionWithDifferentAccounts(borrowAccountOwner, borrowAccountNumber, toAccountOwner, toAccountNumber, marketIds, options = {}) {
return this.contracts.callContractFunction(this.contracts.borrowPositionProxyV2.methods.closeBorrowPositionWithDifferentAccounts(borrowAccountOwner, borrowAccountNumber.toFixed(), toAccountOwner, toAccountNumber.toFixed(), marketIds.map(marketId => marketId.toFixed())), options);
}
async transferBetweenAccountsWithDifferentAccounts(fromAccountOwner, fromAccountNumber, toAccountOwner, toAccountNumber, marketId, amountWei, balanceCheckFlag, options = {}) {
return this.contracts.callContractFunction(this.contracts.borrowPositionProxyV2.methods.transferBetweenAccountsWithDifferentAccounts(fromAccountOwner, fromAccountNumber.toFixed(), toAccountOwner, toAccountNumber.toFixed(), marketId.toFixed(), amountWei.toFixed(), balanceCheckFlag), options);
}
async repayAllForBorrowPositionWithDifferentAccounts(fromAccountOwner, fromAccountNumber, borrowAccountOwner, borrowAccountNumber, marketId, balanceCheckFlag, options = {}) {
return this.contracts.callContractFunction(this.contracts.borrowPositionProxyV2.methods.repayAllForBorrowPositionWithDifferentAccounts(fromAccountOwner, fromAccountNumber.toFixed(), borrowAccountOwner, borrowAccountNumber.toFixed(), marketId.toFixed(), balanceCheckFlag), options);
}
}
exports.BorrowPositionProxyV2 = BorrowPositionProxyV2;
//# sourceMappingURL=BorrowPositionProxyV2.js.map