🧩Extensions

Extensions allow you to create reusable constants for your bots.

You can create extensions that allow you to reuse same logic in many bots, e.g. checking if NFT from a patricular collection belongs to some SubDAO or doing some calculations based on traits.

Example

Every owl from Owlpha has staking multiplier that's calculated based on traits. This multiplier doesn't necessary increase with the NFT rarity so sniping based on that multiplier is more profitable.

Let's say we want to create an extension that will calculate multipliers for every trait and the total multiplier. Based on the official traits cheatsheet that can be found on their Discord, such extension would look like this:

def brain_multiplier = switch {
    case nft.traits["BRAIN"] in ["giga glow", "Giga"] => 5
    case nft.traits["BRAIN"] in ["gold", "chip"] => 2
    case nft.traits["BRAIN"] in ["floating"] => 1.9
    case nft.traits["BRAIN"] in ["black", "orange"] => 1.8
    case nft.traits["BRAIN"] in ["polygon", "Splitting"] => 1.7
    case nft.traits["BRAIN"] in ["metal", "bitten"] => 1.6
    case nft.traits["BRAIN"] in ["red and blue", "blue"] => 1.5
    case nft.traits["BRAIN"] in ["purple", "red"] => 1.4
    case nft.traits["BRAIN"] in ["regular glow"] => 1.3
    case nft.traits["BRAIN"] in ["electric", "lightning"] => 1.2
    case nft.traits["BRAIN"] in ["receptor"] => 1.1
    case nft.traits["BRAIN"] in ["regular"] => 1
    # Legendary Owl
    default => 12
}

def crown_multiplier = switch {
    case nft.traits["CROWN"] != "none" => 7
    default => 0
}

def headgear_multiplier = switch {
    case nft.traits["HEADGEAR"] in ["Wrath", "Thrasher", "Tanium", "Ranger", "Tundra"] => 2
    case nft.traits["HEADGEAR"] in ["Tropics", "Invader", "Rebel"] => 1.8
    case nft.traits["HEADGEAR"] in ["Samurai", "Recon"] => 1.7
    case nft.traits["HEADGEAR"] in ["Morph", "Cyberpunk"] => 1.6
    case nft.traits["HEADGEAR"] in ["Woodland", "Starbird", "Death Star"] => 1.5
    case nft.traits["HEADGEAR"] in ["Covert", "Nature", "Gundam"] => 1.4
    case nft.traits["HEADGEAR"] in ["Cardinal", "Night King"] => 1.3
    case nft.traits["HEADGEAR"] in ["Firecracker", "Azure"] => 1.2
    case nft.traits["HEADGEAR"] in ["Nocturnal", "Cosmo"] => 1.1
    default => 1
}

def body_multiplier = switch {
    case nft.traits["BODY"] in ["Midnight", "Visionary", "Kinetic", "Toxic"] => 2
    case nft.traits["BODY"] in ["Emperor", "Optimus", "Assassin"] => 1.8
    case nft.traits["BODY"] in ["Foxfire", "Cyborg"] => 1.6
    case nft.traits["BODY"] in ["Pharaoh", "Alliance"] => 1.5
    case nft.traits["BODY"] in ["Magma", "Incognito"] => 1.4
    case nft.traits["BODY"] in ["Frost", "Darkside"] => 1.3
    case nft.traits["BODY"] in ["Stealth", "Berserk"] => 1.2
    case nft.traits["BODY"] in ["Excalibur"] => 1.1
    default => 1
}

def wings_multiplier = switch {
    case nft.traits["WINGS"] in ["black and gold"] => 2
    case nft.traits["WINGS"] in ["metal", "red gold"] => 1.8
    case nft.traits["WINGS"] in ["gold", "galaxy"] => 1.7
    case nft.traits["WINGS"] in ["green and silver"] => 1.6
    case nft.traits["WINGS"] in ["dark purple", "cyan"] => 1.5
    case nft.traits["WINGS"] in ["maroon", "orangish brown", "dark blue"] => 1.4
    case nft.traits["WINGS"] in ["blue"] => 1.3
    case nft.traits["WINGS"] in ["white and black dot", "white snow", "white and brown", "strip white and brown"] => 1.2
    case nft.traits["WINGS"] in ["black", "brown"] => 1.1
    default => 1
}

def total_multiplier = brain_multiplier
                     + crown_multiplier
                     + headgear_multiplier
                     + body_multiplier
                     + wings_multiplier
                     - 3

Once such extension is created you can use it in your bots to do pretty much anything you want. Let's say that we want to snipe every owl that has a total multiplier greater than 3 and price lower than 2000 MATIC:

trigger: "listing"

use {total_multiplier} from "Owlpha Multipliers"

preconditions:
    collection.address == "0x12aa01f646fe5c993c66c9c86eddad4e514f6cbc"

if:
    total_multiplier >= 3
    and listing.price <= 2000 MATIC
then:
    autobuy({
        via: "My Burner"
    })

Note that even if you're not using other constants like "brain_multiplier" in your config directly, you need to import them from the extension as well if you'd like to embed such information in your message templates. By doing so you can create templates customized to your collection.

Last updated