@alephium/powfi-sdk 0.0.1-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/clmm/artifacts/BitmapWord.ral.json +125 -0
- package/clmm/artifacts/BitmapWordDeployer.ral.json +31 -0
- package/clmm/artifacts/CreateConfig.ral.json +37 -0
- package/clmm/artifacts/CreateLiquidPool.ral.json +55 -0
- package/clmm/artifacts/DexAccount.ral.json +110 -0
- package/clmm/artifacts/LiquidityAmountsTest.ral.json +161 -0
- package/clmm/artifacts/LiquidityManagmentTest.ral.json +384 -0
- package/clmm/artifacts/Pool.ral.json +1530 -0
- package/clmm/artifacts/PoolConfig.ral.json +31 -0
- package/clmm/artifacts/PoolFactory.ral.json +300 -0
- package/clmm/artifacts/PoolRouterDemo.ral.json +49 -0
- package/clmm/artifacts/PoolUser.ral.json +89 -0
- package/clmm/artifacts/Position.ral.json +183 -0
- package/clmm/artifacts/PositionManager.ral.json +416 -0
- package/clmm/artifacts/SwapWithoutAccount.ral.json +46 -0
- package/clmm/artifacts/TestToken.ral.json +68 -0
- package/clmm/artifacts/Tick.ral.json +161 -0
- package/clmm/artifacts/TickBitmapTest.ral.json +220 -0
- package/clmm/artifacts/constants.ral.json +81 -0
- package/clmm/artifacts/structs.ral.json +335 -0
- package/clmm/artifacts/ts/BitmapWord.ts +337 -0
- package/clmm/artifacts/ts/BitmapWordDeployer.ts +164 -0
- package/clmm/artifacts/ts/DexAccount.ts +330 -0
- package/clmm/artifacts/ts/LiquidityAmountsTest.ts +464 -0
- package/clmm/artifacts/ts/LiquidityManagmentTest.ts +859 -0
- package/clmm/artifacts/ts/Pool.ts +2535 -0
- package/clmm/artifacts/ts/PoolConfig.ts +179 -0
- package/clmm/artifacts/ts/PoolFactory.ts +640 -0
- package/clmm/artifacts/ts/PoolUser.ts +237 -0
- package/clmm/artifacts/ts/Position.ts +440 -0
- package/clmm/artifacts/ts/PositionManager.ts +929 -0
- package/clmm/artifacts/ts/TestToken.ts +277 -0
- package/clmm/artifacts/ts/Tick.ts +351 -0
- package/clmm/artifacts/ts/TickBitmapTest.ts +512 -0
- package/clmm/artifacts/ts/constants.ts +17 -0
- package/clmm/artifacts/ts/contracts.ts +26 -0
- package/clmm/artifacts/ts/deployments.ts +160 -0
- package/clmm/artifacts/ts/index.ts +20 -0
- package/clmm/artifacts/ts/scripts.ts +76 -0
- package/clmm/artifacts/ts/types.ts +105 -0
- package/clmm/deployments/.deployments.devnet.json +350 -0
- package/clmm/deployments/.deployments.testnet.json +350 -0
- package/cpmm/artifacts/dex/DexAccount.ral.json +110 -0
- package/cpmm/artifacts/dex/Router.ral.json +361 -0
- package/cpmm/artifacts/dex/TokenPair.ral.json +512 -0
- package/cpmm/artifacts/dex/TokenPairFactory.ral.json +297 -0
- package/cpmm/artifacts/examples/ExampleOracleSimple.ral.json +192 -0
- package/cpmm/artifacts/examples/FeeCollectorFactoryImpl.ral.json +185 -0
- package/cpmm/artifacts/examples/FeeCollectorPerTokenPairImpl.ral.json +216 -0
- package/cpmm/artifacts/examples/FullMathTest.ral.json +123 -0
- package/cpmm/artifacts/scripts/AddLiquidity.ral.json +46 -0
- package/cpmm/artifacts/scripts/Burn.ral.json +31 -0
- package/cpmm/artifacts/scripts/CollectFee.ral.json +25 -0
- package/cpmm/artifacts/scripts/CreatePair.ral.json +37 -0
- package/cpmm/artifacts/scripts/CreatePairAndAddLiquidity.ral.json +43 -0
- package/cpmm/artifacts/scripts/EnableFeeCollector.ral.json +28 -0
- package/cpmm/artifacts/scripts/Mint.ral.json +34 -0
- package/cpmm/artifacts/scripts/RemoveLiquidity.ral.json +43 -0
- package/cpmm/artifacts/scripts/SetFeeCollectorFactory.ral.json +28 -0
- package/cpmm/artifacts/scripts/Swap.ral.json +46 -0
- package/cpmm/artifacts/scripts/SwapMaxIn.ral.json +46 -0
- package/cpmm/artifacts/scripts/SwapMinOut.ral.json +46 -0
- package/cpmm/artifacts/test/GetToken.ral.json +31 -0
- package/cpmm/artifacts/test/MathTest.ral.json +49 -0
- package/cpmm/artifacts/test/TestToken.ral.json +87 -0
- package/cpmm/artifacts/ts/DexAccount.ts +329 -0
- package/cpmm/artifacts/ts/ExampleOracleSimple.ts +383 -0
- package/cpmm/artifacts/ts/FeeCollectorFactoryImpl.ts +227 -0
- package/cpmm/artifacts/ts/FeeCollectorPerTokenPairImpl.ts +327 -0
- package/cpmm/artifacts/ts/FullMathTest.ts +251 -0
- package/cpmm/artifacts/ts/MathTest.ts +183 -0
- package/cpmm/artifacts/ts/Router.ts +554 -0
- package/cpmm/artifacts/ts/TestToken.ts +312 -0
- package/cpmm/artifacts/ts/TokenPair.ts +947 -0
- package/cpmm/artifacts/ts/TokenPairFactory.ts +501 -0
- package/cpmm/artifacts/ts/contracts.ts +26 -0
- package/cpmm/artifacts/ts/deployments.ts +109 -0
- package/cpmm/artifacts/ts/index.ts +16 -0
- package/cpmm/artifacts/ts/scripts.ts +142 -0
- package/cpmm/deployments/.deployments.devnet.json +77 -0
- package/cpmm/deployments/.deployments.testnet.json +79 -0
- package/lib/index.d.mts +8800 -0
- package/lib/index.d.ts +8800 -0
- package/lib/index.js +21769 -0
- package/lib/index.js.map +1 -0
- package/lib/index.mjs +22118 -0
- package/lib/index.mjs.map +1 -0
- package/package.json +80 -0
- package/src/clmm/clmm.ts +607 -0
- package/src/clmm/constants.ts +7 -0
- package/src/clmm/index.ts +6 -0
- package/src/clmm/liquidity.ts +163 -0
- package/src/clmm/pool.ts +154 -0
- package/src/clmm/tick.ts +335 -0
- package/src/clmm/types.ts +155 -0
- package/src/common/constants.ts +1 -0
- package/src/common/error.ts +46 -0
- package/src/common/index.ts +7 -0
- package/src/common/logger.ts +82 -0
- package/src/common/math.ts +88 -0
- package/src/common/numeric.ts +64 -0
- package/src/common/types.ts +49 -0
- package/src/common/utils.ts +3 -0
- package/src/cpmm/constants.ts +2 -0
- package/src/cpmm/cpmm.ts +631 -0
- package/src/cpmm/index.ts +3 -0
- package/src/cpmm/types.ts +113 -0
- package/src/index.ts +25 -0
- package/src/moduleBase.ts +64 -0
- package/src/staking/index.ts +4 -0
- package/src/staking/settings.ts +38 -0
- package/src/staking/staking.ts +277 -0
- package/src/staking/types.ts +15 -0
- package/src/staking/utils.ts +25 -0
- package/src/token/index.ts +1 -0
- package/src/token/token.ts +163 -0
- package/src/zeta.ts +105 -0
- package/staking/artifacts/AlphStakeAndLock.ral.json +31 -0
- package/staking/artifacts/AlphUnstakeVault.ral.json +151 -0
- package/staking/artifacts/XAlphStakeVault.ral.json +559 -0
- package/staking/artifacts/XAlphToken.ral.json +404 -0
- package/staking/artifacts/XAlphUnlockAndStartUnstake.ral.json +31 -0
- package/staking/artifacts/examples/GovernanceDemo.ral.json +282 -0
- package/staking/artifacts/examples/RewardSharingVault.ral.json +253 -0
- package/staking/artifacts/structs.ral.json +47 -0
- package/staking/artifacts/ts/AlphUnstakeVault.ts +354 -0
- package/staking/artifacts/ts/FullMathTest.ts +175 -0
- package/staking/artifacts/ts/GovernanceDemo.ts +726 -0
- package/staking/artifacts/ts/RewardSharingVault.ts +559 -0
- package/staking/artifacts/ts/TestDynamicArrayByteVec32.ts +431 -0
- package/staking/artifacts/ts/TestDynamicSortedArrayForU256.ts +516 -0
- package/staking/artifacts/ts/TestMerkleProof.ts +343 -0
- package/staking/artifacts/ts/XAlphStakeVault.ts +1120 -0
- package/staking/artifacts/ts/XAlphToken.ts +835 -0
- package/staking/artifacts/ts/contracts.ts +26 -0
- package/staking/artifacts/ts/deployments.ts +109 -0
- package/staking/artifacts/ts/index.ts +15 -0
- package/staking/artifacts/ts/scripts.ts +35 -0
- package/staking/artifacts/ts/types.ts +19 -0
- package/staking/artifacts/utils/FullMathTest.ral.json +57 -0
- package/staking/artifacts/utils/TestDynamicArrayByteVec32.ral.json +165 -0
- package/staking/artifacts/utils/TestDynamicSortedArrayForU256.ral.json +189 -0
- package/staking/artifacts/utils/TestMerkleProof.ral.json +134 -0
- package/staking/deployments/.deployments.devnet.json +77 -0
- package/staking/deployments/.deployments.testnet.json +78 -0
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import type { TokenInfo } from '@alephium/token-list';
|
|
2
|
+
import ModuleBase from '../moduleBase';
|
|
3
|
+
import type { Zeta } from '../zeta';
|
|
4
|
+
import { TokenListFetchError } from '../common/error';
|
|
5
|
+
|
|
6
|
+
interface TokenCache {
|
|
7
|
+
tokens: TokenInfo[];
|
|
8
|
+
lastFetched: Date;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
type TokenListResponse = {
|
|
12
|
+
tokens: TokenInfo[];
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export class TokenModule extends ModuleBase {
|
|
16
|
+
private cache?: TokenCache;
|
|
17
|
+
private readonly cacheTimeMs: number;
|
|
18
|
+
|
|
19
|
+
constructor(
|
|
20
|
+
scope: Zeta,
|
|
21
|
+
private readonly cacheTimeDays: number = 1,
|
|
22
|
+
) {
|
|
23
|
+
super({ scope, moduleName: 'TokenModule' });
|
|
24
|
+
|
|
25
|
+
this.scope = scope;
|
|
26
|
+
this.cacheTimeMs = cacheTimeDays * 24 * 60 * 60 * 1000;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async getTokens(): Promise<TokenInfo[]> {
|
|
30
|
+
if (this.isCacheValid()) {
|
|
31
|
+
return this.cache!.tokens;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
try {
|
|
35
|
+
return await this.fetchTokens();
|
|
36
|
+
} catch (error) {
|
|
37
|
+
if (this.cache) {
|
|
38
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
39
|
+
this.logInfo(`Failed to refresh token list, using cached copy. Reason: ${reason}`);
|
|
40
|
+
return this.cache.tokens;
|
|
41
|
+
}
|
|
42
|
+
this.logAndThrowError(`Failed to refresh token list`, error);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async getTokenById(id: string): Promise<TokenInfo> {
|
|
47
|
+
const tokenInfo = await this.getTokenInfoBy((token) => token.id === id);
|
|
48
|
+
if (!tokenInfo) {
|
|
49
|
+
throw new Error(`Unknown token, id not found in token list: ${id}`);
|
|
50
|
+
}
|
|
51
|
+
return tokenInfo;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async getTokenBySymbol(symbol: string): Promise<TokenInfo> {
|
|
55
|
+
const tokenInfo = await this.getTokenInfoBy((token) => token.symbol === symbol);
|
|
56
|
+
if (!tokenInfo) {
|
|
57
|
+
throw new Error(`Unknown token, symbol not found in token list: ${symbol}`);
|
|
58
|
+
}
|
|
59
|
+
return tokenInfo;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
async getTokenInfoBy(fn: (token: TokenInfo) => boolean): Promise<TokenInfo | undefined> {
|
|
63
|
+
const tokenInfoz = await this.getTokens();
|
|
64
|
+
return tokenInfoz.find(fn);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
async fetchTokens(): Promise<TokenInfo[]> {
|
|
68
|
+
try {
|
|
69
|
+
const response = await fetch(this.scope.tokenListUrl);
|
|
70
|
+
if (!response.ok) {
|
|
71
|
+
throw new TokenListFetchError(this.scope.tokenListUrl, { status: response.status });
|
|
72
|
+
}
|
|
73
|
+
const payload: unknown = await response.json();
|
|
74
|
+
const tokens = this.extractTokens(payload);
|
|
75
|
+
this.cache = {
|
|
76
|
+
tokens,
|
|
77
|
+
lastFetched: new Date(),
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
return tokens;
|
|
81
|
+
} catch (error) {
|
|
82
|
+
if (error instanceof TokenListFetchError) {
|
|
83
|
+
this.logAndThrowError(`Failed to fetch token list`, error);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
this.logAndThrowError(
|
|
87
|
+
`Failed to fetch token list`,
|
|
88
|
+
new TokenListFetchError(this.scope.tokenListUrl, {
|
|
89
|
+
cause: error,
|
|
90
|
+
}),
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
private isCacheValid(): boolean {
|
|
96
|
+
if (!this.cache) {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const now = new Date();
|
|
101
|
+
const timeDiff = now.getTime() - this.cache.lastFetched.getTime();
|
|
102
|
+
return timeDiff < this.cacheTimeMs;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
private extractTokens(payload: unknown): TokenInfo[] {
|
|
106
|
+
if (!this.validateTokenListResponse(payload)) {
|
|
107
|
+
throw new Error('Invalid token list payload received from token list endpoint');
|
|
108
|
+
}
|
|
109
|
+
return payload.tokens;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
private validateTokenListResponse(value: unknown): value is TokenListResponse {
|
|
113
|
+
if (typeof value !== 'object' || value === null) {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
const tokens = (value as { tokens?: unknown }).tokens;
|
|
117
|
+
if (!Array.isArray(tokens)) {
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
return tokens.every((token) => this.validateTokenInfo(token));
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
private validateTokenInfo(value: unknown): value is TokenInfo {
|
|
124
|
+
if (typeof value !== 'object' || value === null) {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const token = value as Partial<TokenInfo>;
|
|
129
|
+
|
|
130
|
+
const requiredStringFields: Array<keyof TokenInfo> = [
|
|
131
|
+
'id',
|
|
132
|
+
'name',
|
|
133
|
+
'symbol',
|
|
134
|
+
'description',
|
|
135
|
+
'logoURI',
|
|
136
|
+
];
|
|
137
|
+
|
|
138
|
+
if (requiredStringFields.some((field) => typeof token[field] !== 'string')) {
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const { decimals, originChain, unchainedLogoURI } = token;
|
|
143
|
+
|
|
144
|
+
if (
|
|
145
|
+
typeof decimals !== 'number' ||
|
|
146
|
+
!Number.isInteger(decimals) ||
|
|
147
|
+
decimals < 0 ||
|
|
148
|
+
decimals > 255
|
|
149
|
+
) {
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (originChain !== undefined && typeof originChain !== 'string') {
|
|
154
|
+
return false;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (unchainedLogoURI !== undefined && typeof unchainedLogoURI !== 'string') {
|
|
158
|
+
return false;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return true;
|
|
162
|
+
}
|
|
163
|
+
}
|
package/src/zeta.ts
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import type { SignerProvider, Account } from '@alephium/web3';
|
|
2
|
+
import { NodeProvider, ExplorerProvider, web3 } from '@alephium/web3';
|
|
3
|
+
import { CpmmModule } from './cpmm/cpmm';
|
|
4
|
+
import type { Network, ZetaLoadParams } from './common/types';
|
|
5
|
+
import { defaultNetworks } from './common/types';
|
|
6
|
+
import { ClmmModule } from './clmm/clmm';
|
|
7
|
+
import { TokenModule } from './token/token';
|
|
8
|
+
import { StakingModule } from './staking/staking';
|
|
9
|
+
|
|
10
|
+
export class Zeta {
|
|
11
|
+
public cpmm: CpmmModule;
|
|
12
|
+
public clmm: ClmmModule;
|
|
13
|
+
public token: TokenModule;
|
|
14
|
+
public staking: StakingModule;
|
|
15
|
+
|
|
16
|
+
private _nodeProvider: NodeProvider;
|
|
17
|
+
private _explorerProvider: ExplorerProvider;
|
|
18
|
+
private _tokenListUrl: string;
|
|
19
|
+
private _signer?: SignerProvider;
|
|
20
|
+
private _account?: Account;
|
|
21
|
+
private _network: Network;
|
|
22
|
+
|
|
23
|
+
constructor(params: ZetaLoadParams) {
|
|
24
|
+
const network = defaultNetworks.find((n) => n.id === params.networkId);
|
|
25
|
+
if (!network) {
|
|
26
|
+
throw new Error(`Network ${params.networkId} not found`);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const overrides = params.networkOverrides ?? {};
|
|
30
|
+
const networkConfig: Network = { ...network, ...overrides };
|
|
31
|
+
|
|
32
|
+
this._network = networkConfig;
|
|
33
|
+
this._nodeProvider = new NodeProvider(this._network.nodeUrl, this._network.nodeApiKey);
|
|
34
|
+
this._explorerProvider = new ExplorerProvider(this._network.explorerApiUrl);
|
|
35
|
+
this._tokenListUrl = this._network.tokenListUrl;
|
|
36
|
+
this._signer = params.signer;
|
|
37
|
+
|
|
38
|
+
// Initialize modules
|
|
39
|
+
this.cpmm = new CpmmModule(this);
|
|
40
|
+
this.clmm = new ClmmModule(this);
|
|
41
|
+
this.token = new TokenModule(this);
|
|
42
|
+
this.staking = new StakingModule(this);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
static load(config: ZetaLoadParams): Zeta {
|
|
46
|
+
return new Zeta(config);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
public set signer(signer: SignerProvider) {
|
|
50
|
+
this._signer = signer;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
public set account(account: Account) {
|
|
54
|
+
this._account = account;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
get signer(): SignerProvider {
|
|
58
|
+
if (!this._signer) {
|
|
59
|
+
throw new Error('Signer not set');
|
|
60
|
+
}
|
|
61
|
+
return this._signer;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
get account(): Account {
|
|
65
|
+
if (!this._account) {
|
|
66
|
+
throw new Error('Account not set');
|
|
67
|
+
}
|
|
68
|
+
return this._account;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
public clearSigner() {
|
|
72
|
+
this._signer = undefined;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
public clearAccount() {
|
|
76
|
+
this._account = undefined;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
get nodeProvider(): NodeProvider {
|
|
80
|
+
return this._nodeProvider;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
get explorerProvider(): ExplorerProvider {
|
|
84
|
+
return this._explorerProvider;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
get network(): Network {
|
|
88
|
+
return this._network;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
get tokenListUrl(): string {
|
|
92
|
+
return this._tokenListUrl;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
public setCurrentProviders(): void {
|
|
96
|
+
if (!this._nodeProvider) {
|
|
97
|
+
throw new Error('Node provider not set');
|
|
98
|
+
}
|
|
99
|
+
if (!this._explorerProvider) {
|
|
100
|
+
throw new Error('Explorer provider not set');
|
|
101
|
+
}
|
|
102
|
+
web3.setCurrentNodeProvider(this._nodeProvider);
|
|
103
|
+
web3.setCurrentExplorerProvider(this._explorerProvider);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "v4.2.5",
|
|
3
|
+
"name": "AlphStakeAndLock",
|
|
4
|
+
"bytecodeTemplate": "01010300020018b417001600{2}a2{2}0d0c{0}010c0c0d{1}010c170116001601{2}a3{2}0d0c{1}010f",
|
|
5
|
+
"fieldsSig": {
|
|
6
|
+
"names": [
|
|
7
|
+
"xAlphToken",
|
|
8
|
+
"xAlphStakeVault",
|
|
9
|
+
"amount"
|
|
10
|
+
],
|
|
11
|
+
"types": [
|
|
12
|
+
"XAlphToken",
|
|
13
|
+
"XAlphStakeVault",
|
|
14
|
+
"U256"
|
|
15
|
+
],
|
|
16
|
+
"isMutable": [
|
|
17
|
+
false,
|
|
18
|
+
false,
|
|
19
|
+
false
|
|
20
|
+
]
|
|
21
|
+
},
|
|
22
|
+
"functions": [
|
|
23
|
+
{
|
|
24
|
+
"name": "main",
|
|
25
|
+
"paramNames": [],
|
|
26
|
+
"paramTypes": [],
|
|
27
|
+
"paramIsMutable": [],
|
|
28
|
+
"returnTypes": []
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "v4.2.5",
|
|
3
|
+
"name": "AlphUnstakeVault",
|
|
4
|
+
"bytecode": "060540ea40f841384172418c0000030901409216020c3013415e7b160016010c0d3687170316001601371704160316043616031604314c020d4a010c36170516050c2f4c04160416022d02160216053313415f7b160016011602871706160516061604334c020d4a010c361705160416063617040c1602361602381707160216072d1702160416072d17040c16073616072d0d351707160416051607373917040f1602370e3a170816080e16021608373637170816080e16021608373637170816080e16021608373637170816080e16021608373637170816080e16021608373637170816080e160216083736371708160416083702010000000103d3f10c9d97ce020201000003014020d3223281b2ce040c3313167b5617001600ce033413177b1600ce032b1701ce0217021601ce04314c0516021601ce04000017021602a0002b0201020102011fd30e00e856b417011601ce0077457a4b04181601ce014513147b160000023213157bce011600a8a00016002aa100a000ce022f0201020001000bd38e18691cb417001600ce00774513147bce01b0",
|
|
5
|
+
"codeHash": "5216c458f360d0f51f5e2109a760814ff97eab76f546adc835eb318c6cbc5256",
|
|
6
|
+
"fieldsSig": {
|
|
7
|
+
"names": [
|
|
8
|
+
"xalphToken",
|
|
9
|
+
"unstakerAddress",
|
|
10
|
+
"totalUnstakeAmount",
|
|
11
|
+
"unstakeStartTime",
|
|
12
|
+
"unstakeDuration",
|
|
13
|
+
"withdrawnAmount"
|
|
14
|
+
],
|
|
15
|
+
"types": [
|
|
16
|
+
"XAlphToken",
|
|
17
|
+
"Address",
|
|
18
|
+
"U256",
|
|
19
|
+
"U256",
|
|
20
|
+
"U256",
|
|
21
|
+
"U256"
|
|
22
|
+
],
|
|
23
|
+
"isMutable": [
|
|
24
|
+
false,
|
|
25
|
+
false,
|
|
26
|
+
false,
|
|
27
|
+
false,
|
|
28
|
+
false,
|
|
29
|
+
true
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
"eventsSig": [],
|
|
33
|
+
"functions": [
|
|
34
|
+
{
|
|
35
|
+
"name": "mulDiv",
|
|
36
|
+
"paramNames": [
|
|
37
|
+
"a",
|
|
38
|
+
"b",
|
|
39
|
+
"denominator"
|
|
40
|
+
],
|
|
41
|
+
"paramTypes": [
|
|
42
|
+
"U256",
|
|
43
|
+
"U256",
|
|
44
|
+
"U256"
|
|
45
|
+
],
|
|
46
|
+
"paramIsMutable": [
|
|
47
|
+
false,
|
|
48
|
+
false,
|
|
49
|
+
true
|
|
50
|
+
],
|
|
51
|
+
"returnTypes": [
|
|
52
|
+
"U256"
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"name": "getTotalUnstakeAmount",
|
|
57
|
+
"paramNames": [],
|
|
58
|
+
"paramTypes": [],
|
|
59
|
+
"paramIsMutable": [],
|
|
60
|
+
"returnTypes": [
|
|
61
|
+
"U256"
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"name": "getClaimableAmount",
|
|
66
|
+
"paramNames": [],
|
|
67
|
+
"paramTypes": [],
|
|
68
|
+
"paramIsMutable": [],
|
|
69
|
+
"returnTypes": [
|
|
70
|
+
"U256"
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"name": "claim",
|
|
75
|
+
"paramNames": [
|
|
76
|
+
"amount"
|
|
77
|
+
],
|
|
78
|
+
"paramTypes": [
|
|
79
|
+
"U256"
|
|
80
|
+
],
|
|
81
|
+
"paramIsMutable": [
|
|
82
|
+
false
|
|
83
|
+
],
|
|
84
|
+
"returnTypes": [
|
|
85
|
+
"Bool"
|
|
86
|
+
]
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"name": "destroy",
|
|
90
|
+
"paramNames": [],
|
|
91
|
+
"paramTypes": [],
|
|
92
|
+
"paramIsMutable": [],
|
|
93
|
+
"returnTypes": []
|
|
94
|
+
}
|
|
95
|
+
],
|
|
96
|
+
"constants": [],
|
|
97
|
+
"enums": [
|
|
98
|
+
{
|
|
99
|
+
"name": "FullMathError",
|
|
100
|
+
"fields": [
|
|
101
|
+
{
|
|
102
|
+
"name": "DivByZero",
|
|
103
|
+
"value": {
|
|
104
|
+
"type": "U256",
|
|
105
|
+
"value": "350"
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"name": "MulDivOverflow",
|
|
110
|
+
"value": {
|
|
111
|
+
"type": "U256",
|
|
112
|
+
"value": "351"
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
]
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"name": "ErrorCodes",
|
|
119
|
+
"fields": [
|
|
120
|
+
{
|
|
121
|
+
"name": "InvalidCaller",
|
|
122
|
+
"value": {
|
|
123
|
+
"type": "U256",
|
|
124
|
+
"value": "20"
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"name": "InsufficientClaimableAmount",
|
|
129
|
+
"value": {
|
|
130
|
+
"type": "U256",
|
|
131
|
+
"value": "21"
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"name": "InvalidUnstakeDuration",
|
|
136
|
+
"value": {
|
|
137
|
+
"type": "U256",
|
|
138
|
+
"value": "22"
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"name": "InvalidTimestamp",
|
|
143
|
+
"value": {
|
|
144
|
+
"type": "U256",
|
|
145
|
+
"value": "23"
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
]
|
|
149
|
+
}
|
|
150
|
+
]
|
|
151
|
+
}
|