Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions accman/AccMan.sol
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ contract AccMan is Debot, Upgradable {

/// @notice Entry point function for DeBot.
function start() public override {

}

/// @notice Returns Metadata about DeBot.
Expand Down Expand Up @@ -158,6 +158,7 @@ contract AccMan is Debot, Upgradable {
m_invokeType = Invoke.QueryAccounts;
m_invoker = msg.sender;
m_ownerKey = ownerKey;
// FIXME Sdk.substring(tvm.functionId(uint32 callbackFunctionId), bytes str, uint32 start, uint32 count);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wat is callbackFunctionId?

Sdk.getAccountsDataByHash(
tvm.functionId(setInvites),
tvm.hash(buildInviteCode(InviteType.Self, _calcRoot())),
Expand Down Expand Up @@ -245,23 +246,23 @@ contract AccMan is Debot, Upgradable {

/// @notice API function.
function invokeRemoveInvites() public {

}
*/

/////////////////////////////////////////////////////////////////////////////////////////////////

function createPrivInvite() public {
// TODO: check that nonce is valid;
m_deployFlags |= CREATE_INVITE;
TvmCell body = tvm.encodeBody(AccMan.deployInvite, m_ownerKey,
TvmCell body = tvm.encodeBody(AccMan.deployInvite, m_ownerKey,
InviteType.Private, m_account, m_nonce, m_deployFlags);
this.callMultisig(address(this), body, _calcFee(m_deployFlags, 1), tvm.functionId(completePrivInvite));
}

function createPubInvite() public {
m_deployFlags |= CREATE_INVITE;
TvmCell body = tvm.encodeBody(AccMan.deployInvite, m_ownerKey,
TvmCell body = tvm.encodeBody(AccMan.deployInvite, m_ownerKey,
InviteType.Public, m_account, "", m_deployFlags);
this.callMultisig(address(this), body, _calcFee(m_deployFlags, 1), tvm.functionId(completePubInvite));
}
Expand Down Expand Up @@ -368,8 +369,8 @@ contract AccMan is Debot, Upgradable {
}
totalFee += _calcFee(m_deployFlags, ownerCount);
TvmCell body = tvm.encodeBody(
AccMan.deployAccount, m_ownerKey, m_ownerKeys, m_currentSeqno,
m_accountImage.toSlice().loadRef(), signature, m_args,
AccMan.deployAccount, m_ownerKey, m_ownerKeys, m_currentSeqno,
m_accountImage.toSlice().loadRef(), signature, m_args,
m_deployFlags
);
this.callMultisig(address(this), body, totalFee, tvm.functionId(checkAccount));
Expand Down Expand Up @@ -423,15 +424,14 @@ contract AccMan is Debot, Upgradable {
// TODO: allow transfer only from multisig with 1 custodian.
IMultisig(m_wallet).sendTransaction{
abiVer: 2,
extMsg: true,
sign: true,
pubkey: pubkey,
time: 0,
expire: 0,
signBoxHandle: sbhandle,
callbackId: tvm.functionId(onSuccess),
onErrorId: tvm.functionId(onError)
}(m_callArgs.dest, m_callArgs.value, true, 3, m_callArgs.payload);
}(m_callArgs.dest, m_callArgs.value, true, 3, m_callArgs.payload).extMsg;
delete m_callArgs;
}

Expand Down Expand Up @@ -620,7 +620,7 @@ contract AccMan is Debot, Upgradable {
if (flags & CREATE_ROOT != 0) {
deployInviteRoot(ownerKey);
}

TvmCell rootImage = tvm.insertPubkey(m_inviteRootImage, ownerKey);
address root = address(tvm.hash(rootImage));
if (invType == InviteType.Public) {
Expand Down Expand Up @@ -655,7 +655,7 @@ contract AccMan is Debot, Upgradable {
//

function onCodeUpgrade() internal override {

}

}
}
6 changes: 3 additions & 3 deletions accman/deploy_debot.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash

#!/bin/bash
set -e

tos=tonos-cli
Expand All @@ -24,7 +24,7 @@ echo GIVER $1 ------------------------------------------------
giver $DEBOT_ADDRESS
echo DEPLOY $1 -----------------------------------------------
$tos --url $NETWORK deploy $1.tvc "{}" --sign $1.keys.json --abi $1.abi.json
DEBOT_ABI=$(cat $1.abi.json | xxd -ps -c 20000)
DEBOT_ABI=$(cat $1.abi.json | jq --compact-output | xxd -ps -c 20000)
$tos --url $NETWORK call $DEBOT_ADDRESS setABI "{\"dabi\":\"$DEBOT_ABI\"}" --sign $1.keys.json --abi $1.abi.json
echo -n $DEBOT_ADDRESS > $1.addr
}
Expand Down Expand Up @@ -77,4 +77,4 @@ echo client $DEBOT_ADDRESS
echo debot $ACCMAN_ADDRESS
echo msig $MSIG_ADDRESS

$tos --url $NETWORK debot fetch $DEBOT_ADDRESS
$tos --url $NETWORK debot fetch $DEBOT_ADDRESS
14 changes: 7 additions & 7 deletions accman/deployerDebot.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ contract DeployerDebot is Debot, IAccManCallbacks, IonQueryAccounts {
MenuItem("Deploy new account", "", tvm.functionId(menuDeployAccount)),
MenuItem("Show all your accounts", "", tvm.functionId(menuViewAccounts))
]);

}

function menuViewAccounts(uint32 index) public {
Expand Down Expand Up @@ -164,13 +164,13 @@ contract DeployerDebot is Debot, IAccManCallbacks, IonQueryAccounts {
//

function _parseKey(string value) private returns (bool) {
(uint256 key, bool res) = stoi("0x" + value);
if (!res) {
optional(int) res = stoi("0x" + value);
if (!res.hasValue()) {
Terminal.print(tvm.functionId(Debot.start), "Invalid public key.");
return res;
return false;
}
m_ownerKey = key;
return res;
m_ownerKey = uint256(res.get());
return true;
}

}
}