Skip to main content

Contract Compilation

The smart contract is written in Archetype language. Go to the Smart contract section for a detailed presentation.

In order to generate the javascript, used in the dapp, here is the command:

completium-cli generate javascript ./contract/zero_coupon_bond.arl > ./src/contract.js

you can now use contract as below:

import { code, getStorage } from '../contract';
...
tezos.wallet.originate({
code: code,
init: getStorage(
zcbState.contractInfo.issueraccount, // issuer : address,
zcbState.contractInfo.subscriberaccount, // subscriber : address,
zcbState.contractInfo.faceprice * 1000000, // facevalue : tez,
mk_rational (parseInt(zcbState.contractInfo.discount), 100), // discount : rational,
zcbState.contractInfo.duration * 60, // maturityduration : duration,
zcbState.contractInfo.period * 60, // paybackduration : duration,
false, // issuersigned : bool,
false // subscribersigned : bool
)},
).send().then(op => {
...