Skip to content

Instantly share code, notes, and snippets.

View bayological's full-sized avatar
🎯
Focusing

Bayological bayological

🎯
Focusing
View GitHub Profile
@bayological
bayological / ManualTrigger.sol
Created August 1, 2023 02:06
BreakerBox setRateFeedTradingMode function
/**
* @notice Sets the trading mode for the specified rateFeed.
* @param rateFeedID The address of the rateFeed.
* @param tradingMode The trading mode that should be set.
*/
function setRateFeedTradingMode(address rateFeedID, uint8 tradingMode) public onlyOwner {
require(rateFeedStatus[rateFeedID], "Rate feed ID has not been added");
rateFeedTradingMode[rateFeedID] = tradingMode;
emit TradingModeUpdated(rateFeedID, tradingMode);
/**
* @title BiPoolExchangeManager
* @notice An exchange manager that manages asset exchanges consisting of two assets
*/
contract BiPoolManager {
/**
* @notice Execute a token swap with fixed amountIn
* @param exchangeId The id of exchange, i.e. PoolExchange to use
* @param tokenIn The token to be sold
/**
* @title Breaker With Cooldown
* @notice Utility portion of a Breaker contract which deals with the
* cooldown component.
*/
contract WithCooldown {
/* ==================== Events ==================== */
/**
* @notice Emitted after the cooldownTime has been updated.
* @param newCooldownTime The new cooldownTime of the breaker.
@bayological
bayological / MedianDeltaBreaker.sol
Last active July 27, 2023 15:27
shouldTrigger() implementation from the Median Delta Breaker
/**
* @title Median Delta Breaker
* @notice Breaker contract that will trigger when an updated oracle median rate changes
* more than a configured relative threshold from the previous one. If this
* breaker is triggered for a rate feed it should be set to no trading mode.
*/
contract MedianDeltaBreaker is IBreaker, WithCooldown, WithThreshold, Ownable {
using SafeMath for uint256;
using FixidityLib for FixidityLib.Fraction;
@bayological
bayological / IBreaker.sol
Last active July 31, 2023 18:53
IBreaker interface
/**
* @title Breaker Interface
* @notice Defines the basic interface for a Breaker
*/
interface IBreaker {
/**
* @notice Emitted when the sortedOracles address is updated.
* @param newSortedOracles The address of the new sortedOracles.
*/
event SortedOraclesUpdated(address newSortedOracles);
/**
* @title BreakerBox
* @notice The BreakerBox checks the criteria defined in separate breaker contracts
* to determine whether or not buying or selling should be allowed for a
* specified rateFeedIDs. The contract stores references to all breakers
* that hold criteria to be checked, rateFeedIDs that
* can make use of the BreakerBox & their current trading.
*/
contract BreakerBox is IBreakerBox, Ownable {
using SafeMath for uint256;

Keybase proof

I hereby claim:

  • I am bayological on github.
  • I am bayological (https://keybase.io/bayological) on keybase.
  • I have a public key ASAaJ7Vs0L6LB2bk7wlfE0kwlueo9HGCl7WxIDCYqBTFfQo

To claim this, I am signing this object:

$url = "$($env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI)$env:SYSTEM_TEAMPROJECTID/_apis/Release/definitions/$($env:RELEASE_DEFINITIONID)?api-version=5.0"
#Get definition
$pipeline = Invoke-RestMethod -Uri $url -Headers @{
Authorization = "Bearer $env:SYSTEM_ACCESSTOKEN"
}
#Update variable
$pipeline.variables.MyVariableName.value = "New value"
@bayological
bayological / CreateResourceGroupAndSites
Created July 8, 2019 23:29
Create resource group, app service & website
public static async Task Main(string[] args)
{
string _location = "West Europe";
TokenCredentials credentials = await GetTokenCredentialsAsync().ConfigureAwait(false);
var _webClient = new WebSiteManagementClient(credentials)
{
SubscriptionId = _subscriptionId
};
private static async Task<TokenCredentials> GetTokenCredentialsAsync()
{
var clientCredential = new ClientCredential(_clientId, _clientSecret);
var authContext = new AuthenticationContext($"https://login.windows.net/{_tenantId}");
AuthenticationResult result;
try
{
result = await authContext.AcquireTokenAsync("https://management.azure.com/", clientCredential).ConfigureAwait(false);