UNPKG

@dolomite-exchange/dolomite-margin

Version:

Ethereum Smart Contracts and TypeScript library used for the DolomiteMargin trading protocol

63 lines 4.07 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DepositProxy = void 0; class DepositProxy { constructor(contracts) { this.contracts = contracts; } get address() { return this.contracts.depositProxy.options.address; } // ============ View Functions ============ async dolomiteMargin() { return this.contracts.callConstantContractFunction(this.contracts.depositProxy.methods.DOLOMITE_MARGIN()); } // ============ Write Functions ============ async initializePayableMarket(payableToken, options = {}) { return this.contracts.callContractFunction(this.contracts.depositProxy.methods.initializePayableMarket(payableToken), options); } async depositWei(accountIndex, marketId, amountWei, options = {}) { return this.contracts.callContractFunction(this.contracts.depositProxy.methods.depositWei(accountIndex.toFixed(), marketId.toFixed(), amountWei.toFixed()), options); } async depositPayable(accountIndex, amountWei, options = {}) { return this.contracts.callContractFunction(this.contracts.depositProxy.methods.depositPayable(accountIndex.toFixed()), { ...options, value: amountWei.toFixed(), }); } async depositWeiIntoDefaultAccount(marketId, amountWei, options = {}) { return this.contracts.callContractFunction(this.contracts.depositProxy.methods.depositWeiIntoDefaultAccount(marketId.toFixed(), amountWei.toFixed()), options); } async depositPayableIntoDefaultAccount(amountWei, options = {}) { return this.contracts.callContractFunction(this.contracts.depositProxy.methods.depositPayableIntoDefaultAccount(), { ...options, value: amountWei.toFixed(), }); } async withdrawWei(accountIndex, marketId, amountWei, balanceCheckFlag, options = {}) { return this.contracts.callContractFunction(this.contracts.depositProxy.methods.withdrawWei(accountIndex.toFixed(), marketId.toFixed(), amountWei.toFixed(), balanceCheckFlag), options); } async withdrawPayable(accountIndex, amountWei, balanceCheckFlag, options = {}) { return this.contracts.callContractFunction(this.contracts.depositProxy.methods.withdrawPayable(accountIndex.toFixed(), amountWei.toFixed(), balanceCheckFlag), options); } async withdrawWeiFromDefaultAccount(marketId, amountWei, balanceCheckFlag, options = {}) { return this.contracts.callContractFunction(this.contracts.depositProxy.methods.withdrawWeiFromDefaultAccount(marketId.toFixed(), amountWei.toFixed(), balanceCheckFlag), options); } async withdrawPayableFromDefaultAccount(amountWei, balanceCheckFlag, options = {}) { return this.contracts.callContractFunction(this.contracts.depositProxy.methods.withdrawPayableFromDefaultAccount(amountWei.toFixed(), balanceCheckFlag), options); } async depositPar(accountIndex, marketId, amountPar, options = {}) { return this.contracts.callContractFunction(this.contracts.depositProxy.methods.depositPar(accountIndex.toFixed(), marketId.toFixed(), amountPar.toFixed()), options); } async depositParIntoDefaultAccount(marketId, amountPar, options = {}) { return this.contracts.callContractFunction(this.contracts.depositProxy.methods.depositParIntoDefaultAccount(marketId.toFixed(), amountPar.toFixed()), options); } async withdrawPar(accountIndex, marketId, amountPar, balanceCheckFlag, options = {}) { return this.contracts.callContractFunction(this.contracts.depositProxy.methods.withdrawPar(accountIndex.toFixed(), marketId.toFixed(), amountPar.toFixed(), balanceCheckFlag), options); } async withdrawParFromDefaultAccount(marketId, amountPar, balanceCheckFlag, options = {}) { return this.contracts.callContractFunction(this.contracts.depositProxy.methods.withdrawParFromDefaultAccount(marketId.toFixed(), amountPar.toFixed(), balanceCheckFlag), options); } } exports.DepositProxy = DepositProxy; //# sourceMappingURL=DepositProxy.js.map