0.2.10 • Published 9 months ago

@frankencoin/zchf v0.2.10

Weekly downloads
-
License
ISC
Repository
github
Last release
9 months ago

FrankenCoin

This is the source code repository for the smart contracts of the oracle-free, collateralized stablecoin Frankencoin.

There also is a public frontend, a documentation page, an outdated Frankencoin Research Paper, and a more recent chapter of a pending phd thesis.

Source Code

The source code can be found in the contracts folder. The following are the most important contracts.

ContractDescription
Frankencoin.solThe Frankencoin (ZCHF) ERC20 token
Equity.solThe Frankencoin Pool Shares (FPS) ERC20 token
MintingHub.solPlugin for oracle-free collateralized minting
Position.solA borrowed minting position holding collateral
PositionRoller.solA module to roll positions into new ones
StablecoinBridge.solPlugin for 1:1 swaps with other CHF stablecoins
Savings.solA module to pay out interest to ZCHF holders

Compiling and Testing

The project is setup to be compiled and tested with hardhat. Given node.js and hardhat are installed, you can compile or compile and test using these two commands:

npx hardhat compile
npx hardhat test
npx hardhat coverage

With tsc-watch (auto refresh commands)

npx tsc-watch --onCompilationComplete "npx hardhat test ./test/RollerTests.ts"

Deployment

Define the private key from your deployer address and etherscan api key as an environment variable in .env file.

PK=0x123456
APIKEY=123456

Then run a deployment script with tags and network params (e.g., sepolia that specifies the network)

Recommanded commands for sepolia network.

hh deploy --network sepolia --tags MockTokens
hh deploy --network sepolia --tags Frankencoin
hh deploy --network sepolia --tags PositionFactory
hh deploy --network sepolia --tags MintingHub
hh deploy --network sepolia --tags MockCHFToken
hh deploy --network sepolia --tags XCHFBridge
hh deploy --network sepolia --tags positions

The networks are configured in hardhat.config.ts.

npx hardhat verify "0x..." --network sepolia

Publish for NPM Pkg

NPM Package: @frankencoin/zchf

"build": "tsup"

Publish: You need to be logged in and execute npm publish --access public

Edit: index.ts for all pkg exports.

@dev: how to transpile package into bundled apps

E.g. for NextJs using the next.config.js in root of project.

/** @type {import('next').NextConfig} */
const nextConfig = {
	reactStrictMode: true,
	transpilePackages: ['@.../core', '@.../api'],
};

module.exports = nextConfig;
0.2.10

9 months ago

0.2.7

9 months ago

0.2.6

9 months ago

0.2.9

9 months ago

0.2.5

9 months ago

0.2.4

9 months ago

0.2.3

9 months ago

0.2.2

9 months ago

0.2.1

9 months ago

0.2.0

9 months ago