@dolomite-exchange/dolomite-margin
Version:
Ethereum Smart Contracts and TypeScript library used for the DolomiteMargin trading protocol
33 lines • 2.04 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.TransferProxy = void 0;
class TransferProxy {
constructor(contracts) {
this.contracts = contracts;
}
get address() {
return this.contracts.transferProxy.options.address;
}
// ============ View Functions ============
async dolomiteMargin() {
return this.contracts.callConstantContractFunction(this.contracts.transferProxy.methods.DOLOMITE_MARGIN());
}
async isCallerAuthorized(caller, options = {}) {
return this.contracts.callConstantContractFunction(this.contracts.transferProxy.methods.isCallerAuthorized(caller), options);
}
// ============ Write Functions ============
async setIsCallerAuthorized(caller, isAuthorized, options = {}) {
return this.contracts.callContractFunction(this.contracts.transferProxy.methods.setIsCallerAuthorized(caller, isAuthorized), options);
}
async transfer(fromAccountIndex, to, toAccountIndex, token, amountWei, options = {}) {
return this.contracts.callContractFunction(this.contracts.transferProxy.methods.transfer(fromAccountIndex.toFixed(), to, toAccountIndex.toFixed(), token, amountWei.toFixed()), options);
}
async transferMultiple(fromAccountIndex, to, toAccountIndex, tokens, amountsWei, options = {}) {
return this.contracts.callContractFunction(this.contracts.transferProxy.methods.transferMultiple(fromAccountIndex.toFixed(), to, toAccountIndex.toFixed(), tokens, amountsWei.map(amount => amount.toFixed())), options);
}
async transferMultipleWithMarkets(fromAccountIndex, to, toAccountIndex, markets, amounts, options = {}) {
return this.contracts.callContractFunction(this.contracts.transferProxy.methods.transferMultipleWithMarkets(fromAccountIndex.toFixed(), to, toAccountIndex.toFixed(), markets.map(market => market.toFixed()), amounts.map(amount => amount.toFixed())), options);
}
}
exports.TransferProxy = TransferProxy;
//# sourceMappingURL=TransferProxy.js.map