Cobo Argus
(EN)
(EN)
  • Announcements
    • Cobo Argus V2 is Here! Supercharge Your DeFi Investments Today
  • Product Documentation
    • Account and Organization
      • Sign Up
        • Sign Up Using Web3 Wallet
        • Sign Up Using Email Address
      • Create Organization
        • Invite Team Member
        • Join Organization
      • Manage Account
        • Log In
        • Add Wallet Addresses for Logins
        • Add Email Address
        • Set Up 2FA
      • Manage Wallet Settings
    • Safe & Cobo Safe
      • Create Safe Wallet
      • Import Safe Wallet to Cobo Argus
      • Create & Enable Cobo Safe Module
      • Add Address
        • Team Members
        • Admin
    • Role-Based Access Controls
      • Authorization
        • Strategy Marketplace
        • Authorization Workflow
          • Modify Authorization
          • Remove Authorization
      • DeFi Operations (Delegated Members)
        • View Roles & DeFi Permissions
        • Complete DeFi Operations
      • Customized DeFi Permissions
        • Create Safe Role & DeFi Permissions
        • Delegate Role to Members
        • Complete Multisig Transaction
    • DeFi Bots
      • Strategy Bots
        • Farming Bots
        • Withdrawal Bots
      • Customized Bots
      • Webhook
        • Configuring Webhooks
        • How to connect Argus and Chainbot Webhook
        • Set up a webhook to monitor contract upgrades.
    • Token Approval
      • View Token Approval
      • Revoke Token Approval
      • Batch-Revoke Token Approval
      • Update Token Approval
    • What's New
  • Tutorials
    • Curve-Convex Authorization & DeFi Bots
    • Farming Bots-Equilibria Finance (EQB)
    • Farming Bots & Withdrawal Bots-BendDAO
    • Rabby Wallet
    • Customized Bots-DAI
    • How to Manage Automated Leverage on Cobo Argus
    • Cobo Argus Claiming Bot automatically claims Pendle minings rewards!
  • Cobo Safe Technical Documentation
    • Cobo Account
      • Cobo Safe Account
      • Cobo Smart Account
      • Send Transactions
    • Role Manager
    • Authorizer
      • Authorizer Example
      • BaseACL
      • Other Authorizers
    • Cobo Argus
      • Workflow
    • Security Audit
    • Deployed Smart Contracts
Powered by GitBook
On this page
  1. Cobo Safe Technical Documentation
  2. Cobo Account

Send Transactions

PreviousCobo Smart AccountNextRole Manager

Last updated 1 year ago

Delegate can call either execTransaction() or execTransactions() to send transactions.

The following uses execTransaction() as an example, where the CallData struct is passed in as a parameter.

struct CallData {
    uint256 flag; // 0x1 delegate call, 0x0 call.
    address to;
    uint256 value;
    bytes data; // calldata
    bytes hint;
    bytes extra; // for future support: signatures etc.
}

Each field in the struct is defined as follows:

  • flag: The call type. 0 indicates call and 1 indicates delegatecall. Note that each type of call comes with different access controls.

  • to: The target smart contract to be called.

  • value: The ETH amount of the transaction when the contract is called.

  • data: The calldata of a transaction (i.e., abi.encoded parameters of a contract call).

  • hint: When the hint field is set, the Authorizer will optimize the validation process by executing a fast path. This helps reduce gas consumption.

To generate a hint, you can execute an eth_call to the execTransaction() function with the hint field left unset. The TransactionResult returned from the call will contain the correct hint value.

The above process can be achieved using . The following uses Cobo Safe SDKs in Javascript as an example.

const {CoboSafeAccount} = require("jscobosafe");
const {ethers} = require("ethers");
const ERC20_ABI = require("./ERC20.json");

require("dotenv").config();
const PRI_KEY = process.env.PRIV;
const COBO_SAFE_ADDRESS = process.env.COBOSAFE

const provider = new ethers.JsonRpcProvider("https://rpc.ankr.com/polygon")
const signer = new ethers.Wallet(PRI_KEY, provider);
const coboSafe = new CoboSafeAccount(COBO_SAFE_ADDRESS, signer)
const delegate = coboSafe.delegate;

const WMATIC_ADDRESS = "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270";

async function main(){
    console.log("CoboSafe", coboSafe.address);
    console.log("Safe", await coboSafe.safe());
    console.log("Delegate", coboSafe.delegate);

    let tx;

    // Connect with the contract as other ethers.js signers do.
    const token = new ethers.Contract(WMATIC_ADDRESS, ERC20_ABI, coboSafe);

    console.log(await token.balanceOf(await coboSafe.safe()))
    tx = await token.transfer(delegate, 1);
    await tx.wait()
    console.log(await token.balanceOf(await coboSafe.safe()))
}

main().catch((error) => {
    console.error(error);
    process.exitCode = 1;
});

Cobo Safe offers SDKs in and . For more information, please refer to .

Cobo Safe SDKs
Python
Javascript
https://github.com/coboglobal/