Skip to content

Commit

Permalink
feat: upated contracts packages with new deposit manager abi
Browse files Browse the repository at this point in the history
  • Loading branch information
bangjelkoski committed Mar 14, 2021
1 parent 940d87f commit fdbee9d
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 98 deletions.
26 changes: 5 additions & 21 deletions packages/contracts/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,30 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.0.17](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/contracts@0.0.16...@injectivelabs/contracts@0.0.17) (2021-03-04)

**Note:** Version bump only for package @injectivelabs/contracts
## [0.0.18](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/contracts@0.0.17...@injectivelabs/contracts@0.0.18) (2021-03-14)

### Features

* upated contracts packages with new deposit manager abi ([68dd78d](https://github.com/InjectiveLabs/injective-ts/commit/68dd78d8d3274c4ca787f47621825a492ab6ce31))

## [0.0.17](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/contracts@0.0.16...@injectivelabs/contracts@0.0.17) (2021-03-04)

**Note:** Version bump only for package @injectivelabs/contracts

## [0.0.16](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/contracts@0.0.15...@injectivelabs/contracts@0.0.16) (2021-03-03)

**Note:** Version bump only for package @injectivelabs/contracts





## [0.0.15](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/contracts@0.0.14...@injectivelabs/contracts@0.0.15) (2021-03-02)

**Note:** Version bump only for package @injectivelabs/contracts





## [0.0.14](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/contracts@0.0.13...@injectivelabs/contracts@0.0.14) (2021-03-02)

**Note:** Version bump only for package @injectivelabs/contracts





## 0.0.13 (2021-03-01)


### Bug Fixes

* added types for ethereum-utils, fixed bech32 import ([1bec7b4](https://github.com/InjectiveLabs/injective-ts/commit/1bec7b41a7b612f0f5f08292483c2090fc9a84d5))
Expand All @@ -50,7 +39,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
* window type checking for node env ([b52faa5](https://github.com/InjectiveLabs/injective-ts/commit/b52faa56ed555475c4695c219a81a185ad79cf67))
* zeroed out addresses for unused chains ([17792b8](https://github.com/InjectiveLabs/injective-ts/commit/17792b8b28cbc7ebb278f15ed29ea8fd2db6d6e8))


### Features

* added a new tx-utils package for reducing the size of the utils package ([d8e4786](https://github.com/InjectiveLabs/injective-ts/commit/d8e4786dd2082cbac2cf1f2ba36b66a038dfa9b0))
Expand All @@ -64,10 +52,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
* initial setup for the assert package ([415e9b8](https://github.com/InjectiveLabs/injective-ts/commit/415e9b886e9054bb9bbf2a68f566e243d52a919a))
* ported chain consumer from the client ([cff10b9](https://github.com/InjectiveLabs/injective-ts/commit/cff10b916959b82d5f1ddbe9267131424ac0b566))





## [0.0.12](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/contracts@0.0.11...@injectivelabs/contracts@0.0.12) (2021-02-25)

### Features
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@injectivelabs/contracts",
"description": "Contracts wrapper that can be reused throughout Injective's projects.",
"version": "0.0.17",
"version": "0.0.18",
"license": "MIT",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
11 changes: 4 additions & 7 deletions packages/contracts/src/contracts/DepositManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ export class DepositManagerContract extends BaseContract<
})
}

public depositFor({
address,
public deposit({
amount,
transactionOptions,
}: {
Expand All @@ -54,22 +53,20 @@ export class DepositManagerContract extends BaseContract<
},

getABIEncodedTransactionData(): string {
return contract.methods
.depositFor(amount.toFixed(), address)
.encodeABI()
return contract.methods.deposit(amount.toFixed()).encodeABI()
},

async sendTransactionAsync(): Promise<string> {
const { transactionHash } = await contract.methods
.depositFor(amount.toFixed(), address)
.deposit(amount.toFixed())
.send(getTransactionOptionsAsNonPayableTx(transactionOptions))

return transactionHash
},

async estimateGasAsync(): Promise<number> {
return contract.methods
.depositFor(amount.toFixed(), address)
.deposit(amount.toFixed())
.estimateGas(transactionOptions)
},
}
Expand Down
89 changes: 20 additions & 69 deletions packages/contracts/src/contracts/abi/deposit_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ import { AbiItem } from 'web3-utils'
const abi = [
{
inputs: [
{
internalType: 'contract Peggy',
name: 'peggy_',
type: 'address',
},
{
internalType: 'contract IERC20',
name: 'realINJ_',
Expand All @@ -26,12 +21,6 @@ const abi = [
name: 'staker',
type: 'address',
},
{
indexed: true,
internalType: 'address',
name: 'destination',
type: 'address',
},
{
indexed: false,
internalType: 'uint256',
Expand Down Expand Up @@ -110,19 +99,7 @@ const abi = [
],
stateMutability: 'view',
type: 'function',
},
{
inputs: [
{
internalType: 'uint256',
name: 'amount',
type: 'uint256',
},
],
name: 'deposit',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
constant: true,
},
{
inputs: [
Expand All @@ -142,24 +119,7 @@ const abi = [
],
stateMutability: 'view',
type: 'function',
},
{
inputs: [
{
internalType: 'uint256',
name: 'amount',
type: 'uint256',
},
{
internalType: 'address',
name: 'destination',
type: 'address',
},
],
name: 'depositFor',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
constant: true,
},
{
inputs: [
Expand All @@ -179,26 +139,21 @@ const abi = [
],
stateMutability: 'view',
type: 'function',
constant: true,
},
{
inputs: [],
name: 'endCompetition',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [],
name: 'fakeINJ',
name: 'lockingPeriod',
outputs: [
{
internalType: 'contract IERC20',
internalType: 'uint256',
name: '',
type: 'address',
type: 'uint256',
},
],
stateMutability: 'view',
type: 'function',
constant: true,
},
{
inputs: [],
Expand All @@ -212,19 +167,7 @@ const abi = [
],
stateMutability: 'view',
type: 'function',
},
{
inputs: [],
name: 'peggy',
outputs: [
{
internalType: 'contract Peggy',
name: '',
type: 'address',
},
],
stateMutability: 'view',
type: 'function',
constant: true,
},
{
inputs: [],
Expand All @@ -238,6 +181,7 @@ const abi = [
],
stateMutability: 'view',
type: 'function',
constant: true,
},
{
inputs: [],
Expand All @@ -262,12 +206,12 @@ const abi = [
{
inputs: [
{
internalType: 'contract Peggy',
name: 'peggy_',
type: 'address',
internalType: 'uint256',
name: 'amount',
type: 'uint256',
},
],
name: 'updatePeggy',
name: 'deposit',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
Expand All @@ -292,6 +236,13 @@ const abi = [
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [],
name: 'endCompetition',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
] as AbiItem[]

export default abi

0 comments on commit fdbee9d

Please sign in to comment.