-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from Laina-Protocol/develop
Pre-poc product
- Loading branch information
Showing
19 changed files
with
2,986 additions
and
2,490 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.soroban | ||
target/* | ||
.env | ||
node_modules | ||
packages/* | ||
CONTRIBUTING.md |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
import { defineConfig } from 'astro/config'; | ||
import basicSsl from '@vitejs/plugin-basic-ssl' | ||
|
||
// https://astro.build/config | ||
export default defineConfig({}); | ||
export default defineConfig({ | ||
vite: { | ||
plugins: [basicSsl()], | ||
server: { | ||
https: true, | ||
}, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[package] | ||
name = "factory" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[lib] | ||
crate-type = ["cdylib"] | ||
doctest = false | ||
|
||
[dependencies] | ||
soroban-sdk = { workspace = true } | ||
|
||
[dev-dependencies] | ||
soroban-sdk = { workspace = true, features = ["testutils"] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#![no_std] | ||
|
||
use soroban_sdk::{contract, contractimpl, Address, BytesN, Env, Symbol, Val, Vec}; | ||
|
||
#[contract] | ||
pub struct Deployer; | ||
|
||
#[contractimpl] | ||
impl Deployer { | ||
/// Deploy the contract Wasm and after deployment invoke the init function | ||
/// of the contract with the given arguments. | ||
/// | ||
/// This has to be authorized by `deployer` (unless the `Deployer` instance | ||
/// itself is used as deployer). This way the whole operation is atomic | ||
/// and it's not possible to frontrun the contract initialization. | ||
/// | ||
/// Returns the contract address and result of the init function. | ||
pub fn deploy( | ||
env: Env, | ||
deployer: Address, | ||
wasm_hash: BytesN<32>, | ||
salt: BytesN<32>, | ||
init_fn: Symbol, | ||
init_args: Vec<Val>, | ||
) -> Address { | ||
// Skip authorization if deployer is the current contract. | ||
if deployer != env.current_contract_address() { | ||
deployer.require_auth(); | ||
} | ||
|
||
// Deploy the contract using the uploaded Wasm with given hash. | ||
let deployed_address = env | ||
.deployer() | ||
.with_address(deployer, salt) | ||
.deploy(wasm_hash); | ||
|
||
// Invoke the init function with the given arguments. | ||
let _res: Val = env.invoke_contract(&deployed_address, &init_fn, init_args); | ||
// Return the contract ID of the deployed contract and the result of | ||
// invoking the init result. | ||
deployed_address | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[package] | ||
name = "loan" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[lib] | ||
crate-type = ["cdylib"] | ||
doctest = false | ||
|
||
[dependencies] | ||
soroban-sdk = { workspace = true } | ||
|
||
[dev-dependencies] | ||
soroban-sdk = { workspace = true, features = ["testutils"] } |
Oops, something went wrong.