Skip to content

Commit

Permalink
Merge pull request #1 from svub/custom-secret-contract
Browse files Browse the repository at this point in the history
Custom secret contract
  • Loading branch information
ltfschoen authored Oct 6, 2024
2 parents 9a76a0e + fd513f8 commit bc29d35
Show file tree
Hide file tree
Showing 25 changed files with 545 additions and 378 deletions.
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Run smart contract test with `yarn hardhat:test`
* Install Rust
```
rustup update
rustup toolchain use stable
rustup default stable
rustup target add wasm32-unknown-unknown
source "$HOME/.cargo/env"
```
Expand Down Expand Up @@ -111,6 +111,18 @@ cd packages/secret-contracts/my-counter-contract
make build
```

* FIXME: attempt to fix on macOS hack https://github.com/briansmith/ring/issues/1824
```
cd packages/secret-contracts/nunya-contract
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install llvm
echo 'export PATH="/opt/homebrew/opt/llvm/bin:$PATH"' >> ~/.zshrc
export LDFLAGS="-L/opt/homebrew/opt/llvm/lib"
export CPPFLAGS="-I/opt/homebrew/opt/llvm/include"
RUSTFLAGS='-C link-arg=-s' cargo build --release --target wasm32-unknown-unknown
make build
```

* OPTIONAL - optimize contract code

* Upload and Instantiate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ unit-test:
.PHONY: build _build
build: _build compress-wasm
_build:
RUSTFLAGS='-C link-arg=-s' cargo build --release --target wasm32-unknown-unknown --features="debug-print"
RUSTFLAGS='-C link-arg=-s' cargo build --release --target wasm32-unknown-unknown
# RUSTFLAGS='-C link-arg=-s' cargo build --release --target wasm32-unknown-unknown --features="debug-print"

# This is a build suitable for uploading to mainnet.
# Calls to `debug_print` get removed by the compiler.
Expand Down Expand Up @@ -69,4 +70,4 @@ integration-test:
.PHONY: clean
clean:
cargo clean
-rm -f ./contract.wasm ./contract.wasm.gz
-rm -f ./contract.wasm ./contract.wasm.gz
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# FIXME - update these after deploying nunya-contract
MNEMONIC="shed clerk pray velvet flower tide bug idea private solar prize tackle"
CODE_HASH="e8d3f1c82b620fced20a7d8878ea81cd5af3de28ad7427246c3d7e93b2fa3c4f"
SECRET_ADDRESS="secret1m9d45wakl6vmshxc5kp6ztrf29uc3gzm8vpe47"
SECRET_ADDRESS="secret1m9d45wakl6vmshxc5kp6ztrf29uc3gzm8vpe47"
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ dotenv.config();

let query = async () => {
const secretjs = new SecretNetworkClient({
url: "https://lcd.testnet.secretsaturn.net",
url: "https://api.pulsar3.scrttestnet.com",
chainId: "pulsar-3",
});

const query_tx = await secretjs.query.compute.queryContract({
contract_address: process.env.SECRET_ADDRESS,
code_hash: process.env.CODE_HASH,
query: { retrieve_bids: { key: 1 } },
query: { retrieve_pubkey_query: { key: 1 } },
});
console.log(query_tx);
};
Expand Down
Loading

0 comments on commit bc29d35

Please sign in to comment.