I am upgrading the DAO to use version 4 of the near sdk. During the migration I needed to change the way the AccountId struct was used, from being a string to being a struct that holds a string.
The original test has a token id of an empty string, ""
assigned to a const
which cannot be converted to a struct instance because instantiating a struct isn't constant. An empty string ""
now raises a panic
because it isn't a proper account id (it must have lowercase letters and numbers with a period, among other things).
I changed it to base.token
and added constructors where there were strings before.
Here is my code: https://github.com/roshkins/sputnik-dao-contract
I'm getting this error:
---- test_multi_council stdout ----
thread 'test_multi_council' panicked at 'Outcome ExecutionOutcome {
logs: [],
receipt_ids: [
`6MxMk3XY6o2VnL4DucLADm86gUJPJHDfecQQ9hUDA72X`,
`7k1jV711STFLKdbznRCvXr27UxJ2WwgZfnoGiZiFrEKm`,
],
burnt_gas: 2428070807578,
tokens_burnt: 242807080757800000000,
status: Failure(Action #0: Can't complete the action because account "base.token" doesn't exist),
If I add an account called "base.token" it throws an error because it's a sub account. I tried changing the accountid of the contract to base.token that also throws that error. Any help?
Edit: I was able to add the following code to change the root account name to base.token
:
let mut gen_cfg = GenesisConfig::default();
gen_cfg.init_root_signer(base_token().as_str());
I get a slightly different error now:
thread 'test_multi_council' panicked at 'Outcome ExecutionOutcome {
logs: [],
receipt_ids: [
`6MxMk3XY6o2VnL4DucLADm86gUJPJHDfecQQ9hUDA72X`,
`7k1jV711STFLKdbznRCvXr27UxJ2WwgZfnoGiZiFrEKm`,
],
burnt_gas: 2428070807578,
tokens_burnt: 242807080757800000000,
status: Failure(Action #0: cannot find contract code for account base.token),
} was a failure',