Skip to content

Commit

Permalink
Merge pull request #27 from zkcloudworker/bonding-curve
Browse files Browse the repository at this point in the history
Bonding curve
  • Loading branch information
dfstio authored Jan 23, 2025
2 parents c202c75 + 0b63813 commit ae418fb
Show file tree
Hide file tree
Showing 22 changed files with 596 additions and 113 deletions.
138 changes: 76 additions & 62 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "minatokens-lib",
"description": "MinaTokens API Library",
"version": "0.15.0",
"version": "0.15.2",
"author": "DFST",
"devDependencies": {
"@types/node": "^22.10.3",
Expand Down Expand Up @@ -39,5 +39,6 @@
"packages/storage",
"packages/token",
"packages/upgradable"
]
],
"packageManager": "[email protected]+sha512.3003a14012e2987072d244c720506549c1aab73ee728208f1b2580a9fd67b92d61ba6b08fe93f6dce68fd771e3af1e59a0afa28dd242dd0940d73b95fedd4e90"
}
14 changes: 10 additions & 4 deletions packages/abi/dist/node/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ async function buildTokenTransaction(params) {
async function getTokenSymbolAndAdmin(params) {
const { txType, tokenAddress, chain, to, offerAddress, bidAddress } = params;
const vk = tokenVerificationKeys[chain === "mainnet" ? "mainnet" : "devnet"].vk;
const verificationKeyHashes = [];
let verificationKeyHashes = [];
if (bidAddress) {
verificationKeyHashes.push(vk.FungibleTokenBidContract.hash);
}
Expand Down Expand Up @@ -738,7 +738,11 @@ async function getTokenSymbolAndAdmin(params) {
} else if (vk.FungibleTokenAdmin.hash === adminVerificationKey.hash.toJSON() && vk.FungibleTokenAdmin.data === adminVerificationKey.data) {
isAdvanced = false;
} else {
throw new Error("Unknown admin verification key");
console.error("Unknown admin verification key", {
hash: adminVerificationKey.hash.toJSON(),
symbol,
address: adminContractPublicKey.toBase58()
});
}
let isToNewAccount = void 0;
if (to) {
Expand All @@ -760,8 +764,10 @@ async function getTokenSymbolAndAdmin(params) {
const adminAddress = import_o1js2.PublicKey.fromFields([adminAddress0, adminAddress1]);
for (const hash of verificationKeyHashes) {
const found = Object.values(vk).some((key) => key.hash === hash);
if (!found)
throw new Error(`Final check: unknown verification key hash: ${hash}`);
if (!found) {
console.error(`Final check: unknown verification key hash: ${hash}`);
verificationKeyHashes = verificationKeyHashes.filter((h) => h !== hash);
}
}
verificationKeyHashes.sort((a, b) => {
const typeA = Object.values(vk).find((key) => key.hash === a)?.type;
Expand Down
Loading

0 comments on commit ae418fb

Please sign in to comment.