File tree 6 files changed +63
-2
lines changed
src/adapters/peggedAssets
6 files changed +63
-2
lines changed Original file line number Diff line number Diff line change 1
1
const axios = require ( "axios" ) ;
2
2
const retry = require ( "async-retry" ) ;
3
3
const endpoint = "https://fullnode.mainnet.aptoslabs.com" ;
4
+ import http from "../helper/http" ;
4
5
5
6
export async function aQuery ( api : string ) {
6
7
const query = await retry (
@@ -38,4 +39,27 @@ export async function getTokenSupply(token: string) {
38
39
const coinInfo = data . find ( ( coin : any ) => coin . type . startsWith ( '0x1::coin::CoinInfo' ) ) ;
39
40
40
41
return coinInfo . data . supply . vec [ 0 ] . integer . vec [ 0 ] . value / 10 ** coinInfo . data . decimals ;
42
+ }
43
+
44
+ const MOVEMENT_RPC = "https://mainnet.movementnetwork.xyz" ;
45
+
46
+ export async function function_view ( {
47
+ functionStr,
48
+ type_arguments = [ ] ,
49
+ args = [ ] ,
50
+ ledgerVersion,
51
+ } : {
52
+ functionStr : string ;
53
+ type_arguments ?: string [ ] ;
54
+ args ?: any [ ] ;
55
+ ledgerVersion ?: number ;
56
+ } ) {
57
+ let path = `${ MOVEMENT_RPC } /v1/view` ;
58
+ if ( ledgerVersion !== undefined ) path += `?ledger_version=${ ledgerVersion } ` ;
59
+ const response = await http . post ( path , {
60
+ function : functionStr ,
61
+ type_arguments,
62
+ arguments : args ,
63
+ } ) ;
64
+ return response . length === 1 ? response [ 0 ] : response ;
41
65
}
Original file line number Diff line number Diff line change 109
109
" morph" ,
110
110
" moonbeam" ,
111
111
" moonriver" ,
112
+ " move" ,
112
113
" nahmii" ,
113
114
" near" ,
114
115
" neo" ,
Original file line number Diff line number Diff line change @@ -378,4 +378,7 @@ export const chainContracts: ChainContracts = {
378
378
corn : {
379
379
bridgedFromETH : [ "0xb8ce59fc3717ada4c02eadf9682a9e934f625ebb" ] , // USDT0
380
380
} ,
381
+ move : {
382
+ bridgedFromETH : [ "0x38cdb3f0afabee56a3393793940d28214cba1f5781e13d5db18fa7079f60ab55" ] , // OFT native bridge
383
+ }
381
384
} ;
Original file line number Diff line number Diff line change 1
1
const sdk = require ( "@defillama/sdk" ) ;
2
2
import { ChainApi } from "@defillama/sdk" ;
3
- import { getTotalSupply as aptosGetTotalSupply } from "../helper/aptos" ;
3
+ import { getTotalSupply as aptosGetTotalSupply , function_view } from "../helper/aptos" ;
4
4
import { sumMultipleBalanceFunctions , sumSingleBalance } from "../helper/generalUtil" ;
5
5
import {
6
6
bridgedSupply ,
@@ -458,6 +458,18 @@ async function suiBridged(): Promise<Balances> {
458
458
return balances ;
459
459
}
460
460
461
+ async function moveNativeBridge ( ) : Promise < Balances > {
462
+ const balances = { } as Balances ;
463
+
464
+ const resp = await function_view ( {
465
+ functionStr : `${ chainContracts . move . bridgedFromETH } ::oft_fa::supply` ,
466
+ args : [ ] ,
467
+ } ) ;
468
+ balances [ "peggedUSD" ] = Number ( resp ) / 1e6 ; // adjust if decimals ≠ 6
469
+
470
+ return balances ;
471
+ }
472
+
461
473
462
474
async function polyNetworkBridged (
463
475
chainID : number ,
@@ -1091,6 +1103,9 @@ const adapter: PeggedIssuanceAdapter = {
1091
1103
} ,
1092
1104
corn : {
1093
1105
ethereum : bridgedSupply ( "corn" , 6 , chainContracts . corn . bridgedFromETH )
1106
+ } ,
1107
+ move : {
1108
+ ethereum : moveNativeBridge ,
1094
1109
}
1095
1110
} ;
1096
1111
Original file line number Diff line number Diff line change @@ -485,4 +485,7 @@ export const chainContracts: ChainContracts = {
485
485
flare : {
486
486
bridgedFromETH : [ "0xFbDa5F676cB37624f28265A144A48B0d6e87d3b6" ] ,
487
487
} ,
488
+ move : {
489
+ bridgedFromETH : [ "0x4d2969d384e440db9f1a51391cfc261d1ec08ee1bdf7b9711a6c05d485a4110a" ] , // oft native bridge
490
+ } ,
488
491
} ;
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ import {
21
21
getBalance as ontologyGetBalance ,
22
22
} from "../helper/ontology" ;
23
23
import { getTotalSupply as kavaGetTotalSupply } from "../helper/kava" ;
24
- import { getTotalSupply as aptosGetTotalSupply } from "../helper/aptos" ;
24
+ import { getTotalSupply as aptosGetTotalSupply , function_view } from "../helper/aptos" ;
25
25
import { call as nearCall } from "../helper/near" ;
26
26
import {
27
27
ChainBlocks ,
@@ -500,6 +500,18 @@ async function flowBridged(address: string, decimals: number) {
500
500
} ;
501
501
}
502
502
503
+ async function moveNativeBridge ( ) : Promise < Balances > {
504
+ const balances = { } as Balances ;
505
+
506
+ const resp = await function_view ( {
507
+ functionStr : `${ chainContracts . move . bridgedFromETH } ::oft_fa::supply` ,
508
+ args : [ ] ,
509
+ } ) ;
510
+ balances [ "peggedUSD" ] = Number ( resp ) / 1e6 ; // adjust if decimals ≠ 6
511
+
512
+ return balances ;
513
+ }
514
+
503
515
504
516
const adapter : PeggedIssuanceAdapter = {
505
517
ethereum : {
@@ -1035,6 +1047,9 @@ const adapter: PeggedIssuanceAdapter = {
1035
1047
chainContracts . xdc . bridgeOnARB [ 0 ] ,
1036
1048
6
1037
1049
)
1050
+ } ,
1051
+ move : {
1052
+ ethereum : moveNativeBridge ,
1038
1053
}
1039
1054
} ;
1040
1055
You can’t perform that action at this time.
0 commit comments