OAAAAA - Obyte Autonomous Autonomous Agent Address Agent

in #obyte5 years ago

Autonomous Agents on Obyte are open compute and open data self-running services.

So I imagine situations in which everyone will eventually run into when they use these services.

One of the first thing is how does one know if they are using the latest version of the service?

The solution is a autonomous service which allows users to check if the address is the latest version, and allow address transfer to the latest version.

I call it Latest Address Check and Route AA or OAAAA

I only came up with the idea today and there are still some functionality which I am not sure OScript has or not.

Anyways, I am going to submit the idea and work on it some more if others think it's a good idea too.

I imagine everyone will run this as their entry point to their AA service.

{
    messages: [
        { 
            app: 'state',
            state: `{
                $checkaddress = trigger.data.address;
                if ( !$checkaddress )  // not sure how to check if data.address is an invalid address???  It especially cannot be a logicaladdress
                    bounce( 'input: { address : address , [ newaddress : newaddress ] , [ checkonly : false ] }');

                $logicaladdress = var[ $checkaddress ];
                if ( $logicaladdress ){ // EXISTS
                    $currentaddress = var[ $logicaladdress ];

                    // TRANSFER
                    $newaddress = trigger.data.newaddress;
                    if( $newaddress ){ // again need to check is an valid address??? again cannot be a logicaladdress
                        
                        if( var[ $currentaddress ][ 'author' ] == trigger.address ){  // how to get author of an external address???
                            // transfer to new address only if author of current address ONLY
                            var[ $logicaladdress ] = $newaddress;
                            var[ $newaddress ] = $logicaladdress;
                            
                            if( trigger.data.checkonly ) return "Address transferred from " || $currentaddress || " to " || $newaddress;
                        }

                    }else{
                        if( trigger.data.checkonly ) bounce( "You need to be author of " || $currentaddress || " in order to transfer to newaddress" );
                    }

                    // CHECK IF LATEST ADDRESS
                    if( trigger.data.checkonly ){
                        if( $checkaddress != $currentaddress ) bounce( "Please use latest address at " || $currentaddress );
                        else bounce( "This address is current");
                    }

                    // route to var[ $logicaladdress ]

                }else{ // NEW

                    var[ "L" || $checkaddress ] = $checkaddress; // create logical address
                    var[ $checkaddress ] = "L" || $checkaddress; // set checkaddress to logical address

                    // route to $checkaddress

                }
            }`
        }
    ]
}

Coin Marketplace

STEEM 0.25
TRX 0.20
JST 0.036
BTC 94745.85
ETH 3468.48
USDT 1.00
SBD 3.48