@nori-zk/mina-token-bridge
Version:
A Mina zk-program contract allowing users to mint tokens on Nori Bridge.
37 lines • 1.48 kB
JavaScript
import { __decorate, __metadata } from "tslib";
import { Field, SmartContract, state, State, method } from 'o1js';
/** Stores */
export class NoriStorageInterface extends SmartContract {
constructor() {
super(...arguments);
this.userKeyHash = State();
this.mintedSoFar = State();
}
async increaseMintedAmount(lockedSoFar) {
let mintedSoFar = this.mintedSoFar.getAndRequireEquals();
const amountToMint = lockedSoFar.sub(mintedSoFar);
amountToMint.assertGreaterThan(Field(0));
this.mintedSoFar.set(mintedSoFar.add(amountToMint));
return amountToMint;
// Provable.log(mintedSoFaraa, 'minted so farrrrrrrr');
// let amount = totalAmountLockedOnEth.sub(mintedSoFar);
// this.mintedSoFar.set(mintedSoFar.add(amount));
// this.self.body.mayUseToken = AccountUpdate.MayUseToken.InheritFromParent;
// return this.self;
}
}
__decorate([
state(Field),
__metadata("design:type", Object)
], NoriStorageInterface.prototype, "userKeyHash", void 0);
__decorate([
state(Field),
__metadata("design:type", Object)
], NoriStorageInterface.prototype, "mintedSoFar", void 0);
__decorate([
method.returns(Field),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Field]),
__metadata("design:returntype", Promise)
], NoriStorageInterface.prototype, "increaseMintedAmount", null);
//# sourceMappingURL=NoriStorageInterface.js.map