Skip to content

Commit

Permalink
Merge #1693
Browse files Browse the repository at this point in the history
1693: Save default nft factory contract r=Deniallugo a=perekopskiy



Co-authored-by: perekopskiy <[email protected]>
  • Loading branch information
bors-matterlabs-dev[bot] and perekopskiy authored Jun 9, 2021
2 parents ffc38d4 + 92cfb17 commit f7f9c66
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE server_config DROP COLUMN nft_factory_addr;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE server_config ADD COLUMN nft_factory_addr TEXT;
6 changes: 6 additions & 0 deletions core/lib/storage/sqlx-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -2701,6 +2701,11 @@
"ordinal": 2,
"name": "gov_contract_addr",
"type_info": "Text"
},
{
"ordinal": 3,
"name": "nft_factory_addr",
"type_info": "Text"
}
],
"parameters": {
Expand All @@ -2709,6 +2714,7 @@
"nullable": [
false,
true,
true,
true
]
}
Expand Down
1 change: 1 addition & 0 deletions core/lib/storage/src/config/records.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ pub struct ServerConfig {
pub id: bool,
pub contract_addr: Option<String>,
pub gov_contract_addr: Option<String>,
pub nft_factory_addr: Option<String>,
}
8 changes: 5 additions & 3 deletions infrastructure/zk/src/db/insert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ export async function contract() {
env.reload();
const contractAddress = process.env.CONTRACTS_CONTRACT_ADDR;
const governanceAddress = process.env.CONTRACTS_GOVERNANCE_ADDR;
await utils.exec(`${SQL()} "INSERT INTO server_config (contract_addr, gov_contract_addr)
VALUES ('${contractAddress}', '${governanceAddress}')
const nftFactoryAddress = process.env.CONTRACTS_NFT_FACTORY_ADDR;
await utils.exec(`${SQL()} "INSERT INTO server_config (contract_addr, gov_contract_addr, nft_factory_addr)
VALUES ('${contractAddress}', '${governanceAddress}', '${nftFactoryAddress}')
ON CONFLICT (id) DO UPDATE
SET (contract_addr, gov_contract_addr) = ('${contractAddress}', '${governanceAddress}')"`);
SET (contract_addr, gov_contract_addr, nft_factory_addr)
= ('${contractAddress}', '${governanceAddress}', '${nftFactoryAddress}')"`);
console.log('Successfully inserted contract address into the database');
}

Expand Down

0 comments on commit f7f9c66

Please sign in to comment.