This repository has been archived by the owner on Jan 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add function for calling update allocation with TWAP. (#379)
Add function for calling update allocation with TWAP.
- Loading branch information
Showing
14 changed files
with
768 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
Copyright 2020 Set Labs Inc. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
import Web3 from 'web3'; | ||
|
||
import { StrategyContractWrapper } from './StrategyContractWrapper'; | ||
import { Address } from '../../types/common'; | ||
|
||
/** | ||
* @title SocialAllocatorWrapper | ||
* @author Set Protocol | ||
* | ||
* The SocialAllocatorWrapper handles all functions on the SocialAllocator contract | ||
* | ||
*/ | ||
export class SocialAllocatorWrapper { | ||
public web3: Web3; | ||
public contracts: StrategyContractWrapper; | ||
|
||
public constructor(web3: Web3) { | ||
this.web3 = web3; | ||
this.contracts = new StrategyContractWrapper(this.web3); | ||
} | ||
|
||
/** | ||
* Get base asset of a social allocator | ||
* | ||
* @param socialAllocator Address of the SocialAllocator contract | ||
* @return Base asset addresss | ||
*/ | ||
public async baseAsset( | ||
allocatorAddress: Address, | ||
): Promise<Address> { | ||
const allocatorInstance = await this.contracts.loadSocialAllocatorContractAsync( | ||
allocatorAddress | ||
); | ||
|
||
return allocatorInstance.baseAsset.callAsync(); | ||
} | ||
|
||
/** | ||
* Get quote asset of a social allocator | ||
* | ||
* @param socialAllocator Address of the SocialAllocator contract | ||
* @return Quote asset addresss | ||
*/ | ||
public async quoteAsset( | ||
allocatorAddress: Address, | ||
): Promise<Address> { | ||
const allocatorInstance = await this.contracts.loadSocialAllocatorContractAsync( | ||
allocatorAddress | ||
); | ||
|
||
return allocatorInstance.quoteAsset.callAsync(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.