Skip to content

Commit

Permalink
Merge pull request #56 from BitGo/BG-59996-add-wdoge-abi
Browse files Browse the repository at this point in the history
feat(eth): add wrapped token (WDOGE) ABI files and instance address with some examples
  • Loading branch information
DinshawKothari authored Jan 5, 2023
2 parents cbd33c4 + 80f637d commit 00b6107
Show file tree
Hide file tree
Showing 13 changed files with 1,801 additions and 300 deletions.
465 changes: 465 additions & 0 deletions eth/abis/WrappedTokenControllerV1.json

Large diffs are not rendered by default.

848 changes: 848 additions & 0 deletions eth/abis/WrappedTokenFactoryV1.json

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions eth/abis/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import UniswapV3SwapRouter from './UniswapV3SwapRouter.json';
import UniswapV3NonfungiblePositionManager from './UniswapV3NonfungiblePositionManager.json';
import SushiswapV2Router from './SushiswapV2Router.json';
import KashiPairMediumRiskV1 from './KashiPairMediumRiskV1.json';
import WrappedTokenControllerV1 from './WrappedTokenControllerV1.json'
import WrappedTokenFactoryV1 from './WrappedTokenFactoryV1.json'
export default {
Compound,
CompoundComptroller,
Expand Down Expand Up @@ -56,5 +58,7 @@ export default {
WrappedTokenController,
WrappedTokenFactory,
WrappedTokenMembers,
WrappedTokenControllerV1,
WrappedTokenFactoryV1,
};

12 changes: 10 additions & 2 deletions eth/config/instances.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"USDT": "0xdac17f958d2ee523a2206206994597c13d831ec7"
},
"WrappedToken": {
"WBTC": "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599"
"WBTC": "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599",
"WDOGE": "0x8aa9381b2544b48c26f3b850F6e07E2c5161EB3e"
},
"WrappedTokenFactory":{
"WBTC": "0xe5a5f138005e19a3e6d0fe68b039397eeef2322b"
Expand All @@ -23,7 +24,14 @@
"WBTC": "0xCA06411bd7a7296d7dbdd0050DFc846E95fEBEB7"
},
"WrappedTokenMembers":{
"WBTC": "0x3e8640574aa764763291eD733672D3A105107ac5"
"WBTC": "0x3e8640574aa764763291eD733672D3A105107ac5",
"WDOGE": "0x78749C8E1af46cA85bEE4AE566F0Fe9a324ac531"
},
"WrappedTokenFactoryV1":{
"WDOGE": "0x62084120c6006956dDa975B89C07b7d68b6D61E0"
},
"WrappedTokenControllerV1":{
"WDOGE": "0xaF9f0d1CE262d70be64346cBa74706230951f067"
},
"Compound": {
"CUSDC": "0x39aa39c021dfbae8fac545936693ac917d5e7563",
Expand Down
15 changes: 15 additions & 0 deletions eth/examples/WrappedToken/balanceOf.ts
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)

14 changes: 14 additions & 0 deletions eth/examples/WrappedToken/burn.ts
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)
15 changes: 15 additions & 0 deletions eth/examples/WrappedToken/mint.ts
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)

15 changes: 15 additions & 0 deletions eth/examples/WrappedToken/transfer.ts
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 eth/examples/WrappedTokenControllerV1/transferOwnership.ts
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)

25 changes: 25 additions & 0 deletions eth/examples/WrappedTokenFactoryV1/addMintRequest.ts
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);
16 changes: 16 additions & 0 deletions eth/examples/WrappedTokenMembers/setCustodian.ts
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)

Loading

0 comments on commit 00b6107

Please sign in to comment.