Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: clean up #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
3 changes: 0 additions & 3 deletions .env

This file was deleted.

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules/
logs/
logs/
.env
2 changes: 0 additions & 2 deletions .nxignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
# Personal Conf
.vscode/
\.DS_Store
skaffold.yaml

auth0-cypress-demo/
# Created by .ignore support plugin (hsz.mobi)
### Node template
# Logs
Expand Down
9 changes: 2 additions & 7 deletions cast.code-workspace
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
{
"extensions": {
"recommendations": [
"googlecloudtools.cloudcode",
"msjsdiag.debugger-for-chrome",
"jingkaizhao.vscode-redux-devtools",
"ms-azuretools.vscode-docker",
"redhat.vscode-yaml",
"mikestead.dotenv",
Expand Down Expand Up @@ -43,7 +40,7 @@
"path": "packages/cast/cast-tz-v1"
},
{
"name": "forge-platform",
"name": "cast-v1",
"path": "."
}
],
Expand Down Expand Up @@ -75,10 +72,8 @@
"editor.tabSize": 2,
"files.eol": "\n",
"files.exclude": {
"packages/sgforge/www": true,
"packages/cast/cast-eth-v1": true,
"packages/cast/cast-tz-v1": true,
"charts": true,
"packages": true
},
"eslint.enable": true,
Expand Down Expand Up @@ -179,7 +174,7 @@
"typescript.format.insertSpaceAfterSemicolonInForStatements": false,
"typescript.format.insertSpaceBeforeAndAfterBinaryOperators": false,
"typescript.reportStyleChecksAsWarnings": false,
"typescript.tsdk": "forge-platform/node_modules/typescript/lib",
"typescript.tsdk": "cast1/node_modules/typescript/lib",
"workbench.editor.enablePreview": false,
"solidity.enableLocalNodeCompiler": false,
"python.formatting.autopep8Args": [
Expand Down
4 changes: 1 addition & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ services:
- POSTGRES_DB=oracle
ports:
- '5434:5432'
volumes:
- './charts/forge-platform/init-data/defaults/default-str-postgres-init.sql:/docker-entrypoint-initdb.d/init.sql'
fro:
container_name: fro
image: 'node:16.9.1-alpine3.14'
Expand Down Expand Up @@ -106,7 +104,7 @@ services:
- "20000:20000"
volumes:
- 'flextesa_data:/tmp'
command: hangzbox start --keep-root --add-bootstrap-account "${TZ_KEY}@2_000_000_000_000" --no-daemons-for=forge
command: hangzbox start --keep-root --add-bootstrap-account "${TZ_KEY}@2_000_000_000_000" --no-daemons-for=cast
environment:
- block_time=3
mkdocs:
Expand Down
12 changes: 6 additions & 6 deletions docs/fro/04_createEMTN_variables_TEZOS.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"EMTN": {
"status": "CREATED",
"issuerId": "O2RNE8IBXP4R0TD8PU41",
"issuerId": "40FB4DC1392C13C0C1D5",
"isinCode": "202106301141",
"cfiCode": "202106301141",
"commonCode": "202106301141",
Expand All @@ -18,11 +18,11 @@
"firstCouponDate": "2022-07-30T09:41:26.079Z",
"isCallable": false,
"callFrequency": "DAILY",
"registrarAgentAddress": "tz1es1Cci5T4NWhYHep7gnj3M3aF7Vq9CiLL",
"settlerAgentAddress": "tz1NF3vkkDAozuVrBKTWTmALULPkbVsa53r2",
"issuerAddress": "tz1fjUm3gdP9ugKKU9Uiv3StnVCC5CoaVqaF",
"registrarId": "969500FX8K40ZDW4F377",
"settlementAgentId": "PAREL_LEI",
"registrarAgentAddress": "tz1es1Cci5T4NWhYHep7jnj3M3aF7Vq9CiLL",
"settlerAgentAddress": "tz1NF3vkkDAozuVrBKTWTnALULPkbVsa53r2",
"issuerAddress": "tz1fjUm3gdP9ugKKU9Uiv3StnVCC5CoaVqeF",
"registrarId": "5F04801BA62A99392892",
"settlementAgentId": "6FE314DDB2F43A4AAA47",
"EmtnType": "type1",
"underlying": "UDL1",
"isAutocall": true,
Expand Down
6 changes: 3 additions & 3 deletions docs/fro/05_initiateSubscription_variables_ETHEREUM.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"initiateSubscriptionInput": {
"settlementModel": "INDIRECT",
"intermediateAccountIBAN": "FR7630003011300300000000000",
"intermediateAccountIBAN": "FR7632000000000000000000000",
"holdableTokenAddress": null,
"settlementDate": "2022-04-04T08:44:32.785Z",
"operationId": "974a2dcc-a241-447f-8ea2-82b00cf818bb",
Expand All @@ -12,12 +12,12 @@
"tradeDate": "2022-03-04T09:44:32.785",
"issuerAddresses": {
"legalEntityId": "LEI_ISSUER_1",
"paymentAccountNumber": "FR7630003011300400000000000"
"paymentAccountNumber": "FR7633000000000000000000000"
},
"investorAddresses": {
"deliveryAccountNumber": "0xee39c0435ab3c4a205e9e117dcea0cc7610d7dc3",
"legalEntityId": "LEI_INVESTOR_1",
"paymentAccountNumber": "FR7630003011300500000000000"
"paymentAccountNumber": "FR7631000000000000000000000"
},
"deliveryQuantity": 1,
"paymentAmount": 980000,
Expand Down
6 changes: 3 additions & 3 deletions docs/fro/05_initiateSubscription_variables_TEZOS.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"initiateSubscriptionInput": {
"settlementModel": "INDIRECT",
"intermediateAccountIBAN": "FR7630003011300300000000000",
"intermediateAccountIBAN": "FR7632000000000000000000000",
"holdableTokenAddress": null,
"settlementDate": "2022-04-04T08:44:32.785Z",
"operationId": "974a2dcc-a241-447f-8ea2-82b00cf818bb",
Expand All @@ -12,12 +12,12 @@
"tradeDate": "2022-03-04T09:44:32.785",
"issuerAddresses": {
"legalEntityId": "LEI_ISSUER_1",
"paymentAccountNumber": "FR7630003011300400000000000"
"paymentAccountNumber": "FR7633000000000000000000000"
},
"investorAddresses": {
"deliveryAccountNumber": "tz1gQZPnKpc97AXNohwkzBdHuw53KJrCkvRs",
"legalEntityId": "LEI_INVESTOR_1",
"paymentAccountNumber": "FR7630003011300500000000000"
"paymentAccountNumber": "FR7631000000000000000000000"
},
"deliveryQuantity": 1,
"paymentAmount": 980000,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"settlementTransactionId": "a984f4ca-ee73-487b-9bca-04943819f3a0" // id of the corresponding settlement transaction
"settlementTransactionId": "2cc3e9bbfc2360j8" // id of the swift reference received
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Emitting a Bond using Financial Oracles

This step by step guide will go through the bond emission process.
At the end of this tutorial you will have emitted and settled a new Forge Bond on
At the end of this tutorial you will have issued and settled a new Forge Bond on
your local environnement.

For this you need to interact with two components : the <span class="froColor">[Financial Registrar Oracle (FRO)](/modules/explorerFRO)</span> and the <span class="fsoColor">[Financial Settlement Oracle (FSO)](/modules/explorerFSO)</span>.
Expand All @@ -17,7 +17,7 @@ Any Financial Oracle (FO) can do this. For this tutorial, we will be using the <

### Registry Notification

Anytime a new contract is emitted by a factory, you will receive a notification here.
Anytime a new contract is issued by a factory, you will receive a notification here.

<div class="froBorder" >
<div class="explorer" id="froSubRegistryNotification"></div>
Expand Down Expand Up @@ -97,7 +97,7 @@ Keep that address, it represents your new Bond.

## Subscribing to the bond

Now that the bond is emitted, investors can subscribe.
Now that the bond is issued, investors can subscribe.
For this example, we are using a preconfigured address as an investor.

We now need to build a subscription object.
Expand Down Expand Up @@ -157,7 +157,7 @@ Once the mutation is executed, you should receive a `ConfirmPaymentTransferred`
<div class="explorer" id="fsoConfirmPaymentTransferred"></div>
</div>

**Congratulations** You have just emitted and subscribed to a Forge Bond !
**Congratulations** You have just issued and subscribed to a Forge Bond !

<script>
const froEndPoint = 'http://localhost:6661/graphql';
Expand Down
2 changes: 1 addition & 1 deletion mkdocs/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ site_name: Cast v1
nav:
- Home: index.md
- Tutorials :
- Bond Emission: tutorials/bondEmission.md
- Bond Emission: tutorials/bondIssuance.md
- Modules:
- modules/explorerFRO.md
- modules/explorerFSO.md
Expand Down
2 changes: 2 additions & 0 deletions networks/local/.gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
env
ethereum/coinbase.json
ethereum/contracts.json
ethereum/keys.json
mnemonic.json
tezos/coinbase.json
tezos/keys.json
tezos/contracts.json

2 changes: 1 addition & 1 deletion networks/local/env.liquid
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
GANACHE_PRIV="{{ "m/44'/60'/0'/0/0" | ethereum_private_key }}"
GANACHE_ADDRESS="{{ "m/44'/60'/0'/0/0" | ethereum_address }}"
TZ_KEY="forge,{{"m/44'/1729'/0'/0'" | tezos_flextesa_material }}"
TZ_KEY="cast,{{"m/44'/1729'/0'/0'" | tezos_flextesa_material }}"
2 changes: 1 addition & 1 deletion networks/local/ethereum/keys.json.liquid
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"SG_FORGE": "{{ "m/44'/60'/0'/0/0'" | ethereum_private_key }}",
"CAST_AGENT": "{{ "m/44'/60'/0'/0/0'" | ethereum_private_key }}",
"REGISTRAR": "{{ "m/44'/60'/0'/0/1'" | ethereum_private_key }}",
"SETTLEMENT_AGENT": "{{ "m/44'/60'/0'/0/2'" | ethereum_private_key }}",
"ISSUER_1": "{{ "m/44'/60'/0'/0/3'" | ethereum_private_key }}",
Expand Down
2 changes: 1 addition & 1 deletion networks/local/tezos/keys.json.liquid
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"SG_FORGE": "{{ "m/44'/1729'/0'/0'" | tezos_private_key }}",
"CAST_AGENT": "{{ "m/44'/1729'/0'/0'" | tezos_private_key }}",
"REGISTRAR": "{{ "m/44'/1729'/0'/1'" | tezos_private_key }}",
"SETTLEMENT_AGENT": "{{ "m/44'/1729'/0'/2'" | tezos_private_key }}",
"ISSUER_1": "{{ "m/44'/1729'/0'/3'" | tezos_private_key }}",
Expand Down
2 changes: 1 addition & 1 deletion networks/testnet/ethereum/keys.json.liquid
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"SG_FORGE": "{{ "m/44'/60'/0'/0/0'" | ethereum_private_key }}",
"CAST_AGENT": "{{ "m/44'/60'/0'/0/0'" | ethereum_private_key }}",
"REGISTRAR": "{{ "m/44'/60'/0'/0/1'" | ethereum_private_key }}",
"SETTLEMENT_AGENT": "{{ "m/44'/60'/0'/0/2'" | ethereum_private_key }}",
"ISSUER_1": "{{ "m/44'/60'/0'/0/3'" | ethereum_private_key }}",
Expand Down
2 changes: 1 addition & 1 deletion networks/testnet/tezos/keys.json.liquid
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"SG_FORGE": "{{ "m/44'/1729'/0'/0'" | tezos_private_key }}",
"CAST_AGENT": "{{ "m/44'/1729'/0'/0'" | tezos_private_key }}",
"REGISTRAR": "{{ "m/44'/1729'/0'/1'" | tezos_private_key }}",
"SETTLEMENT_AGENT": "{{ "m/44'/1729'/0'/2'" | tezos_private_key }}",
"ISSUER_1": "{{ "m/44'/1729'/0'/3'" | tezos_private_key }}",
Expand Down
10 changes: 0 additions & 10 deletions packages/cast/cast-interface-v1/sonar-project.properties

This file was deleted.

2 changes: 1 addition & 1 deletion packages/cast/cast-tz-v1/scripts/toolchain/cli/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ async function dothestuff(): Promise<void> {
const sequence = getObjectFromFile(originationFile);

const context = {
ADMIN: extractAddressFromSecret(networkConfig.keysConfig.SG_FORGE),
ADMIN: extractAddressFromSecret(networkConfig.keysConfig.CAST_AGENT),
REGISTRAR: extractAddressFromSecret(networkConfig.keysConfig.REGISTRAR),
};

Expand Down
2 changes: 1 addition & 1 deletion packages/cast/cast-tz-v1/scripts/toolchain/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export type EnvironmentConfig = {

export type ContractsConfig = { [contractName: string]: string };
export type KeysConfig = {
SG_FORGE: TezosKey;
CAST_AGENT: TezosKey;
REGISTRAR: TezosKey;
ISSUER_1: TezosKey;
DEALER_1: TezosKey;
Expand Down
2 changes: 1 addition & 1 deletion packages/cast/cast-tz-v1/scripts/toolchain/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export async function getTezosToolkit(

toolkit.setProvider({
rpc: networkConfig.nodeConfig.host,
signer: new InMemorySigner(networkConfig.keysConfig.SG_FORGE),
signer: new InMemorySigner(networkConfig.keysConfig.CAST_AGENT),
config: {
confirmationPollingIntervalSecond: 1,
confirmationPollingTimeoutSecond: 3600,
Expand Down
10 changes: 0 additions & 10 deletions packages/cast/chain-auth/sonar-project.properties

This file was deleted.

4 changes: 2 additions & 2 deletions packages/cast/chain-auth/src/auth.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AuthReport, ForgeJws } from './types';
import { AuthReport, CASTJws } from './types';
import { decodeJws, trimJwsSignature, encodeUnsignedJws } from './jws';
import { getIss, getAlg, isTokenExpired } from './tokenUtils';

Expand Down Expand Up @@ -39,7 +39,7 @@ export function authenticate(encodedJws: string): AuthReport {
}
}

export function signJws(claim: ForgeJws, secretKey: string): string {
export function signJws(claim: CASTJws, secretKey: string): string {
const toSign = encodeUnsignedJws(claim);
const alg = getAlg(claim);
const { sign } = algRegister[alg];
Expand Down
10 changes: 5 additions & 5 deletions packages/cast/chain-auth/src/jws.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Base64 } from 'js-base64';
import { jwsData, jwsHeader, ForgeJws } from './types';
import { jwsData, jwsHeader, CASTJws } from './types';

export function isJwsHeader(header: any): header is jwsHeader {
return header.alg && header.typ;
Expand All @@ -19,7 +19,7 @@ export function constructJws(
header: any,
data: any,
signature?: string,
): ForgeJws {
): CASTJws {
if (!isJwsHeader(header)) {
throw new Error('Header is not a valid jws header');
}
Expand Down Expand Up @@ -47,13 +47,13 @@ export function base64DecodeToJS(input: string): any {
return JSON.parse(Base64.decode(input));
}

export function encodeUnsignedJws(jws: ForgeJws): string {
export function encodeUnsignedJws(jws: CASTJws): string {
const { header, data } = jws;

return `${base64EncodeFromJS(header)}.${base64EncodeFromJS(data)}`;
}

export function decodeJws(jws: string): ForgeJws {
export function decodeJws(jws: string): CASTJws {
const [_header, _data, signature, ...rest] = jws.split('.');

if (rest.length !== 0) {
Expand All @@ -75,7 +75,7 @@ export function generateNewJws(
aud: string,
alg: jwsHeader['alg'],
expIn = 5000,
): ForgeJws {
): CASTJws {
const header = {
alg,
typ: 'JWT',
Expand Down
10 changes: 5 additions & 5 deletions packages/cast/chain-auth/src/tokenUtils.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { ForgeJws, jwsHeader } from './types';
import { CASTJws, jwsHeader } from './types';

export function checkSender(sender: string, jws: ForgeJws): boolean {
export function checkSender(sender: string, jws: CASTJws): boolean {
return sender === jws.data.iss;
}

export function getIss(jws: ForgeJws): string {
export function getIss(jws: CASTJws): string {
return jws.data.iss;
}

export function getAlg(jws: ForgeJws): jwsHeader['alg'] {
export function getAlg(jws: CASTJws): jwsHeader['alg'] {
return jws.header.alg;
}
export function isTokenExpired(jws: ForgeJws): boolean {
export function isTokenExpired(jws: CASTJws): boolean {
const now = Date.now();

if (now < jws.data.iat) {
Expand Down
4 changes: 2 additions & 2 deletions packages/cast/chain-auth/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export interface AuthReport {
success: boolean;
jws: ForgeJws;
jws: CASTJws;
address: string; // address according to the jwsHeader.alg and jwsData.iss fields
errorMessage?: string;
}
Expand All @@ -18,7 +18,7 @@ export type jwsData = {
jti?: string;
};

export interface ForgeJws {
export interface CASTJws {
header: jwsHeader;
data: jwsData;
signature?: string;
Expand Down
Loading