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

Update examples and run during e2e build #479

Merged
7 commits merged into from
Dec 16, 2024
Merged
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
12 changes: 6 additions & 6 deletions doc-site/docs/tutorials/bond-issuance.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ await paladin1.sendTransaction({
abi: bondTrackerPublicJson.abi,
bytecode: bondTrackerPublicJson.bytecode,
function: "",
from: bondIssuerUnqualified,
from: bondIssuer.lookup,
data: {
owner: issuerCustodianGroup.address,
issueDate_: issueDate,
Expand All @@ -108,7 +108,7 @@ events throughout the bond's lifetime.
await newBondTracker(issuerCustodianGroup, bondIssuer, {
name: "BOND",
symbol: "BOND",
custodian: bondCustodianAddress,
custodian: await bondCustodian.address(),
publicTracker: bondTrackerPublicAddress,
});
```
Expand Down Expand Up @@ -149,7 +149,7 @@ await paladin1.sendTransaction({
abi: atomFactoryJson.abi,
bytecode: atomFactoryJson.bytecode,
function: "",
from: bondIssuerUnqualified,
from: bondIssuer.lookup,
data: {},
});
```
Expand Down Expand Up @@ -189,7 +189,7 @@ await bondTracker.using(paladin2).beginDistribution(bondCustodian, {
const investorList = await bondTracker.investorList(bondIssuer);
await investorList
.using(paladin2)
.addInvestor(bondCustodian, { addr: investorAddress });
.addInvestor(bondCustodian, { addr: await investor.address() });
```

This allows the bond custodian to begin distributing the bond to potential investors. Each investor must be added
Expand Down Expand Up @@ -227,7 +227,7 @@ const bondSubscription = await newBondSubscription(
{
bondAddress_: notoBond.address,
units_: 100,
custodian_: bondCustodianAddress,
custodian_: await bondCustodian.address(),
atomFactory_: atomFactoryAddress,
}
);
Expand Down Expand Up @@ -336,7 +336,7 @@ await paladin2.sendTransaction({
type: TransactionType.PUBLIC,
abi: atomJson.abi,
function: "execute",
from: bondCustodianUnqualified,
from: bondCustodian.lookup,
to: atomAddress,
data: {},
});
Expand Down
27 changes: 18 additions & 9 deletions example/bond/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@ configurations {
}

dependencies {
contractCompile project(path: ":solidity", configuration: "compiledContracts")
buildSDK project(path: ":sdk:typescript", configuration: "buildSDK")
contractCompile project(path: ':solidity', configuration: 'compiledContracts')
buildSDK project(path: ':sdk:typescript', configuration: 'buildSDK')
}

task install(type: Exec) {
executable 'npm'
args 'install'

inputs.files(configurations.buildSDK)
inputs.files("package.json")
outputs.files("package-lock.json")
outputs.dir("node_modules")
inputs.files('package.json')
outputs.files('package-lock.json')
outputs.dir('node_modules')
}

task copyABI(type: Exec, dependsOn: install) {
Expand All @@ -46,6 +46,7 @@ task copyABI(type: Exec, dependsOn: install) {
args 'abi'

inputs.files(configurations.contractCompile)
inputs.dir('scripts')
outputs.dir('src/abis')
}

Expand All @@ -54,11 +55,19 @@ task build(type: Exec, dependsOn: [install, copyABI]) {
args 'run'
args 'build'

inputs.dir("src")
outputs.dir("build")
inputs.dir('src')
outputs.dir('build')
}

task e2e(type: Exec, dependsOn: [build]) {
dependsOn ':operator:deploy'

executable 'npm'
args 'run'
args 'start'
}

task clean(type: Delete) {
delete "node_modules"
delete "build"
delete 'node_modules'
delete 'build'
}
12 changes: 6 additions & 6 deletions example/bond/package-lock.json

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

2 changes: 1 addition & 1 deletion example/bond/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
"typescript": "^5.6.3"
},
"dependencies": {
"paladin-sdk": "file:../../sdk/typescript"
"@lfdecentralizedtrust-labs/paladin-sdk": "file:../../sdk/typescript"
}
}
11 changes: 6 additions & 5 deletions example/bond/src/helpers/bondsubscription.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import PaladinClient, {
PaladinVerifier,
PentePrivacyGroup,
PentePrivateContract,
} from "paladin-sdk";
} from "@lfdecentralizedtrust-labs/paladin-sdk";
import bondSubscription from "../abis/BondSubscription.json";

const bondSubscriptionConstructor = bondSubscription.abi.find(
Expand All @@ -27,7 +28,7 @@ export interface PrepareBondParams {

export const newBondSubscription = async (
pente: PentePrivacyGroup,
from: string,
from: PaladinVerifier,
params: BondSubscriptionConstructorParams
) => {
if (bondSubscriptionConstructor === undefined) {
Expand All @@ -54,15 +55,15 @@ export class BondSubscription extends PentePrivateContract<BondSubscriptionConst
return new BondSubscription(this.evm.using(paladin), this.address);
}

preparePayment(from: string, params: PreparePaymentParams) {
preparePayment(from: PaladinVerifier, params: PreparePaymentParams) {
return this.invoke(from, "preparePayment", params);
}

prepareBond(from: string, params: PrepareBondParams) {
prepareBond(from: PaladinVerifier, params: PrepareBondParams) {
return this.invoke(from, "prepareBond", params);
}

async distribute(from: string) {
async distribute(from: PaladinVerifier) {
return this.invoke(from, "distribute", {});
}
}
9 changes: 5 additions & 4 deletions example/bond/src/helpers/bondtracker.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import PaladinClient, {
PaladinVerifier,
PentePrivacyGroup,
PentePrivateContract,
} from "paladin-sdk";
} from "@lfdecentralizedtrust-labs/paladin-sdk";
import bondTracker from "../abis/BondTracker.json";
import { InvestorList } from "./investorlist";

Expand All @@ -19,7 +20,7 @@ export interface BeginDistributionParams {

export const newBondTracker = async (
pente: PentePrivacyGroup,
from: string,
from: PaladinVerifier,
params: BondTrackerConstructorParams
) => {
const address = await pente.deploy(
Expand All @@ -43,11 +44,11 @@ export class BondTracker extends PentePrivateContract<BondTrackerConstructorPara
return new BondTracker(this.evm.using(paladin), this.address);
}

beginDistribution(from: string, params: BeginDistributionParams) {
beginDistribution(from: PaladinVerifier, params: BeginDistributionParams) {
return this.invoke(from, "beginDistribution", params);
}

async investorList(from: string) {
async investorList(from: PaladinVerifier) {
const result = await this.call(from, "investorList", []);
return new InvestorList(this.evm, result[0]);
}
Expand Down
5 changes: 3 additions & 2 deletions example/bond/src/helpers/investorlist.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import PaladinClient, {
PaladinVerifier,
PentePrivacyGroup,
PentePrivateContract,
} from "paladin-sdk";
} from "@lfdecentralizedtrust-labs/paladin-sdk";
import investorList from "../abis/InvestorList.json";

export interface AddInvestorParams {
Expand All @@ -20,7 +21,7 @@ export class InvestorList extends PentePrivateContract<{}> {
return new InvestorList(this.evm.using(paladin), this.address);
}

addInvestor(from: string, params: AddInvestorParams) {
addInvestor(from: PaladinVerifier, params: AddInvestorParams) {
return this.invoke(from, "addInvestor", params);
}
}
Loading
Loading