-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
123ce3d
commit 8b5bba2
Showing
8 changed files
with
204 additions
and
53 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
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
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { toNano, Address } from "ton-core"; | ||
import { SourcesRegistry } from "../wrappers/sources-registry"; | ||
import { compile, NetworkProvider } from "@ton-community/blueprint"; | ||
import inquirer from "inquirer"; | ||
|
||
export async function run(provider: NetworkProvider) { | ||
const compiled = await compile("sources-registry"); | ||
|
||
const codeCellHash = compiled.hash().toString("base64"); | ||
const addressToConfirm = Address.parse("[SOURCES_REGISTRY_ADDRESS]"); | ||
|
||
const sourcesRegistry = provider.open(SourcesRegistry.createFromAddress(addressToConfirm)); | ||
|
||
const { address } = await inquirer.prompt([ | ||
{ | ||
type: "input", | ||
name: "address", | ||
message: `\n\n!!!This will set the code of the Sources Registry contract!!! Proceed with extreme caution!\n\nSources Registry Address: ${addressToConfirm}\nNew Code Cell Hash: ${codeCellHash}\n\nWrite the address of the contract to confirm:`, | ||
}, | ||
]); | ||
|
||
try { | ||
if (!Address.parse(address).equals(addressToConfirm)) { | ||
console.log("Address does not match, aborting..."); | ||
process.exit(1); | ||
} | ||
} catch (e) { | ||
console.log(`Invalid address: ${address}, aborting...`); | ||
process.exit(1); | ||
} | ||
|
||
await sourcesRegistry.sendChangeCode(provider.sender(), { | ||
newCode: compiled, | ||
value: toNano("0.05"), | ||
}); | ||
|
||
console.log("Source Registry set code", sourcesRegistry.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
Oops, something went wrong.