-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #56 from BitGo/BG-59996-add-wdoge-abi
feat(eth): add wrapped token (WDOGE) ABI files and instance address with some examples
- Loading branch information
Showing
13 changed files
with
1,801 additions
and
300 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { getContractsFactory } from '../../../src/index'; | ||
|
||
const tokenName = 'WDOGE'; | ||
|
||
const contract = getContractsFactory('eth').getContract('WrappedToken').instance(tokenName); | ||
|
||
const result = contract.methods().balanceOf.call({_owner: '0xd5ADdE17feD8baed3F32b84AF05B8F2816f7b560'}) | ||
console.log(result) | ||
|
||
const decoder = getContractsFactory('eth').getDecoder(); | ||
|
||
const wdogeData = result.data.slice(2); | ||
const decoded = decoder.decode(Buffer.from(wdogeData, 'hex')); | ||
console.log(decoded) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { getContractsFactory } from '../../../src/index'; | ||
|
||
const tokenName = 'WDOGE'; | ||
|
||
const contract = getContractsFactory('eth').getContract('WrappedToken').instance(tokenName); | ||
|
||
const result = contract.methods().burn.call({ value: '10' }); | ||
console.log(result) | ||
|
||
const decoder = getContractsFactory('eth').getDecoder(); | ||
|
||
const wdogeData = result.data.slice(2); | ||
const decoded = decoder.decode(Buffer.from(wdogeData, 'hex')); | ||
console.log(decoded) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { getContractsFactory } from '../../../src/index'; | ||
|
||
const tokenName = 'WDOGE'; | ||
|
||
const contract = getContractsFactory('eth').getContract('WrappedToken').instance(tokenName); | ||
|
||
const result = contract.methods().mint.call({ _to: '0xD037CA7A2B62c66B0F01CB2C93B978493dcD06d6', _amount: '100' }); | ||
console.log(result) | ||
|
||
const decoder = getContractsFactory('eth').getDecoder(); | ||
|
||
const wdogeData = result.data.slice(2); | ||
const decoded = decoder.decode(Buffer.from(wdogeData, 'hex')); | ||
console.log(decoded) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { getContractsFactory } from '../../../src/index'; | ||
|
||
const tokenName = 'WDOGE'; | ||
|
||
const contract = getContractsFactory('eth').getContract('WrappedToken').instance(tokenName); | ||
|
||
const result = contract.methods().transfer.call({_to: '0xd5ADdE17feD8baed3F32b84AF05B8F2816f7b560', _value: 12}) | ||
console.log(result) | ||
|
||
const decoder = getContractsFactory('eth').getDecoder(); | ||
|
||
const wdogeData = result.data.slice(2); | ||
const decoded = decoder.decode(Buffer.from(wdogeData, 'hex')); | ||
console.log(decoded) | ||
|
15 changes: 15 additions & 0 deletions
15
eth/examples/WrappedTokenControllerV1/transferOwnership.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { getContractsFactory } from '../../../src/index'; | ||
|
||
const tokenName = 'WDOGE'; | ||
|
||
const contract = getContractsFactory('eth').getContract('WrappedTokenControllerV1').instance(tokenName); | ||
|
||
const result = contract.methods().transferOwnership.call({ newOwner: '0xD037CA7A2B62c66B0F01CB2C93B978493dcD06d6' }); | ||
console.log(result) | ||
|
||
const decoder = getContractsFactory('eth').getDecoder(); | ||
|
||
const wdogeData = result.data.slice(2); | ||
const decoded = decoder.decode(Buffer.from(wdogeData, 'hex')); | ||
console.log(decoded) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { getContractsFactory } from '../../../src/index'; | ||
|
||
const tokenName = 'WDOGE'; | ||
|
||
const contract = getContractsFactory('eth').getContract('WrappedTokenFactoryV1').instance(tokenName); | ||
|
||
const custodianDepositAddress = '0xd5ADdE17feD8baed3F32b84AF05B8F2816f7b560'; | ||
const txId = 'f3b566050a4b57ca2acd1acdf9221a911d3740d9e7f9e0f3ddb468988f454ea1'; | ||
const amount = '10'; | ||
|
||
const result = contract.methods().addMintRequest.call({ amount: amount, txid: txId, depositAddress: custodianDepositAddress }); | ||
console.log('encoded', result); | ||
|
||
const decoder = getContractsFactory('eth').getDecoder(); | ||
|
||
const data = result.data; | ||
console.log(data); | ||
|
||
/** Decode with string data */ | ||
const decodedFromString = decoder.decode(data); | ||
console.log(`\n AddMintRequest decoded from string: \n`, decodedFromString); | ||
|
||
/** Decode with Buffer data*/ | ||
const decodedFromBuffer = decoder.decode(Buffer.from(data.slice(2), 'hex')); | ||
console.log(`\n AddMintRequest decoded from Buffer: \n`, decodedFromBuffer); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { getContractsFactory } from '../../../src/index'; | ||
|
||
const tokenName = 'WDOGE'; | ||
|
||
const contract = getContractsFactory('eth').getContract('WrappedTokenMembers').instance(tokenName); | ||
|
||
const result = contract.methods().setCustodian.call({ _custodian: '0xD037CA7A2B62c66B0F01CB2C93B978493dcD06d6' }); | ||
|
||
console.log(result) | ||
|
||
const decoder = getContractsFactory('eth').getDecoder(); | ||
|
||
const wdogeData = result.data.slice(2); | ||
const decoded = decoder.decode(Buffer.from(wdogeData, 'hex')); | ||
console.log(decoded) | ||
|
Oops, something went wrong.