Skip to content

Commit

Permalink
Revert "check DAOAccountCap (#89)"
Browse files Browse the repository at this point in the history
This reverts commit 0404a53.
  • Loading branch information
nkysg committed Mar 3, 2023
1 parent a7a2b34 commit 17d571f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 67 deletions.
2 changes: 1 addition & 1 deletion build/StarcoinFramework/BuildInfo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ compiled_package_info:
? address: "0x00000000000000000000000000000001"
name: YieldFarmingV2
: StarcoinFramework
source_digest: 7383E555375A13FC20185C03038B1A256C817A71C484233F6D7EAEE9FA1263EA
source_digest: 7138A8A0DEBB195CC13E43D24FAACA4CCE188BA3536A5DED8646E8934CBC2431
build_flags:
dev_mode: false
test_mode: false
Expand Down
42 changes: 3 additions & 39 deletions integration-tests/daospace/dao_account.exp
Original file line number Diff line number Diff line change
@@ -1,53 +1,17 @@
processed 6 tasks
processed 4 tasks

task 2 'run'. lines 6-23:
{
"gas_used": 837509,
"gas_used": 827652,
"status": {
"Keep": "Executed"
}
}

task 3 'run'. lines 28-40:
{
"gas_used": 84519,
"gas_used": 74662,
"status": {
"Keep": "Executed"
}
}

task 4 'run'. lines 42-51:
{
"gas_used": 712879,
"status": {
"Keep": {
"MoveAbort": [
{
"Module": {
"address": "0x00000000000000000000000000000001",
"name": "DAOAccount"
}
},
25862
]
}
}
}

task 5 'run'. lines 53-61:
{
"gas_used": 711648,
"status": {
"Keep": {
"MoveAbort": [
{
"Module": {
"address": "0x00000000000000000000000000000001",
"name": "DAOAccount"
}
},
25862
]
}
}
}
25 changes: 2 additions & 23 deletions integration-tests/daospace/dao_account.move
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//# init -n dev

//# faucet --addr alice --amount 10000000
//# faucet --addr alice --amount 1000000


//# run --signers alice
Expand Down Expand Up @@ -37,25 +37,4 @@ script {
DAOAccount::restore_dao_account_cap(&sender, dao_cap);
}
}
// check: EXECUTED

//# run --signers alice
script {
use StarcoinFramework::DAOAccount;

fun main(sender: signer) {
let dao_cap = DAOAccount::create_account(&sender);
DAOAccount::restore_dao_account_cap(&sender, dao_cap);
}
}
// check: ABORT, code 25862. Reason: alice already has a DAOAccountCap

//# run --signers alice
script {
use StarcoinFramework::DAOAccount;

fun main(sender: signer) {
DAOAccount::create_account_entry(sender);
}
}
// check: ABORT, code 25862. Reason: alice already has a DAOAccountCap
// check: EXECUTED
4 changes: 0 additions & 4 deletions sources/daospace/DAOAccount.move
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ module StarcoinFramework::DAOAccount{
}

const ERR_ACCOUNT_CAP_NOT_EXISTS:u64 = 100;
const ERR_ACCOUNT_CAP_EXISTS: u64 = 101;

/// DAOAccount
struct DAOAccount has key{
Expand All @@ -37,7 +36,6 @@ module StarcoinFramework::DAOAccount{
/// Entry function for create dao account, the `DAOAccountCap` save to the `creator` account
public(script) fun create_account_entry(sender: signer){
let cap = create_account(&sender);
assert!(!exists<DAOAccountCap>(Signer::address_of(&sender)), Errors::already_published(ERR_ACCOUNT_CAP_EXISTS));
move_to(&sender, cap);
}

Expand All @@ -50,8 +48,6 @@ module StarcoinFramework::DAOAccount{

/// Restore the DAOAccountCap to the `sender`
public fun restore_dao_account_cap(sender: &signer, cap: DAOAccountCap) {
let sender_addr = Signer::address_of(sender);
assert!(!exists<DAOAccountCap>(sender_addr), Errors::already_published(ERR_ACCOUNT_CAP_EXISTS));
move_to(sender, cap)
}

Expand Down

0 comments on commit 17d571f

Please sign in to comment.