Skip to content

Commit addca32

Browse files
committed
add e2e case
1 parent df5e183 commit addca32

File tree

4 files changed

+45
-0
lines changed

4 files changed

+45
-0
lines changed

evm-tests/src/contracts/alpha.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,5 +315,18 @@ export const IAlphaABI = [
315315
],
316316
"stateMutability": "view",
317317
"type": "function"
318+
},
319+
{
320+
"inputs": [],
321+
"name": "getCKBurn",
322+
"outputs": [
323+
{
324+
"internalType": "uint256",
325+
"name": "",
326+
"type": "uint256"
327+
}
328+
],
329+
"stateMutability": "view",
330+
"type": "function"
318331
}
319332
]

evm-tests/test/alpha.precompile.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,21 @@ describe("Test Alpha Precompile", () => {
209209
assert.ok(typeof alphaIssuance === 'bigint', "Alpha issuance should be a bigint");
210210
assert.ok(alphaIssuance >= BigInt(0), "Alpha issuance should be non-negative");
211211
});
212+
213+
it("getCKBurn returns valid CK burn rate", async () => {
214+
const ckBurn = await publicClient.readContract({
215+
abi: IAlphaABI,
216+
address: toViemAddress(IALPHA_ADDRESS),
217+
functionName: "getCKBurn",
218+
args: []
219+
})
220+
221+
const ckBurnOnChain = await api.query.SubtensorModule.CKBurn.getValue()
222+
223+
assert.strictEqual(ckBurn, ckBurnOnChain, "CK burn should match on chain");
224+
assert.ok(ckBurn !== undefined, "CK burn should be defined");
225+
assert.ok(typeof ckBurn === 'bigint', "CK burn should be a bigint");
226+
});
212227
});
213228

214229
describe("Global Functions", () => {

precompiles/src/solidity/alpha.abi

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,5 +313,18 @@
313313
],
314314
"stateMutability": "view",
315315
"type": "function"
316+
},
317+
{
318+
"inputs": [],
319+
"name": "getCKBurn",
320+
"outputs": [
321+
{
322+
"internalType": "uint256",
323+
"name": "",
324+
"type": "uint256"
325+
}
326+
],
327+
"stateMutability": "view",
328+
"type": "function"
316329
}
317330
]

precompiles/src/solidity/alpha.sol

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,8 @@ interface IAlpha {
9494
/// @dev Returns the sum of alpha prices for all subnets.
9595
/// @return The sum of alpha prices.
9696
function getSumAlphaPrice() external view returns (uint256);
97+
98+
/// @dev Returns the CK burn rate.
99+
/// @return The CK burn rate.
100+
function getCKBurn() external view returns (uint256);
97101
}

0 commit comments

Comments
 (0)