Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/odd-grapes-remember.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@chainlink/secure-mint-adapter': patch
---

Add new fields
15 changes: 10 additions & 5 deletions packages/composites/secure-mint/src/transport/mintable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export class MintableTransport extends SubscriptionTransport<BaseEndpointTypes>
// We will prevent minting if there is more supply + pre-mint than reserve
const overmint = hasSupplyError
? false
: BigInt(supply.premint) + BigInt(supply.supply) > reserve.reserveAmount
: BigInt(supply.mintable) + BigInt(supply.supply) > reserve.reserveAmount

const data = {
overmint,
Expand All @@ -98,10 +98,15 @@ export class MintableTransport extends SubscriptionTransport<BaseEndpointTypes>
id,
{
mintable: overmint ? '0' : data.mintable,
// TODO: Update these with actual values
nativeMint: '0',
totalAborts: '0',
mintablePacked: overmint ? '0' : data.mintable,
nativeMint: data.token_native_mint,
totalAborts: data.token_revert_mint,
mintablePacked: overmint
? '0'
: String(
BigInt(data.mintable) +
BigInt(data.token_native_mint) +
BigInt(data.token_revert_mint),
),
block: data.response_block,
},
]),
Expand Down
11 changes: 7 additions & 4 deletions packages/composites/secure-mint/src/transport/supply.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,19 @@ type ChainData = {
request_block: number
mintable: string
token_supply: string
token_native_mint: string
token_ccip_mint: string
token_ccip_burn: string
token_pre_mint: string
aggregate_pre_mint: boolean
token_request_mint: string
token_revert_mint: string
token_attest_mint: string
aggregate_mint_request: boolean
token_native_mint: string
aggregate_native_mint: boolean
block_finality: string
}
export type IndexerResponse = {
supply: string
premint: string
mintable: string
chains: { [chainName: string]: ChainData }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ exports[`execute mintable endpoint should block overmint 1`] = `
"block": 6,
"mintable": "0",
"mintablePacked": "0",
"nativeMint": "0",
"totalAborts": "0",
"nativeMint": "15",
"totalAborts": "13",
},
},
"overmint": true,
Expand All @@ -24,20 +24,23 @@ exports[`execute mintable endpoint should block overmint 1`] = `
"supplyDetails": {
"chains": {
"1": {
"aggregate_pre_mint": false,
"aggregate_mint_request": true,
"aggregate_native_mint": false,
"block_finality": "0",
"latest_block": 5,
"mintable": "8",
"request_block": 7,
"response_block": 6,
"token_ccip_burn": "12",
"token_ccip_mint": "11",
"token_native_mint": "10",
"token_pre_mint": "13",
"token_attest_mint": "14",
"token_ccip_burn": "11",
"token_ccip_mint": "10",
"token_native_mint": "15",
"token_request_mint": "12",
"token_revert_mint": "13",
"token_supply": "9",
},
},
"premint": "500000000000000001",
"mintable": "500000000000000001",
"supply": "500000000000000000",
},
},
Expand Down Expand Up @@ -91,9 +94,9 @@ exports[`execute mintable endpoint should return success 1`] = `
"1": {
"block": 6,
"mintable": "8",
"mintablePacked": "8",
"nativeMint": "0",
"totalAborts": "0",
"mintablePacked": "36",
"nativeMint": "15",
"totalAborts": "13",
},
},
"overmint": false,
Expand All @@ -105,20 +108,23 @@ exports[`execute mintable endpoint should return success 1`] = `
"supplyDetails": {
"chains": {
"1": {
"aggregate_pre_mint": false,
"aggregate_mint_request": true,
"aggregate_native_mint": false,
"block_finality": "finalized",
"latest_block": 5,
"mintable": "8",
"request_block": 7,
"response_block": 6,
"token_ccip_burn": "12",
"token_ccip_mint": "11",
"token_native_mint": "10",
"token_pre_mint": "13",
"token_attest_mint": "14",
"token_ccip_burn": "11",
"token_ccip_mint": "10",
"token_native_mint": "15",
"token_request_mint": "12",
"token_revert_mint": "13",
"token_supply": "9",
},
},
"premint": "4",
"mintable": "4",
"supply": "3",
},
},
Expand Down
30 changes: 18 additions & 12 deletions packages/composites/secure-mint/test/integration/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,22 @@ export const mockIndexerSuccess = (): nock.Scope =>
})
.reply(200, () => ({
supply: '3',
premint: '4',
mintable: '4',
chains: {
'1': {
latest_block: 5,
response_block: 6,
request_block: 7,
mintable: '8',
token_supply: '9',
token_native_mint: '10',
token_ccip_mint: '11',
token_ccip_burn: '12',
token_pre_mint: '13',
aggregate_pre_mint: false,
token_ccip_mint: '10',
token_ccip_burn: '11',
token_request_mint: '12',
token_revert_mint: '13',
token_attest_mint: '14',
aggregate_mint_request: true,
token_native_mint: '15',
aggregate_native_mint: false,
block_finality: 'finalized',
},
},
Expand All @@ -67,19 +70,22 @@ export const mockIndexerSuccess = (): nock.Scope =>
})
.reply(200, () => ({
supply: '500000000000000000',
premint: '500000000000000001',
mintable: '500000000000000001',
chains: {
'1': {
latest_block: 5,
response_block: 6,
request_block: 7,
mintable: '8',
token_supply: '9',
token_native_mint: '10',
token_ccip_mint: '11',
token_ccip_burn: '12',
token_pre_mint: '13',
aggregate_pre_mint: false,
token_ccip_mint: '10',
token_ccip_burn: '11',
token_request_mint: '12',
token_revert_mint: '13',
token_attest_mint: '14',
aggregate_mint_request: true,
token_native_mint: '15',
aggregate_native_mint: false,
block_finality: '0',
},
},
Expand Down
Loading
Loading