-
Notifications
You must be signed in to change notification settings - Fork 81
Client DAO Upgrade Integration Guide
Trevor Clarke edited this page Mar 22, 2022
·
1 revision
The following are steps required to help DAOs upgrade to the latest release.
Using a view call to the NEAR RPC, you can check if your DAO code_hash matches the latest DAO code.
Get the latest code_hash from the factory:
NEAR_ENV=mainnet near view sputnik-dao.near get_default_code_hash
Get the hash
for the DAO via RPC:
const response = await near.connection.provider.query({
request_type: "view_code",
finality: "final",
account_id: "DAO_NAME_HERE.sputnik-dao.near",
});
Here is the proposal needed to store DAO upgrade version:
BASE_64_ENCODED_ARGS='{"code_hash":"TO_BE_DETERMINED_BY_LATEST_HASH_FROM_FACTORY"}'
{
"proposal": {
"description": "Upgrade to v3 DAO code using upgrade contract",
"kind": {
"FunctionCall": {
"receiver_id": "sputnik-dao.near",
"actions": [
{
"method_name": "store_contract_self",
"args": "BASE_64_ENCODED_ARGS",
"deposit": "6000000000000000000000000",
"gas": "220000000000000"
}
]
}
}
}
}
Once the above proposal has passed and successful, the following proposal should be submitted:
{
"proposal": {
"description": "Upgrade to v3 DAO code using local stored code",
"kind": {
"UpgradeSelf": {
"hash": "TO_BE_DETERMINED_BY_LATEST_HASH_FROM_FACTORY"
}
}
}
}
Once the above proposal has passed and successful, the code stored in the DAO used for upgrades can then be removed and storage cost refunded.
BASE_64_ENCODED_ARGS='{"code_hash":"TO_BE_DETERMINED_BY_LATEST_HASH_FROM_FACTORY"}'
{
"proposal": {
"description": "Remove DAO upgrade contract code",
"kind": {
"FunctionCall": {
"receiver_id": "sputnik-dao.near",
"actions": [
{
"method_name": "remove_contract_self",
"args": "BASE_64_ENCODED_ARGS",
"deposit": "0",
"gas": "220000000000000"
}
]
}
}
}
}