Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
ltfschoen committed Oct 17, 2024
1 parent b3dbf1b commit 953c751
Show file tree
Hide file tree
Showing 15 changed files with 798 additions and 152 deletions.
4 changes: 4 additions & 0 deletions _SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,10 @@ yarn run secret:start:uploadContract
```
yarn run secret:queryPubkey
```
* Transaction `secretContract.retrievePubkey`
```
yarn run secret:submit
```
* View logs at ./logs/instantiateOutput.log
* View on Secret Testnet block explorer at https://testnet.ping.pub/secret/

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"vercel:yolo": "yarn workspace @se-2/nextjs vercel:yolo",
"verify": "yarn workspace @se-2/hardhat verify",
"secret:queryPubkey": "yarn workspace secret-upload-contract queryPubkey",
"secret:submit": "yarn workspace secret-upload-contract submit",
"secret:clean:uploadContract": "yarn workspace secret-upload-contract clean",
"secret:start:uploadContract": "yarn workspace secret-upload-contract start",
"secret:clean:instantiateContract": "yarn workspace secret-instantiate-contract clean",
Expand Down
2 changes: 2 additions & 0 deletions packages/secret-contracts/nunya-contract/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ fn retrieve_pubkey(
_request_id: task.clone(),
_key: my_keys.public_key,
_code: response_status_code,
// Example only
_user_address: input.user_address,
};

let json_string =
Expand Down
1 change: 1 addition & 0 deletions packages/secret-contracts/nunya-contract/src/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ pub struct ResponseRetrievePubkeyStoreMsg {
pub _request_id: Task,
pub _key: Vec<u8>,
pub _code: ResponseStatusCode,
pub _user_address: String,
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
Expand Down
4 changes: 4 additions & 0 deletions packages/secret-upload-contract/.env-sample
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ WALLET_MNEMONIC_LOCAL="juice math fringe believe garbage over avocado demand dev
WALLET_MNEMONIC_TESTNET=""
ENDPOINT_TESTNET="https://api.pulsar3.scrttestnet.com"
ENDPOINT_LOCAL=""
# Ethereum Sepolia
PROVIDER_RPC_ETHEREUM_SEPOLIA=
DEPLOYER_ADDRESS=
DEPLOYER_PRIVATE_KEY=
5 changes: 5 additions & 0 deletions packages/secret-upload-contract/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,18 @@
"private": true,
"scripts": {
"queryPubkey": "yarn build && node ./dist/queryPubkey.js",
"submit": "yarn build && node ./dist/submit.js",
"build": "./node_modules/.bin/tsc --build",
"clean": "./node_modules/.bin/tsc --build --clean",
"start": "yarn build && node ./dist/index.js"
},
"dependencies": {
"@blake.regalia/belt": "^0.35.1",
"@solar-republic/cosmos-grpc": "^0.15.3",
"@solar-republic/neutrino": "^1.2.4",
"@types/node": "^22.7.4",
"dotenv": "^16.4.5",
"ethers": "^5.7.2",
"secretjs": "^1.12.5",
"typescript": "^5.6.2"
}
Expand Down
318 changes: 318 additions & 0 deletions packages/secret-upload-contract/src/config/abi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,318 @@
const abi = [
{ type: "constructor", inputs: [], stateMutability: "nonpayable" },
{
type: "function",
name: "VRF_routing_code_hash",
inputs: [],
outputs: [{ name: "", type: "string", internalType: "string" }],
stateMutability: "view",
},
{
type: "function",
name: "VRF_routing_info",
inputs: [],
outputs: [{ name: "", type: "string", internalType: "string" }],
stateMutability: "view",
},
{
type: "function",
name: "increaseTaskId",
inputs: [{ name: "_newTaskId", type: "uint256", internalType: "uint256" }],
outputs: [],
stateMutability: "nonpayable",
},
{
type: "function",
name: "initialize",
inputs: [],
outputs: [],
stateMutability: "nonpayable",
},
{
type: "function",
name: "owner",
inputs: [],
outputs: [{ name: "", type: "address", internalType: "address" }],
stateMutability: "view",
},
{
type: "function",
name: "payoutBalance",
inputs: [],
outputs: [],
stateMutability: "nonpayable",
},
{
type: "function",
name: "postExecution",
inputs: [
{ name: "_taskId", type: "uint256", internalType: "uint256" },
{ name: "_sourceNetwork", type: "string", internalType: "string" },
{
name: "_info",
type: "tuple",
internalType: "struct Gateway.PostExecutionInfo",
components: [
{ name: "payload_hash", type: "bytes32", internalType: "bytes32" },
{ name: "packet_hash", type: "bytes32", internalType: "bytes32" },
{
name: "callback_address",
type: "bytes20",
internalType: "bytes20",
},
{ name: "callback_selector", type: "bytes4", internalType: "bytes4" },
{
name: "callback_gas_limit",
type: "bytes4",
internalType: "bytes4",
},
{ name: "packet_signature", type: "bytes", internalType: "bytes" },
{ name: "result", type: "bytes", internalType: "bytes" },
],
},
],
outputs: [],
stateMutability: "nonpayable",
},
{
type: "function",
name: "renounceOwnership",
inputs: [],
outputs: [],
stateMutability: "nonpayable",
},
{
type: "function",
name: "requestRandomness",
inputs: [
{ name: "_numWords", type: "uint32", internalType: "uint32" },
{ name: "_callbackGasLimit", type: "uint32", internalType: "uint32" },
],
outputs: [{ name: "requestId", type: "uint256", internalType: "uint256" }],
stateMutability: "payable",
},
{
type: "function",
name: "secret_gateway_signer_address",
inputs: [],
outputs: [{ name: "", type: "address", internalType: "address" }],
stateMutability: "view",
},
{
type: "function",
name: "send",
inputs: [
{ name: "_payloadHash", type: "bytes32", internalType: "bytes32" },
{ name: "_userAddress", type: "address", internalType: "address" },
{ name: "_routingInfo", type: "string", internalType: "string" },
{
name: "_info",
type: "tuple",
internalType: "struct Gateway.ExecutionInfo",
components: [
{ name: "user_key", type: "bytes", internalType: "bytes" },
{ name: "user_pubkey", type: "bytes", internalType: "bytes" },
{ name: "routing_code_hash", type: "string", internalType: "string" },
{
name: "task_destination_network",
type: "string",
internalType: "string",
},
{ name: "handle", type: "string", internalType: "string" },
{ name: "nonce", type: "bytes12", internalType: "bytes12" },
{
name: "callback_gas_limit",
type: "uint32",
internalType: "uint32",
},
{ name: "payload", type: "bytes", internalType: "bytes" },
{ name: "payload_signature", type: "bytes", internalType: "bytes" },
],
},
],
outputs: [{ name: "_taskId", type: "uint256", internalType: "uint256" }],
stateMutability: "payable",
},
{
type: "function",
name: "taskId",
inputs: [],
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
stateMutability: "view",
},
{
type: "function",
name: "task_destination_network",
inputs: [],
outputs: [{ name: "", type: "string", internalType: "string" }],
stateMutability: "view",
},
{
type: "function",
name: "tasks",
inputs: [{ name: "", type: "uint256", internalType: "uint256" }],
outputs: [
{
name: "payload_hash_reduced",
type: "bytes31",
internalType: "bytes31",
},
{ name: "completed", type: "bool", internalType: "bool" },
],
stateMutability: "view",
},
{
type: "function",
name: "transferOwnership",
inputs: [{ name: "newOwner", type: "address", internalType: "address" }],
outputs: [],
stateMutability: "nonpayable",
},
{
type: "function",
name: "upgradeHandler",
inputs: [],
outputs: [],
stateMutability: "nonpayable",
},
{
type: "event",
name: "FulfilledRandomWords",
inputs: [
{
name: "requestId",
type: "uint256",
indexed: true,
internalType: "uint256",
},
],
anonymous: false,
},
{
type: "event",
name: "Initialized",
inputs: [
{
name: "version",
type: "uint64",
indexed: false,
internalType: "uint64",
},
],
anonymous: false,
},
{
type: "event",
name: "OwnershipTransferred",
inputs: [
{
name: "previousOwner",
type: "address",
indexed: true,
internalType: "address",
},
{
name: "newOwner",
type: "address",
indexed: true,
internalType: "address",
},
],
anonymous: false,
},
{
type: "event",
name: "TaskCompleted",
inputs: [
{
name: "taskId",
type: "uint256",
indexed: true,
internalType: "uint256",
},
{
name: "callbackSuccessful",
type: "bool",
indexed: false,
internalType: "bool",
},
],
anonymous: false,
},
{
type: "event",
name: "logNewTask",
inputs: [
{
name: "task_id",
type: "uint256",
indexed: true,
internalType: "uint256",
},
{
name: "source_network",
type: "string",
indexed: false,
internalType: "string",
},
{
name: "user_address",
type: "address",
indexed: false,
internalType: "address",
},
{
name: "routing_info",
type: "string",
indexed: false,
internalType: "string",
},
{
name: "payload_hash",
type: "bytes32",
indexed: false,
internalType: "bytes32",
},
{
name: "info",
type: "tuple",
indexed: false,
internalType: "struct Gateway.ExecutionInfo",
components: [
{ name: "user_key", type: "bytes", internalType: "bytes" },
{ name: "user_pubkey", type: "bytes", internalType: "bytes" },
{ name: "routing_code_hash", type: "string", internalType: "string" },
{
name: "task_destination_network",
type: "string",
internalType: "string",
},
{ name: "handle", type: "string", internalType: "string" },
{ name: "nonce", type: "bytes12", internalType: "bytes12" },
{
name: "callback_gas_limit",
type: "uint32",
internalType: "uint32",
},
{ name: "payload", type: "bytes", internalType: "bytes" },
{ name: "payload_signature", type: "bytes", internalType: "bytes" },
],
},
],
anonymous: false,
},
{ type: "error", name: "InvalidInitialization", inputs: [] },
{ type: "error", name: "NotInitializing", inputs: [] },
{
type: "error",
name: "OwnableInvalidOwner",
inputs: [{ name: "owner", type: "address", internalType: "address" }],
},
{
type: "error",
name: "OwnableUnauthorizedAccount",
inputs: [{ name: "account", type: "address", internalType: "address" }],
},
];

export default abi;
Loading

0 comments on commit 953c751

Please sign in to comment.